public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] i2c: bcm-iproc: Fix Wvoid-pointer-to-enum-cast warning
@ 2025-11-26 18:22 Krzysztof Kozlowski
  2025-11-26 18:22 ` [PATCH 2/3] i2c: pxa: " Krzysztof Kozlowski
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Krzysztof Kozlowski @ 2025-11-26 18:22 UTC (permalink / raw)
  To: Andi Shyti, Ray Jui, Scott Branden,
	Broadcom internal kernel review list, Wolfram Sang,
	Geert Uytterhoeven, Magnus Damm, Nathan Chancellor,
	Nick Desaulniers, Bill Wendling, Justin Stitt, linux-i2c,
	linux-arm-kernel, linux-kernel, linux-renesas-soc, llvm
  Cc: Krzysztof Kozlowski

'type' is an enum, thus cast of pointer on 64-bit compile test with
clang and W=1 causes:

  i2c-bcm-iproc.c:1102:3: error: cast to smaller integer type 'enum bcm_iproc_i2c_type' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast]

One of the discussions in 2023 on LKML suggested warning is not suitable
for kernel.  Nothing changed in this regard since that time, so assume
the warning will stay and we want to have warnings-free builds.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>

---

kernel_ulong_t is the preferred cast for such cases.
---
 drivers/i2c/busses/i2c-bcm-iproc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-bcm-iproc.c b/drivers/i2c/busses/i2c-bcm-iproc.c
index e418a4f23f15..b5629cffe99b 100644
--- a/drivers/i2c/busses/i2c-bcm-iproc.c
+++ b/drivers/i2c/busses/i2c-bcm-iproc.c
@@ -1098,8 +1098,7 @@ static int bcm_iproc_i2c_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, iproc_i2c);
 	iproc_i2c->device = &pdev->dev;
-	iproc_i2c->type =
-		(enum bcm_iproc_i2c_type)of_device_get_match_data(&pdev->dev);
+	iproc_i2c->type = (kernel_ulong_t)of_device_get_match_data(&pdev->dev);
 	init_completion(&iproc_i2c->done);
 
 	iproc_i2c->base = devm_platform_ioremap_resource(pdev, 0);
-- 
2.48.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2025-12-03 17:38 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-26 18:22 [PATCH 1/3] i2c: bcm-iproc: Fix Wvoid-pointer-to-enum-cast warning Krzysztof Kozlowski
2025-11-26 18:22 ` [PATCH 2/3] i2c: pxa: " Krzysztof Kozlowski
2025-11-26 18:23 ` [PATCH 3/3] i2c: rcar: " Krzysztof Kozlowski
2025-11-27  9:02   ` Geert Uytterhoeven
2025-11-27 11:42     ` Krzysztof Kozlowski
2025-11-27 11:48       ` Krzysztof Kozlowski
2025-11-27 12:52         ` Geert Uytterhoeven
2025-11-27 13:42           ` Krzysztof Kozlowski
2025-11-27 13:46             ` Geert Uytterhoeven
2025-11-28  8:32               ` Arnd Bergmann
2025-12-03 17:38 ` [PATCH 1/3] i2c: bcm-iproc: " Andi Shyti

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox