gpio: mvebu: prepatatory cleanup for pwm-fan support
cover gpio: mvebu: prepatatory cleanup for pwm-fan support
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(-)
Signature · 1 line
2.10.2
PATCH 1/6 gpio: mvebu: checkpatch: block comment fixes
Fix issues in block comments reported by checkpatch.
--- drivers/gpio/gpio-mvebu.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-)
drivers/gpio/gpio-mvebu.c +16 -8
@@ -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,
Signature · 1 line
2.10.2
Re: [PATCH 1/6] gpio: mvebu: checkpatch: block comment fixes
Quoted 3 lines · Ralph Sennhauser
Fix issues in block comments reported by checkpatch.
Signed-off-by Ralph Sennhauser <[email protected]>
Patch applied.
Yours,
Linus Walleij
PATCH 2/6 gpio: mvebu: start multiline block comments with blank line
In reply to Ralph SennhauserWhile 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.
--- drivers/gpio/gpio-mvebu.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpio/gpio-mvebu.c +4 -2
@@ -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. */
Signature · 1 line
2.10.2
Re: [PATCH 2/6] gpio: mvebu: start multiline block comments with blank line
Quoted 5 lines · Ralph Sennhauser
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
PATCH 3/6 gpio: mvebu: checkpatch: unsigned int fixes
In reply to Ralph SennhauserUse unsigned int instead of plain unsigned as reported by checkpatch.
--- drivers/gpio/gpio-mvebu.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/gpio/gpio-mvebu.c +7 -6
@@ -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);
Signature · 1 line
2.10.2
Re: [PATCH 3/6] gpio: mvebu: checkpatch: unsigned int fixes
Quoted 3 lines · Ralph Sennhauser
Use unsigned int instead of plain unsigned as reported by checkpatch.
Signed-off-by Ralph Sennhauser <[email protected]>
Patch applied.
Yours,
Linus Walleij
PATCH 4/6 gpio: mvebu: checkpatch: whitespace fixes
In reply to Ralph SennhauserFix whitespace errors reported by checkpatch.
--- drivers/gpio/gpio-mvebu.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpio/gpio-mvebu.c +1 -0
@@ -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); }
Signature · 1 line
2.10.2
Re: [PATCH 4/6] gpio: mvebu: checkpatch: whitespace fixes
Quoted 3 lines · Ralph Sennhauser
Fix whitespace errors reported by checkpatch.
Signed-off-by Ralph Sennhauser <[email protected]>
Patch applied.
Yours,
Linus Walleij
PATCH 5/6 gpio: mvebu: extra whitespace fixes
In reply to Ralph SennhauserFix whitespace errors missed by checkpatch.
--- drivers/gpio/gpio-mvebu.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/gpio/gpio-mvebu.c +6 -7
@@ -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);
Signature · 1 line
2.10.2
Re: [PATCH 5/6] gpio: mvebu: extra whitespace fixes
Quoted 3 lines · Ralph Sennhauser
Fix whitespace errors missed by checkpatch.
Signed-off-by Ralph Sennhauser <[email protected]>
Patch applied.
Yours,
Linus Walleij
PATCH 6/6 gpio: mvebu: let the compiler inline
In reply to Ralph SennhauserA modern compiler should know better when to inline, so drop the inline keywords.
--- drivers/gpio/gpio-mvebu.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-)
drivers/gpio/gpio-mvebu.c +7 -11
@@ -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;
Signature · 1 line
2.10.2
Re: [PATCH 6/6] gpio: mvebu: let the compiler inline
Quoted 4 lines · Ralph Sennhauser
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
Re: [PATCH 6/6] gpio: mvebu: let the compiler inline
Quoted 6 lines · On Thu, 16 Mar 2017 16:44:58 +0100 Linus Walleij <[email protected]>…
Quoted 3 lines · Ralph Sennhauser
A modern compiler should know better when to inline, so drop the inline keywords.
Quoted 6 lines
Quoted 1 line
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