gpio: realtek-otto: compile fixes
cover gpio: realtek-otto: compile fixes
Fixes compilation on 32-bit. Also small OF change.
Rosen Penev (3):
gpio: realtek-otto: use kernel_ulong_t
gpio: realtek-otto: add COMPILE_TEST
gpio: realtek-otto: use of instead of device handlers
drivers/gpio/Kconfig | 2 +- drivers/gpio/gpio-realtek-otto.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
--
2.52.0
PATCH 1/3 gpio: realtek-otto: use kernel_ulong_t
Fixes compilation on 64-bit platforms as pointers needed a larger type.
--- drivers/gpio/gpio-realtek-otto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpio-realtek-otto.c +1 -1
@@ -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 int )(kernel_ulong_t )device_get_match_data (dev); ngpios =REALTEK_GPIO_MAX ;device_property_read_u32 (dev,"ngpios" , &ngpios);
Signature · 1 line
2.52.0
Bartosz Golaszewski
maintainerRe: [PATCH 1/3] gpio: realtek-otto: use kernel_ulong_t
Quoted 22 lines · Rosen Penev
Fixes compilation on 64-bit platforms as pointers needed a larger type.
Signed-off-by Rosen Penev <[email protected]>--- drivers/gpio/gpio-realtek-otto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpio/gpio-realtek-otto.c +1
-2@@ -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 int )(kernel_ulong_t )device_get_match_data (dev); ngpios =REALTEK_GPIO_MAX ;device_property_read_u32 (dev,"ngpios" , &ngpios); --
Quoted 2 lines
2.52.0
Just make dev_flags an unsigned long and castdevice_get_match_data(dev) to uintptr_t.
Bart
Re: [PATCH 1/3] gpio: realtek-otto: use kernel_ulong_t
Quoted 20 lines · On Wed, 17 Dec 2025 10:34:26 +0100 Bartosz Golaszewski <[email protected]> wrote:
Quoted 19 lines · Rosen Penev
Fixes compilation on 64-bit platforms as pointers needed a larger type.
Signed-off-by Rosen Penev <[email protected]>--- drivers/gpio/gpio-realtek-otto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpio/gpio-realtek-otto.c +1
-1@@ -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 int )(kernel_ulong_t )device_get_match_data (dev);
Quoted 8 lines
Quoted 5 lines
drivers/gpio/gpio-realtek-otto.c +0
-1ngpios =REALTEK_GPIO_MAX ;device_property_read_u32 (dev,"ngpios" , &ngpios); --2.52.0
Just make
dev_flagsan unsigned long and castdevice_get_match_data(dev)touintptr_t.
Or just cast the pointer to (unsigned long) and leave dev_flags alone. 'uintptr_t' is a 'user' type, not a kernel one.
The kernel tends to just use 'long' when pointers need to be in an integer type.
David
Quoted 3 lines
Bart
PATCH 2/3 gpio: realtek-otto: add COMPILE_TEST
In reply to Rosen PenevAllows the buildbots to test compilation.
--- drivers/gpio/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/Kconfig +1 -1
@@ -600,7 +600,7 @@ config GPIO_RDA config GPIO_REALTEK_OTTO tristate "Realtek Otto GPIO support" - depends on MACH_REALTEK_RTL + depends on MACH_REALTEK_RTL || COMPILE_TEST default MACH_REALTEK_RTL select GPIO_GENERIC select GPIOLIB_IRQCHIP
Signature · 1 line
2.52.0
PATCH 3/3 gpio: realtek-otto: use of instead of device handlers
In reply to Rosen PenevThis is an OF only driver. No point in using generic device handlers.
--- drivers/gpio/gpio-realtek-otto.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpio/gpio-realtek-otto.c +2 -2
@@ -372,10 +372,10 @@ static int realtek_gpio_probe(struct platform_device *pdev)if (!ctrl)return -ENOMEM ; - dev_flags = (unsigned int )(kernel_ulong_t )device_get_match_data (dev); + dev_flags = (unsigned int )(kernel_ulong_t )of_device_get_match_data (dev); ngpios =REALTEK_GPIO_MAX ; -device_property_read_u32 (dev,"ngpios" , &ngpios); +of_property_read_u32 (dev->of_node,"ngpios" , &ngpios);if (ngpios >REALTEK_GPIO_MAX ) { dev_err(&pdev->dev, "invalid ngpios (max. %d)\n",
Signature · 1 line
2.52.0
Bartosz Golaszewski
maintainerRe: [PATCH 3/3] gpio: realtek-otto: use of instead of device handlers
Quoted 26 lines · Rosen Penev
This is an OF only driver. No point in using generic device handlers.
Signed-off-by Rosen Penev <[email protected]>--- drivers/gpio/gpio-realtek-otto.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpio/gpio-realtek-otto.c +2
-3@@ -372,10 +372,10 @@ static int realtek_gpio_probe(struct platform_device *pdev)if (!ctrl)return -ENOMEM ; - dev_flags = (unsigned int )(kernel_ulong_t )device_get_match_data (dev); + dev_flags = (unsigned int )(kernel_ulong_t )of_device_get_match_data (dev); ngpios =REALTEK_GPIO_MAX ; -device_property_read_u32 (dev,"ngpios" , &ngpios); +of_property_read_u32 (dev->of_node,"ngpios" , &ngpios);if (ngpios >REALTEK_GPIO_MAX ) { dev_err(&pdev->dev, "invalid ngpios (max. %d)\n", --
Quoted 2 lines
2.52.0
Yeah, no, there's almost *never* a point in using OF-specific accessors. NAK.
Bart
Re: [PATCH 3/3] gpio: realtek-otto: use of instead of device handlers
Quoted 25 lines · Bartosz Golaszewski
Quoted 23 lines · Rosen Penev
This is an OF only driver. No point in using generic device handlers.
Signed-off-by Rosen Penev <[email protected]>--- drivers/gpio/gpio-realtek-otto.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpio/gpio-realtek-otto.c +2
-2@@ -372,10 +372,10 @@ static int realtek_gpio_probe(struct platform_device *pdev)if (!ctrl)return -ENOMEM ; - dev_flags = (unsigned int )(kernel_ulong_t )device_get_match_data (dev); + dev_flags = (unsigned int )(kernel_ulong_t )of_device_get_match_data (dev); ngpios =REALTEK_GPIO_MAX ; -device_property_read_u32 (dev,"ngpios" , &ngpios); +of_property_read_u32 (dev->of_node,"ngpios" , &ngpios);
Quoted 7 lines
Quoted 5 lines
drivers/gpio/gpio-realtek-otto.c +0
-1if (ngpios >REALTEK_GPIO_MAX ) { dev_err(&pdev->dev, "invalid ngpios (max. %d)\n", --2.52.0
Yeah, no, there's almost *never* a point in using OF-specific accessors. NAK.
Argument made to me on netdev before is it's pointless overhead for an OF only driver.
Quoted 2 lines
Bart
Bartosz Golaszewski
maintainerRe: [PATCH 3/3] gpio: realtek-otto: use of instead of device handlers
Quoted 5 lines · Rosen Penev
Quoted 2 lines
Yeah, no, there's almost *never* a point in using OF-specific accessors. NAK.
Argument made to me on netdev before is it's pointless overhead for an OF only driver.
Would you mind posting a lore link? I'll gladly chime in.
Drivers are OF-only until they aren't. Vide: lots of discussions currently about supporting ARM laptops and servers with mixed DT-ACPI setup.
The overhead of going through the fwnode pointer is absolutely negligible while using generic accessors allows taking secondary fwnodes into account.
Please don't tell me people are going around the kernel converting drivers to using of_ routines?
Bart
Re: [PATCH 3/3] gpio: realtek-otto: use of instead of device handlers
Quoted 5 lines · Bartosz Golaszewski
Quoted 3 lines · Rosen Penev
Quoted 2 lines
Yeah, no, there's almost *never* a point in using OF-specific accessors. NAK.
Quoted 8 lines
Quoted 2 lines
Argument made to me on netdev before is it's pointless overhead for an OF only driver.
Would you mind posting a lore link? I'll gladly chime in.
Drivers are OF-only until they aren't. Vide: lots of discussions currently about supporting ARM laptops and servers with mixed DT-ACPI setup.
Hrm I must have misremembered or I can't find it. In any case, these devices will never support ACPI. They're all embedded devices with uboot.
Quoted 7 lines
The overhead of going through the fwnode pointer is absolutely negligible while using generic accessors allows taking secondary fwnodes into account.
Please don't tell me people are going around the kernel converting drivers to using
of_routines?
There's one special case I know of, of_get_mac_address vs device_get_mac_address. The former supports NVMEM. The latter does not.
Quoted 2 lines
Bart
Bartosz Golaszewski
maintainerRe: [PATCH 3/3] gpio: realtek-otto: use of instead of device handlers
Quoted 10 lines · Rosen Penev
Quoted 8 lines · Bartosz Golaszewski
Quoted 5 lines · Rosen Penev
Quoted 2 lines
Yeah, no, there's almost *never* a point in using OF-specific accessors. NAK.
Argument made to me on netdev before is it's pointless overhead for an OF only driver.
Quoted 9 lines
Quoted 5 lines
Would you mind posting a lore link? I'll gladly chime in.
Drivers are OF-only until they aren't. Vide: lots of discussions currently about supporting ARM laptops and servers with mixed DT-ACPI setup.
Hrm I must have misremembered or I can't find it. In any case, these devices will never support ACPI. They're all embedded devices with uboot.
Quoted 1 line
If I had a euro everytime someone was wrong saying "never"... :)
Quoted 10 lines
Quoted 6 lines
The overhead of going through the fwnode pointer is absolutely negligible while using generic accessors allows taking secondary fwnodes into account.
Please don't tell me people are going around the kernel converting drivers to using
of_routines?There's one special case I know of,
of_get_mac_addressvsdevice_get_mac_address. The former supports NVMEM. The latter does not.Quoted 1 line
Yes, that is one of those special cases but a better fix would be to make NVMEM core fwnode-agnostic. While nvmem remains OF-specific, we can live with using of_get_mac_address().
Bart
Bartosz Golaszewski
AppliedRe: (subset) [PATCH 0/3] gpio: realtek-otto: compile fixes
In reply to Rosen PenevQuoted 8 lines · Rosen Penev
Fixes compilation on 32-bit. Also small OF change.
Rosen Penev (3):
gpio: realtek-otto: usekernel_ulong_t
gpio: realtek-otto: addCOMPILE_TEST
gpio: realtek-otto: use of instead of device handlers[...]
Applied, thanks!
[2/3] gpio: realtek-otto: add COMPILE_TEST
commit: 3203d8f573af87d8c967d36e8d5016ef306ff078
Best regards,
Signature · 1 line
Bartosz Golaszewski <[email protected]>