diff mbox series

[by,Rafal] pinctrl: bcm: ns: Use uintptr_t for casting data

Message ID 20181011112621.16963-1-zajec5@gmail.com
State New
Headers show
Series [by,Rafal] pinctrl: bcm: ns: Use uintptr_t for casting data | expand

Commit Message

Rafał Miłecki Oct. 11, 2018, 11:26 a.m. UTC
From: Rafał Miłecki <rafal@milecki.pl>

Fix up a compiler error on 64bit architectures where pointers
and integers differ in size.

Suggested-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
It's an alternative to Linus's
[PATCH v2] pinctrl: bcm: ns: Use uintptr_t for data

I believe it's safe to assign uintptr_t to the unsigned int. It's also
what I saw in some drivers.

I don't have any real preference for which version to use/apply. Linus,
please pick the one you like more :)
 drivers/pinctrl/bcm/pinctrl-ns.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series


diff --git a/drivers/pinctrl/bcm/pinctrl-ns.c b/drivers/pinctrl/bcm/pinctrl-ns.c
index aedbb2813c50..d7f8175d2c1c 100644
--- a/drivers/pinctrl/bcm/pinctrl-ns.c
+++ b/drivers/pinctrl/bcm/pinctrl-ns.c
@@ -285,7 +285,7 @@  static int ns_pinctrl_probe(struct platform_device *pdev)
 	of_id = of_match_device(ns_pinctrl_of_match_table, dev);
 	if (!of_id)
 		return -EINVAL;
-	ns_pinctrl->chipset_flag = (unsigned int)of_id->data;
+	ns_pinctrl->chipset_flag = (uintptr_t)of_id->data;
 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
@@ -307,7 +307,7 @@  static int ns_pinctrl_probe(struct platform_device *pdev)
 	for (i = 0, pin = (struct pinctrl_pin_desc *)&pctldesc->pins[0];
 	     i < ARRAY_SIZE(ns_pinctrl_pins); i++) {
 		const struct pinctrl_pin_desc *src = &ns_pinctrl_pins[i];
-		unsigned int chipsets = (unsigned int)src->drv_data;
+		unsigned int chipsets = (uintptr_t)src->drv_data;
 		if (chipsets & ns_pinctrl->chipset_flag) {
 			memcpy(pin++, src, sizeof(*src));