Re: [PATCH 1/3] gpio: realtek-otto: use kernel_ulong_t
From: David Laight
Date: Wed Dec 17 2025 - 17:56:20 EST
On Wed, 17 Dec 2025 10:34:26 +0100
Bartosz Golaszewski <brgl@xxxxxxxxxx> wrote:
> On Wed, Dec 17, 2025 at 7:32 AM Rosen Penev <rosenp@xxxxxxxxx> wrote:
> >
> > Fixes compilation on 64-bit platforms as pointers needed a larger type.
> >
> > Signed-off-by: Rosen Penev <rosenp@xxxxxxxxx>
> > ---
> > drivers/gpio/gpio-realtek-otto.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpio/gpio-realtek-otto.c b/drivers/gpio/gpio-realtek-otto.c
> > index de527f4fc6c2..efcddbe01308 100644
> > --- a/drivers/gpio/gpio-realtek-otto.c
> > +++ b/drivers/gpio/gpio-realtek-otto.c
> > @@ -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);
> > --
> > 2.52.0
> >
>
> Just make dev_flags an unsigned long and cast
> device_get_match_data(dev) to uintptr_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
>
> Bart
>