From c3e883b3080e4296cb3114f1aa76a9a7ad72ae2a Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Sun, 14 May 2023 02:36:35 +0200 Subject: [PATCH] kernel: ltq-vdsl-vr9: fix multiple compilation warning Fix multiple compilation warning for fallthrough and unused functions. Fix compilation warning: home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xrx200/drv_dsl_cpe_api-4.17.18.6/src/device/drv_dsl_cpe_device_vrx.c: In function 'DSL_DRV_VRX_TestParametersFeUpdate': /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xrx200/drv_dsl_cpe_api-4.17.18.6/src/device/drv_dsl_cpe_device_vrx.c:3359:17: error: unused variable 'nMsgId' [-Werror=unused-variable] 3359 | DSL_uint16_t nMsgId = EVT_PMD_TESTPARAMSGET; | ^~~~~~ /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xrx200/drv_dsl_cpe_api-4.17.18.6/src/device/drv_dsl_cpe_device_vrx.c: In function 'DSL_DRV_DEV_AutobootHandleTraining': /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xrx200/drv_dsl_cpe_api-4.17.18.6/src/device/drv_dsl_cpe_device_vrx.c:8310:19: error: this statement may fall through [-Werror=implicit-fallthrough=] 8310 | bPreFail = DSL_TRUE; | ~~~~~~~~~^~~~~~~~~~ /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xrx200/drv_dsl_cpe_api-4.17.18.6/src/device/drv_dsl_cpe_device_vrx.c:8316:7: note: here 8316 | case DSL_LINESTATE_EXCEPTION: | ^~~~ cc1: all warnings being treated as errors /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xrx200/drv_dsl_cpe_api-4.17.18.6/src/pm/drv_dsl_cpe_pm_core.c: In function 'DSL_DRV_PM_CountersReset': /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xrx200/drv_dsl_cpe_api-4.17.18.6/src/pm/drv_dsl_cpe_pm_core.c:2328:7: error: this statement may fall through [-Werror=implicit-fallthrough=] 2328 | if (ResetType == DSL_PM_RESET_HISTORY) | ^ /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xrx200/drv_dsl_cpe_api-4.17.18.6/src/pm/drv_dsl_cpe_pm_core.c:2331:4: note: here 2331 | case DSL_PM_RESET_TOTAL: | ^~~~ cc1: all warnings being treated as errors /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xrx200/drv_dsl_cpe_api-4.17.18.6/src/common/drv_dsl_cpe_os_linux.c: In function 'DSL_ModuleCleanup': /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xrx200/drv_dsl_cpe_api-4.17.18.6/src/common/drv_dsl_cpe_os_linux.c:1266:13: error: assignment to 'dev_t' {aka 'unsigned int'} from 'void *' makes integer from pointer without a cast [-Werror=int-conversion] 1266 | dsl_devt = NULL; | ^ /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xrx200/drv_dsl_cpe_api-4.17.18.6/src/common/drv_dsl_cpe_os_linux.c: At top level: /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xrx200/drv_dsl_cpe_api-4.17.18.6/src/common/drv_dsl_cpe_os_linux.c:1178:13: error: 'DSL_DRV_NlSendMsg' defined but not used [-Werror=unused-function] 1178 | static void DSL_DRV_NlSendMsg(DSL_char_t* pMsg) | ^~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xrx200/drv_dsl_cpe_api-4.17.18.6/src/device/drv_dsl_cpe_msg_vrx.c:2459:20: error: 'DSL_DRV_VRX_SpreadArray' defined but not used [-Werror=unused-function] 2459 | static DSL_Error_t DSL_DRV_VRX_SpreadArray( | ^~~~~~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors Signed-off-by: Christian Marangi --- ...-fix-compilation-warning-fallthrough.patch | 36 +++++ ...1-fix-compilation-warning-simple-fix.patch | 132 ++++++++++++++++++ 2 files changed, 168 insertions(+) create mode 100644 package/kernel/lantiq/ltq-vdsl-vr9/patches/300-fix-compilation-warning-fallthrough.patch create mode 100644 package/kernel/lantiq/ltq-vdsl-vr9/patches/301-fix-compilation-warning-simple-fix.patch diff --git a/package/kernel/lantiq/ltq-vdsl-vr9/patches/300-fix-compilation-warning-fallthrough.patch b/package/kernel/lantiq/ltq-vdsl-vr9/patches/300-fix-compilation-warning-fallthrough.patch new file mode 100644 index 0000000000..b0e106a5f5 --- /dev/null +++ b/package/kernel/lantiq/ltq-vdsl-vr9/patches/300-fix-compilation-warning-fallthrough.patch @@ -0,0 +1,36 @@ +--- a/src/common/drv_dsl_cpe_api.c ++++ b/src/common/drv_dsl_cpe_api.c +@@ -1922,7 +1922,7 @@ DSL_Error_t DSL_DRV_AutobootControlSet( + } + /* no break */ + /* ... pass to restart*/ +- ++ fallthrough; + case DSL_AUTOBOOT_CTRL_RESTART: + case DSL_AUTOBOOT_CTRL_RESTART_FULL: + if (bAutobootDisable && pData->data.nCommand == DSL_AUTOBOOT_CTRL_RESTART) +--- a/src/pm/drv_dsl_cpe_pm_core.c ++++ b/src/pm/drv_dsl_cpe_pm_core.c +@@ -2325,16 +2325,18 @@ DSL_Error_t DSL_DRV_PM_CountersReset( + } + #endif /* #ifdef INCLUDE_DSL_CPE_PM_HISTORY*/ + +- if (ResetType == DSL_PM_RESET_HISTORY) +- break; ++ if (ResetType == DSL_PM_RESET_HISTORY) ++ break; + ++ fallthrough; + case DSL_PM_RESET_TOTAL: + #ifdef INCLUDE_DSL_CPE_PM_TOTAL_COUNTERS + memset(EpData.pRecTotal, nFillValue, EpData.nEpRecElementSize); + #endif /* #ifdef INCLUDE_DSL_CPE_PM_TOTAL_COUNTERS*/ +- if (ResetType == DSL_PM_RESET_TOTAL) +- break; ++ if (ResetType == DSL_PM_RESET_TOTAL) ++ break; + ++ fallthrough; + case DSL_PM_RESET_HISTORY_SHOWTIME: + #ifdef INCLUDE_DSL_CPE_PM_SHOWTIME_COUNTERS + nErrCode = DSL_DRV_PM_HistoryDelete(pContext, EpData.pHistShowtime ); \ No newline at end of file diff --git a/package/kernel/lantiq/ltq-vdsl-vr9/patches/301-fix-compilation-warning-simple-fix.patch b/package/kernel/lantiq/ltq-vdsl-vr9/patches/301-fix-compilation-warning-simple-fix.patch new file mode 100644 index 0000000000..99f1908f0f --- /dev/null +++ b/package/kernel/lantiq/ltq-vdsl-vr9/patches/301-fix-compilation-warning-simple-fix.patch @@ -0,0 +1,132 @@ +--- a/src/common/drv_dsl_cpe_os_linux.c ++++ b/src/common/drv_dsl_cpe_os_linux.c +@@ -54,7 +54,7 @@ static int DSL_DRV_Release(DSL_DRV_inode_t * ino, DSL_DRV_file_t * fil); + + static DSL_uint_t DSL_DRV_Poll(DSL_DRV_file_t *pFile, DSL_DRV_Poll_Table_t *wait); + +-#ifdef INCLUDE_DSL_CPE_DEBUG_LOGGER_SUPPORT ++#if defined(INCLUDE_DSL_CPE_DEBUG_LOGGER_SUPPORT) && !defined(DSL_DEBUG_DISABLE) + static void DSL_DRV_NlSendMsg(DSL_char_t* pMsg); + #endif + +@@ -368,10 +368,10 @@ int DSL_DRV_debug_printf(DSL_Context_t const *pContext, DSL_char_t const *fmt, . + { + DSL_int_t nRet = 0; + #ifndef _lint +- DSL_int_t nLength = 0; +- DSL_boolean_t bPrint = DSL_FALSE; + #ifdef INCLUDE_DSL_CPE_DEBUG_LOGGER_SUPPORT + #ifndef DSL_DEBUG_DISABLE ++ DSL_int_t nLength = 0; ++ DSL_boolean_t bPrint = DSL_FALSE; + DSL_char_t debugString[DSL_DBG_MAX_DEBUG_PRINT_CHAR + 1] = {0}; + va_list ap; /* points to each unnamed arg in turn */ + +@@ -406,6 +406,8 @@ int DSL_DRV_debug_printf(DSL_Context_t const *pContext, DSL_char_t const *fmt, . + #endif /* DSL_DEBUG_DISABLE */ + return nRet; + #else ++ DSL_int_t nLength = 0; ++ DSL_boolean_t bPrint = DSL_FALSE; + DSL_char_t msg[DSL_DBG_MAX_DEBUG_PRINT_CHAR + 1] = "\0"; + va_list ap; /* points to each unnamed arg in turn */ + +@@ -1172,7 +1174,7 @@ static void DSL_DRV_DebugInit(void) + return; + } + +-#ifdef INCLUDE_DSL_CPE_DEBUG_LOGGER_SUPPORT ++#if defined(INCLUDE_DSL_CPE_DEBUG_LOGGER_SUPPORT) && !defined(DSL_DEBUG_DISABLE) + static void DSL_DRV_NlSendMsg(DSL_char_t* pMsg) + { + struct nlmsghdr *pNlMsgHdr; +@@ -1261,7 +1263,7 @@ void __exit DSL_ModuleCleanup(void) + printk("Module will be unloaded"DSL_DRV_CRLF); + + device_destroy(dsl_class, dsl_devt); +- dsl_devt = NULL; ++ dsl_devt = 0; + class_destroy(dsl_class); + dsl_class = NULL; + +--- a/src/device/drv_dsl_cpe_msg_vrx.c ++++ b/src/device/drv_dsl_cpe_msg_vrx.c +@@ -2456,32 +2456,32 @@ DSL_Error_t DSL_DRV_VRX_SendMsgSnrPerGroupesGet( + #endif /* defined(INCLUDE_DSL_G997_PER_TONE) || defined(INCLUDE_DSL_DELT)*/ + + #ifdef INCLUDE_DSL_DELT +-static DSL_Error_t DSL_DRV_VRX_SpreadArray( +- DSL_void_t* pArray, +- DSL_uint16_t valueSize, +- DSL_uint16_t valueCount, +- DSL_uint16_t multiplier) +-{ +- DSL_void_t* pSrc = pArray + valueSize * (valueCount - 1); +- DSL_void_t* pDst = pArray + valueSize * (valueCount*multiplier - 1); +- +- if (pArray == DSL_NULL) +- { +- return DSL_ERROR; +- } +- +- for (; valueCount; --valueCount, pSrc -= valueSize) +- { +- DSL_uint16_t i; +- +- for ( i = multiplier; i; --i, pDst -= valueSize) +- { +- memcpy(pDst,pSrc,valueSize); +- } +- } +- +- return DSL_SUCCESS; +-} ++// static DSL_Error_t DSL_DRV_VRX_SpreadArray( ++// DSL_void_t* pArray, ++// DSL_uint16_t valueSize, ++// DSL_uint16_t valueCount, ++// DSL_uint16_t multiplier) ++// { ++// DSL_void_t* pSrc = pArray + valueSize * (valueCount - 1); ++// DSL_void_t* pDst = pArray + valueSize * (valueCount*multiplier - 1); ++ ++// if (pArray == DSL_NULL) ++// { ++// return DSL_ERROR; ++// } ++ ++// for (; valueCount; --valueCount, pSrc -= valueSize) ++// { ++// DSL_uint16_t i; ++ ++// for ( i = multiplier; i; --i, pDst -= valueSize) ++// { ++// memcpy(pDst,pSrc,valueSize); ++// } ++// } ++ ++// return DSL_SUCCESS; ++// } + + /** + This function requests a set of up to 60 entries of the DELT data. +--- a/src/device/drv_dsl_cpe_device_vrx.c ++++ b/src/device/drv_dsl_cpe_device_vrx.c +@@ -3356,7 +3356,9 @@ static DSL_Error_t DSL_DRV_VRX_TestParametersFeUpdate( + DSL_Error_t nErrCode = DSL_SUCCESS; + DSL_uint16_t i = 0; + DSL_uint16_t nDataLen = 0; ++#ifndef DSL_DEBUG_DISABLE + DSL_uint16_t nMsgId = EVT_PMD_TESTPARAMSGET; ++#endif /* DSL_DEBUG_DISABLE */ + + DSL_DEBUG( DSL_DBG_MSG, + (pContext, SYS_DBG_MSG"DSL[%02d]: IN - DSL_DRV_VRX_TestParametersFeUpdate" +@@ -8312,6 +8314,7 @@ DSL_Error_t DSL_DRV_DEV_AutobootHandleTraining( + (pContext, SYS_DBG_MSG"DSL[%02d]: ORDERLY_SHUTDOWN state reached" + DSL_DRV_CRLF, DSL_DEV_NUM(pContext))); + /* do not use break here, continue handling */ ++ fallthrough; + #endif /* INCLUDE_DSL_CPE_API_VRX */ + case DSL_LINESTATE_EXCEPTION: + if (!bPreFail) -- 2.30.2