mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/3] i2c: muxes: pca954x: switch to device_get_match_data
@ 2025-03-28  8:35 Ahmad Fatoum
  2025-03-28  8:35 ` [PATCH 2/3] treewide: export symbols needed for i2c-mux-pca954x.ko Ahmad Fatoum
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Ahmad Fatoum @ 2025-03-28  8:35 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

dev_get_drvdata has other semantics in barebox than in Linux and should
be removed eventually. Drop it in favor of device_get_match_data, which
avoids common bugs with pointer width difference casts.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/i2c/muxes/i2c-mux-pca954x.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/i2c/muxes/i2c-mux-pca954x.c b/drivers/i2c/muxes/i2c-mux-pca954x.c
index 6c21b92860f0..4a926fb92b17 100644
--- a/drivers/i2c/muxes/i2c-mux-pca954x.c
+++ b/drivers/i2c/muxes/i2c-mux-pca954x.c
@@ -186,7 +186,6 @@ static int pca954x_probe(struct device *dev)
 	struct i2c_adapter *adap = to_i2c_adapter(client->dev.parent);
 	int num;
 	struct pca954x *data;
-	uintptr_t tmp;
 	int ret = -ENODEV;
 	int gpio;
 	bool idle_disconnect;
@@ -210,10 +209,7 @@ static int pca954x_probe(struct device *dev)
 	if (i2c_smbus_write_byte(client, 0) < 0)
 		goto exit_free;
 
-	ret = dev_get_drvdata(dev, (const void **)&tmp);
-	data->type = tmp;
-	if (ret)
-		goto exit_free;
+	data->type = (uintptr_t)device_get_match_data(dev);
 
 	idle_disconnect = of_property_read_bool(dev->of_node,
 						"i2c-mux-idle-disconnect");
-- 
2.39.5




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

end of thread, other threads:[~2025-03-31  7:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-28  8:35 [PATCH 1/3] i2c: muxes: pca954x: switch to device_get_match_data Ahmad Fatoum
2025-03-28  8:35 ` [PATCH 2/3] treewide: export symbols needed for i2c-mux-pca954x.ko Ahmad Fatoum
2025-03-28 16:54   ` David Dgien
2025-03-28  8:35 ` [PATCH 3/3] kbuild: compile *.mod.c files with -fshort-wchar Ahmad Fatoum
2025-03-31  7:05 ` [PATCH 1/3] i2c: muxes: pca954x: switch to device_get_match_data Sascha Hauer

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