All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] gpio/gpiolib.c:Fixing style issues in gpiolib.c
@ 2016-12-09  4:08 Mukesh Kaushik
  2016-12-28 12:38 ` Linus Walleij
  0 siblings, 1 reply; 4+ messages in thread
From: Mukesh Kaushik @ 2016-12-09  4:08 UTC (permalink / raw)
  To: Alexandre Courbot, Linus Walleij; +Cc: linux-gpio, Mukesh Kaushik, linux-kernel

Fixing the following checkpatch.pl error:

ERROR: else should follow close brace '}'
#2248: FILE: drivers/gpio/gpiolib.c:2248:
+       }
+       else if (test_bit(FLAG_OPEN_SOURCE, &desc->flags)) {

ERROR: space prohibited after that open parenthesis '('
#2018: FILE: drivers/gpio/gpiolib.c:2018:
+       if ( !desc->gdev->chip ) { \

ERROR: space prohibited before that close parenthesis ')'
#2018: FILE: drivers/gpio/gpiolib.c:2018:
+       if ( !desc->gdev->chip ) { \

and following warnings :

WARNING: Prefer 'unsigned int' to bare use of 'unsigned'

WARNING: else is not generally useful after a break or return
#160: FILE: drivers/gpio/gpiolib.c:160:
+                       break;
+               else

Signed-off-by: Mukesh Kaushik <mukesh.k4@samsung.com>
---
 drivers/gpio/gpiolib.c |   34 ++++++++++++++++------------------
 1 file changed, 16 insertions(+), 18 deletions(-)

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 868128a..80c5304 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -85,7 +85,7 @@ static inline void desc_set_label(struct gpio_desc *d, const char *label)
 /**
  * Convert a GPIO number to its descriptor
  */
-struct gpio_desc *gpio_to_desc(unsigned gpio)
+struct gpio_desc *gpio_to_desc(unsigned int gpio)
 {
 	struct gpio_device *gdev;
 	unsigned long flags;
@@ -157,9 +157,8 @@ static int gpiochip_find_base(int ngpio)
 		/* found a free space? */
 		if (gdev->base + gdev->ngpio <= base)
 			break;
-		else
-			/* nope, check the space right before the chip */
-			base = gdev->base - ngpio;
+		/* nope, check the space right before the chip */
+		base = gdev->base - ngpio;
 	}
 
 	if (gpio_is_valid(base)) {
@@ -182,7 +181,7 @@ static int gpiochip_find_base(int ngpio)
 int gpiod_get_direction(struct gpio_desc *desc)
 {
 	struct gpio_chip	*chip;
-	unsigned		offset;
+	unsigned int		offset;
 	int			status = -EINVAL;
 
 	chip = gpiod_to_chip(desc);
@@ -1104,7 +1103,7 @@ int gpiochip_add_data(struct gpio_chip *chip, void *data)
 {
 	unsigned long	flags;
 	int		status = 0;
-	unsigned	i;
+	unsigned int	i;
 	int		base = chip->base;
 	struct gpio_device *gdev;
 
@@ -1311,7 +1310,7 @@ void gpiochip_remove(struct gpio_chip *chip)
 	struct gpio_device *gdev = chip->gpiodev;
 	struct gpio_desc *desc;
 	unsigned long	flags;
-	unsigned	i;
+	unsigned int	i;
 	bool		requested = false;
 
 	/* FIXME: should the legacy sysfs handling be moved to gpio_device? */
@@ -1640,7 +1639,7 @@ static void gpiochip_irq_relres(struct irq_data *d)
 	module_put(chip->gpiodev->owner);
 }
 
-static int gpiochip_to_irq(struct gpio_chip *chip, unsigned offset)
+static int gpiochip_to_irq(struct gpio_chip *chip, unsigned int offset)
 {
 	return irq_find_mapping(chip->irqdomain, offset);
 }
@@ -1717,7 +1716,7 @@ int _gpiochip_irqchip_add(struct gpio_chip *gpiochip,
 	struct device_node *of_node;
 	bool irq_base_set = false;
 	unsigned int offset;
-	unsigned irq_base = 0;
+	unsigned int irq_base = 0;
 
 	if (!gpiochip || !irqchip)
 		return -EINVAL;
@@ -1815,7 +1814,7 @@ static inline void gpiochip_irqchip_free_valid_mask(struct gpio_chip *gpiochip)
  * @chip: the gpiochip owning the GPIO
  * @offset: the offset of the GPIO to request for GPIO function
  */
-int gpiochip_generic_request(struct gpio_chip *chip, unsigned offset)
+int gpiochip_generic_request(struct gpio_chip *chip, unsigned int offset)
 {
 	return pinctrl_request_gpio(chip->gpiodev->base + offset);
 }
@@ -1826,7 +1825,7 @@ int gpiochip_generic_request(struct gpio_chip *chip, unsigned offset)
  * @chip: the gpiochip to request the gpio function for
  * @offset: the offset of the GPIO to free from GPIO function
  */
-void gpiochip_generic_free(struct gpio_chip *chip, unsigned offset)
+void gpiochip_generic_free(struct gpio_chip *chip, unsigned int offset)
 {
 	pinctrl_free_gpio(chip->gpiodev->base + offset);
 }
@@ -2015,7 +2014,7 @@ static int __gpiod_request(struct gpio_desc *desc, const char *label)
 		pr_warn("%s: invalid GPIO (no device)\n", __func__); \
 		return -EINVAL; \
 	} \
-	if ( !desc->gdev->chip ) { \
+	if (!desc->gdev->chip) { \
 		dev_warn(&desc->gdev->dev, \
 			 "%s: backing chip is gone\n", __func__); \
 		return 0; \
@@ -2117,7 +2116,7 @@ void gpiod_free(struct gpio_desc *desc)
  * help with diagnostics, and knowing that the signal is used as a GPIO
  * can help avoid accidentally multiplexing it to another controller.
  */
-const char *gpiochip_is_requested(struct gpio_chip *chip, unsigned offset)
+const char *gpiochip_is_requested(struct gpio_chip *chip, unsigned int offset)
 {
 	struct gpio_desc *desc;
 
@@ -2244,8 +2243,7 @@ static int _gpiod_direction_output_raw(struct gpio_desc *desc, int value)
 		/* Emulate open drain by not actively driving the line high */
 		if (value)
 			return gpiod_direction_input(desc);
-	}
-	else if (test_bit(FLAG_OPEN_SOURCE, &desc->flags)) {
+	} else if (test_bit(FLAG_OPEN_SOURCE, &desc->flags)) {
 		if (gc->set_single_ended) {
 			ret = gc->set_single_ended(gc, gpio_chip_hwgpio(desc),
 						   LINE_MODE_OPEN_SOURCE);
@@ -2326,7 +2324,7 @@ int gpiod_direction_output(struct gpio_desc *desc, int value)
  * returns -ENOTSUPP if the controller does not support setting
  * debounce.
  */
-int gpiod_set_debounce(struct gpio_desc *desc, unsigned debounce)
+int gpiod_set_debounce(struct gpio_desc *desc, unsigned int debounce)
 {
 	struct gpio_chip	*chip;
 
@@ -3517,9 +3515,9 @@ static int __init gpiolib_dev_init(void)
 
 static void gpiolib_dbg_show(struct seq_file *s, struct gpio_device *gdev)
 {
-	unsigned		i;
+	unsigned int		i;
 	struct gpio_chip	*chip = gdev->chip;
-	unsigned		gpio = gdev->base;
+	unsigned int		gpio = gdev->base;
 	struct gpio_desc	*gdesc = &gdev->descs[0];
 	int			is_out;
 	int			is_irq;
-- 
1.7.9.5


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

* Re: [PATCH] gpio/gpiolib.c:Fixing style issues in gpiolib.c
  2016-12-09  4:08 [PATCH] gpio/gpiolib.c:Fixing style issues in gpiolib.c Mukesh Kaushik
@ 2016-12-28 12:38 ` Linus Walleij
  0 siblings, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2016-12-28 12:38 UTC (permalink / raw)
  To: Mukesh Kaushik; +Cc: Alexandre Courbot, linux-gpio, linux-kernel

