From 8a40d49a563bac15fd61468d322c7aa875aefb3e Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Fri, 28 Jun 2024 03:06:08 +0100 Subject: [PATCH] ltq-tapi: fix build with Linux 6.6 Satisfy compiler expectations in a hell of typedef's and get rid of system-wide workqueue flush. Results in warning-free compile of the TAPI driver also with Linux 6.6. Signed-off-by: Daniel Golle Link: https://github.com/openwrt/openwrt/pull/15811 Signed-off-by: Hauke Mehrtens --- package/kernel/lantiq/ltq-tapi/Makefile | 2 +- .../610-flush-only-local-workqueue.patch | 11 +++ .../patches/611-ifxos-typedef-madness.diff | 87 +++++++++++++++++++ 3 files changed, 99 insertions(+), 1 deletion(-) create mode 100644 package/kernel/lantiq/ltq-tapi/patches/610-flush-only-local-workqueue.patch create mode 100644 package/kernel/lantiq/ltq-tapi/patches/611-ifxos-typedef-madness.diff diff --git a/package/kernel/lantiq/ltq-tapi/Makefile b/package/kernel/lantiq/ltq-tapi/Makefile index d44eeae565..41e0ccf816 100644 --- a/package/kernel/lantiq/ltq-tapi/Makefile +++ b/package/kernel/lantiq/ltq-tapi/Makefile @@ -10,7 +10,7 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=drv_tapi PKG_VERSION:=3.13.0 -PKG_RELEASE:=5 +PKG_RELEASE:=6 PKG_SOURCE:=drv_tapi-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=@OPENWRT diff --git a/package/kernel/lantiq/ltq-tapi/patches/610-flush-only-local-workqueue.patch b/package/kernel/lantiq/ltq-tapi/patches/610-flush-only-local-workqueue.patch new file mode 100644 index 0000000000..a56f04d10e --- /dev/null +++ b/package/kernel/lantiq/ltq-tapi/patches/610-flush-only-local-workqueue.patch @@ -0,0 +1,11 @@ +--- a/src/drv_tapi_linux.c ++++ b/src/drv_tapi_linux.c +@@ -3351,7 +3351,7 @@ static void __exit ifx_tapi_module_exit( + /* as we are using work queues to schedule events from the interrupt + context to the process context, we use work queues in case of + Linux 2.6. they must be flushed on driver unload... */ +- flush_scheduled_work(); ++ flush_workqueue(pTapiWq); + destroy_workqueue(pTapiWq); + #endif /* LINUX_2_6 */ + diff --git a/package/kernel/lantiq/ltq-tapi/patches/611-ifxos-typedef-madness.diff b/package/kernel/lantiq/ltq-tapi/patches/611-ifxos-typedef-madness.diff new file mode 100644 index 0000000000..a3cd2c4993 --- /dev/null +++ b/package/kernel/lantiq/ltq-tapi/patches/611-ifxos-typedef-madness.diff @@ -0,0 +1,87 @@ +--- a/src/drv_tapi_linux.c ++++ b/src/drv_tapi_linux.c +@@ -274,7 +274,7 @@ IFX_return_t TAPI_OS_RegisterLLDrv (IFX_ + TRACE( TAPI_DRV, DBG_LEVEL_HIGH, + ("IFX_TAPI_Register_LL_Drv: unable to register chrdev major number " + "%d\n", majorNumber)); +- return TAPI_statusErr; ++ return IFX_ERROR; + } + + #if 0 +@@ -290,7 +290,7 @@ IFX_return_t TAPI_OS_RegisterLLDrv (IFX_ + #endif /* LINUX_2_6 */ + #endif /* 0 */ + +- return TAPI_statusOk; ++ return IFX_SUCCESS; + } + + +@@ -316,7 +316,7 @@ IFX_return_t TAPI_OS_UnregisterLLDrv (IF + { + unregister_chrdev (pLLDrvCtx->majorNumber, pHLDrvCtx->registeredDrvName); + +- return TAPI_statusOk; ++ return IFX_SUCCESS; + } + + +@@ -3589,7 +3589,7 @@ static IFX_void_t Deferred_Worker (struc + */ + IFX_return_t TAPI_DeferWork (IFX_void_t *pFunc, IFX_void_t *pParam) + { +- IFX_return_t ret = TAPI_statusOk; ++ IFX_return_t ret = IFX_SUCCESS; + IFX_TAPI_EXT_EVENT_PARAM_t *pEvParam = (IFX_TAPI_EXT_EVENT_PARAM_t *) pParam; + #ifdef LINUX_2_6 + struct work_struct *pTapiWs; +@@ -3605,7 +3605,7 @@ IFX_return_t TAPI_DeferWork (IFX_void_t + + if (queue_work (pTapiWq, pTapiWs) == 0) + { +- ret = TAPI_statusWorkFail; ++ ret = IFX_ERROR; + } + #else + struct tq_struct *pTapiTq; +@@ -3617,7 +3617,7 @@ IFX_return_t TAPI_DeferWork (IFX_void_t + pTapiTq->sync = 0; + if (schedule_task (pTapiTq) == 0) + { +- ret = TAPI_statusWorkFail; ++ ret = IFX_ERROR; + } + #endif /* LINUX_2_6 */ + return ret; +--- a/src/drv_tapi_event.c ++++ b/src/drv_tapi_event.c +@@ -1394,7 +1394,7 @@ IFX_return_t IFX_TAPI_Event_Dispatch (TA + pTapiDev->error.nCode = + (IFX_uint32_t)pTapiEvent->data.error->nLlCode; + } +- return TAPI_statusOk; ++ return IFX_SUCCESS; + } + + /* global irq lock - multiple drivers may be loaded and all share this +@@ -2660,7 +2660,7 @@ IFX_return_t TAPI_EVENT_PKT_EV_Generate + /* start/stop generation of rfc 2833 pkt */ + (IFX_void_t)pDrvCtx->COD.RTP_EV_Generate(pChannel->pLLChannel, + pPacketEvent->event, +- pPacketEvent->action, ++ (IFX_boolean_t)pPacketEvent->action, + pPacketEvent->duration, + nVolume); + } +--- a/src/drv_tapi_cid.c ++++ b/src/drv_tapi_cid.c +@@ -2278,7 +2278,7 @@ static FSM_STATUS_t cid_fsm_ack_exec(TAP + + memset(&tapiEvent, 0, sizeof(IFX_TAPI_EVENT_t)); + tapiEvent.id = IFX_TAPI_EVENT_CID_TX_NOACK_ERR; +- ret = IFX_TAPI_Event_Dispatch(pChannel,&tapiEvent); ++ ret = (FSM_STATUS_t)IFX_TAPI_Event_Dispatch(pChannel,&tapiEvent); + TRACE (TAPI_DRV,DBG_LEVEL_HIGH, ("no CID ack received!\n")); + } + ret = E_FSM_ERROR;