From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932482AbcLIELQ (ORCPT ); Thu, 8 Dec 2016 23:11:16 -0500 Received: from mailout4.samsung.com ([203.254.224.34]:42021 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932170AbcLIELP (ORCPT ); Thu, 8 Dec 2016 23:11:15 -0500 X-AuditID: cbfee61b-f796f6d000004092-a8-584a2ee1d0d8 From: Mukesh Kaushik To: Alexandre Courbot , Linus Walleij Cc: linux-gpio@vger.kernel.org, Mukesh Kaushik , linux-kernel@vger.kernel.org Subject: [PATCH] gpio/gpiolib.c:Fixing style issues in gpiolib.c Date: Fri, 09 Dec 2016 09:38:47 +0530 Message-id: <1481256527-25776-1-git-send-email-mukesh.k4@samsung.com> X-Mailer: git-send-email 1.7.9.5 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrMLMWRmVeSWpSXmKPExsVy+t9jQd2Hel4RBnu7OS3OvXrEYjHlz3Im i83z/zBaXN41h83i49pNLA6sHjtn3WX3uHNtD5tH35ZVjB6fN8kFsES52WSkJqakFimk5iXn p2TmpdsqhYa46VooKeQl5qbaKkXo+oYEKSmUJeaUAnlGBmjAwTnAPVhJ3y7BLaNlx1SWggV6 FScPeDQwdql2MXJySAiYSBz//ocNwhaTuHBvPZDNxSEkMItRYu3Kb8wQzk9GiYOn5rCDVLEJ 6EhcWLmJEcQWEQiRaNixEsjm4GAWSJNYvj0AJCws4CCx9fMtFhCbRUBVYue6A6wgNq+Aq8Su Oy/ZQMolBBQk5kyymcDIvYCRYRWjRGpBckFxUnquUV5quV5xYm5xaV66XnJ+7iZGcAA+k97B eHiX+yFGAQ5GJR7eAwWeEUKsiWXFlbmHGCU4mJVEeJfqeEUI8aYkVlalFuXHF5XmpBYfYjQF 2j+RWUo0OR8YHXkl8YYm5ibmxgYW5paWJkZK4ryNs5+FCwmkJ5akZqemFqQWwfQxcXBKNTDm aqzpqrQL01777ta1zXJFnWxZd2v6jfl3CHcrVs+r+vJ/nuK/C1wsxjtc8pZJrjhtWO+4tb3K o+40Q1LZG3Nh2QwXz0K+G3670jJsot72Llrez/Gh54ifbbzqgk0XpkRO2HDy+SP1y09S5ntc 3j3r7CmOwKe71jbyz3dcxb9nUnfI1wfV8w4osRRnJBpqMRcVJwIAT29941YCAAA= X-MTR: 20000000000000000@CPGS Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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