On Fri, Dec 9, 2016 at 5:08 AM, Mukesh Kaushik <mukesh.k4@samsung.com> wrote:

> Fixing the following checkpatch.pl error:

This does not apply to v4.10+

If you want it considered, rebase and resend.

Sorry for constant rebase, but purelyt syntactic changes are
second/third priority.

Yours,
Linus Walleij

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

* Re: [PATCH] gpio/gpiolib.c:Fixing style issues in gpiolib.c
  2016-12-05 11:45 Mukesh Kaushik
@ 2016-12-07 15:07 ` Linus Walleij
  0 siblings, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2016-12-07 15:07 UTC (permalink / raw)
  To: Mukesh Kaushik; +Cc: Alexandre Courbot, linux-gpio, linux-kernel, vidushi.koul

On Mon, Dec 5, 2016 at 12:45 PM, Mukesh Kaushik <mukesh.k4@samsung.com> wrote:

> Fixing the following checkpatch.pl error:
>
> ERROR: else should follow close brace '}'
> +       }
> +       else if (test_bit(FLAG_OPEN_SOURCE, &desc->flags)) {
>
> ERROR: space prohibited after that open parenthesis '('
> +       if ( !desc->gdev->chip ) { \
>
> ERROR: space prohibited before that close parenthesis ')'
> +       if ( !desc->gdev->chip ) { \
>
> and following warnings :
>
> WARNING: Prefer 'unsigned int' to bare use of 'unsigned'
>
> WARNING: else is not generally useful after a break or return
> +                       break;
> +               else
>
> Change-Id: I9164832686efb8db1f6d365f89f278e998104f81

Gerrit? We don't need this.

> Signed-off-by: Mukesh Kaushik <mukesh.k4@samsung.com>

This does not apply to my devel branch.

Please rebase on devel or v4.9 final whatever comes first
and resend.

Yours,
Linus Walleij

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

* [PATCH] gpio/gpiolib.c:Fixing style issues in gpiolib.c
@ 2016-12-05 11:45 Mukesh Kaushik
  2016-12-07 15:07 ` Linus Walleij
  0 siblings, 1 reply; 4+ messages in thread
