Re: [PATCH v5 2/3] gpio: pca9570: add a platform data structure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Shubhrajyoti,

On Fri, Sep 30, 2022 at 12:41 PM Shubhrajyoti Datta
<shubhrajyoti.datta@xxxxxxx> wrote:
> Add struct pca9570_platform_data for adding the platform data
> structure. Also modify the existing structs for pca9570 and pca9571
>
> Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xxxxxxx>
> ---
>
> (no changes since v3)
>
> Changes in v3:
> split the new patch
> Suggested by Andy Shevchenko

Thanks for your patch, which is now commit 35a4bc94a47f2ea6 ("gpio:
pca9570: add a platform data structure") in gpio/gpio/for-next
linux-next/master next-20221026

> --- a/drivers/gpio/gpio-pca9570.c
> +++ b/drivers/gpio/gpio-pca9570.c
> @@ -15,6 +15,16 @@
>  #include <linux/mutex.h>
>  #include <linux/property.h>
>
> +/**
> + * struct pca9570_platform_data - GPIO platformdata
> + * @ngpio: no of gpios
> + * @command: Command to be sent
> + */
> +struct pca9570_platform_data {
> +       u16 ngpio;
> +       u32 command;
> +};
> +
>  /**
>   * struct pca9570 - GPIO driver data
>   * @chip: GPIO controller chip
> @@ -119,16 +129,24 @@ static int pca9570_probe(struct i2c_client *client)
>         return devm_gpiochip_add_data(&client->dev, &gpio->chip, gpio);
>  }
>
> +static const struct pca9570_platform_data pca9570_gpio = {
> +       .ngpio = 4,
> +};
> +
> +static const struct pca9570_platform_data pca9571_gpio = {
> +       .ngpio = 8,
> +};
> +
>  static const struct i2c_device_id pca9570_id_table[] = {
> -       { "pca9570", 4 },
> -       { "pca9571", 8 },
> +       { "pca9570", (kernel_ulong_t)&pca9570_gpio},
> +       { "pca9571", (kernel_ulong_t)&pca9571_gpio },
>         { /* sentinel */ }
>  };
>  MODULE_DEVICE_TABLE(i2c, pca9570_id_table);
>
>  static const struct of_device_id pca9570_of_match_table[] = {
> -       { .compatible = "nxp,pca9570", .data = (void *)4 },
> -       { .compatible = "nxp,pca9571", .data = (void *)8 },
> +       { .compatible = "nxp,pca9570", .data = &pca9570_gpio },
> +       { .compatible = "nxp,pca9571", .data = &pca9571_gpio },

This breaks bisection, as .data is still considered to be the number
of GPIOs:

    gpio->chip.ngpio = (uintptr_t)device_get_match_data(&client->dev);


>         { /* sentinel */ }
>  };
>  MODULE_DEVICE_TABLE(of, pca9570_of_match_table);

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux