[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <56AA234C.4010707@ti.com>
Date: Thu, 28 Jan 2016 16:18:52 +0200
From: Grygorii Strashko <grygorii.strashko@...com>
To: Keerthy <j-keerthy@...com>, <linus.walleij@...aro.org>,
<gnurou@...il.com>
CC: <linux-gpio@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<lokeshvutla@...com>, Santosh Shilimkar <ssantosh@...nel.org>,
Sekhar Nori <nsekhar@...com>
Subject: Re: [PATCH 2/2] gpio: davinci: Fix the number of controllers
allocated
On 01/28/2016 03:38 PM, Keerthy wrote:
> From: Lokesh Vutla <lokeshvutla@...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@...com>
> Signed-off-by: Keerthy <j-keerthy@...com>
Reviewed-by: Grygorii Strashko <grygorii.strashko@...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;
>
--
regards,
-grygorii
Powered by blists - more mailing lists