From: Mukesh Kaushik @ 2016-12-05 11:45 UTC (permalink / raw)
  To: Linus Walleij, Alexandre Courbot, Mukesh Kaushik
  Cc: linux-gpio, linux-kernel, vidushi.koul

Fixing the following checkpatch.pl error:

ERROR: else should follow close brace '}'
+       }
+       else if (test_bit(FLAG_OPEN_SOURCE, &desc->flags)) {

ERROR: space prohibited after that open parenthesis '('
+       if ( !desc->gdev->chip ) { \

ERROR: space prohibited before that close parenthesis ')'
+       if ( !desc->gdev->chip ) { \

and following warnings :

WARNING: Prefer 'unsigned int' to bare use of 'unsigned'

WARNING: else is not generally useful after a break or return
+                       break;
+               else

Change-Id: I9164832686efb8db1f6d365f89f278e998104f81
Signed-off-by: Mukesh Kaushik <mukesh.k4@samsung.com>
---
 drivers/gpio/gpiolib.c |   34 ++++++++++++++++------------------
 1 file changed, 16 insertions(+), 18 deletions(-)

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 93ed0e0..1b3361a 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -85,7 +85,7 @@ static inline void desc_set_label(struct gpio_desc *d, const char *label)
 /**
  * Convert a GPIO number to its descriptor
  */
-struct gpio_desc *gpio_to_desc(unsigned gpio)
+struct gpio_desc *gpio_to_desc(unsigned int gpio)
 {
 	struct gpio_device *gdev;
 	unsigned long flags;
@@ -157,9 +157,8 @@ static int gpiochip_find_base(int ngpio)
 		/* found a free space? */
 		if (gdev->base + gdev->ngpio <= base)
 			break;
-		else
-			/* nope, check the space right before the chip */
-			base = gdev->base - ngpio;
+		/* nope, check the space right before the chip */
+		base = gdev->base - ngpio;
 	}
 
 	if (gpio_is_valid(base)) {
@@ -182,7 +181,7 @@ static int gpiochip_find_base(int ngpio)
 int gpiod_get_direction(struct gpio_desc *desc)
 {
 	struct gpio_chip	*chip;
-	unsigned		offset;
+	unsigned int		offset;
 	int			status = -EINVAL;
 
 	chip = gpiod_to_chip(desc);
@@ -1104,7 +1103,7 @@ int gpiochip_add_data(struct gpio_chip *chip, void *data)
 {
 	unsigned long	flags;
 	int		status = 0;
-	unsigned	i;
+	unsigned int	i;
 	int		base = chip->base;
 	struct gpio_device *gdev;
 
@@ -1311,7 +1310,7 @@ void gpiochip_remove(struct gpio_chip *chip)
 	struct gpio_device *gdev = chip->gpiodev;
 	struct gpio_desc *desc;
 	unsigned long	flags;
-	unsigned	i;
+	unsigned int	i;
 	bool		requested = false;
 
 	/* FIXME: should the legacy sysfs handling be moved to gpio_device? */
@@ -1640,7 +1639,7 @@ static void gpiochip_irq_relres(struct irq_data *d)
 	module_put(chip->gpiodev->owner);
 }
 
-static int gpiochip_to_irq(struct gpio_chip *chip, unsigned offset)
+static int gpiochip_to_irq(struct gpio_chip *chip, unsigned int offset)
 {
 	return irq_find_mapping(chip->irqdomain, offset);
 }
@@ -1717,7 +1716,7 @@ int _gpiochip_irqchip_add(struct gpio_chip *gpiochip,
 	struct device_node *of_node;
 	bool irq_base_set = false;
 	unsigned int offset;
-	unsigned irq_base = 0;
+	unsigned int irq_base = 0;
 
 	if (!gpiochip || !irqchip)
 		return -EINVAL;
@@ -1815,7 +1814,7 @@ static inline void gpiochip_irqchip_free_valid_mask(struct gpio_chip *gpiochip)
  * @chip: the gpiochip owning the GPIO
  * @offset: the offset of the GPIO to request for GPIO function
  */
-int gpiochip_generic_request(struct gpio_chip *chip, unsigned offset)
+int gpiochip_generic_request(struct gpio_chip *chip, unsigned int offset)
 {
 	return pinctrl_request_gpio(chip->gpiodev->base + offset);
 }
@@ -1826,7 +1825,7 @@ int gpiochip_generic_request(struct gpio_chip *chip, unsigned offset)
  * @chip: the gpiochip to request the gpio function for
  * @offset: the offset of the GPIO to free from GPIO function
  */
-void gpiochip_generic_free(struct gpio_chip *chip, unsigned offset)
+void gpiochip_generic_free(struct gpio_chip *chip, unsigned int offset)
 {
 	pinctrl_free_gpio(chip->gpiodev->base + offset);
 }
@@ -2015,7 +2014,7 @@ static int __gpiod_request(struct gpio_desc *desc, const char *label)
 		pr_warn("%s: invalid GPIO (no device)\n", __func__); \
 		return -EINVAL; \
 	} \
-	if ( !desc->gdev->chip ) { \
+	if (!desc->gdev->chip) { \
 		dev_warn(&desc->gdev->dev, \
 			 "%s: backing chip is gone\n", __func__); \
 		return 0; \
@@ -2117,7 +2116,7 @@ void gpiod_free(struct gpio_desc *desc)
  * help with diagnostics, and knowing that the signal is used as a GPIO
  * can help avoid accidentally multiplexing it to another controller.
  */
-const char *gpiochip_is_requested(struct gpio_chip *chip, unsigned offset)
+const char *gpiochip_is_requested(struct gpio_chip *chip, unsigned int offset)
 {
 	struct gpio_desc *desc;
 
@@ -2244,8 +2243,7 @@ static int _gpiod_direction_output_raw(struct gpio_desc *desc, int value)
 		/* Emulate open drain by not actively driving the line high */
 		if (value)
 			return gpiod_direction_input(desc);
-	}
-	else if (test_bit(FLAG_OPEN_SOURCE, &desc->flags)) {
+	} else if (test_bit(FLAG_OPEN_SOURCE, &desc->flags)) {
 		if (gc->set_single_ended) {
 			ret = gc->set_single_ended(gc, gpio_chip_hwgpio(desc),
 						   LINE_MODE_OPEN_SOURCE);
@@ -2326,7 +2324,7 @@ int gpiod_direction_output(struct gpio_desc *desc, int value)
  * returns -ENOTSUPP if the controller does not support setting
  * debounce.
  */
-int gpiod_set_debounce(struct gpio_desc *desc, unsigned debounce)
+int gpiod_set_debounce(struct gpio_desc *desc, unsigned int debounce)
 {
 	struct gpio_chip	*chip;
 
@@ -3514,9 +3512,9 @@ static int __init gpiolib_dev_init(void)
 
 static void gpiolib_dbg_show(struct seq_file *s, struct gpio_device *gdev)
 {
-	unsigned		i;
+	unsigned int		i;
 	struct gpio_chip	*chip = gdev->chip;
-	unsigned		gpio = gdev->base;
+	unsigned int		gpio = gdev->base;
 	struct gpio_desc	*gdesc = &gdev->descs[0];
 	int			is_out;
 	int			is_irq;
-- 
1.7.9.5


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

end of thread, other threads:[~2016-12-28 12:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-09  4:08 [PATCH] gpio/gpiolib.c:Fixing style issues in gpiolib.c Mukesh Kaushik
2016-12-28 12:38 ` Linus Walleij
  -- strict thread matches above, loose matches on Subject: below --
2016-12-05 11:45 Mukesh Kaushik
2016-12-07 15:07 ` Linus Walleij

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.