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


Groups > linux.kernel > #1690101 > unrolled thread

[PATCH 0/4] gpio: davinci: Add keystone-k2g support and few clean ups

Started byKeerthy <j-keerthy@ti.com>
First post2017-07-18 13:00 +0200
Last post2017-07-25 05:30 +0200
Articles 20 on this page of 27 — 6 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/4] gpio: davinci: Add keystone-k2g support and few clean ups Keerthy <j-keerthy@ti.com> - 2017-07-18 13:00 +0200
    [PATCH 4/4] ARM: dts: keystone-k2g-evm: Add gpio nodes Keerthy <j-keerthy@ti.com> - 2017-07-18 13:00 +0200
      Re: [PATCH 4/4] ARM: dts: keystone-k2g-evm: Add gpio nodes Suman Anna <s-anna@ti.com> - 2017-07-18 21:20 +0200
        Re: [PATCH 4/4] ARM: dts: keystone-k2g-evm: Add gpio nodes Keerthy <j-keerthy@ti.com> - 2017-07-19 06:10 +0200
    [PATCH 1/4] gpio: davinci: Use devm_gpiochip_add_data in place of gpiochip_add_data Keerthy <j-keerthy@ti.com> - 2017-07-18 13:00 +0200
      Re: [PATCH 1/4] gpio: davinci: Use devm_gpiochip_add_data in place of  gpiochip_add_data Suman Anna <s-anna@ti.com> - 2017-07-18 19:00 +0200
        Re: [PATCH 1/4] gpio: davinci: Use devm_gpiochip_add_data in place of  gpiochip_add_data Keerthy <j-keerthy@ti.com> - 2017-07-18 19:50 +0200
      Re: [PATCH 1/4] gpio: davinci: Use devm_gpiochip_add_data in place  of gpiochip_add_data Johan Hovold <johan@kernel.org> - 2017-07-19 11:40 +0200
        Re: [PATCH 1/4] gpio: davinci: Use devm_gpiochip_add_data in place of  gpiochip_add_data Keerthy <j-keerthy@ti.com> - 2017-07-19 12:00 +0200
    [PATCH 2/4] gpio: davinci: Handle the return value of davinci_gpio_irq_setup function Keerthy <j-keerthy@ti.com> - 2017-07-18 13:00 +0200
      Re: [PATCH 2/4] gpio: davinci: Handle the return value of  davinci_gpio_irq_setup function Suman Anna <s-anna@ti.com> - 2017-07-18 19:00 +0200
        Re: [PATCH 2/4] gpio: davinci: Handle the return value of  davinci_gpio_irq_setup function Keerthy <j-keerthy@ti.com> - 2017-07-18 19:50 +0200
      Re: [PATCH 2/4] gpio: davinci: Handle the return value of  davinci_gpio_irq_setup function Johan Hovold <johan@kernel.org> - 2017-07-19 13:20 +0200
        Re: [PATCH 2/4] gpio: davinci: Handle the return value of  davinci_gpio_irq_setup function Keerthy <j-keerthy@ti.com> - 2017-07-20 08:50 +0200
          Re: [PATCH 2/4] gpio: davinci: Handle the return value of  davinci_gpio_irq_setup function Keerthy <j-keerthy@ti.com> - 2017-07-20 11:20 +0200
            Re: [PATCH 2/4] gpio: davinci: Handle the return value of  davinci_gpio_irq_setup function Johan Hovold <johan@kernel.org> - 2017-07-20 12:00 +0200
              Re: [PATCH 2/4] gpio: davinci: Handle the return value of  davinci_gpio_irq_setup function Keerthy <j-keerthy@ti.com> - 2017-07-20 12:10 +0200
                Re: [PATCH 2/4] gpio: davinci: Handle the return value of  davinci_gpio_irq_setup function Johan Hovold <johan@kernel.org> - 2017-07-20 12:10 +0200
                  Re: [PATCH 2/4] gpio: davinci: Handle the return value of  davinci_gpio_irq_setup function Keerthy <j-keerthy@ti.com> - 2017-07-20 12:20 +0200
                  Re: [PATCH 2/4] gpio: davinci: Handle the return value of  davinci_gpio_irq_setup function Grygorii Strashko <grygorii.strashko@ti.com> - 2017-07-20 23:40 +0200
                    Re: [PATCH 2/4] gpio: davinci: Handle the return value of  davinci_gpio_irq_setup function Keerthy <j-keerthy@ti.com> - 2017-07-21 06:00 +0200
                    Re: [PATCH 2/4] gpio: davinci: Handle the return value of  davinci_gpio_irq_setup function Johan Hovold <johan@kernel.org> - 2017-07-21 09:50 +0200
    [PATCH 3/4] gpio: davinci: Add a separate compatible for keystone-k2g soc Keerthy <j-keerthy@ti.com> - 2017-07-18 13:10 +0200
      Re: [PATCH 3/4] gpio: davinci: Add a separate compatible for  keystone-k2g soc Sekhar Nori <nsekhar@ti.com> - 2017-07-18 13:40 +0200
        Re: [PATCH 3/4] gpio: davinci: Add a separate compatible for  keystone-k2g soc Keerthy <j-keerthy@ti.com> - 2017-07-18 19:50 +0200
      Re: [PATCH 3/4] gpio: davinci: Add a separate compatible for  keystone-k2g soc Rob Herring <robh@kernel.org> - 2017-07-24 20:30 +0200
        Re: [PATCH 3/4] gpio: davinci: Add a separate compatible for  keystone-k2g soc Keerthy <j-keerthy@ti.com> - 2017-07-25 05:30 +0200

Page 1 of 2  [1] 2  Next page →


#1690101 — [PATCH 0/4] gpio: davinci: Add keystone-k2g support and few clean ups

FromKeerthy <j-keerthy@ti.com>
Date2017-07-18 13:00 +0200
Subject[PATCH 0/4] gpio: davinci: Add keystone-k2g support and few clean ups
Message-ID<u4yoq-1lh-25@gated-at.bofh.it>
The patch series adds support for keystone-k2g soc GPIO.
Also does a couple of important return handling which were missed
earlier in the driver probe.

This is based on Suman's:

http://marc.info/?l=linux-arm-kernel&m=150034845427555&w=2
http://marc.info/?l=linux-arm-kernel&m=150034856627618&w=2

The driver patches should have no dependency but the device Tree
will need the above set.

Keerthy (4):
  gpio: davinci: Use devm_gpiochip_add_data in place of
    gpiochip_add_data
  gpio: davinci: Handle the return value of davinci_gpio_irq_setup
    function
  gpio: davinci: Add a separate compatible for keystone-k2g soc
  ARM: dts: keystone-k2g-evm: Add gpio nodes

 .../devicetree/bindings/gpio/gpio-davinci.txt      |  3 +-
 arch/arm/boot/dts/keystone-k2g.dtsi                | 42 ++++++++++++++++++++++
 drivers/gpio/gpio-davinci.c                        | 21 +++++++++--
 3 files changed, 62 insertions(+), 4 deletions(-)

