power: don't disable all cast qualifier warnings

Message ID 20240812215609.97353-1-stephen@networkplumber.org (mailing list archive)
State New
Delegated to: Thomas Monjalon
Headers
Series power: don't disable all cast qualifier warnings |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/github-robot: build success github build: passed
ci/intel-Functional success Functional PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-marvell-Functional success Functional Testing PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-compile-arm64-testing success Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-sample-apps-testing success Testing PASS

Commit Message

Stephen Hemminger Aug. 12, 2024, 9:56 p.m. UTC
Only in one place does the power library need un-constify a pointer
and this can be done by casting to uintptr_t first. Better, to have
the warning enabled across the rest of the code.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/power/meson.build          | 4 +---
 lib/power/rte_power_pmd_mgmt.c | 2 +-
 2 files changed, 2 insertions(+), 4 deletions(-)
  

Comments

Morten Brørup Aug. 13, 2024, 6:11 a.m. UTC | #1
> From: Stephen Hemminger [mailto:stephen@networkplumber.org]
> 
> Only in one place does the power library need un-constify a pointer
> and this can be done by casting to uintptr_t first. Better, to have
> the warning enabled across the rest of the code.
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---

Agree; disabling warnings should be avoided.

Acked-by: Morten Brørup <mb@smartsharesystems.com>
  
Bruce Richardson Aug. 13, 2024, 8:18 a.m. UTC | #2
On Mon, Aug 12, 2024 at 02:56:09PM -0700, Stephen Hemminger wrote:
> Only in one place does the power library need un-constify a pointer
> and this can be done by casting to uintptr_t first. Better, to have
> the warning enabled across the rest of the code.
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
  
Huisong Li Aug. 13, 2024, 8:53 a.m. UTC | #3
在 2024/8/13 5:56, Stephen Hemminger 写道:
> Only in one place does the power library need un-constify a pointer
> and this can be done by casting to uintptr_t first. Better, to have
> the warning enabled across the rest of the code.
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
Acked-by: Huisong Li <lihuisong@huawei.com>
  
Tyler Retzlaff Sept. 12, 2024, 5:19 a.m. UTC | #4
On Mon, Aug 12, 2024 at 02:56:09PM -0700, Stephen Hemminger wrote:
> Only in one place does the power library need un-constify a pointer
> and this can be done by casting to uintptr_t first. Better, to have
> the warning enabled across the rest of the code.
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---

Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
  

Patch

diff --git a/lib/power/meson.build b/lib/power/meson.build
index b8426589b2..2f0f3d26e9 100644
--- a/lib/power/meson.build
+++ b/lib/power/meson.build
@@ -30,7 +30,5 @@  headers = files(
         'rte_power_pmd_mgmt.h',
         'rte_power_uncore.h',
 )
-if cc.has_argument('-Wno-cast-qual')
-    cflags += '-Wno-cast-qual'
-endif
+
 deps += ['timer', 'ethdev']
diff --git a/lib/power/rte_power_pmd_mgmt.c b/lib/power/rte_power_pmd_mgmt.c
index b1c18a5f56..6dec282054 100644
--- a/lib/power/rte_power_pmd_mgmt.c
+++ b/lib/power/rte_power_pmd_mgmt.c
@@ -664,7 +664,7 @@  rte_power_ethdev_pmgmt_queue_disable(unsigned int lcore_id,
 	 * ports before calling any of these API's, so we can assume that the
 	 * callbacks can be freed. we're intentionally casting away const-ness.
 	 */
-	rte_free((void *)queue_cfg->cb);
+	rte_free((void *)(uintptr_t)queue_cfg->cb);
 	free(queue_cfg);
 
 	return 0;