* [PATCH] gpio: gpio-104-dio-48e: Fixed coding style issues
@ 2021-04-08 2:49 Barney Goette
2021-04-08 11:24 ` William Breathitt Gray
0 siblings, 1 reply; 2+ messages in thread
From: Barney Goette @ 2021-04-08 2:49 UTC (permalink / raw)
To: vilhelm.gray, linus.walleij, bgolaszewski, linux-gpio, linux-kernel
Cc: Barney Goette
Fixed multiple bare uses of 'unsigned' without 'int'.
Fixed space around '*' operator.
Fixed function parameter alignment to opening parenthesis.
Reported by checkpatch.
Signed-off-by: Barney Goette <barneygoette@gmail.com>
---
drivers/gpio/gpio-104-dio-48e.c | 53 +++++++++++++++++----------------
1 file changed, 27 insertions(+), 26 deletions(-)
diff --git a/drivers/gpio/gpio-104-dio-48e.c b/drivers/gpio/gpio-104-dio-48e.c
index 7a9021c4fa48..38badc421c32 100644
--- a/drivers/gpio/gpio-104-dio-48e.c
+++ b/drivers/gpio/gpio-104-dio-48e.c
@@ -49,15 +49,15 @@ struct dio48e_gpio {
unsigned char out_state[6];
unsigned char control[2];
raw_spinlock_t lock;
- unsigned base;
+ unsigned int base;
unsigned char irq_mask;
};
-static int dio48e_gpio_get_direction(struct gpio_chip *chip, unsigned offset)
+static int dio48e_gpio_get_direction(struct gpio_chip *chip, unsigned int offset)
{
struct dio48e_gpio *const dio48egpio = gpiochip_get_data(chip);
- const unsigned port = offset / 8;
- const unsigned mask = BIT(offset % 8);
+ const unsigned int port = offset / 8;
+ const unsigned int mask = BIT(offset % 8);
if (dio48egpio->io_state[port] & mask)
return GPIO_LINE_DIRECTION_IN;
@@ -65,14 +65,15 @@ static int dio48e_gpio_get_direction(struct gpio_chip *chip, unsigned offset)
return GPIO_LINE_DIRECTION_OUT;
}
-static int dio48e_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
+static int dio48e_gpio_direction_input(struct gpio_chip *chip, unsigned int offset)
{
struct dio48e_gpio *const dio48egpio = gpiochip_get_data(chip);
- const unsigned io_port = offset / 8;
+ const unsigned int io_port = offset / 8;
const unsigned int control_port = io_port / 3;
- const unsigned control_addr = dio48egpio->base + 3 + control_port*4;
- unsigned long flags;
- unsigned control;
+ const unsigned int control_addr = dio48egpio->base + 3 + control_port * 4;
+
+ unsigned int long flags;
+ unsigned int control;
raw_spin_lock_irqsave(&dio48egpio->lock, flags);
@@ -104,17 +105,17 @@ static int dio48e_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
return 0;
}
-static int dio48e_gpio_direction_output(struct gpio_chip *chip, unsigned offset,
- int value)
+static int dio48e_gpio_direction_output(struct gpio_chip *chip, unsigned int offset,
+ int value)
{
struct dio48e_gpio *const dio48egpio = gpiochip_get_data(chip);
- const unsigned io_port = offset / 8;
+ const unsigned int io_port = offset / 8;
const unsigned int control_port = io_port / 3;
- const unsigned mask = BIT(offset % 8);
- const unsigned control_addr = dio48egpio->base + 3 + control_port*4;
- const unsigned out_port = (io_port > 2) ? io_port + 1 : io_port;
+ const unsigned int mask = BIT(offset % 8);
+ const unsigned int control_addr = dio48egpio->base + 3 + control_port * 4;
+ const unsigned int out_port = (io_port > 2) ? io_port + 1 : io_port;
unsigned long flags;
- unsigned control;
+ unsigned int control;
raw_spin_lock_irqsave(&dio48egpio->lock, flags);
@@ -154,14 +155,14 @@ static int dio48e_gpio_direction_output(struct gpio_chip *chip, unsigned offset,
return 0;
}
-static int dio48e_gpio_get(struct gpio_chip *chip, unsigned offset)
+static int dio48e_gpio_get(struct gpio_chip *chip, unsigned int offset)
{
struct dio48e_gpio *const dio48egpio = gpiochip_get_data(chip);
- const unsigned port = offset / 8;
- const unsigned mask = BIT(offset % 8);
- const unsigned in_port = (port > 2) ? port + 1 : port;
+ const unsigned int port = offset / 8;
+ const unsigned int mask = BIT(offset % 8);
+ const unsigned int in_port = (port > 2) ? port + 1 : port;
unsigned long flags;
- unsigned port_state;
+ unsigned int port_state;
raw_spin_lock_irqsave(&dio48egpio->lock, flags);
@@ -202,12 +203,12 @@ static int dio48e_gpio_get_multiple(struct gpio_chip *chip, unsigned long *mask,
return 0;
}
-static void dio48e_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
+static void dio48e_gpio_set(struct gpio_chip *chip, unsigned int offset, int value)
{
struct dio48e_gpio *const dio48egpio = gpiochip_get_data(chip);
- const unsigned port = offset / 8;
- const unsigned mask = BIT(offset % 8);
- const unsigned out_port = (port > 2) ? port + 1 : port;
+ const unsigned int port = offset / 8;
+ const unsigned int mask = BIT(offset % 8);
+ const unsigned int out_port = (port > 2) ? port + 1 : port;
unsigned long flags;
raw_spin_lock_irqsave(&dio48egpio->lock, flags);
@@ -306,7 +307,7 @@ static void dio48e_irq_unmask(struct irq_data *data)
raw_spin_unlock_irqrestore(&dio48egpio->lock, flags);
}
-static int dio48e_irq_set_type(struct irq_data *data, unsigned flow_type)
+static int dio48e_irq_set_type(struct irq_data *data, unsigned int flow_type)
{
const unsigned long offset = irqd_to_hwirq(data);
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] gpio: gpio-104-dio-48e: Fixed coding style issues
2021-04-08 2:49 [PATCH] gpio: gpio-104-dio-48e: Fixed coding style issues Barney Goette
@ 2021-04-08 11:24 ` William Breathitt Gray
0 siblings, 0 replies; 2+ messages in thread
From: William Breathitt Gray @ 2021-04-08 11:24 UTC (permalink / raw)
To: Barney Goette; +Cc: linus.walleij, bgolaszewski, linux-gpio, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 5688 bytes --]
On Wed, Apr 07, 2021 at 09:49:00PM -0500, Barney Goette wrote:
> Fixed multiple bare uses of 'unsigned' without 'int'.
> Fixed space around '*' operator.
> Fixed function parameter alignment to opening parenthesis.
> Reported by checkpatch.
>
> Signed-off-by: Barney Goette <barneygoette@gmail.com>
Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com>
I am all right with this cleanup in order to pacify the checkpatch
warnings, so you may add my Acked-by line to this commit; however, I do
have a couple comments inline below.
> ---
> drivers/gpio/gpio-104-dio-48e.c | 53 +++++++++++++++++----------------
> 1 file changed, 27 insertions(+), 26 deletions(-)
>
> diff --git a/drivers/gpio/gpio-104-dio-48e.c b/drivers/gpio/gpio-104-dio-48e.c
> index 7a9021c4fa48..38badc421c32 100644
> --- a/drivers/gpio/gpio-104-dio-48e.c
> +++ b/drivers/gpio/gpio-104-dio-48e.c
> @@ -49,15 +49,15 @@ struct dio48e_gpio {
> unsigned char out_state[6];
> unsigned char control[2];
> raw_spinlock_t lock;
> - unsigned base;
> + unsigned int base;
> unsigned char irq_mask;
> };
>
> -static int dio48e_gpio_get_direction(struct gpio_chip *chip, unsigned offset)
> +static int dio48e_gpio_get_direction(struct gpio_chip *chip, unsigned int offset)
> {
> struct dio48e_gpio *const dio48egpio = gpiochip_get_data(chip);
> - const unsigned port = offset / 8;
> - const unsigned mask = BIT(offset % 8);
> + const unsigned int port = offset / 8;
> + const unsigned int mask = BIT(offset % 8);
>
> if (dio48egpio->io_state[port] & mask)
> return GPIO_LINE_DIRECTION_IN;
> @@ -65,14 +65,15 @@ static int dio48e_gpio_get_direction(struct gpio_chip *chip, unsigned offset)
> return GPIO_LINE_DIRECTION_OUT;
> }
>
> -static int dio48e_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
> +static int dio48e_gpio_direction_input(struct gpio_chip *chip, unsigned int offset)
> {
> struct dio48e_gpio *const dio48egpio = gpiochip_get_data(chip);
> - const unsigned io_port = offset / 8;
> + const unsigned int io_port = offset / 8;
> const unsigned int control_port = io_port / 3;
> - const unsigned control_addr = dio48egpio->base + 3 + control_port*4;
> - unsigned long flags;
> - unsigned control;
> + const unsigned int control_addr = dio48egpio->base + 3 + control_port * 4;
> +
This empty line is not necessary and can be removed.
> + unsigned int long flags;
This is "unsigned long" so I don't think there is a need to change it.
William Breathitt Gray
> + unsigned int control;
>
> raw_spin_lock_irqsave(&dio48egpio->lock, flags);
>
> @@ -104,17 +105,17 @@ static int dio48e_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
> return 0;
> }
>
> -static int dio48e_gpio_direction_output(struct gpio_chip *chip, unsigned offset,
> - int value)
> +static int dio48e_gpio_direction_output(struct gpio_chip *chip, unsigned int offset,
> + int value)
> {
> struct dio48e_gpio *const dio48egpio = gpiochip_get_data(chip);
> - const unsigned io_port = offset / 8;
> + const unsigned int io_port = offset / 8;
> const unsigned int control_port = io_port / 3;
> - const unsigned mask = BIT(offset % 8);
> - const unsigned control_addr = dio48egpio->base + 3 + control_port*4;
> - const unsigned out_port = (io_port > 2) ? io_port + 1 : io_port;
> + const unsigned int mask = BIT(offset % 8);
> + const unsigned int control_addr = dio48egpio->base + 3 + control_port * 4;
> + const unsigned int out_port = (io_port > 2) ? io_port + 1 : io_port;
> unsigned long flags;
> - unsigned control;
> + unsigned int control;
>
> raw_spin_lock_irqsave(&dio48egpio->lock, flags);
>
> @@ -154,14 +155,14 @@ static int dio48e_gpio_direction_output(struct gpio_chip *chip, unsigned offset,
> return 0;
> }
>
> -static int dio48e_gpio_get(struct gpio_chip *chip, unsigned offset)
> +static int dio48e_gpio_get(struct gpio_chip *chip, unsigned int offset)
> {
> struct dio48e_gpio *const dio48egpio = gpiochip_get_data(chip);
> - const unsigned port = offset / 8;
> - const unsigned mask = BIT(offset % 8);
> - const unsigned in_port = (port > 2) ? port + 1 : port;
> + const unsigned int port = offset / 8;
> + const unsigned int mask = BIT(offset % 8);
> + const unsigned int in_port = (port > 2) ? port + 1 : port;
> unsigned long flags;
> - unsigned port_state;
> + unsigned int port_state;
>
> raw_spin_lock_irqsave(&dio48egpio->lock, flags);
>
> @@ -202,12 +203,12 @@ static int dio48e_gpio_get_multiple(struct gpio_chip *chip, unsigned long *mask,
> return 0;
> }
>
> -static void dio48e_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
> +static void dio48e_gpio_set(struct gpio_chip *chip, unsigned int offset, int value)
> {
> struct dio48e_gpio *const dio48egpio = gpiochip_get_data(chip);
> - const unsigned port = offset / 8;
> - const unsigned mask = BIT(offset % 8);
> - const unsigned out_port = (port > 2) ? port + 1 : port;
> + const unsigned int port = offset / 8;
> + const unsigned int mask = BIT(offset % 8);
> + const unsigned int out_port = (port > 2) ? port + 1 : port;
> unsigned long flags;
>
> raw_spin_lock_irqsave(&dio48egpio->lock, flags);
> @@ -306,7 +307,7 @@ static void dio48e_irq_unmask(struct irq_data *data)
> raw_spin_unlock_irqrestore(&dio48egpio->lock, flags);
> }
>
> -static int dio48e_irq_set_type(struct irq_data *data, unsigned flow_type)
> +static int dio48e_irq_set_type(struct irq_data *data, unsigned int flow_type)
> {
> const unsigned long offset = irqd_to_hwirq(data);
>
> --
> 2.25.1
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-04-08 11:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-08 2:49 [PATCH] gpio: gpio-104-dio-48e: Fixed coding style issues Barney Goette
2021-04-08 11:24 ` William Breathitt Gray
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).