struct platform_device::id was only set by board code, but since i.MX
became a devicetree-only platform, this will always be -1
(PLATFORM_DEVID_NONE).
Note: of_alias_get_id() returns a negative number on error and base
treats all negative errors the same, so we need not add any additional
error handling.
Fixes: 0f2c7af45d7e ("gpio: mxc: Convert the driver to DT-only")
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
drivers/gpio/gpio-mxc.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c
index 4cb455b2bdee71ba4eb20c93567c3b8db100dbb2..619b6fb9d833a4bb94a93b4209f01b49ad1cbdb0 100644
--- a/drivers/gpio/gpio-mxc.c
+++ b/drivers/gpio/gpio-mxc.c
@@ -490,8 +490,7 @@ static int mxc_gpio_probe(struct platform_device *pdev)
port->gc.request = mxc_gpio_request;
port->gc.free = mxc_gpio_free;
port->gc.to_irq = mxc_gpio_to_irq;
- port->gc.base = (pdev->id < 0) ? of_alias_get_id(np, "gpio") * 32 :
- pdev->id * 32;
+ port->gc.base = of_alias_get_id(np, "gpio") * 32;
err = devm_gpiochip_add_data(&pdev->dev, &port->gc, port);
if (err)
--
2.39.5
On Mon, Jan 13, 2025 at 11:19 PM Ahmad Fatoum <a.fatoum@pengutronix.de> wrote:
>
> struct platform_device::id was only set by board code, but since i.MX
> became a devicetree-only platform, this will always be -1
> (PLATFORM_DEVID_NONE).
>
> Note: of_alias_get_id() returns a negative number on error and base
> treats all negative errors the same, so we need not add any additional
> error handling.
>
> Fixes: 0f2c7af45d7e ("gpio: mxc: Convert the driver to DT-only")
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
> drivers/gpio/gpio-mxc.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c
> index 4cb455b2bdee71ba4eb20c93567c3b8db100dbb2..619b6fb9d833a4bb94a93b4209f01b49ad1cbdb0 100644
> --- a/drivers/gpio/gpio-mxc.c
> +++ b/drivers/gpio/gpio-mxc.c
> @@ -490,8 +490,7 @@ static int mxc_gpio_probe(struct platform_device *pdev)
> port->gc.request = mxc_gpio_request;
> port->gc.free = mxc_gpio_free;
> port->gc.to_irq = mxc_gpio_to_irq;
> - port->gc.base = (pdev->id < 0) ? of_alias_get_id(np, "gpio") * 32 :
> - pdev->id * 32;
> + port->gc.base = of_alias_get_id(np, "gpio") * 32;
>
> err = devm_gpiochip_add_data(&pdev->dev, &port->gc, port);
> if (err)
>
> --
> 2.39.5
>
This looks like I can pick it up separately from the rest? Is that right?
Bart
On 15.01.25 17:55, Bartosz Golaszewski wrote:
> On Mon, Jan 13, 2025 at 11:19 PM Ahmad Fatoum <a.fatoum@pengutronix.de> wrote:
>>
>> struct platform_device::id was only set by board code, but since i.MX
>> became a devicetree-only platform, this will always be -1
>> (PLATFORM_DEVID_NONE).
>>
>> Note: of_alias_get_id() returns a negative number on error and base
>> treats all negative errors the same, so we need not add any additional
>> error handling.
>>
>> Fixes: 0f2c7af45d7e ("gpio: mxc: Convert the driver to DT-only")
>> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
>> ---
>> drivers/gpio/gpio-mxc.c | 3 +--
>> 1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c
>> index 4cb455b2bdee71ba4eb20c93567c3b8db100dbb2..619b6fb9d833a4bb94a93b4209f01b49ad1cbdb0 100644
>> --- a/drivers/gpio/gpio-mxc.c
>> +++ b/drivers/gpio/gpio-mxc.c
>> @@ -490,8 +490,7 @@ static int mxc_gpio_probe(struct platform_device *pdev)
>> port->gc.request = mxc_gpio_request;
>> port->gc.free = mxc_gpio_free;
>> port->gc.to_irq = mxc_gpio_to_irq;
>> - port->gc.base = (pdev->id < 0) ? of_alias_get_id(np, "gpio") * 32 :
>> - pdev->id * 32;
>> + port->gc.base = of_alias_get_id(np, "gpio") * 32;
>>
>> err = devm_gpiochip_add_data(&pdev->dev, &port->gc, port);
>> if (err)
>>
>> --
>> 2.39.5
>>
>
> This looks like I can pick it up separately from the rest? Is that right?
Yes, please do.
Thanks,
Ahmad
>
> Bart
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
On Tue, Jan 14, 2025 at 12:19 AM Ahmad Fatoum <a.fatoum@pengutronix.de> wrote: > > struct platform_device::id was only set by board code, but since i.MX > became a devicetree-only platform, this will always be -1 > (PLATFORM_DEVID_NONE). > > Note: of_alias_get_id() returns a negative number on error and base > treats all negative errors the same, so we need not add any additional > error handling. This one is good, Reviewed-by: Andy Shevchenko <andy@kernel.org> -- With Best Regards, Andy Shevchenko
© 2016 - 2025 Red Hat, Inc.