From: Keerthy <j-keerthy@ti.com>
To: linus.walleij@linaro.org, gnurou@gmail.com
Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
grygorii.strashko@ti.com, lokeshvutla@ti.com, j-keerthy@ti.com
Subject: [PATCH 2/2] gpio: davinci: Fix the number of controllers allocated
Date: Thu, 28 Jan 2016 19:08:51 +0530 [thread overview]
Message-ID: <1453988331-17111-3-git-send-email-j-keerthy@ti.com> (raw)
In-Reply-To: <1453988331-17111-1-git-send-email-j-keerthy@ti.com>
From: Lokesh Vutla <lokeshvutla@ti.com>
Driver only needs to allocate for [ngpio / 32] controllers,
as each controller handles 32 gpios. But the current driver
allocates for ngpio of which the extra allocated are unused.
Fix it be registering only the required number of controllers.
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Signed-off-by: Keerthy <j-keerthy@ti.com>
---
drivers/gpio/gpio-davinci.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/gpio/gpio-davinci.c b/drivers/gpio/gpio-davinci.c
index c889f31..cd007a6 100644
--- a/drivers/gpio/gpio-davinci.c
+++ b/drivers/gpio/gpio-davinci.c
@@ -195,7 +195,7 @@ static int davinci_gpio_of_xlate(struct gpio_chip *gc,
static int davinci_gpio_probe(struct platform_device *pdev)
{
int i, base;
- unsigned ngpio;
+ unsigned ngpio, nbank;
struct davinci_gpio_controller *chips;
struct davinci_gpio_platform_data *pdata;
struct davinci_gpio_regs __iomem *regs;
@@ -224,8 +224,9 @@ static int davinci_gpio_probe(struct platform_device *pdev)
if (WARN_ON(ARCH_NR_GPIOS < ngpio))
ngpio = ARCH_NR_GPIOS;
+ nbank = DIV_ROUND_UP(ngpio, 32);
chips = devm_kzalloc(dev,
- ngpio * sizeof(struct davinci_gpio_controller),
+ nbank * sizeof(struct davinci_gpio_controller),
GFP_KERNEL);
if (!chips)
return -ENOMEM;
--
1.9.1
next prev parent reply other threads:[~2016-01-28 13:38 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-28 13:38 [PATCH 0/2] gpio: davinci: driver fixes Keerthy
2016-01-28 13:38 ` [PATCH 1/2] gpio: davinci: Add the missing of-node pointer in the irq_domain_add_legacy function call Keerthy
2016-01-28 14:18 ` Grygorii Strashko
2016-02-08 9:48 ` Keerthy
2016-02-10 10:00 ` Linus Walleij
2016-01-28 13:38 ` Keerthy [this message]
2016-01-28 14:18 ` [PATCH 2/2] gpio: davinci: Fix the number of controllers allocated Grygorii Strashko
2016-02-08 9:47 ` Keerthy
2016-02-10 10:01 ` 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=1453988331-17111-3-git-send-email-j-keerthy@ti.com \
--to=j-keerthy@ti.com \
--cc=gnurou@gmail.com \
--cc=grygorii.strashko@ti.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lokeshvutla@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).