-- 
1.9.1

[toc] | [next] | [standalone]


#1690111 — [PATCH 4/4] ARM: dts: keystone-k2g-evm: Add gpio nodes

FromKeerthy <j-keerthy@ti.com>
Date2017-07-18 13:00 +0200
Subject[PATCH 4/4] ARM: dts: keystone-k2g-evm: Add gpio nodes
Message-ID<u4yor-1lh-55@gated-at.bofh.it>
In reply to#1690101
keystone-k2g has 2 instances of gpio. The first one has all the 144 GPIOs
functional( 9 banks with 16 gpios = 144). The second instance has
only the GPIO0:GPIO67 functional and rest are marked reserved.

Signed-off-by: Keerthy <j-keerthy@ti.com>
---
 arch/arm/boot/dts/keystone-k2g.dtsi | 42 +++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/arch/arm/boot/dts/keystone-k2g.dtsi b/arch/arm/boot/dts/keystone-k2g.dtsi
index bf4d1fa..58ac3db 100644
--- a/arch/arm/boot/dts/keystone-k2g.dtsi
+++ b/arch/arm/boot/dts/keystone-k2g.dtsi
@@ -15,6 +15,7 @@
 
 #include <dt-bindings/interrupt-controller/arm-gic.h>
 #include <dt-bindings/pinctrl/keystone.h>
+#include <dt-bindings/gpio/gpio.h>
 
 / {
 	compatible = "ti,k2g","ti,keystone";
@@ -168,5 +169,46 @@
 				#reset-cells = <2>;
 			};
 		};
+
+		gpio0: gpio@2603000 {
+			compatible = "ti,keystone-k2g-gpio";
+			reg = <0x02603000 0x100>;
+			gpio-controller;
+			#gpio-cells = <2>;
+
+			interrupts = <GIC_SPI 432 IRQ_TYPE_EDGE_RISING>,
+					<GIC_SPI 433 IRQ_TYPE_EDGE_RISING>,
+					<GIC_SPI 434 IRQ_TYPE_EDGE_RISING>,
+					<GIC_SPI 435 IRQ_TYPE_EDGE_RISING>,
+					<GIC_SPI 436 IRQ_TYPE_EDGE_RISING>,
+					<GIC_SPI 437 IRQ_TYPE_EDGE_RISING>,
+					<GIC_SPI 438 IRQ_TYPE_EDGE_RISING>,
+					<GIC_SPI 439 IRQ_TYPE_EDGE_RISING>,
+					<GIC_SPI 440 IRQ_TYPE_EDGE_RISING>;
+			interrupt-controller;
+			#interrupt-cells = <2>;
+			ti,ngpio = <144>;
+			ti,davinci-gpio-unbanked = <0>;
+			clocks = <&k2g_clks 0x001b 0x0>;
+			clock-names = "gpio";
+		};
+
+		gpio1: gpio@260a000 {
+			compatible = "ti,keystone-k2g-gpio";
+			reg = <0x0260a000 0x100>;
+			gpio-controller;
+			#gpio-cells = <2>;
+			interrupts = <GIC_SPI 442 IRQ_TYPE_EDGE_RISING>,
+					<GIC_SPI 443 IRQ_TYPE_EDGE_RISING>,
+					<GIC_SPI 444 IRQ_TYPE_EDGE_RISING>,
+					<GIC_SPI 445 IRQ_TYPE_EDGE_RISING>,
+					<GIC_SPI 446 IRQ_TYPE_EDGE_RISING>;
+			interrupt-controller;
+			#interrupt-cells = <2>;
+			ti,ngpio = <68>;
+			ti,davinci-gpio-unbanked = <0>;
+			clocks = <&k2g_clks 0x001c 0x0>;
+			clock-names = "gpio";
+		};
 	};
 };
-- 
1.9.1

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


#1690577 — Re: [PATCH 4/4] ARM: dts: keystone-k2g-evm: Add gpio nodes

FromSuman Anna <s-anna@ti.com>
Date2017-07-18 21:20 +0200
SubjectRe: [PATCH 4/4] ARM: dts: keystone-k2g-evm: Add gpio nodes
Message-ID<u4Gch-6nx-3@gated-at.bofh.it>
In reply to#1690111
Hi Keerthy,

On 07/18/2017 05:57 AM, Keerthy wrote:
> keystone-k2g has 2 instances of gpio. The first one has all the 144 GPIOs

Please use 66AK2G for keystone-k2g.

> functional( 9 banks with 16 gpios = 144). The second instance has
> only the GPIO0:GPIO67 functional and rest are marked reserved.
> 
> Signed-off-by: Keerthy <j-keerthy@ti.com>
> ---
>  arch/arm/boot/dts/keystone-k2g.dtsi | 42 +++++++++++++++++++++++++++++++++++++
>  1 file changed, 42 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/keystone-k2g.dtsi b/arch/arm/boot/dts/keystone-k2g.dtsi
> index bf4d1fa..58ac3db 100644
> --- a/arch/arm/boot/dts/keystone-k2g.dtsi
> +++ b/arch/arm/boot/dts/keystone-k2g.dtsi
> @@ -15,6 +15,7 @@
>  
>  #include <dt-bindings/interrupt-controller/arm-gic.h>
>  #include <dt-bindings/pinctrl/keystone.h>
> +#include <dt-bindings/gpio/gpio.h>
>  
>  / {
>  	compatible = "ti,k2g","ti,keystone";
> @@ -168,5 +169,46 @@
>  				#reset-cells = <2>;
>  			};
>  		};
> +
> +		gpio0: gpio@2603000 {
> +			compatible = "ti,keystone-k2g-gpio";
> +			reg = <0x02603000 0x100>;
> +			gpio-controller;
> +			#gpio-cells = <2>;
> +
> +			interrupts = <GIC_SPI 432 IRQ_TYPE_EDGE_RISING>,
> +					<GIC_SPI 433 IRQ_TYPE_EDGE_RISING>,
> +					<GIC_SPI 434 IRQ_TYPE_EDGE_RISING>,
> +					<GIC_SPI 435 IRQ_TYPE_EDGE_RISING>,
> +					<GIC_SPI 436 IRQ_TYPE_EDGE_RISING>,
> +					<GIC_SPI 437 IRQ_TYPE_EDGE_RISING>,
> +					<GIC_SPI 438 IRQ_TYPE_EDGE_RISING>,
> +					<GIC_SPI 439 IRQ_TYPE_EDGE_RISING>,
> +					<GIC_SPI 440 IRQ_TYPE_EDGE_RISING>;
> +			interrupt-controller;
> +			#interrupt-cells = <2>;
> +			ti,ngpio = <144>;
> +			ti,davinci-gpio-unbanked = <0>;
> +			clocks = <&k2g_clks 0x001b 0x0>;
> +			clock-names = "gpio";

I don't see the clocks and clock-names documented in the binding.
Looking at davinci_gpio_irq_setup(), these are required, and a specific
clock name is what the driver is looking for. And you have different
semantics for this on K2G and non-K2G SoCs. Davinci platforms are using
non-DT clocks, so their DT nodes didn't have them.

regards
Suman

> +		};
> +
> +		gpio1: gpio@260a000 {
> +			compatible = "ti,keystone-k2g-gpio";
> +			reg = <0x0260a000 0x100>;
> +			gpio-controller;
> +			#gpio-cells = <2>;
> +			interrupts = <GIC_SPI 442 IRQ_TYPE_EDGE_RISING>,
> +					<GIC_SPI 443 IRQ_TYPE_EDGE_RISING>,
> +					<GIC_SPI 444 IRQ_TYPE_EDGE_RISING>,
> +					<GIC_SPI 445 IRQ_TYPE_EDGE_RISING>,
> +					<GIC_SPI 446 IRQ_TYPE_EDGE_RISING>;
> +			interrupt-controller;
> +			#interrupt-cells = <2>;
> +			ti,ngpio = <68>;
> +			ti,davinci-gpio-unbanked = <0>;
> +			clocks = <&k2g_clks 0x001c 0x0>;
> +			clock-names = "gpio";
> +		};
>  	};
>  };
> 

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


