Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1320680 > unrolled thread

[PATCH 2/2] gpio: davinci: Fix the number of controllers allocated

Started byKeerthy <j-keerthy@ti.com>
First post2016-01-28 14:40 +0100
Last post2016-02-08 10:50 +0100
Articles 3 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 2/2] gpio: davinci: Fix the number of controllers allocated Keerthy <j-keerthy@ti.com> - 2016-01-28 14:40 +0100
    Re: [PATCH 2/2] gpio: davinci: Fix the number of controllers  allocated Grygorii Strashko <grygorii.strashko@ti.com> - 2016-01-28 15:20 +0100
      Re: [PATCH 2/2] gpio: davinci: Fix the number of controllers  allocated Keerthy <a0393675@ti.com> - 2016-02-08 10:50 +0100

#1320680 — [PATCH 2/2] gpio: davinci: Fix the number of controllers allocated

FromKeerthy <j-keerthy@ti.com>
Date2016-01-28 14:40 +0100
Subject[PATCH 2/2] gpio: davinci: Fix the number of controllers allocated
Message-ID<qVUXM-43r-25@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1320721 — Re: [PATCH 2/2] gpio: davinci: Fix the number of controllers allocated

FromGrygorii Strashko <grygorii.strashko@ti.com>
Date2016-01-28 15:20 +0100
SubjectRe: [PATCH 2/2] gpio: davinci: Fix the number of controllers allocated
Message-ID<qVVAu-4Ce-19@gated-at.bofh.it>
In reply to#1320680
On 01/28/2016 03:38 PM, Keerthy wrote:
> 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>

Reviewed-by: Grygorii Strashko <grygorii.strashko@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;
>


-- 
regards,
-grygorii

[toc] | [prev] | [next] | [standalone]


#1328859 — Re: [PATCH 2/2] gpio: davinci: Fix the number of controllers allocated

FromKeerthy <a0393675@ti.com>
Date2016-02-08 10:50 +0100
SubjectRe: [PATCH 2/2] gpio: davinci: Fix the number of controllers allocated
Message-ID<qZQCe-3pM-1@gated-at.bofh.it>
In reply to#1320721

On Thursday 28 January 2016 07:48 PM, Grygorii Strashko wrote:
> On 01/28/2016 03:38 PM, Keerthy wrote:
>> 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>
>
> Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com>

A gentle ping on this patch. Thanks Grygorii for the review.

>
>> ---
>>   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;
>>
>
>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web