From: Keerthy <j-keerthy@ti.com>
To: "Andrew F. Davis" <afd@ti.com>, Sekhar Nori <nsekhar@ti.com>,
Kevin Hilman <khilman@kernel.org>,
Linus Walleij <linus.walleij@linaro.org>
Cc: <linux-gpio@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 3/5] gpio: davinci: Allocate the correct amount of memory for controller
Date: Wed, 19 Sep 2018 10:32:16 +0530 [thread overview]
Message-ID: <1cc3aa9b-a736-ee14-d414-8a2b1c4ea659@ti.com> (raw)
In-Reply-To: <20180831191326.25106-3-afd@ti.com>
On Saturday 01 September 2018 12:43 AM, Andrew F. Davis wrote:
> Previously we created a controller structure per bank of GPIO pins. This
> has since been changed to one per controller, but the allocation size
> was not changed. Fix this here.
>
> This also leaves the variable 'nbank' unused, instead of removing it,
> move it down and use it to clean up a loop. For loops with multiple
> initializers and/or iteration expressions, especially ones that don't
> use those loop counters are quite hard to follow, fix this.
>
Tested for gpio interrupts on k2g and da850-lcdk
Tested-by: Keerthy <j-keerthy@ti.com>
Acked-by: Keerthy <j-keerthy@ti.com>
> Signed-off-by: Andrew F. Davis <afd@ti.com>
> ---
> drivers/gpio/gpio-davinci.c | 10 ++++------
> 1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpio/gpio-davinci.c b/drivers/gpio/gpio-davinci.c
> index 14d1729927d3..121a7948f785 100644
> --- a/drivers/gpio/gpio-davinci.c
> +++ b/drivers/gpio/gpio-davinci.c
> @@ -165,7 +165,7 @@ davinci_gpio_get_pdata(struct platform_device *pdev)
>
> static int davinci_gpio_probe(struct platform_device *pdev)
> {
> - int gpio, bank, i, ret = 0;
> + int bank, i, ret = 0;
> unsigned int ngpio, nbank, nirq;
> struct davinci_gpio_controller *chips;
> struct davinci_gpio_platform_data *pdata;
> @@ -204,10 +204,7 @@ static int davinci_gpio_probe(struct platform_device *pdev)
> else
> nirq = DIV_ROUND_UP(ngpio, 16);
>
> - nbank = DIV_ROUND_UP(ngpio, 32);
> - chips = devm_kcalloc(dev,
> - nbank, sizeof(struct davinci_gpio_controller),
> - GFP_KERNEL);
> + chips = devm_kzalloc(dev, sizeof(*chips), GFP_KERNEL);
> if (!chips)
> return -ENOMEM;
>
> @@ -247,7 +244,8 @@ static int davinci_gpio_probe(struct platform_device *pdev)
> #endif
> spin_lock_init(&chips->lock);
>
> - for (gpio = 0, bank = 0; gpio < ngpio; gpio += 32, bank++)
> + nbank = DIV_ROUND_UP(ngpio, 32);
> + for (bank = 0; bank < nbank; bank++)
> chips->regs[bank] = gpio_base + offset_array[bank];
>
> ret = devm_gpiochip_add_data(dev, &chips->chip, chips);
>
next prev parent reply other threads:[~2018-09-19 5:02 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-31 19:13 [PATCH 1/5] gpio: davinci: Remove unused member of davinci_gpio_controller Andrew F. Davis
2018-08-31 19:13 ` [PATCH 2/5] gpio: davinci: Use dev name for label and automatic base selection Andrew F. Davis
2018-09-03 5:40 ` Keerthy
2018-09-05 10:37 ` Linus Walleij
2018-09-06 14:16 ` Keerthy
2018-09-08 19:41 ` Grygorii Strashko
2018-09-10 2:47 ` Keerthy
2018-09-10 22:05 ` Grygorii Strashko
2018-09-10 7:25 ` Linus Walleij
2018-09-10 7:37 ` Sekhar Nori
2018-09-10 17:03 ` David Lechner
2018-09-18 19:26 ` Linus Walleij
2018-09-19 4:08 ` Keerthy
2018-08-31 19:13 ` [PATCH 3/5] gpio: davinci: Allocate the correct amount of memory for controller Andrew F. Davis
2018-09-19 5:02 ` Keerthy [this message]
2018-08-31 19:13 ` [PATCH 4/5] gpio: davinci: Remove unneeded GPIO macro Andrew F. Davis
2018-09-19 5:02 ` Keerthy
2018-08-31 19:13 ` [PATCH 5/5] gpio: davinci: Move driver local definitions to driver Andrew F. Davis
2018-09-19 5:02 ` Keerthy
2018-09-18 19:24 ` [PATCH 1/5] gpio: davinci: Remove unused member of davinci_gpio_controller Linus Walleij
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1cc3aa9b-a736-ee14-d414-8a2b1c4ea659@ti.com \
--to=j-keerthy@ti.com \
--cc=afd@ti.com \
--cc=khilman@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nsekhar@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).