#1690952 — Re: [PATCH 4/4] ARM: dts: keystone-k2g-evm: Add gpio nodes

FromKeerthy <j-keerthy@ti.com>
Date2017-07-19 06:10 +0200
SubjectRe: [PATCH 4/4] ARM: dts: keystone-k2g-evm: Add gpio nodes
Message-ID<u4Otb-3eF-5@gated-at.bofh.it>
In reply to#1690577

On Wednesday 19 July 2017 12:43 AM, Suman Anna wrote:
> Hi Keerthy,
> 
> On 07/18/2017 05:57 AM, Keerthy wrote:
>> keystone-k2g has 2 instances of gpio. The first one has all the 144 GPIOs
> 
> Please use 66AK2G for keystone-k2g.

Okay

> 
>> functional( 9 banks with 16 gpios = 144). The second instance has
>> only the GPIO0:GPIO67 functional and rest are marked reserved.
>>
>> Signed-off-by: Keerthy <j-keerthy@ti.com>
>> ---
>>  arch/arm/boot/dts/keystone-k2g.dtsi | 42 +++++++++++++++++++++++++++++++++++++
>>  1 file changed, 42 insertions(+)
>>
>> diff --git a/arch/arm/boot/dts/keystone-k2g.dtsi b/arch/arm/boot/dts/keystone-k2g.dtsi
>> index bf4d1fa..58ac3db 100644
>> --- a/arch/arm/boot/dts/keystone-k2g.dtsi
>> +++ b/arch/arm/boot/dts/keystone-k2g.dtsi
>> @@ -15,6 +15,7 @@
>>  
>>  #include <dt-bindings/interrupt-controller/arm-gic.h>
>>  #include <dt-bindings/pinctrl/keystone.h>
>> +#include <dt-bindings/gpio/gpio.h>
>>  
>>  / {
>>  	compatible = "ti,k2g","ti,keystone";
>> @@ -168,5 +169,46 @@
>>  				#reset-cells = <2>;
>>  			};
>>  		};
>> +
>> +		gpio0: gpio@2603000 {
>> +			compatible = "ti,keystone-k2g-gpio";
>> +			reg = <0x02603000 0x100>;
>> +			gpio-controller;
>> +			#gpio-cells = <2>;
>> +
>> +			interrupts = <GIC_SPI 432 IRQ_TYPE_EDGE_RISING>,
>> +					<GIC_SPI 433 IRQ_TYPE_EDGE_RISING>,
>> +					<GIC_SPI 434 IRQ_TYPE_EDGE_RISING>,
>> +					<GIC_SPI 435 IRQ_TYPE_EDGE_RISING>,
>> +					<GIC_SPI 436 IRQ_TYPE_EDGE_RISING>,
>> +					<GIC_SPI 437 IRQ_TYPE_EDGE_RISING>,
>> +					<GIC_SPI 438 IRQ_TYPE_EDGE_RISING>,
>> +					<GIC_SPI 439 IRQ_TYPE_EDGE_RISING>,
>> +					<GIC_SPI 440 IRQ_TYPE_EDGE_RISING>;
>> +			interrupt-controller;
>> +			#interrupt-cells = <2>;
>> +			ti,ngpio = <144>;
>> +			ti,davinci-gpio-unbanked = <0>;
>> +			clocks = <&k2g_clks 0x001b 0x0>;
>> +			clock-names = "gpio";
> 
> I don't see the clocks and clock-names documented in the binding.
> Looking at davinci_gpio_irq_setup(), these are required, and a specific
> clock name is what the driver is looking for. And you have different
> semantics for this on K2G and non-K2G SoCs. Davinci platforms are using
> non-DT clocks, so their DT nodes didn't have them.

I will document the same.

> 
> regards
> Suman
> 
>> +		};
>> +
>> +		gpio1: gpio@260a000 {
>> +			compatible = "ti,keystone-k2g-gpio";
>> +			reg = <0x0260a000 0x100>;
>> +			gpio-controller;
>> +			#gpio-cells = <2>;
>> +			interrupts = <GIC_SPI 442 IRQ_TYPE_EDGE_RISING>,
>> +					<GIC_SPI 443 IRQ_TYPE_EDGE_RISING>,
>> +					<GIC_SPI 444 IRQ_TYPE_EDGE_RISING>,
>> +					<GIC_SPI 445 IRQ_TYPE_EDGE_RISING>,
>> +					<GIC_SPI 446 IRQ_TYPE_EDGE_RISING>;
>> +			interrupt-controller;
>> +			#interrupt-cells = <2>;
>> +			ti,ngpio = <68>;
>> +			ti,davinci-gpio-unbanked = <0>;
>> +			clocks = <&k2g_clks 0x001c 0x0>;
>> +			clock-names = "gpio";
>> +		};
>>  	};
>>  };
>>
> 

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


#1690114 — [PATCH 1/4] gpio: davinci: Use devm_gpiochip_add_data in place of gpiochip_add_data

FromKeerthy <j-keerthy@ti.com>
Date2017-07-18 13:00 +0200
Subject[PATCH 1/4] gpio: davinci: Use devm_gpiochip_add_data in place of gpiochip_add_data
Message-ID<u4yos-1lh-63@gated-at.bofh.it>
In reply to#1690101
Use the devm version of gpiochip_add_data and pass on the
return value. Reset the static variables to 0 before returning.

