Skip to contentSkip to conversation

gpio: realtek-otto: use unsigned long

PATCH Applied Rosen Penev 4 participants 5 messages Dec 17, 2025 – Dec 18, 2025 GPIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpio: realtek-otto: use unsigned long

Fixes compilation on 64-bit platforms as pointers need a larger type.

Change device_get_match_data to of variant. The data is obtained through OF anyway.

---
 drivers/gpio/gpio-realtek-otto.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpio/gpio-realtek-otto.c +2 -2
index e6694d5d1696..e9c89b191989 100644
@@ -360,7 +360,7 @@ static int realtek_gpio_probe(struct platform_device *pdev)
 	struct gpio_generic_chip_config config;
 	struct device *dev = &pdev->dev;
 	unsigned long gen_gc_flags;
-	unsigned int dev_flags;
+	unsigned long dev_flags;
 	struct gpio_irq_chip *girq;
 	struct realtek_gpio_ctrl *ctrl;
 	struct resource *res;
@@ -372,7 +372,7 @@ static int realtek_gpio_probe(struct platform_device *pdev)
 	if (!ctrl)
 		return -ENOMEM;
 
-	dev_flags = (unsigned int) device_get_match_data(dev);
+	dev_flags = (unsigned long) of_device_get_match_data(dev);
 
 	ngpios = REALTEK_GPIO_MAX;
 	of_property_read_u32(dev->of_node, "ngpios", &ngpios);
Signature · 1 line
2.52.0
#1 lore raw
Quoted 1 line · On Wed, 17 Dec 2025 12:23:31 -0800 Rosen Penev <[email protected]> wrote:

Fixes compilation on 64-bit platforms as pointers need a larger type.

Not a good description...

Quoted 14 lines

Change device_get_match_data to of variant. The data is obtained through OF anyway.

---
 drivers/gpio/gpio-realtek-otto.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpio/gpio-realtek-otto.c +0 -0
index e6694d5d1696..e9c89b191989 100644

drivers/gpio/gpio-realtek-otto.c static int realtek_gpio_probe(struct platform_device *pdev) · line 363

Quoted 5 lines
drivers/gpio/gpio-realtek-otto.c +1 -1
@@ -360,7 +360,7 @@ static int realtek_gpio_probe(struct platform_device *pdev)
 	struct gpio_generic_chip_config config;
 	struct device *dev = &pdev->dev;
 	unsigned long gen_gc_flags;
-	unsigned int dev_flags;
+	unsigned long dev_flags;

You don't need to change the type of the variable, just the cast.

David

Quoted 12 lines
drivers/gpio/gpio-realtek-otto.c +1 -1
 	struct gpio_irq_chip *girq;
 	struct realtek_gpio_ctrl *ctrl;
 	struct resource *res;
@@ -372,7 +372,7 @@ static int realtek_gpio_probe(struct platform_device *pdev)
 	if (!ctrl)
 		return -ENOMEM;
 
-	dev_flags = (unsigned int) device_get_match_data(dev);
+	dev_flags = (unsigned long) of_device_get_match_data(dev);
 
 	ngpios = REALTEK_GPIO_MAX;
 	of_property_read_u32(dev->of_node, "ngpios", &ngpios);
#2 lore raw
Quoted 17 lines · David Laight
Quoted 1 line · On Wed, 17 Dec 2025 12:23:31 -0800 Rosen Penev <[email protected]> wrote:

Fixes compilation on 64-bit platforms as pointers need a larger type.

Not a good description...

Quoted 9 lines

Change device_get_match_data to of variant. The data is obtained through OF anyway.

---
 drivers/gpio/gpio-realtek-otto.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 12 lines

drivers/gpio/gpio-realtek-otto.c static int realtek_gpio_probe(struct platform_device *pdev) · line 363

Quoted 10 lines
drivers/gpio/gpio-realtek-otto.c +1 -1
index e6694d5d1696..e9c89b191989 100644
@@ -360,7 +360,7 @@ static int realtek_gpio_probe(struct platform_device *pdev)
      struct gpio_generic_chip_config config;
      struct device *dev = &pdev->dev;
      unsigned long gen_gc_flags;
-     unsigned int dev_flags;
+     unsigned long dev_flags;

You don't need to change the type of the variable, just the cast.

Previous review was:

Just make dev_flags an unsigned long and cast
device_get_match_data(dev) to uintptr_t.

Bart

Quoted 16 lines

David

Quoted 12 lines
drivers/gpio/gpio-realtek-otto.c +1 -1
      struct gpio_irq_chip *girq;
      struct realtek_gpio_ctrl *ctrl;
      struct resource *res;
@@ -372,7 +372,7 @@ static int realtek_gpio_probe(struct platform_device *pdev)
      if (!ctrl)
              return -ENOMEM;
 
-     dev_flags = (unsigned int) device_get_match_data(dev);
+     dev_flags = (unsigned long) of_device_get_match_data(dev);
 
      ngpios = REALTEK_GPIO_MAX;
      of_property_read_u32(dev->of_node, "ngpios", &ngpios);
#3 lore raw
Quoted 32 lines · Rosen Penev
Quoted 17 lines · David Laight
Quoted 1 line · On Wed, 17 Dec 2025 12:23:31 -0800 Rosen Penev <[email protected]> wrote:

Fixes compilation on 64-bit platforms as pointers need a larger type.

Not a good description...

Quoted 9 lines

Change device_get_match_data to of variant. The data is obtained through OF anyway.

---
 drivers/gpio/gpio-realtek-otto.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 12 lines

drivers/gpio/gpio-realtek-otto.c static int realtek_gpio_probe(struct platform_device *pdev) · line 363

Quoted 10 lines
drivers/gpio/gpio-realtek-otto.c +1 -1
index e6694d5d1696..e9c89b191989 100644
@@ -360,7 +360,7 @@ static int realtek_gpio_probe(struct platform_device *pdev)
      struct gpio_generic_chip_config config;
      struct device *dev = &pdev->dev;
      unsigned long gen_gc_flags;
-     unsigned int dev_flags;
+     unsigned long dev_flags;

You don't need to change the type of the variable, just the cast.

Quoted 5 lines

Previous review was:

Just make dev_flags an unsigned long and cast
device_get_match_data(dev) to uintptr_t.

And you still cast it to unsigned long instead. Nevermind, my tree is broken now due to the warning from picking up the COMPILE_TEST=y patch so I need to fix it. I'm queuing this as well with some changes to the commit message and the cast.

Bart

#4 lore raw
In reply to Rosen Penev
Quoted 6 lines · Rosen Penev

Fixes compilation on 64-bit platforms as pointers need a larger type.

Change device_get_match_data to of variant. The data is obtained through OF anyway.

Applied, thanks!

[1/1] gpio: realtek-otto: use unsigned long

      commit: 47d8cb678081d12704d52ed42b625e96f38470e0

Best regards,

Signature · 1 line
Bartosz Golaszewski <[email protected]>