diff mbox series

[v6,2/7] gpio-f7188x: add a prefix to macros to keep gpio namespace clean

Message ID 20220825104422.14156-3-henning.schild@siemens.com
State Accepted
Commit 470308d9d2e0fc4367870e58ccd5f2e182c71d92
Headers show
Series add support for another simatic board | expand

Commit Message

Henning Schild Aug. 25, 2022, 10:44 a.m. UTC
Subsequent patches will touch that file, apply some nice to have style
changes before actually adding functional changes.

Signed-off-by: Henning Schild <henning.schild@siemens.com>
---
 drivers/gpio/gpio-f7188x.c | 36 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)

Comments

Andy Shevchenko Aug. 25, 2022, 11:20 a.m. UTC | #1
On Thu, Aug 25, 2022 at 12:44:17PM +0200, Henning Schild wrote:
> Subsequent patches will touch that file, apply some nice to have style
> changes before actually adding functional changes.

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

> Signed-off-by: Henning Schild <henning.schild@siemens.com>
> ---
>  drivers/gpio/gpio-f7188x.c | 36 ++++++++++++++++++------------------
>  1 file changed, 18 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/gpio/gpio-f7188x.c b/drivers/gpio/gpio-f7188x.c
> index fef539bbc03a..878458249833 100644
> --- a/drivers/gpio/gpio-f7188x.c
> +++ b/drivers/gpio/gpio-f7188x.c
> @@ -165,11 +165,11 @@ static int f7188x_gpio_set_config(struct gpio_chip *chip, unsigned offset,
>  		.regbase = _regbase,					\
>  	}
>  
> -#define gpio_dir(base) (base + 0)
> -#define gpio_data_out(base) (base + 1)
> -#define gpio_data_in(base) (base + 2)
> +#define f7188x_gpio_dir(base) ((base) + 0)
> +#define f7188x_gpio_data_out(base) ((base) + 1)
> +#define f7188x_gpio_data_in(base) ((base) + 2)
>  /* Output mode register (0:open drain 1:push-pull). */
> -#define gpio_out_mode(base) (base + 3)
> +#define f7188x_gpio_out_mode(base) ((base) + 3)
>  
>  static struct f7188x_gpio_bank f71869_gpio_bank[] = {
>  	F7188X_GPIO_BANK(0, 6, 0xF0),
> @@ -267,7 +267,7 @@ static int f7188x_gpio_get_direction(struct gpio_chip *chip, unsigned offset)
>  		return err;
>  	superio_select(sio->addr, SIO_LD_GPIO);
>  
> -	dir = superio_inb(sio->addr, gpio_dir(bank->regbase));
> +	dir = superio_inb(sio->addr, f7188x_gpio_dir(bank->regbase));
>  
>  	superio_exit(sio->addr);
>  
> @@ -289,9 +289,9 @@ static int f7188x_gpio_direction_in(struct gpio_chip *chip, unsigned offset)
>  		return err;
>  	superio_select(sio->addr, SIO_LD_GPIO);
>  
> -	dir = superio_inb(sio->addr, gpio_dir(bank->regbase));
> +	dir = superio_inb(sio->addr, f7188x_gpio_dir(bank->regbase));
>  	dir &= ~BIT(offset);
> -	superio_outb(sio->addr, gpio_dir(bank->regbase), dir);
> +	superio_outb(sio->addr, f7188x_gpio_dir(bank->regbase), dir);
>  
>  	superio_exit(sio->addr);
>  
> @@ -310,12 +310,12 @@ static int f7188x_gpio_get(struct gpio_chip *chip, unsigned offset)
>  		return err;
>  	superio_select(sio->addr, SIO_LD_GPIO);
>  
> -	dir = superio_inb(sio->addr, gpio_dir(bank->regbase));
> +	dir = superio_inb(sio->addr, f7188x_gpio_dir(bank->regbase));
>  	dir = !!(dir & BIT(offset));
>  	if (dir)
> -		data = superio_inb(sio->addr, gpio_data_out(bank->regbase));
> +		data = superio_inb(sio->addr, f7188x_gpio_data_out(bank->regbase));
>  	else
> -		data = superio_inb(sio->addr, gpio_data_in(bank->regbase));
> +		data = superio_inb(sio->addr, f7188x_gpio_data_in(bank->regbase));
>  
>  	superio_exit(sio->addr);
>  
> @@ -335,16 +335,16 @@ static int f7188x_gpio_direction_out(struct gpio_chip *chip,
>  		return err;
>  	superio_select(sio->addr, SIO_LD_GPIO);
>  
> -	data_out = superio_inb(sio->addr, gpio_data_out(bank->regbase));
> +	data_out = superio_inb(sio->addr, f7188x_gpio_data_out(bank->regbase));
>  	if (value)
>  		data_out |= BIT(offset);
>  	else
>  		data_out &= ~BIT(offset);
> -	superio_outb(sio->addr, gpio_data_out(bank->regbase), data_out);
> +	superio_outb(sio->addr, f7188x_gpio_data_out(bank->regbase), data_out);
>  
> -	dir = superio_inb(sio->addr, gpio_dir(bank->regbase));
> +	dir = superio_inb(sio->addr, f7188x_gpio_dir(bank->regbase));
>  	dir |= BIT(offset);
> -	superio_outb(sio->addr, gpio_dir(bank->regbase), dir);
> +	superio_outb(sio->addr, f7188x_gpio_dir(bank->regbase), dir);
>  
>  	superio_exit(sio->addr);
>  
> @@ -363,12 +363,12 @@ static void f7188x_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
>  		return;
>  	superio_select(sio->addr, SIO_LD_GPIO);
>  
> -	data_out = superio_inb(sio->addr, gpio_data_out(bank->regbase));
> +	data_out = superio_inb(sio->addr, f7188x_gpio_data_out(bank->regbase));
>  	if (value)
>  		data_out |= BIT(offset);
>  	else
>  		data_out &= ~BIT(offset);
> -	superio_outb(sio->addr, gpio_data_out(bank->regbase), data_out);
> +	superio_outb(sio->addr, f7188x_gpio_data_out(bank->regbase), data_out);
>  
>  	superio_exit(sio->addr);
>  }
> @@ -391,12 +391,12 @@ static int f7188x_gpio_set_config(struct gpio_chip *chip, unsigned offset,
>  		return err;
>  	superio_select(sio->addr, SIO_LD_GPIO);
>  
> -	data = superio_inb(sio->addr, gpio_out_mode(bank->regbase));
> +	data = superio_inb(sio->addr, f7188x_gpio_out_mode(bank->regbase));
>  	if (param == PIN_CONFIG_DRIVE_OPEN_DRAIN)
>  		data &= ~BIT(offset);
>  	else
>  		data |= BIT(offset);
> -	superio_outb(sio->addr, gpio_out_mode(bank->regbase), data);
> +	superio_outb(sio->addr, f7188x_gpio_out_mode(bank->regbase), data);
>  
>  	superio_exit(sio->addr);
>  	return 0;
> -- 
> 2.35.1
>
diff mbox series

Patch

diff --git a/drivers/gpio/gpio-f7188x.c b/drivers/gpio/gpio-f7188x.c
index fef539bbc03a..878458249833 100644
--- a/drivers/gpio/gpio-f7188x.c
+++ b/drivers/gpio/gpio-f7188x.c
@@ -165,11 +165,11 @@  static int f7188x_gpio_set_config(struct gpio_chip *chip, unsigned offset,
 		.regbase = _regbase,					\
 	}
 
-#define gpio_dir(base) (base + 0)
-#define gpio_data_out(base) (base + 1)
-#define gpio_data_in(base) (base + 2)
+#define f7188x_gpio_dir(base) ((base) + 0)
+#define f7188x_gpio_data_out(base) ((base) + 1)
+#define f7188x_gpio_data_in(base) ((base) + 2)
 /* Output mode register (0:open drain 1:push-pull). */
-#define gpio_out_mode(base) (base + 3)
+#define f7188x_gpio_out_mode(base) ((base) + 3)
 
 static struct f7188x_gpio_bank f71869_gpio_bank[] = {
 	F7188X_GPIO_BANK(0, 6, 0xF0),
@@ -267,7 +267,7 @@  static int f7188x_gpio_get_direction(struct gpio_chip *chip, unsigned offset)
 		return err;
 	superio_select(sio->addr, SIO_LD_GPIO);
 
-	dir = superio_inb(sio->addr, gpio_dir(bank->regbase));
+	dir = superio_inb(sio->addr, f7188x_gpio_dir(bank->regbase));
 
 	superio_exit(sio->addr);
 
@@ -289,9 +289,9 @@  static int f7188x_gpio_direction_in(struct gpio_chip *chip, unsigned offset)
 		return err;
 	superio_select(sio->addr, SIO_LD_GPIO);
 
-	dir = superio_inb(sio->addr, gpio_dir(bank->regbase));
+	dir = superio_inb(sio->addr, f7188x_gpio_dir(bank->regbase));
 	dir &= ~BIT(offset);
-	superio_outb(sio->addr, gpio_dir(bank->regbase), dir);
+	superio_outb(sio->addr, f7188x_gpio_dir(bank->regbase), dir);
 
 	superio_exit(sio->addr);
 
@@ -310,12 +310,12 @@  static int f7188x_gpio_get(struct gpio_chip *chip, unsigned offset)
 		return err;
 	superio_select(sio->addr, SIO_LD_GPIO);
 
-	dir = superio_inb(sio->addr, gpio_dir(bank->regbase));
+	dir = superio_inb(sio->addr, f7188x_gpio_dir(bank->regbase));
 	dir = !!(dir & BIT(offset));
 	if (dir)
-		data = superio_inb(sio->addr, gpio_data_out(bank->regbase));
+		data = superio_inb(sio->addr, f7188x_gpio_data_out(bank->regbase));
 	else
-		data = superio_inb(sio->addr, gpio_data_in(bank->regbase));
+		data = superio_inb(sio->addr, f7188x_gpio_data_in(bank->regbase));
 
 	superio_exit(sio->addr);
 
@@ -335,16 +335,16 @@  static int f7188x_gpio_direction_out(struct gpio_chip *chip,
 		return err;
 	superio_select(sio->addr, SIO_LD_GPIO);
 
-	data_out = superio_inb(sio->addr, gpio_data_out(bank->regbase));
+	data_out = superio_inb(sio->addr, f7188x_gpio_data_out(bank->regbase));
 	if (value)
 		data_out |= BIT(offset);
 	else
 		data_out &= ~BIT(offset);
-	superio_outb(sio->addr, gpio_data_out(bank->regbase), data_out);
+	superio_outb(sio->addr, f7188x_gpio_data_out(bank->regbase), data_out);
 
-	dir = superio_inb(sio->addr, gpio_dir(bank->regbase));
+	dir = superio_inb(sio->addr, f7188x_gpio_dir(bank->regbase));
 	dir |= BIT(offset);
-	superio_outb(sio->addr, gpio_dir(bank->regbase), dir);
+	superio_outb(sio->addr, f7188x_gpio_dir(bank->regbase), dir);
 
 	superio_exit(sio->addr);
 
@@ -363,12 +363,12 @@  static void f7188x_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
 		return;
 	superio_select(sio->addr, SIO_LD_GPIO);
 
-	data_out = superio_inb(sio->addr, gpio_data_out(bank->regbase));
+	data_out = superio_inb(sio->addr, f7188x_gpio_data_out(bank->regbase));
 	if (value)
 		data_out |= BIT(offset);
 	else
 		data_out &= ~BIT(offset);
-	superio_outb(sio->addr, gpio_data_out(bank->regbase), data_out);
+	superio_outb(sio->addr, f7188x_gpio_data_out(bank->regbase), data_out);
 
 	superio_exit(sio->addr);
 }
@@ -391,12 +391,12 @@  static int f7188x_gpio_set_config(struct gpio_chip *chip, unsigned offset,
 		return err;
 	superio_select(sio->addr, SIO_LD_GPIO);
 
-	data = superio_inb(sio->addr, gpio_out_mode(bank->regbase));
+	data = superio_inb(sio->addr, f7188x_gpio_out_mode(bank->regbase));
 	if (param == PIN_CONFIG_DRIVE_OPEN_DRAIN)
 		data &= ~BIT(offset);
 	else
 		data |= BIT(offset);
-	superio_outb(sio->addr, gpio_out_mode(bank->regbase), data);
+	superio_outb(sio->addr, f7188x_gpio_out_mode(bank->regbase), data);
 
 	superio_exit(sio->addr);
 	return 0;