linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gpio: pca9570: rename platform_data to chip_data
@ 2022-12-30 10:00 Bartosz Golaszewski
  2022-12-30 11:53 ` Andy Shevchenko
  2022-12-30 15:51 ` Linus Walleij
  0 siblings, 2 replies; 3+ messages in thread
From: Bartosz Golaszewski @ 2022-12-30 10:00 UTC (permalink / raw)
  To: Andy Shevchenko, Linus Walleij, Shubhrajyoti Datta
  Cc: linux-gpio, linux-kernel, Bartosz Golaszewski

From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

By convention platform_data refers to structures passed to drivers by
code that registers devices. When talking about model-specific data
structures associated with OF compatibles, we usually call them chip_data.

In order to avoid confusion rename all mentions of platform_data to
chip_data.

Fixes: fbb19fe17eae ("gpio: pca9570: add slg7xl45106 support")
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
 drivers/gpio/gpio-pca9570.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/gpio/gpio-pca9570.c b/drivers/gpio/gpio-pca9570.c
index 6c07a8811a7a..6a5a8e593ed5 100644
--- a/drivers/gpio/gpio-pca9570.c
+++ b/drivers/gpio/gpio-pca9570.c
@@ -18,11 +18,11 @@
 #define SLG7XL45106_GPO_REG	0xDB
 
 /**
- * struct pca9570_platform_data - GPIO platformdata
+ * struct pca9570_chip_data - GPIO platformdata
  * @ngpio: no of gpios
  * @command: Command to be sent
  */
