Hi everyone
I did pick up a patch series by Andrew Lunn adding PWM upport to mvebu's
gpio controller. Checkpach complained quite a bit and there are extra
inconsitencies which make it worth to clean drivers/gpio/gpio-mvebu.c a bit
before adding the desired pwm fan support for armada 370 / xp.
This series is split out to save the pwm folks from having to review this
part as well.
Thanks
Ralph
Ralph Sennhauser (6):
gpio: mvebu: checkpatch: block comment fixes
gpio: mvebu: start multiline block comments with blank line
gpio: mvebu: checkpatch: unsigned int fixes
gpio: mvebu: checkpatch: whitespace fixes
gpio: mvebu: extra whitespace fixes
gpio: mvebu: let the compiler inline
drivers/gpio/gpio-mvebu.c | 75 ++++++++++++++++++++++++++---------------------
1 file changed, 41 insertions(+), 34 deletions(-)
--
2.10.2
Fix issues in block comments reported by checkpatch.
Signed-off-by: Ralph Sennhauser <[email protected]>
---
drivers/gpio/gpio-mvebu.c | 24 ++++++++++++++++--------
1 file changed, 16 insertions(+), 8 deletions(-)
diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c
index a649556..a2351f3 100644
--- a/drivers/gpio/gpio-mvebu.c
+++ b/drivers/gpio/gpio-mvebu.c
@@ -62,9 +62,11 @@
#define GPIO_EDGE_MASK_MV78200_OFF(cpu) ((cpu) ? 0x30 : 0x18)
#define GPIO_LEVEL_MASK_MV78200_OFF(cpu) ((cpu) ? 0x34 : 0x1C)
-/* The Armada XP has per-CPU registers for interrupt cause, interrupt
+/*
+ * The Armada XP has per-CPU registers for interrupt cause, interrupt
* mask and interrupt level mask. Those are relative to the
- * percpu_membase. */
+ * percpu_membase.
+ */
#define GPIO_EDGE_CAUSE_ARMADAXP_OFF(cpu) ((cpu) * 0x4)
#define GPIO_EDGE_MASK_ARMADAXP_OFF(cpu) (0x10 + (cpu) * 0x4)
#define GPIO_LEVEL_MASK_ARMADAXP_OFF(cpu) (0x20 + (cpu) * 0x4)
@@ -239,8 +241,10 @@ static int mvebu_gpio_direction_input(struct gpio_chip *chip, unsigned pin)
int ret;
u32 u;
- /* Check with the pinctrl driver whether this pin is usable as
- * an input GPIO */
+ /*
+ * Check with the pinctrl driver whether this pin is usable as
+ * an input GPIO
+ */
ret = pinctrl_gpio_direction_input(chip->base + pin);
if (ret)
return ret;
@@ -262,8 +266,10 @@ static int mvebu_gpio_direction_output(struct gpio_chip *chip, unsigned pin,
int ret;
u32 u;
- /* Check with the pinctrl driver whether this pin is usable as
- * an output GPIO */
+ /*
+ * Check with the pinctrl driver whether this pin is usable as
+ * an output GPIO
+ */
ret = pinctrl_gpio_direction_output(chip->base + pin);
if (ret)
return ret;
@@ -712,8 +718,10 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
if (IS_ERR(mvchip->membase))
return PTR_ERR(mvchip->membase);
- /* The Armada XP has a second range of registers for the
- * per-CPU registers */
+ /*
+ * The Armada XP has a second range of registers for the
+ * per-CPU registers
+ */
if (soc_variant == MVEBU_GPIO_SOC_VARIANT_ARMADAXP) {
res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
mvchip->percpu_membase = devm_ioremap_resource(&pdev->dev,
--
2.10.2
Fix whitespace errors reported by checkpatch.
Signed-off-by: Ralph Sennhauser <[email protected]>
---
drivers/gpio/gpio-mvebu.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c
index a9522f4..1933e63 100644
--- a/drivers/gpio/gpio-mvebu.c
+++ b/drivers/gpio/gpio-mvebu.c
@@ -290,6 +290,7 @@ static int mvebu_gpio_direction_output(struct gpio_chip *chip, unsigned int pin,
static int mvebu_gpio_to_irq(struct gpio_chip *chip, unsigned int pin)
{
struct mvebu_gpio_chip *mvchip = gpiochip_get_data(chip);
+
return irq_create_mapping(mvchip->domain, pin);
}
--
2.10.2
A modern compiler should know better when to inline, so drop the inline
keywords.
Signed-off-by: Ralph Sennhauser <[email protected]>
---
drivers/gpio/gpio-mvebu.c | 18 +++++++-----------
1 file changed, 7 insertions(+), 11 deletions(-)
diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c
index d9aa77b..029f43c 100644
--- a/drivers/gpio/gpio-mvebu.c
+++ b/drivers/gpio/gpio-mvebu.c
@@ -99,35 +99,32 @@ struct mvebu_gpio_chip {
* Functions returning addresses of individual registers for a given
* GPIO controller.
*/
-static inline void __iomem *mvebu_gpioreg_out(struct mvebu_gpio_chip *mvchip)
+static void __iomem *mvebu_gpioreg_out(struct mvebu_gpio_chip *mvchip)
{
return mvchip->membase + GPIO_OUT_OFF;
}
-static inline void __iomem *mvebu_gpioreg_blink(struct mvebu_gpio_chip *mvchip)
+static void __iomem *mvebu_gpioreg_blink(struct mvebu_gpio_chip *mvchip)
{
return mvchip->membase + GPIO_BLINK_EN_OFF;
}
-static inline void __iomem *
-mvebu_gpioreg_io_conf(struct mvebu_gpio_chip *mvchip)
+static void __iomem *mvebu_gpioreg_io_conf(struct mvebu_gpio_chip *mvchip)
{
return mvchip->membase + GPIO_IO_CONF_OFF;
}
-static inline void __iomem *mvebu_gpioreg_in_pol(struct mvebu_gpio_chip *mvchip)
+static void __iomem *mvebu_gpioreg_in_pol(struct mvebu_gpio_chip *mvchip)
{
return mvchip->membase + GPIO_IN_POL_OFF;
}
-static inline void __iomem *
-mvebu_gpioreg_data_in(struct mvebu_gpio_chip *mvchip)
+static void __iomem *mvebu_gpioreg_data_in(struct mvebu_gpio_chip *mvchip)
{
return mvchip->membase + GPIO_DATA_IN_OFF;
}
-static inline void __iomem *
-mvebu_gpioreg_edge_cause(struct mvebu_gpio_chip *mvchip)
+static void __iomem *mvebu_gpioreg_edge_cause(struct mvebu_gpio_chip *mvchip)
{
int cpu;
@@ -144,8 +141,7 @@ mvebu_gpioreg_edge_cause(struct mvebu_gpio_chip *mvchip)
}
}
-static inline void __iomem *
-mvebu_gpioreg_edge_mask(struct mvebu_gpio_chip *mvchip)
+static void __iomem *mvebu_gpioreg_edge_mask(struct mvebu_gpio_chip *mvchip)
{
int cpu;
--
2.10.2
Use unsigned int instead of plain unsigned as reported by checkpatch.
Signed-off-by: Ralph Sennhauser <[email protected]>
---
drivers/gpio/gpio-mvebu.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c
index 80b1d52..a9522f4 100644
--- a/drivers/gpio/gpio-mvebu.c
+++ b/drivers/gpio/gpio-mvebu.c
@@ -187,7 +187,7 @@ static void __iomem *mvebu_gpioreg_level_mask(struct mvebu_gpio_chip *mvchip)
* Functions implementing the gpio_chip methods
*/
-static void mvebu_gpio_set(struct gpio_chip *chip, unsigned pin, int value)
+static void mvebu_gpio_set(struct gpio_chip *chip, unsigned int pin, int value)
{
struct mvebu_gpio_chip *mvchip = gpiochip_get_data(chip);
unsigned long flags;
@@ -203,7 +203,7 @@ static void mvebu_gpio_set(struct gpio_chip *chip, unsigned pin, int value)
spin_unlock_irqrestore(&mvchip->lock, flags);
}
-static int mvebu_gpio_get(struct gpio_chip *chip, unsigned pin)
+static int mvebu_gpio_get(struct gpio_chip *chip, unsigned int pin)
{
struct mvebu_gpio_chip *mvchip = gpiochip_get_data(chip);
u32 u;
@@ -218,7 +218,8 @@ static int mvebu_gpio_get(struct gpio_chip *chip, unsigned pin)
return (u >> pin) & 1;
}
-static void mvebu_gpio_blink(struct gpio_chip *chip, unsigned pin, int value)
+static void mvebu_gpio_blink(struct gpio_chip *chip, unsigned int pin,
+ int value)
{
struct mvebu_gpio_chip *mvchip = gpiochip_get_data(chip);
unsigned long flags;
@@ -234,7 +235,7 @@ static void mvebu_gpio_blink(struct gpio_chip *chip, unsigned pin, int value)
spin_unlock_irqrestore(&mvchip->lock, flags);
}
-static int mvebu_gpio_direction_input(struct gpio_chip *chip, unsigned pin)
+static int mvebu_gpio_direction_input(struct gpio_chip *chip, unsigned int pin)
{
struct mvebu_gpio_chip *mvchip = gpiochip_get_data(chip);
unsigned long flags;
@@ -258,7 +259,7 @@ static int mvebu_gpio_direction_input(struct gpio_chip *chip, unsigned pin)
return 0;
}
-static int mvebu_gpio_direction_output(struct gpio_chip *chip, unsigned pin,
+static int mvebu_gpio_direction_output(struct gpio_chip *chip, unsigned int pin,
int value)
{
struct mvebu_gpio_chip *mvchip = gpiochip_get_data(chip);
@@ -286,7 +287,7 @@ static int mvebu_gpio_direction_output(struct gpio_chip *chip, unsigned pin,
return 0;
}
-static int mvebu_gpio_to_irq(struct gpio_chip *chip, unsigned pin)
+static int mvebu_gpio_to_irq(struct gpio_chip *chip, unsigned int pin)
{
struct mvebu_gpio_chip *mvchip = gpiochip_get_data(chip);
return irq_create_mapping(mvchip->domain, pin);
--
2.10.2
Fix whitespace errors missed by checkpatch.
Signed-off-by: Ralph Sennhauser <[email protected]>
---
drivers/gpio/gpio-mvebu.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c
index 1933e63..d9aa77b 100644
--- a/drivers/gpio/gpio-mvebu.c
+++ b/drivers/gpio/gpio-mvebu.c
@@ -87,12 +87,12 @@ struct mvebu_gpio_chip {
int soc_variant;
/* Used to preserve GPIO registers across suspend/resume */
- u32 out_reg;
- u32 io_conf_reg;
- u32 blink_en_reg;
- u32 in_pol_reg;
- u32 edge_mask_regs[4];
- u32 level_mask_regs[4];
+ u32 out_reg;
+ u32 io_conf_reg;
+ u32 blink_en_reg;
+ u32 in_pol_reg;
+ u32 edge_mask_regs[4];
+ u32 level_mask_regs[4];
};
/*
@@ -186,7 +186,6 @@ static void __iomem *mvebu_gpioreg_level_mask(struct mvebu_gpio_chip *mvchip)
/*
* Functions implementing the gpio_chip methods
*/
-
static void mvebu_gpio_set(struct gpio_chip *chip, unsigned int pin, int value)
{
struct mvebu_gpio_chip *mvchip = gpiochip_get_data(chip);
--
2.10.2
While this isn't an issue according to checkpatch two styles are used.
Add a blank line to the block comments missing a blank line at the start
so multiline block comments look the same across the file.
Signed-off-by: Ralph Sennhauser <[email protected]>
---
drivers/gpio/gpio-mvebu.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c
index a2351f3..80b1d52 100644
--- a/drivers/gpio/gpio-mvebu.c
+++ b/drivers/gpio/gpio-mvebu.c
@@ -788,7 +788,8 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
goto err_domain;
}
- /* NOTE: The common accessors cannot be used because of the percpu
+ /*
+ * NOTE: The common accessors cannot be used because of the percpu
* access to the mask registers
*/
gc = irq_get_domain_generic_chip(mvchip->domain, 0);
@@ -809,7 +810,8 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
ct->handler = handle_edge_irq;
ct->chip.name = mvchip->chip.label;
- /* Setup the interrupt handlers. Each chip can have up to 4
+ /*
+ * Setup the interrupt handlers. Each chip can have up to 4
* interrupt handlers, with each handler dealing with 8 GPIO
* pins.
*/
--
2.10.2
On Thu, Mar 16, 2017 at 7:33 AM, Ralph Sennhauser
<[email protected]> wrote:
> Fix issues in block comments reported by checkpatch.
>
> Signed-off-by: Ralph Sennhauser <[email protected]>
Patch applied.
Yours,
Linus Walleij
On Thu, Mar 16, 2017 at 7:33 AM, Ralph Sennhauser
<[email protected]> wrote:
> Fix whitespace errors reported by checkpatch.
>
> Signed-off-by: Ralph Sennhauser <[email protected]>
Patch applied.
Yours,
Linus Walleij
On Thu, Mar 16, 2017 at 7:33 AM, Ralph Sennhauser
<[email protected]> wrote:
> While this isn't an issue according to checkpatch two styles are used.
> Add a blank line to the block comments missing a blank line at the start
> so multiline block comments look the same across the file.
>
> Signed-off-by: Ralph Sennhauser <[email protected]>
Patch applied.
Yours,
Linus Walleij
On Thu, Mar 16, 2017 at 7:34 AM, Ralph Sennhauser
<[email protected]> wrote:
> A modern compiler should know better when to inline, so drop the inline
> keywords.
>
> Signed-off-by: Ralph Sennhauser <[email protected]>
A bit hesitant about this but whatever, patch applied.
Yours,
Linus Walleij
On Thu, Mar 16, 2017 at 7:33 AM, Ralph Sennhauser
<[email protected]> wrote:
> Use unsigned int instead of plain unsigned as reported by checkpatch.
>
> Signed-off-by: Ralph Sennhauser <[email protected]>
Patch applied.
Yours,
Linus Walleij
On Thu, Mar 16, 2017 at 7:34 AM, Ralph Sennhauser
<[email protected]> wrote:
> Fix whitespace errors missed by checkpatch.
>
> Signed-off-by: Ralph Sennhauser <[email protected]>
Patch applied.
Yours,
Linus Walleij
On Thu, 16 Mar 2017 16:44:58 +0100
Linus Walleij <[email protected]> wrote:
> On Thu, Mar 16, 2017 at 7:34 AM, Ralph Sennhauser
> <[email protected]> wrote:
>
> > A modern compiler should know better when to inline, so drop the
> > inline keywords.
> >
> > Signed-off-by: Ralph Sennhauser <[email protected]>
>
> A bit hesitant about this but whatever, patch applied.
>
> Yours,
> Linus Walleij
Hi Linus,
I thought this might be accepted or not so I just gave it a try. :)
Looks like linux-next is on hiatus though ...
Thanks
Ralph