From: Bartosz Golaszewski <brgl@bgdev.pl>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
Linus Walleij <linus.walleij@linaro.org>,
Andy Shevchenko <andy@kernel.org>
Subject: Re: [PATCH v1 01/10] gpio: pca953x: Drop unused fields in struct pca953x_platform_data
Date: Mon, 4 Sep 2023 09:43:01 +0200 [thread overview]
Message-ID: <CAMRc=Metu3dB0iF1C-5nwTr2Vj1rk0AJAwzn8Dkgto8t-jn_LA@mail.gmail.com> (raw)
In-Reply-To: <20230901134041.1165562-1-andriy.shevchenko@linux.intel.com>
On Fri, Sep 1, 2023 at 3:40 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> New code should solely use firmware nodes for the specifics and
> not any callbacks.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> drivers/gpio/gpio-pca953x.c | 37 ++++++---------------------
> include/linux/platform_data/pca953x.h | 13 ----------
> 2 files changed, 8 insertions(+), 42 deletions(-)
>
> diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
> index bdd50a78e414..02695abd0eb1 100644
> --- a/drivers/gpio/gpio-pca953x.c
> +++ b/drivers/gpio/gpio-pca953x.c
> @@ -211,7 +211,6 @@ struct pca953x_chip {
>
> struct i2c_client *client;
> struct gpio_chip gpio_chip;
> - const char *const *names;
> unsigned long driver_data;
> struct regulator *regulator;
>
> @@ -712,7 +711,6 @@ static void pca953x_setup_gpio(struct pca953x_chip *chip, int gpios)
> gc->label = dev_name(&chip->client->dev);
> gc->parent = &chip->client->dev;
> gc->owner = THIS_MODULE;
> - gc->names = chip->names;
> }
>
> #ifdef CONFIG_GPIO_PCA953X_IRQ
> @@ -998,7 +996,7 @@ static int pca953x_irq_setup(struct pca953x_chip *chip,
> }
> #endif
>
> -static int device_pca95xx_init(struct pca953x_chip *chip, u32 invert)
> +static int device_pca95xx_init(struct pca953x_chip *chip)
> {
> DECLARE_BITMAP(val, MAX_LINE);
> u8 regaddr;
> @@ -1016,24 +1014,21 @@ static int device_pca95xx_init(struct pca953x_chip *chip, u32 invert)
> if (ret)
> goto out;
>
> - /* set platform specific polarity inversion */
> - if (invert)
> - bitmap_fill(val, MAX_LINE);
> - else
> - bitmap_zero(val, MAX_LINE);
> + /* clear polarity inversion */
> + bitmap_zero(val, MAX_LINE);
>
> ret = pca953x_write_regs(chip, chip->regs->invert, val);
> out:
> return ret;
> }
>
> -static int device_pca957x_init(struct pca953x_chip *chip, u32 invert)
> +static int device_pca957x_init(struct pca953x_chip *chip)
> {
> DECLARE_BITMAP(val, MAX_LINE);
> unsigned int i;
> int ret;
>
> - ret = device_pca95xx_init(chip, invert);
> + ret = device_pca95xx_init(chip);
> if (ret)
> goto out;
>
> @@ -1054,9 +1049,8 @@ static int pca953x_probe(struct i2c_client *client)
> {
> struct pca953x_platform_data *pdata;
> struct pca953x_chip *chip;
> - int irq_base = 0;
> + int irq_base;
> int ret;
> - u32 invert = 0;
> struct regulator *reg;
> const struct regmap_config *regmap_config;
>
> @@ -1068,8 +1062,6 @@ static int pca953x_probe(struct i2c_client *client)
> if (pdata) {
> irq_base = pdata->irq_base;
> chip->gpio_start = pdata->gpio_base;
> - invert = pdata->invert;
> - chip->names = pdata->names;
> } else {
> struct gpio_desc *reset_gpio;
>
> @@ -1158,10 +1150,10 @@ static int pca953x_probe(struct i2c_client *client)
> */
> if (PCA_CHIP_TYPE(chip->driver_data) == PCA957X_TYPE) {
> chip->regs = &pca957x_regs;
> - ret = device_pca957x_init(chip, invert);
> + ret = device_pca957x_init(chip);
> } else {
> chip->regs = &pca953x_regs;
> - ret = device_pca95xx_init(chip, invert);
> + ret = device_pca95xx_init(chip);
> }
> if (ret)
> goto err_exit;
> @@ -1174,13 +1166,6 @@ static int pca953x_probe(struct i2c_client *client)
> if (ret)
> goto err_exit;
>
> - if (pdata && pdata->setup) {
> - ret = pdata->setup(client, chip->gpio_chip.base,
> - chip->gpio_chip.ngpio, pdata->context);
> - if (ret < 0)
> - dev_warn(&client->dev, "setup failed, %d\n", ret);
> - }
> -
> return 0;
>
> err_exit:
> @@ -1190,14 +1175,8 @@ static int pca953x_probe(struct i2c_client *client)
>
> static void pca953x_remove(struct i2c_client *client)
> {
> - struct pca953x_platform_data *pdata = dev_get_platdata(&client->dev);
> struct pca953x_chip *chip = i2c_get_clientdata(client);
>
> - if (pdata && pdata->teardown) {
> - pdata->teardown(client, chip->gpio_chip.base,
> - chip->gpio_chip.ngpio, pdata->context);
> - }
> -
> regulator_disable(chip->regulator);
> }
>
> diff --git a/include/linux/platform_data/pca953x.h b/include/linux/platform_data/pca953x.h
> index 96c1a14ab365..3c3787c4d96c 100644
> --- a/include/linux/platform_data/pca953x.h
> +++ b/include/linux/platform_data/pca953x.h
> @@ -11,21 +11,8 @@ struct pca953x_platform_data {
> /* number of the first GPIO */
> unsigned gpio_base;
>
> - /* initial polarity inversion setting */
> - u32 invert;
> -
> /* interrupt base */
> int irq_base;
> -
> - void *context; /* param to setup/teardown */
> -
> - int (*setup)(struct i2c_client *client,
> - unsigned gpio, unsigned ngpio,
> - void *context);
> - void (*teardown)(struct i2c_client *client,
> - unsigned gpio, unsigned ngpio,
> - void *context);
> - const char *const *names;
> };
>
> #endif /* _LINUX_PCA953X_H */
> --
> 2.40.0.1.gaa8946217a0b
>
Ah, we're so close to getting rid of platform data entirely...
Series looks good to me, I'll pick it up next week after the merge
window closes.
Bart
next prev parent reply other threads:[~2023-09-04 7:43 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-01 13:40 [PATCH v1 01/10] gpio: pca953x: Drop unused fields in struct pca953x_platform_data Andy Shevchenko
2023-09-01 13:40 ` [PATCH v1 02/10] gpio: pca953x: Fully convert to device managed resources Andy Shevchenko
2023-09-01 13:40 ` [PATCH v1 03/10] gpio: pca953x: Utilise dev_err_probe() where it makes sense Andy Shevchenko
2023-09-01 13:40 ` [PATCH v1 04/10] gpio: pca953x: Split pca953x_restore_context() and pca953x_save_context() Andy Shevchenko
2023-09-01 13:40 ` [PATCH v1 05/10] gpio: pca953x: Simplify code with cleanup helpers Andy Shevchenko
2023-09-13 14:35 ` Geert Uytterhoeven
2023-09-13 15:27 ` Bartosz Golaszewski
2023-09-14 7:47 ` guard coding style (was: Re: [PATCH v1 05/10] gpio: pca953x: Simplify code with cleanup helpers) Geert Uytterhoeven
2023-09-14 20:51 ` Mitchell Levy
2023-09-14 22:26 ` Peter Zijlstra
2023-09-14 22:41 ` Peter Zijlstra
2023-09-14 22:17 ` Peter Zijlstra
2023-09-14 22:30 ` Peter Zijlstra
2023-09-01 13:40 ` [PATCH v1 06/10] gpio: pca953x: Utilise temporary variable for struct device Andy Shevchenko
2023-09-01 13:40 ` [PATCH v1 07/10] gpio: pca953x: Utilise temporary variable for struct gpio_chip Andy Shevchenko
2023-09-01 13:40 ` [PATCH v1 08/10] gpio: pca953x: Switch to DEFINE_SIMPLE_DEV_PM_OPS() Andy Shevchenko
2023-09-01 13:40 ` [PATCH v1 09/10] gpio: pca953x: Get rid of useless goto label Andy Shevchenko
2023-09-04 7:41 ` Bartosz Golaszewski
2023-09-04 8:38 ` Andy Shevchenko
2023-09-01 13:40 ` [PATCH v1 10/10] gpio: pca953x: Revisit header inclusions Andy Shevchenko
2023-09-04 7:43 ` Bartosz Golaszewski [this message]
2023-09-06 16:26 ` [PATCH v1 01/10] gpio: pca953x: Drop unused fields in struct pca953x_platform_data Andy Shevchenko
2023-09-11 7:01 ` Bartosz Golaszewski
2023-09-12 7:50 ` Linus Walleij
2023-09-12 9:31 ` Andy Shevchenko
2023-09-12 9:48 ` Bartosz Golaszewski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAMRc=Metu3dB0iF1C-5nwTr2Vj1rk0AJAwzn8Dkgto8t-jn_LA@mail.gmail.com' \
--to=brgl@bgdev.pl \
--cc=andriy.shevchenko@linux.intel.com \
--cc=andy@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).