Signed-off-by: Keerthy <j-keerthy@ti.com>
---
 drivers/gpio/gpio-davinci.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/gpio-davinci.c b/drivers/gpio/gpio-davinci.c
index 65cb359..2c88054 100644
--- a/drivers/gpio/gpio-davinci.c
+++ b/drivers/gpio/gpio-davinci.c
@@ -166,7 +166,7 @@ static int davinci_gpio_get(struct gpio_chip *chip, unsigned offset)
 static int davinci_gpio_probe(struct platform_device *pdev)
 {
 	static int ctrl_num, bank_base;
-	int gpio, bank;
+	int gpio, bank, ret = 0;
 	unsigned ngpio, nbank;
 	struct davinci_gpio_controller *chips;
 	struct davinci_gpio_platform_data *pdata;
@@ -232,7 +232,13 @@ static int davinci_gpio_probe(struct platform_device *pdev)
 	for (gpio = 0, bank = 0; gpio < ngpio; gpio += 32, bank++)
 		chips->regs[bank] = gpio_base + offset_array[bank];
 
-	gpiochip_add_data(&chips->chip, chips);
+	ret = devm_gpiochip_add_data(dev, &chips->chip, chips);
+	if (ret) {
+		ctrl_num = 0;
+		bank_base = 0;
+		return ret;
+	}
+
 	platform_set_drvdata(pdev, chips);
 	davinci_gpio_irq_setup(pdev);
 	return 0;
-- 
1.9.1

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


#1690442 — Re: [PATCH 1/4] gpio: davinci: Use devm_gpiochip_add_data in place of gpiochip_add_data

FromSuman Anna <s-anna@ti.com>
Date2017-07-18 19:00 +0200
SubjectRe: [PATCH 1/4] gpio: davinci: Use devm_gpiochip_add_data in place of gpiochip_add_data
Message-ID<u4E0N-4S6-1@gated-at.bofh.it>
In reply to#1690114
Hi Keerthy,

On 07/18/2017 05:57 AM, Keerthy wrote:
> Use the devm version of gpiochip_add_data and pass on the
> return value. Reset the static variables to 0 before returning.
> 
> Signed-off-by: Keerthy <j-keerthy@ti.com>
> ---
>  drivers/gpio/gpio-davinci.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpio/gpio-davinci.c b/drivers/gpio/gpio-davinci.c
> index 65cb359..2c88054 100644
> --- a/drivers/gpio/gpio-davinci.c
> +++ b/drivers/gpio/gpio-davinci.c
> @@ -166,7 +166,7 @@ static int davinci_gpio_get(struct gpio_chip *chip, unsigned offset)
>  static int davinci_gpio_probe(struct platform_device *pdev)
>  {
>  	static int ctrl_num, bank_base;
> -	int gpio, bank;
> +	int gpio, bank, ret = 0;
>  	unsigned ngpio, nbank;
>  	struct davinci_gpio_controller *chips;
>  	struct davinci_gpio_platform_data *pdata;
> @@ -232,7 +232,13 @@ static int davinci_gpio_probe(struct platform_device *pdev)
>  	for (gpio = 0, bank = 0; gpio < ngpio; gpio += 32, bank++)
>  		chips->regs[bank] = gpio_base + offset_array[bank];
>  
> -	gpiochip_add_data(&chips->chip, chips);
> +	ret = devm_gpiochip_add_data(dev, &chips->chip, chips);
> +	if (ret) {
> +		ctrl_num = 0;
> +		bank_base = 0;

Hmm, this doesn't look right to me. These variables are defined as
static, and you are resetting them unconditionally. This should be an
issue when you have multiple devices and one of them fails.

regards
Suman

> +		return ret;
> +	}
> +
>  	platform_set_drvdata(pdev, chips);
>  	davinci_gpio_irq_setup(pdev);
>  	return 0;
> 

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


#1690524 — Re: [PATCH 1/4] gpio: davinci: Use devm_gpiochip_add_data in place of gpiochip_add_data

FromKeerthy <j-keerthy@ti.com>
Date2017-07-18 19:50 +0200
SubjectRe: [PATCH 1/4] gpio: davinci: Use devm_gpiochip_add_data in place of gpiochip_add_data
Message-ID<u4ENb-5q1-9@gated-at.bofh.it>
In reply to#1690442

On Tuesday 18 July 2017 10:20 PM, Suman Anna wrote:
> Hi Keerthy,
> 
> On 07/18/2017 05:57 AM, Keerthy wrote:
>> Use the devm version of gpiochip_add_data and pass on the
>> return value. Reset the static variables to 0 before returning.
>>
>> Signed-off-by: Keerthy <j-keerthy@ti.com>
>> ---
>>  drivers/gpio/gpio-davinci.c | 10 ++++++++--
>>  1 file changed, 8 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpio/gpio-davinci.c b/drivers/gpio/gpio-davinci.c
>> index 65cb359..2c88054 100644
>> --- a/drivers/gpio/gpio-davinci.c
>> +++ b/drivers/gpio/gpio-davinci.c
>> @@ -166,7 +166,7 @@ static int davinci_gpio_get(struct gpio_chip *chip, unsigned offset)
>>  static int davinci_gpio_probe(struct platform_device *pdev)
>>  {
>>  	static int ctrl_num, bank_base;
>> -	int gpio, bank;
>> +	int gpio, bank, ret = 0;
>>  	unsigned ngpio, nbank;
>>  	struct davinci_gpio_controller *chips;
>>  	struct davinci_gpio_platform_data *pdata;
>> @@ -232,7 +232,13 @@ static int davinci_gpio_probe(struct platform_device *pdev)
>>  	for (gpio = 0, bank = 0; gpio < ngpio; gpio += 32, bank++)
>>  		chips->regs[bank] = gpio_base + offset_array[bank];
>>  
>> -	gpiochip_add_data(&chips->chip, chips);
>> +	ret = devm_gpiochip_add_data(dev, &chips->chip, chips);
>> +	if (ret) {
>> +		ctrl_num = 0;
>> +		bank_base = 0;
> 
> Hmm, this doesn't look right to me. These variables are defined as
> static, and you are resetting them unconditionally. This should be an
> issue when you have multiple devices and one of them fails.

Agreed. With multiple instances this can reset the successful count also.

Upon failure in any iteration, the following should take care of those
static variables:

/* Revert the static variable increments */
        ctrl_num--;
        bank_base -= ngpio;

Thanks for the quick review!

Reagrds,
Keerthy

> 
> regards
> Suman
> 
>> +		return ret;
>> +	}
>> +
>>  	platform_set_drvdata(pdev, chips);
>>  	davinci_gpio_irq_setup(pdev);
>>  	return 0;
>>
> 

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


#1691188 — Re: [PATCH 1/4] gpio: davinci: Use devm_gpiochip_add_data in place of gpiochip_add_data

FromJohan Hovold <johan@kernel.org>
Date2017-07-19 11:40 +0200
SubjectRe: [PATCH 1/4] gpio: davinci: Use devm_gpiochip_add_data in place of gpiochip_add_data
Message-ID<u4TCx-6D1-1@gated-at.bofh.it>
In reply to#1690114
On Tue, Jul 18, 2017 at 04:27:13PM +0530, Keerthy wrote:
> Use the devm version of gpiochip_add_data and pass on the
> return value. Reset the static variables to 0 before returning.

You need to describe not just what you do, but also why you it. In this
case, your fixing memory leaks and the gpio chip being left registered
if this driver is unbound.

Johan

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


#1691259 — Re: [PATCH 1/4] gpio: davinci: Use devm_gpiochip_add_data in place of gpiochip_add_data

FromKeerthy <j-keerthy@ti.com>
Date2017-07-19 12:00 +0200
SubjectRe: [PATCH 1/4] gpio: davinci: Use devm_gpiochip_add_data in place of gpiochip_add_data
Message-ID<u4TVV-6Ls-43@gated-at.bofh.it>
In reply to#1691188

On Wednesday 19 July 2017 03:07 PM, Johan Hovold wrote:
> On Tue, Jul 18, 2017 at 04:27:13PM +0530, Keerthy wrote:
>> Use the devm version of gpiochip_add_data and pass on the
>> return value. Reset the static variables to 0 before returning.
> 
> You need to describe not just what you do, but also why you it. In this
> case, your fixing memory leaks and the gpio chip being left registered
> if this driver is unbound.

Sure i can add more description as mentioned above.

> 
> Johan
> 

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


#1690118 — [PATCH 2/4] gpio: davinci: Handle the return value of davinci_gpio_irq_setup function

FromKeerthy <j-keerthy@ti.com>
Date2017-07-18 13:00 +0200
Subject[PATCH 2/4] gpio: davinci: Handle the return value of davinci_gpio_irq_setup function
Message-ID<u4yos-1lh-83@gated-at.bofh.it>
In reply to#1690101
Currently davinci_gpio_irq_setup return value is ignored. Handle the
return value appropriately.

Signed-off-by: Keerthy <j-keerthy@ti.com>
---
 drivers/gpio/gpio-davinci.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/drivers/gpio/gpio-davinci.c b/drivers/gpio/gpio-davinci.c
index 2c88054..932f270 100644
--- a/drivers/gpio/gpio-davinci.c
+++ b/drivers/gpio/gpio-davinci.c
@@ -233,15 +233,23 @@ static int davinci_gpio_probe(struct platform_device *pdev)
 		chips->regs[bank] = gpio_base + offset_array[bank];
 
 	ret = devm_gpiochip_add_data(dev, &chips->chip, chips);
+	if (ret)
+		goto err;
+
+	platform_set_drvdata(pdev, chips);
+	ret = davinci_gpio_irq_setup(pdev);
 	if (ret) {
-		ctrl_num = 0;
-		bank_base = 0;
-		return ret;
+		platform_set_drvdata(pdev, NULL);
+		goto err;
 	}
 
-	platform_set_drvdata(pdev, chips);
-	davinci_gpio_irq_setup(pdev);
 	return 0;
+
+err:
+	ctrl_num = 0;
+	bank_base = 0;
+
+	return ret;
 }
 
 /*--------------------------------------------------------------------------*/
-- 
1.9.1

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


#1690455 — Re: [PATCH 2/4] gpio: davinci: Handle the return value of davinci_gpio_irq_setup function

FromSuman Anna <s-anna@ti.com>
Date2017-07-18 19:00 +0200
SubjectRe: [PATCH 2/4] gpio: davinci: Handle the return value of davinci_gpio_irq_setup function
Message-ID<u4E0P-4S6-49@gated-at.bofh.it>
In reply to#1690118
Hi Keerthy,

On 07/18/2017 05:57 AM, Keerthy wrote:
> Currently davinci_gpio_irq_setup return value is ignored. Handle the
> return value appropriately.
> 
> Signed-off-by: Keerthy <j-keerthy@ti.com>
> ---
>  drivers/gpio/gpio-davinci.c | 18 +++++++++++++-----
>  1 file changed, 13 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpio/gpio-davinci.c b/drivers/gpio/gpio-davinci.c
> index 2c88054..932f270 100644
> --- a/drivers/gpio/gpio-davinci.c
> +++ b/drivers/gpio/gpio-davinci.c
> @@ -233,15 +233,23 @@ static int davinci_gpio_probe(struct platform_device *pdev)
>  		chips->regs[bank] = gpio_base + offset_array[bank];
>  
>  	ret = devm_gpiochip_add_data(dev, &chips->chip, chips);
> +	if (ret)
> +		goto err;
> +
> +	platform_set_drvdata(pdev, chips);
> +	ret = davinci_gpio_irq_setup(pdev);
>  	if (ret) {
> -		ctrl_num = 0;
> -		bank_base = 0;
> -		return ret;
> +		platform_set_drvdata(pdev, NULL);

This is not needed, driver core will set this automatically if probe fails.

> +		goto err;
>  	}
>  
> -	platform_set_drvdata(pdev, chips);
> -	davinci_gpio_irq_setup(pdev);
>  	return 0;
> +
> +err:
> +	ctrl_num = 0;
> +	bank_base = 0;

Same comments as on Patch 1.

regards
Suman

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


#1690521 — Re: [PATCH 2/4] gpio: davinci: Handle the return value of davinci_gpio_irq_setup function

FromKeerthy <j-keerthy@ti.com>
Date2017-07-18 19:50 +0200
SubjectRe: [PATCH 2/4] gpio: davinci: Handle the return value of davinci_gpio_irq_setup function
Message-ID<u4ENb-5q1-1@gated-at.bofh.it>
In reply to#1690455

On Tuesday 18 July 2017 10:24 PM, Suman Anna wrote:
> Hi Keerthy,
> 
> On 07/18/2017 05:57 AM, Keerthy wrote:
>> Currently davinci_gpio_irq_setup return value is ignored. Handle the
>> return value appropriately.
>>
>> Signed-off-by: Keerthy <j-keerthy@ti.com>
>> ---
>>  drivers/gpio/gpio-davinci.c | 18 +++++++++++++-----
>>  1 file changed, 13 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/gpio/gpio-davinci.c b/drivers/gpio/gpio-davinci.c
>> index 2c88054..932f270 100644
>> --- a/drivers/gpio/gpio-davinci.c
>> +++ b/drivers/gpio/gpio-davinci.c
>> @@ -233,15 +233,23 @@ static int davinci_gpio_probe(struct platform_device *pdev)
>>  		chips->regs[bank] = gpio_base + offset_array[bank];
>>  
>>  	ret = devm_gpiochip_add_data(dev, &chips->chip, chips);
>> +	if (ret)
>> +		goto err;
>> +
>> +	platform_set_drvdata(pdev, chips);
>> +	ret = davinci_gpio_irq_setup(pdev);
>>  	if (ret) {
>> -		ctrl_num = 0;
>> -		bank_base = 0;
>> -		return ret;
>> +		platform_set_drvdata(pdev, NULL);
> 
> This is not needed, driver core will set this automatically if probe fails.

okay. I will remove this.

> 
>> +		goto err;
>>  	}
>>  
>> -	platform_set_drvdata(pdev, chips);
>> -	davinci_gpio_irq_setup(pdev);
>>  	return 0;
>> +
>> +err:
>> +	ctrl_num = 0;
>> +	bank_base = 0;
> 
> Same comments as on Patch 1.

Yup will fix this as i have done with Patch 1.

> 
> regards
> Suman
> 

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


#1691504 — Re: [PATCH 2/4] gpio: davinci: Handle the return value of davinci_gpio_irq_setup function

FromJohan Hovold <johan@kernel.org>
Date2017-07-19 13:20 +0200
SubjectRe: [PATCH 2/4] gpio: davinci: Handle the return value of davinci_gpio_irq_setup function
Message-ID<u4Vbm-7Nz-71@gated-at.bofh.it>
In reply to#1690118
On Tue, Jul 18, 2017 at 04:27:14PM +0530, Keerthy wrote:
> Currently davinci_gpio_irq_setup return value is ignored. Handle the
> return value appropriately.
>
> Signed-off-by: Keerthy <j-keerthy@ti.com>
> ---
>  drivers/gpio/gpio-davinci.c | 18 +++++++++++++-----
>  1 file changed, 13 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpio/gpio-davinci.c b/drivers/gpio/gpio-davinci.c
> index 2c88054..932f270 100644
> --- a/drivers/gpio/gpio-davinci.c
> +++ b/drivers/gpio/gpio-davinci.c
> @@ -233,15 +233,23 @@ static int davinci_gpio_probe(struct platform_device *pdev)
>  		chips->regs[bank] = gpio_base + offset_array[bank];
>  
>  	ret = devm_gpiochip_add_data(dev, &chips->chip, chips);
> +	if (ret)
> +		goto err;
> +
> +	platform_set_drvdata(pdev, chips);
> +	ret = davinci_gpio_irq_setup(pdev);
>  	if (ret) {
> -		ctrl_num = 0;
> -		bank_base = 0;
> -		return ret;
> +		platform_set_drvdata(pdev, NULL);
> +		goto err;
>  	}
>  
> -	platform_set_drvdata(pdev, chips);
> -	davinci_gpio_irq_setup(pdev);
>  	return 0;

There's a separate but related bug here too as the clk_prepare_enable()
in davinci_gpio_irq_setup() is never balanced on driver unbind.

Johan

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


#1692471 — Re: [PATCH 2/4] gpio: davinci: Handle the return value of davinci_gpio_irq_setup function

FromKeerthy <j-keerthy@ti.com>
Date2017-07-20 08:50 +0200
SubjectRe: [PATCH 2/4] gpio: davinci: Handle the return value of davinci_gpio_irq_setup function
Message-ID<u5drz-3uU-5@gated-at.bofh.it>
In reply to#1691504

On Wednesday 19 July 2017 04:40 PM, Johan Hovold wrote:
> On Tue, Jul 18, 2017 at 04:27:14PM +0530, Keerthy wrote:
>> Currently davinci_gpio_irq_setup return value is ignored. Handle the
>> return value appropriately.
>>
>> Signed-off-by: Keerthy <j-keerthy@ti.com>
>> ---
>>  drivers/gpio/gpio-davinci.c | 18 +++++++++++++-----
>>  1 file changed, 13 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/gpio/gpio-davinci.c b/drivers/gpio/gpio-davinci.c
>> index 2c88054..932f270 100644
>> --- a/drivers/gpio/gpio-davinci.c
>> +++ b/drivers/gpio/gpio-davinci.c
>> @@ -233,15 +233,23 @@ static int davinci_gpio_probe(struct platform_device *pdev)
>>  		chips->regs[bank] = gpio_base + offset_array[bank];
>>  
>>  	ret = devm_gpiochip_add_data(dev, &chips->chip, chips);
>> +	if (ret)
>> +		goto err;
>> +
>> +	platform_set_drvdata(pdev, chips);
>> +	ret = davinci_gpio_irq_setup(pdev);
>>  	if (ret) {
>> -		ctrl_num = 0;
>> -		bank_base = 0;
>> -		return ret;
>> +		platform_set_drvdata(pdev, NULL);
>> +		goto err;
>>  	}
>>  
>> -	platform_set_drvdata(pdev, chips);
>> -	davinci_gpio_irq_setup(pdev);
>>  	return 0;
> 
> There's a separate but related bug here too as the clk_prepare_enable()
> in davinci_gpio_irq_setup() is never balanced on driver unbind.

Yes Johan. I will send that as a separate patch.

> 
> Johan
> 

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


#1692667 — Re: [PATCH 2/4] gpio: davinci: Handle the return value of davinci_gpio_irq_setup function

FromKeerthy <j-keerthy@ti.com>
Date2017-07-20 11:20 +0200
SubjectRe: [PATCH 2/4] gpio: davinci: Handle the return value of davinci_gpio_irq_setup function
Message-ID<u5fMJ-5hG-7@gated-at.bofh.it>
In reply to#1692471

On Thursday 20 July 2017 12:14 PM, Keerthy wrote:
> 
> 
> On Wednesday 19 July 2017 04:40 PM, Johan Hovold wrote:
>> On Tue, Jul 18, 2017 at 04:27:14PM +0530, Keerthy wrote:
>>> Currently davinci_gpio_irq_setup return value is ignored. Handle the
>>> return value appropriately.
>>>
>>> Signed-off-by: Keerthy <j-keerthy@ti.com>
>>> ---
>>>  drivers/gpio/gpio-davinci.c | 18 +++++++++++++-----
>>>  1 file changed, 13 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/drivers/gpio/gpio-davinci.c b/drivers/gpio/gpio-davinci.c
>>> index 2c88054..932f270 100644
>>> --- a/drivers/gpio/gpio-davinci.c
>>> +++ b/drivers/gpio/gpio-davinci.c
>>> @@ -233,15 +233,23 @@ static int davinci_gpio_probe(struct platform_device *pdev)
>>>  		chips->regs[bank] = gpio_base + offset_array[bank];
>>>  
>>>  	ret = devm_gpiochip_add_data(dev, &chips->chip, chips);
>>> +	if (ret)
>>> +		goto err;
>>> +
>>> +	platform_set_drvdata(pdev, chips);
>>> +	ret = davinci_gpio_irq_setup(pdev);
>>>  	if (ret) {
>>> -		ctrl_num = 0;
>>> -		bank_base = 0;
>>> -		return ret;
>>> +		platform_set_drvdata(pdev, NULL);
>>> +		goto err;
>>>  	}
>>>  
>>> -	platform_set_drvdata(pdev, chips);
>>> -	davinci_gpio_irq_setup(pdev);
>>>  	return 0;
>>
>> There's a separate but related bug here too as the clk_prepare_enable()
>> in davinci_gpio_irq_setup() is never balanced on driver unbind.
> 
> Yes Johan. I will send that as a separate patch.

This is already fixed in the latest kernel:

commit 6dc0048cff988858254fcc26becfc1e9753efa79
Author: Arvind Yadav <arvind.yadav.cs@gmail.com>
Date:   Tue May 23 14:48:57 2017 +0530

Regards,
Keerthy
> 
>>
>> Johan
>>

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


#1692711 — Re: [PATCH 2/4] gpio: davinci: Handle the return value of davinci_gpio_irq_setup function

FromJohan Hovold <johan@kernel.org>
Date2017-07-20 12:00 +0200
SubjectRe: [PATCH 2/4] gpio: davinci: Handle the return value of davinci_gpio_irq_setup function
Message-ID<u5gpr-5yL-5@gated-at.bofh.it>
In reply to#1692667
On Thu, Jul 20, 2017 at 02:40:37PM +0530, Keerthy wrote:
> 
> 
> On Thursday 20 July 2017 12:14 PM, Keerthy wrote:
> > 
> > 
> > On Wednesday 19 July 2017 04:40 PM, Johan Hovold wrote:
> >> On Tue, Jul 18, 2017 at 04:27:14PM +0530, Keerthy wrote:
> >>> Currently davinci_gpio_irq_setup return value is ignored. Handle the
> >>> return value appropriately.
> >>>
> >>> Signed-off-by: Keerthy <j-keerthy@ti.com>
> >>> ---
> >>>  drivers/gpio/gpio-davinci.c | 18 +++++++++++++-----
> >>>  1 file changed, 13 insertions(+), 5 deletions(-)
> >>>
> >>> diff --git a/drivers/gpio/gpio-davinci.c b/drivers/gpio/gpio-davinci.c
> >>> index 2c88054..932f270 100644
> >>> --- a/drivers/gpio/gpio-davinci.c
> >>> +++ b/drivers/gpio/gpio-davinci.c
> >>> @@ -233,15 +233,23 @@ static int davinci_gpio_probe(struct platform_device *pdev)
> >>>  		chips->regs[bank] = gpio_base + offset_array[bank];
> >>>  
> >>>  	ret = devm_gpiochip_add_data(dev, &chips->chip, chips);
> >>> +	if (ret)
> >>> +		goto err;
> >>> +
> >>> +	platform_set_drvdata(pdev, chips);
> >>> +	ret = davinci_gpio_irq_setup(pdev);
> >>>  	if (ret) {
> >>> -		ctrl_num = 0;
> >>> -		bank_base = 0;
> >>> -		return ret;
> >>> +		platform_set_drvdata(pdev, NULL);
> >>> +		goto err;
> >>>  	}
> >>>  
> >>> -	platform_set_drvdata(pdev, chips);
> >>> -	davinci_gpio_irq_setup(pdev);
> >>>  	return 0;
> >>
> >> There's a separate but related bug here too as the clk_prepare_enable()
> >> in davinci_gpio_irq_setup() is never balanced on driver unbind.
> > 
> > Yes Johan. I will send that as a separate patch.
> 
> This is already fixed in the latest kernel:
> 
> commit 6dc0048cff988858254fcc26becfc1e9753efa79
> Author: Arvind Yadav <arvind.yadav.cs@gmail.com>
> Date:   Tue May 23 14:48:57 2017 +0530

That change only handles errors in davinci_gpio_irq_setup() (i.e. during
probe) and not the imbalance at driver unbind that I was referring to.

Johan

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


#1692716 — Re: [PATCH 2/4] gpio: davinci: Handle the return value of davinci_gpio_irq_setup function

FromKeerthy <j-keerthy@ti.com>
Date2017-07-20 12:10 +0200
SubjectRe: [PATCH 2/4] gpio: davinci: Handle the return value of davinci_gpio_irq_setup function
Message-ID<u5gz7-5RF-1@gated-at.bofh.it>
In reply to#1692711

On Thursday 20 July 2017 03:20 PM, Johan Hovold wrote:
> On Thu, Jul 20, 2017 at 02:40:37PM +0530, Keerthy wrote:
>>
>>
>> On Thursday 20 July 2017 12:14 PM, Keerthy wrote:
>>>
>>>
>>> On Wednesday 19 July 2017 04:40 PM, Johan Hovold wrote:
>>>> On Tue, Jul 18, 2017 at 04:27:14PM +0530, Keerthy wrote:
>>>>> Currently davinci_gpio_irq_setup return value is ignored. Handle the
>>>>> return value appropriately.
>>>>>
>>>>> Signed-off-by: Keerthy <j-keerthy@ti.com>
>>>>> ---
>>>>>  drivers/gpio/gpio-davinci.c | 18 +++++++++++++-----
>>>>>  1 file changed, 13 insertions(+), 5 deletions(-)
>>>>>
>>>>> diff --git a/drivers/gpio/gpio-davinci.c b/drivers/gpio/gpio-davinci.c
>>>>> index 2c88054..932f270 100644
>>>>> --- a/drivers/gpio/gpio-davinci.c
>>>>> +++ b/drivers/gpio/gpio-davinci.c
>>>>> @@ -233,15 +233,23 @@ static int davinci_gpio_probe(struct platform_device *pdev)
>>>>>  		chips->regs[bank] = gpio_base + offset_array[bank];
>>>>>  
>>>>>  	ret = devm_gpiochip_add_data(dev, &chips->chip, chips);
>>>>> +	if (ret)
>>>>> +		goto err;
>>>>> +
>>>>> +	platform_set_drvdata(pdev, chips);
>>>>> +	ret = davinci_gpio_irq_setup(pdev);
>>>>>  	if (ret) {
>>>>> -		ctrl_num = 0;
>>>>> -		bank_base = 0;
>>>>> -		return ret;
>>>>> +		platform_set_drvdata(pdev, NULL);
>>>>> +		goto err;
>>>>>  	}
>>>>>  
>>>>> -	platform_set_drvdata(pdev, chips);
>>>>> -	davinci_gpio_irq_setup(pdev);
>>>>>  	return 0;
>>>>
>>>> There's a separate but related bug here too as the clk_prepare_enable()
>>>> in davinci_gpio_irq_setup() is never balanced on driver unbind.
>>>
>>> Yes Johan. I will send that as a separate patch.
>>
>> This is already fixed in the latest kernel:
>>
>> commit 6dc0048cff988858254fcc26becfc1e9753efa79
>> Author: Arvind Yadav <arvind.yadav.cs@gmail.com>
>> Date:   Tue May 23 14:48:57 2017 +0530
> 
> That change only handles errors in davinci_gpio_irq_setup() (i.e. during
> probe) and not the imbalance at driver unbind that I was referring to.

Okay got it. One more clk_unprepare_disable() call needs to be there in
probe err path.

> 
> Johan
> 

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


#1692720 — Re: [PATCH 2/4] gpio: davinci: Handle the return value of davinci_gpio_irq_setup function

FromJohan Hovold <johan@kernel.org>
Date2017-07-20 12:10 +0200
SubjectRe: [PATCH 2/4] gpio: davinci: Handle the return value of davinci_gpio_irq_setup function
Message-ID<u5gz9-5RF-25@gated-at.bofh.it>
In reply to#1692716
On Thu, Jul 20, 2017 at 03:32:27PM +0530, Keerthy wrote:
> On Thursday 20 July 2017 03:20 PM, Johan Hovold wrote:
> > On Thu, Jul 20, 2017 at 02:40:37PM +0530, Keerthy wrote:
> >> On Thursday 20 July 2017 12:14 PM, Keerthy wrote:
> >>> On Wednesday 19 July 2017 04:40 PM, Johan Hovold wrote:

> >>>> There's a separate but related bug here too as the clk_prepare_enable()
> >>>> in davinci_gpio_irq_setup() is never balanced on driver unbind.
> >>>
> >>> Yes Johan. I will send that as a separate patch.
> >>
> >> This is already fixed in the latest kernel:
> >>
> >> commit 6dc0048cff988858254fcc26becfc1e9753efa79
> >> Author: Arvind Yadav <arvind.yadav.cs@gmail.com>
> >> Date:   Tue May 23 14:48:57 2017 +0530
> > 
> > That change only handles errors in davinci_gpio_irq_setup() (i.e. during
> > probe) and not the imbalance at driver unbind that I was referring to.
> 
> Okay got it. One more clk_unprepare_disable() call needs to be there in
> probe err path.

No, you need to balance it on driver unbind, that is, in a new remove()
callback.

Johan

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


#1692734 — Re: [PATCH 2/4] gpio: davinci: Handle the return value of davinci_gpio_irq_setup function

FromKeerthy <j-keerthy@ti.com>
Date2017-07-20 12:20 +0200
SubjectRe: [PATCH 2/4] gpio: davinci: Handle the return value of davinci_gpio_irq_setup function
Message-ID<u5gIO-5VF-35@gated-at.bofh.it>
In reply to#1692720

On Thursday 20 July 2017 03:35 PM, Johan Hovold wrote:
> On Thu, Jul 20, 2017 at 03:32:27PM +0530, Keerthy wrote:
>> On Thursday 20 July 2017 03:20 PM, Johan Hovold wrote:
>>> On Thu, Jul 20, 2017 at 02:40:37PM +0530, Keerthy wrote:
>>>> On Thursday 20 July 2017 12:14 PM, Keerthy wrote:
>>>>> On Wednesday 19 July 2017 04:40 PM, Johan Hovold wrote:
> 
>>>>>> There's a separate but related bug here too as the clk_prepare_enable()
>>>>>> in davinci_gpio_irq_setup() is never balanced on driver unbind.
>>>>>
>>>>> Yes Johan. I will send that as a separate patch.
>>>>
>>>> This is already fixed in the latest kernel:
>>>>
>>>> commit 6dc0048cff988858254fcc26becfc1e9753efa79
>>>> Author: Arvind Yadav <arvind.yadav.cs@gmail.com>
>>>> Date:   Tue May 23 14:48:57 2017 +0530
>>>
>>> That change only handles errors in davinci_gpio_irq_setup() (i.e. during
>>> probe) and not the imbalance at driver unbind that I was referring to.
>>
>> Okay got it. One more clk_unprepare_disable() call needs to be there in
>> probe err path.
> 
> No, you need to balance it on driver unbind, that is, in a new remove()
> callback.

Okay yes davinci_gpio_irq_setup is the last call in probe so no need of
that in probe error path. I will add a new remove() to balance.

Thanks,
Keerthy

> 
> Johan
> 

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


#1693244 — Re: [PATCH 2/4] gpio: davinci: Handle the return value of davinci_gpio_irq_setup function

FromGrygorii Strashko <grygorii.strashko@ti.com>
Date2017-07-20 23:40 +0200
SubjectRe: [PATCH 2/4] gpio: davinci: Handle the return value of davinci_gpio_irq_setup function
Message-ID<u5rkT-4n6-21@gated-at.bofh.it>
In reply to#1692720

On 07/20/2017 05:05 AM, Johan Hovold wrote:
> On Thu, Jul 20, 2017 at 03:32:27PM +0530, Keerthy wrote:
>> On Thursday 20 July 2017 03:20 PM, Johan Hovold wrote:
>>> On Thu, Jul 20, 2017 at 02:40:37PM +0530, Keerthy wrote:
>>>> On Thursday 20 July 2017 12:14 PM, Keerthy wrote:
>>>>> On Wednesday 19 July 2017 04:40 PM, Johan Hovold wrote:
> 
>>>>>> There's a separate but related bug here too as the clk_prepare_enable()
>>>>>> in davinci_gpio_irq_setup() is never balanced on driver unbind.
>>>>>
>>>>> Yes Johan. I will send that as a separate patch.
>>>>
>>>> This is already fixed in the latest kernel:
>>>>
>>>> commit 6dc0048cff988858254fcc26becfc1e9753efa79
>>>> Author: Arvind Yadav <arvind.yadav.cs@gmail.com>
>>>> Date:   Tue May 23 14:48:57 2017 +0530
>>>
>>> That change only handles errors in davinci_gpio_irq_setup() (i.e. during
>>> probe) and not the imbalance at driver unbind that I was referring to.
>>
>> Okay got it. One more clk_unprepare_disable() call needs to be there in
>> probe err path.
> 
> No, you need to balance it on driver unbind, that is, in a new remove()
> callback.
> 

Sry, but manual driver unbind for this driver is really smth unexpected ;(
So, I'm not sure if it need to be implemented and even yes - it should not be
a part of this patch. Probably, smth like "convert driver to be a module".

By the way, I've tried to unbind gpio-omap, result - failure (expected),
as unbind does not take into account module refcnt state.


-- 
regards,
-grygorii

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


Page 1 of 2  [1] 2  Next page →

Back to top | Article view | linux.kernel


csiph-web