-struct pca9570_platform_data {
+struct pca9570_chip_data {
 	u16 ngpio;
 	u32 command;
 };
@@ -36,7 +36,7 @@ struct pca9570_platform_data {
  */
 struct pca9570 {
 	struct gpio_chip chip;
-	const struct pca9570_platform_data *p_data;
+	const struct pca9570_chip_data *chip_data;
 	struct mutex lock;
 	u8 out;
 };
@@ -46,8 +46,8 @@ static int pca9570_read(struct pca9570 *gpio, u8 *value)
 	struct i2c_client *client = to_i2c_client(gpio->chip.parent);
 	int ret;
 
-	if (gpio->p_data->command != 0)
-		ret = i2c_smbus_read_byte_data(client, gpio->p_data->command);
+	if (gpio->chip_data->command != 0)
+		ret = i2c_smbus_read_byte_data(client, gpio->chip_data->command);
 	else
 		ret = i2c_smbus_read_byte(client);
 
@@ -62,8 +62,8 @@ static int pca9570_write(struct pca9570 *gpio, u8 value)
 {
 	struct i2c_client *client = to_i2c_client(gpio->chip.parent);
 
-	if (gpio->p_data->command != 0)
-		return i2c_smbus_write_byte_data(client, gpio->p_data->command, value);
+	if (gpio->chip_data->command != 0)
+		return i2c_smbus_write_byte_data(client, gpio->chip_data->command, value);
 
 	return i2c_smbus_write_byte(client, value);
 }
@@ -127,8 +127,8 @@ static int pca9570_probe(struct i2c_client *client)
 	gpio->chip.get = pca9570_get;
 	gpio->chip.set = pca9570_set;
 	gpio->chip.base = -1;
-	gpio->p_data = device_get_match_data(&client->dev);
-	gpio->chip.ngpio = gpio->p_data->ngpio;
+	gpio->chip_data = device_get_match_data(&client->dev);
+	gpio->chip.ngpio = gpio->chip_data->ngpio;
 	gpio->chip.can_sleep = true;
 
 	mutex_init(&gpio->lock);
@@ -141,15 +141,15 @@ 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 = {
+static const struct pca9570_chip_data pca9570_gpio = {
 	.ngpio = 4,
 };
 
-static const struct pca9570_platform_data pca9571_gpio = {
+static const struct pca9570_chip_data pca9571_gpio = {
 	.ngpio = 8,
 };
 
-static const struct pca9570_platform_data slg7xl45106_gpio = {
+static const struct pca9570_chip_data slg7xl45106_gpio = {
 	.ngpio = 8,
 	.command = SLG7XL45106_GPO_REG,
 };
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] gpio: pca9570: rename platform_data to chip_data
  2022-12-30 10:00 [PATCH] gpio: pca9570: rename platform_data to chip_data Bartosz Golaszewski
@ 2022-12-30 11:53 ` Andy Shevchenko
  2022-12-30 15:51 ` Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2022-12-30 11:53 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Linus Walleij, Shubhrajyoti Datta, linux-gpio, linux-kernel,
	Bartosz Golaszewski

On Fri, Dec 30, 2022 at 11:00:44AM +0100, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> 
> By convention platform_data refers to structures passed to drivers by
> code that registers devices. When talking about model-specific data
> structures associated with OF compatibles, we usually call them chip_data.
> 
> In order to avoid confusion rename all mentions of platform_data to
> chip_data.

Fine by me,
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

> Fixes: fbb19fe17eae ("gpio: pca9570: add slg7xl45106 support")
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> ---
>  drivers/gpio/gpio-pca9570.c | 24 ++++++++++++------------
>  1 file changed, 12 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/gpio/gpio-pca9570.c b/drivers/gpio/gpio-pca9570.c
> index 6c07a8811a7a..6a5a8e593ed5 100644
> --- a/drivers/gpio/gpio-pca9570.c
> +++ b/drivers/gpio/gpio-pca9570.c
> @@ -18,11 +18,11 @@
>  #define SLG7XL45106_GPO_REG	0xDB
>  
>  /**
> - * struct pca9570_platform_data - GPIO platformdata
> + * struct pca9570_chip_data - GPIO platformdata
>   * @ngpio: no of gpios
>   * @command: Command to be sent
>   */
> -struct pca9570_platform_data {
> +struct pca9570_chip_data {
>  	u16 ngpio;
>  	u32 command;
>  };
> @@ -36,7 +36,7 @@ struct pca9570_platform_data {
>   */
>  struct pca9570 {
>  	struct gpio_chip chip;
> -	const struct pca9570_platform_data *p_data;
> +	const struct pca9570_chip_data *chip_data;
>  	struct mutex lock;
>  	u8 out;
>  };
> @@ -46,8 +46,8 @@ static int pca9570_read(struct pca9570 *gpio, u8 *value)
>  	struct i2c_client *client = to_i2c_client(gpio->chip.parent);
>  	int ret;
>  
> -	if (gpio->p_data->command != 0)
> -		ret = i2c_smbus_read_byte_data(client, gpio->p_data->command);
> +	if (gpio->chip_data->command != 0)
> +		ret = i2c_smbus_read_byte_data(client, gpio->chip_data->command);
>  	else
>  		ret = i2c_smbus_read_byte(client);
>  
> @@ -62,8 +62,8 @@ static int pca9570_write(struct pca9570 *gpio, u8 value)
>  {
>  	struct i2c_client *client = to_i2c_client(gpio->chip.parent);
>  
> -	if (gpio->p_data->command != 0)
> -		return i2c_smbus_write_byte_data(client, gpio->p_data->command, value);
> +	if (gpio->chip_data->command != 0)
> +		return i2c_smbus_write_byte_data(client, gpio->chip_data->command, value);
>  
>  	return i2c_smbus_write_byte(client, value);
>  }
> @@ -127,8 +127,8 @@ static int pca9570_probe(struct i2c_client *client)
>  	gpio->chip.get = pca9570_get;
>  	gpio->chip.set = pca9570_set;
>  	gpio->chip.base = -1;
> -	gpio->p_data = device_get_match_data(&client->dev);
> -	gpio->chip.ngpio = gpio->p_data->ngpio;
> +	gpio->chip_data = device_get_match_data(&client->dev);
> +	gpio->chip.ngpio = gpio->chip_data->ngpio;
>  	gpio->chip.can_sleep = true;
>  
>  	mutex_init(&gpio->lock);
> @@ -141,15 +141,15 @@ 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 = {
> +static const struct pca9570_chip_data pca9570_gpio = {
>  	.ngpio = 4,
>  };
>  
> -static const struct pca9570_platform_data pca9571_gpio = {
> +static const struct pca9570_chip_data pca9571_gpio = {
>  	.ngpio = 8,
>  };
>  
> -static const struct pca9570_platform_data slg7xl45106_gpio = {
> +static const struct pca9570_chip_data slg7xl45106_gpio = {
>  	.ngpio = 8,
>  	.command = SLG7XL45106_GPO_REG,
>  };
> -- 
> 2.37.2
> 

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] gpio: pca9570: rename platform_data to chip_data
  2022-12-30 10:00 [PATCH] gpio: pca9570: rename platform_data to chip_data Bartosz Golaszewski
  2022-12-30 11:53 ` Andy Shevchenko
@ 2022-12-30 15:51 ` Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2022-12-30 15:51 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Andy Shevchenko, Shubhrajyoti Datta, linux-gpio, linux-kernel,
	Bartosz Golaszewski

On Fri, Dec 30, 2022 at 11:00 AM Bartosz Golaszewski <brgl@bgdev.pl> wrote:

> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
>
> By convention platform_data refers to structures passed to drivers by
> code that registers devices. When talking about model-specific data
> structures associated with OF compatibles, we usually call them chip_data.
>
> In order to avoid confusion rename all mentions of platform_data to
> chip_data.
>
> Fixes: fbb19fe17eae ("gpio: pca9570: add slg7xl45106 support")
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

Yes this is more to the point.
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-12-30 15:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-30 10:00 [PATCH] gpio: pca9570: rename platform_data to chip_data Bartosz Golaszewski
2022-12-30 11:53 ` Andy Shevchenko
2022-12-30 15:51 ` Linus Walleij

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).