All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 0/3] i2c: mv64xxx: Fix clock resource for Armada 7K/8K
@ 2018-01-16 16:35 Gregory CLEMENT
  2018-01-16 16:35 ` [PATCH v4 1/3] i2c: mv64xxx: Remove useless test before clk_disable_unprepare Gregory CLEMENT
                   ` (3 more replies)
  0 siblings, 4 replies; 16+ messages in thread
From: Gregory CLEMENT @ 2018-01-16 16:35 UTC (permalink / raw)
  To: Wolfram Sang, linux-i2c
  Cc: Jason Cooper, Andrew Lunn, Sebastian Hesselbarth,
	Gregory CLEMENT, Thomas Petazzoni, linux-arm-kernel,
	Antoine Tenart, Miquèl Raynal, Nadav Haklai, Shadi Ammouri,
	Omri Itach, Hanna Hawa, Igal Liberman, Marcin Wojtas

Hi,

This short series fixes the way the clocks are used for the mv64xxx
controller embedded in the Marvell Armada 7K/8K SoCs. On these SoCs a
second one is needed in order to clock the registers. It was not
noticed until now because we relied on the bootloader and also because
the clock driver was wrong.

Thanks to this fix, it would be possible to fix the clock driver
without introducing a regression.

The first patch is just a small cleanup found when I wrote the main
patch.

The last patch is not related to the series but as Wolfram to have a
maintainer for this driver I added the patch here.

Thanks,

Gregory

Changelog:
v1 -> v2:

 - Really add the binding documentation in the second patch, noticed
   by Thomas Petazzoni.

v2 -> v3:

 - Fix typo in binding documentation reported by Thomas	Petazzoni
 - Use correct name for the axi clock, reported by Thomas Petazzoni

v2 -> v4:

 - Use "reg" instead of "axi" as requested by Maxime Ripard
 - Reformulate the binding documentation, requested by Maxime Ripard
 - Add a maintainer for the i2c-mv64xxx driver, requested by Woflram
   Sang

Gregory CLEMENT (3):
  i2c: mv64xxx: Remove useless test before clk_disable_unprepare
  i2c: mv64xxx: Fix clock resource by adding an optional bus clock
  i2c: mv64xxx: Add myslef as maintainer for this driver

 .../devicetree/bindings/i2c/i2c-mv64xxx.txt          | 20 ++++++++++++++++++++
 MAINTAINERS                                          |  6 ++++++
 drivers/i2c/busses/i2c-mv64xxx.c                     | 20 +++++++++++++-------
 3 files changed, 39 insertions(+), 7 deletions(-)

-- 
2.15.1

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v4 1/3] i2c: mv64xxx: Remove useless test before clk_disable_unprepare
  2018-01-16 16:35 [PATCH v4 0/3] i2c: mv64xxx: Fix clock resource for Armada 7K/8K Gregory CLEMENT
@ 2018-01-16 16:35 ` Gregory CLEMENT
  2018-01-26 17:40     ` Wolfram Sang
                     ` (2 more replies)
  2018-01-16 16:35 ` [PATCH v4 2/3] i2c: mv64xxx: Fix clock resource by adding an optional bus clock Gregory CLEMENT
                   ` (2 subsequent siblings)
  3 siblings, 3 replies; 16+ messages in thread
From: Gregory CLEMENT @ 2018-01-16 16:35 UTC (permalink / raw)
  To: Wolfram Sang, linux-i2c
  Cc: Jason Cooper, Andrew Lunn, Sebastian Hesselbarth,
	Gregory CLEMENT, Thomas Petazzoni, linux-arm-kernel,
	Antoine Tenart, Miquèl Raynal, Nadav Haklai, Shadi Ammouri,
	Omri Itach, Hanna Hawa, Igal Liberman, Marcin Wojtas

The 2 functions called from clk_disable_unprepare() already check that
the clock pointer is valid: no need to test it before calling it.

Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
---
 drivers/i2c/busses/i2c-mv64xxx.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c
index a832c45276a4..f69066266faa 100644
--- a/drivers/i2c/busses/i2c-mv64xxx.c
+++ b/drivers/i2c/busses/i2c-mv64xxx.c
@@ -950,9 +950,7 @@ mv64xxx_i2c_probe(struct platform_device *pd)
 exit_reset:
 	reset_control_assert(drv_data->rstc);
 exit_clk:
-	/* Not all platforms have a clk */
-	if (!IS_ERR(drv_data->clk))
-		clk_disable_unprepare(drv_data->clk);
+	clk_disable_unprepare(drv_data->clk);
 
 	return rc;
 }
@@ -965,9 +963,7 @@ mv64xxx_i2c_remove(struct platform_device *dev)
 	i2c_del_adapter(&drv_data->adapter);
 	free_irq(drv_data->irq, drv_data);
 	reset_control_assert(drv_data->rstc);
-	/* Not all platforms have a clk */
-	if (!IS_ERR(drv_data->clk))
-		clk_disable_unprepare(drv_data->clk);
+	clk_disable_unprepare(drv_data->clk);
 
 	return 0;
 }
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v4 2/3] i2c: mv64xxx: Fix clock resource by adding an optional bus clock
  2018-01-16 16:35 [PATCH v4 0/3] i2c: mv64xxx: Fix clock resource for Armada 7K/8K Gregory CLEMENT
  2018-01-16 16:35 ` [PATCH v4 1/3] i2c: mv64xxx: Remove useless test before clk_disable_unprepare Gregory CLEMENT
@ 2018-01-16 16:35 ` Gregory CLEMENT
  2018-01-26 17:53     ` Wolfram Sang
  2018-01-16 16:35 ` [PATCH v4 3/3] i2c: mv64xxx: Add myslef as maintainer for this driver Gregory CLEMENT
  2018-01-24  6:35   ` Wolfram Sang
  3 siblings, 1 reply; 16+ messages in thread
From: Gregory CLEMENT @ 2018-01-16 16:35 UTC (permalink / raw)
  To: Wolfram Sang, linux-i2c
  Cc: Jason Cooper, Andrew Lunn, Sebastian Hesselbarth,
	Gregory CLEMENT, Thomas Petazzoni, linux-arm-kernel,
	Antoine Tenart, Miquèl Raynal, Nadav Haklai, Shadi Ammouri,
	Omri Itach, Hanna Hawa, Igal Liberman, Marcin Wojtas

On Armada 7K/8K we need to explicitly enable the bus clock. The bus clock
is optional because not all the SoCs need them but at least for Armada
7K/8K it is actually mandatory.

The binding documentation is updating accordingly.

Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
---
 .../devicetree/bindings/i2c/i2c-mv64xxx.txt          | 20 ++++++++++++++++++++
 drivers/i2c/busses/i2c-mv64xxx.c                     | 12 +++++++++++-
 2 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt b/Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt
index 5c30026921ae..0ffe65a316ae 100644
--- a/Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt
+++ b/Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt
@@ -25,6 +25,15 @@ default frequency is 100kHz
                      whenever you're using the "allwinner,sun6i-a31-i2c"
                      compatible.
 
+ - clocks:	   : pointers to the reference clocks for this device, the
+		     first one is the one used for the clock on the i2c bus,
+		     the second one is the clock used to acces the registers
+		     of the controller
+
+ - clock-names	   : names of used clocks, mandatory if the second clock is
+		     used, the name must be "core", and "reg" (the latter is
+		     only for Armada 7K/8K).
+
 Examples:
 
 	i2c@11000 {
@@ -42,3 +51,14 @@ For the Armada XP:
 		interrupts = <29>;
 		clock-frequency = <100000>;
 	};
+
+For the Armada 7040:
+
+	i2c@701000 {
+		compatible = "marvell,mv78230-i2c";
+		reg = <0x701000 0x20>;
+		interrupts = <29>;
+		clock-frequency = <100000>;
+		clock-names = "core", "reg";
+		clocks = <&core_clock>, <&reg_clock>;
+	};
diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c
index f69066266faa..440fe4a96e68 100644
--- a/drivers/i2c/busses/i2c-mv64xxx.c
+++ b/drivers/i2c/busses/i2c-mv64xxx.c
@@ -135,6 +135,7 @@ struct mv64xxx_i2c_data {
 	u32			freq_m;
 	u32			freq_n;
 	struct clk              *clk;
+	struct clk              *reg_clk;
 	wait_queue_head_t	waitq;
 	spinlock_t		lock;
 	struct i2c_msg		*msg;
@@ -894,13 +895,20 @@ mv64xxx_i2c_probe(struct platform_device *pd)
 	init_waitqueue_head(&drv_data->waitq);
 	spin_lock_init(&drv_data->lock);
 
-	/* Not all platforms have a clk */
+	/* Not all platforms have clocks */
 	drv_data->clk = devm_clk_get(&pd->dev, NULL);
 	if (IS_ERR(drv_data->clk) && PTR_ERR(drv_data->clk) == -EPROBE_DEFER)
 		return -EPROBE_DEFER;
 	if (!IS_ERR(drv_data->clk))
 		clk_prepare_enable(drv_data->clk);
 
+	drv_data->reg_clk = devm_clk_get(&pd->dev, "reg");
+	if (IS_ERR(drv_data->reg_clk) &&
+	    PTR_ERR(drv_data->reg_clk) == -EPROBE_DEFER)
+		return -EPROBE_DEFER;
+	if (!IS_ERR(drv_data->reg_clk))
+		clk_prepare_enable(drv_data->reg_clk);
+
 	drv_data->irq = platform_get_irq(pd, 0);
 
 	if (pdata) {
@@ -950,6 +958,7 @@ mv64xxx_i2c_probe(struct platform_device *pd)
 exit_reset:
 	reset_control_assert(drv_data->rstc);
 exit_clk:
+	clk_disable_unprepare(drv_data->reg_clk);
 	clk_disable_unprepare(drv_data->clk);
 
 	return rc;
@@ -963,6 +972,7 @@ mv64xxx_i2c_remove(struct platform_device *dev)
 	i2c_del_adapter(&drv_data->adapter);
 	free_irq(drv_data->irq, drv_data);
 	reset_control_assert(drv_data->rstc);
+	clk_disable_unprepare(drv_data->reg_clk);
 	clk_disable_unprepare(drv_data->clk);
 
 	return 0;
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v4 3/3] i2c: mv64xxx: Add myslef as maintainer for this driver
  2018-01-16 16:35 [PATCH v4 0/3] i2c: mv64xxx: Fix clock resource for Armada 7K/8K Gregory CLEMENT
  2018-01-16 16:35 ` [PATCH v4 1/3] i2c: mv64xxx: Remove useless test before clk_disable_unprepare Gregory CLEMENT
  2018-01-16 16:35 ` [PATCH v4 2/3] i2c: mv64xxx: Fix clock resource by adding an optional bus clock Gregory CLEMENT
@ 2018-01-16 16:35 ` Gregory CLEMENT
  2018-01-26 17:55     ` Wolfram Sang
  2018-01-24  6:35   ` Wolfram Sang
  3 siblings, 1 reply; 16+ messages in thread
From: Gregory CLEMENT @ 2018-01-16 16:35 UTC (permalink / raw)
  To: Wolfram Sang, linux-i2c
  Cc: Jason Cooper, Andrew Lunn, Sebastian Hesselbarth,
	Gregory CLEMENT, Thomas Petazzoni, linux-arm-kernel,
	Antoine Tenart, Miquèl Raynal, Nadav Haklai, Shadi Ammouri,
	Omri Itach, Hanna Hawa, Igal Liberman, Marcin Wojtas

As requested by Wolfram Sang add myslef as maintainer of this driver.

Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
---
 MAINTAINERS | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 6d176abafcc4..108fb5cae988 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -6649,6 +6649,12 @@ L:	linux-i2c@vger.kernel.org
 S:	Maintained
 F:	drivers/i2c/i2c-stub.c
 
+I2C MV64XXX MARVELL AND ALLWINNER DRIVER
+M:	Gregory CLEMENT <gregory.clement@free-electrons.com>
+L:	linux-i2c@vger.kernel.org
+S:	Maintained
+F:	drivers/i2c/busses/i2c-mv64xxx.c
+
 i386 BOOT CODE
 M:	"H. Peter Anvin" <hpa@zytor.com>
 S:	Maintained
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH v4 0/3] i2c: mv64xxx: Fix clock resource for Armada 7K/8K
  2018-01-16 16:35 [PATCH v4 0/3] i2c: mv64xxx: Fix clock resource for Armada 7K/8K Gregory CLEMENT
@ 2018-01-24  6:35   ` Wolfram Sang
  2018-01-16 16:35 ` [PATCH v4 2/3] i2c: mv64xxx: Fix clock resource by adding an optional bus clock Gregory CLEMENT
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 16+ messages in thread
From: Wolfram Sang @ 2018-01-24  6:35 UTC (permalink / raw)
  To: Gregory CLEMENT
  Cc: linux-i2c, Jason Cooper, Andrew Lunn, Sebastian Hesselbarth,
	Thomas Petazzoni, linux-arm-kernel, Antoine Tenart,
	Miquèl Raynal, Nadav Haklai, Shadi Ammouri, Omri Itach,
	Hanna Hawa, Igal Liberman, Marcin Wojtas

[-- Attachment #1: Type: text/plain, Size: 915 bytes --]

On Tue, Jan 16, 2018 at 05:35:37PM +0100, Gregory CLEMENT wrote:

> This short series fixes the way the clocks are used for the mv64xxx
> controller embedded in the Marvell Armada 7K/8K SoCs. On these SoCs a
> second one is needed in order to clock the registers. It was not
> noticed until now because we relied on the bootloader and also because
> the clock driver was wrong.
> 
> Thanks to this fix, it would be possible to fix the clock driver
> without introducing a regression.
> 
> The first patch is just a small cleanup found when I wrote the main
> patch.
> 
> The last patch is not related to the series but as Wolfram to have a
> maintainer for this driver I added the patch here.

Thomas, Andrew, Maxime, any tags you'd like to donate?

>  - Add a maintainer for the i2c-mv64xxx driver, requested

Well, I'd say "asked for"...

> by Woflram Sang

... whoever that guy is ;)


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v4 0/3] i2c: mv64xxx: Fix clock resource for Armada 7K/8K
@ 2018-01-24  6:35   ` Wolfram Sang
  0 siblings, 0 replies; 16+ messages in thread
From: Wolfram Sang @ 2018-01-24  6:35 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Jan 16, 2018 at 05:35:37PM +0100, Gregory CLEMENT wrote:

> This short series fixes the way the clocks are used for the mv64xxx
> controller embedded in the Marvell Armada 7K/8K SoCs. On these SoCs a
> second one is needed in order to clock the registers. It was not
> noticed until now because we relied on the bootloader and also because
> the clock driver was wrong.
> 
> Thanks to this fix, it would be possible to fix the clock driver
> without introducing a regression.
> 
> The first patch is just a small cleanup found when I wrote the main
> patch.
> 
> The last patch is not related to the series but as Wolfram to have a
> maintainer for this driver I added the patch here.

Thomas, Andrew, Maxime, any tags you'd like to donate?

>  - Add a maintainer for the i2c-mv64xxx driver, requested

Well, I'd say "asked for"...

> by Woflram Sang

... whoever that guy is ;)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180124/a7061a6c/attachment.sig>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v4 1/3] i2c: mv64xxx: Remove useless test before clk_disable_unprepare
  2018-01-16 16:35 ` [PATCH v4 1/3] i2c: mv64xxx: Remove useless test before clk_disable_unprepare Gregory CLEMENT
@ 2018-01-26 17:40     ` Wolfram Sang
  2018-01-26 17:48     ` Wolfram Sang
  2018-01-26 17:53     ` Wolfram Sang
  2 siblings, 0 replies; 16+ messages in thread
From: Wolfram Sang @ 2018-01-26 17:40 UTC (permalink / raw)
  To: Gregory CLEMENT
  Cc: linux-i2c, Jason Cooper, Andrew Lunn, Sebastian Hesselbarth,
	Thomas Petazzoni, linux-arm-kernel, Antoine Tenart,
	Miquèl Raynal, Nadav Haklai, Shadi Ammouri, Omri Itach,
	Hanna Hawa, Igal Liberman, Marcin Wojtas

[-- Attachment #1: Type: text/plain, Size: 1380 bytes --]

On Tue, Jan 16, 2018 at 05:35:38PM +0100, Gregory CLEMENT wrote:
> The 2 functions called from clk_disable_unprepare() already check that
> the clock pointer is valid: no need to test it before calling it.

I can't find that in the code for !OF?

> Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
> ---
>  drivers/i2c/busses/i2c-mv64xxx.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c
> index a832c45276a4..f69066266faa 100644
> --- a/drivers/i2c/busses/i2c-mv64xxx.c
> +++ b/drivers/i2c/busses/i2c-mv64xxx.c
> @@ -950,9 +950,7 @@ mv64xxx_i2c_probe(struct platform_device *pd)
>  exit_reset:
>  	reset_control_assert(drv_data->rstc);
>  exit_clk:
> -	/* Not all platforms have a clk */
> -	if (!IS_ERR(drv_data->clk))
> -		clk_disable_unprepare(drv_data->clk);
> +	clk_disable_unprepare(drv_data->clk);
>  
>  	return rc;
>  }
> @@ -965,9 +963,7 @@ mv64xxx_i2c_remove(struct platform_device *dev)
>  	i2c_del_adapter(&drv_data->adapter);
>  	free_irq(drv_data->irq, drv_data);
>  	reset_control_assert(drv_data->rstc);
> -	/* Not all platforms have a clk */
> -	if (!IS_ERR(drv_data->clk))
> -		clk_disable_unprepare(drv_data->clk);
> +	clk_disable_unprepare(drv_data->clk);
>  
>  	return 0;
>  }
> -- 
> 2.15.1
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v4 1/3] i2c: mv64xxx: Remove useless test before clk_disable_unprepare
@ 2018-01-26 17:40     ` Wolfram Sang
  0 siblings, 0 replies; 16+ messages in thread
From: Wolfram Sang @ 2018-01-26 17:40 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Jan 16, 2018 at 05:35:38PM +0100, Gregory CLEMENT wrote:
> The 2 functions called from clk_disable_unprepare() already check that
> the clock pointer is valid: no need to test it before calling it.

I can't find that in the code for !OF?

> Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
> ---
>  drivers/i2c/busses/i2c-mv64xxx.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c
> index a832c45276a4..f69066266faa 100644
> --- a/drivers/i2c/busses/i2c-mv64xxx.c
> +++ b/drivers/i2c/busses/i2c-mv64xxx.c
> @@ -950,9 +950,7 @@ mv64xxx_i2c_probe(struct platform_device *pd)
>  exit_reset:
>  	reset_control_assert(drv_data->rstc);
>  exit_clk:
> -	/* Not all platforms have a clk */
> -	if (!IS_ERR(drv_data->clk))
> -		clk_disable_unprepare(drv_data->clk);
> +	clk_disable_unprepare(drv_data->clk);
>  
>  	return rc;
>  }
> @@ -965,9 +963,7 @@ mv64xxx_i2c_remove(struct platform_device *dev)
>  	i2c_del_adapter(&drv_data->adapter);
>  	free_irq(drv_data->irq, drv_data);
>  	reset_control_assert(drv_data->rstc);
> -	/* Not all platforms have a clk */
> -	if (!IS_ERR(drv_data->clk))
> -		clk_disable_unprepare(drv_data->clk);
> +	clk_disable_unprepare(drv_data->clk);
>  
>  	return 0;
>  }
> -- 
> 2.15.1
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180126/cc0de7bc/attachment.sig>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v4 1/3] i2c: mv64xxx: Remove useless test before clk_disable_unprepare
  2018-01-16 16:35 ` [PATCH v4 1/3] i2c: mv64xxx: Remove useless test before clk_disable_unprepare Gregory CLEMENT
@ 2018-01-26 17:48     ` Wolfram Sang
  2018-01-26 17:48     ` Wolfram Sang
  2018-01-26 17:53     ` Wolfram Sang
  2 siblings, 0 replies; 16+ messages in thread
From: Wolfram Sang @ 2018-01-26 17:48 UTC (permalink / raw)
  To: Gregory CLEMENT
  Cc: Thomas Petazzoni, Andrew Lunn, Jason Cooper, Igal Liberman,
	Antoine Tenart, Omri Itach, Nadav Haklai, Shadi Ammouri,
	linux-i2c, Miquèl Raynal, Marcin Wojtas, Hanna Hawa,
	linux-arm-kernel, Sebastian Hesselbarth


[-- Attachment #1.1: Type: text/plain, Size: 1558 bytes --]

On Tue, Jan 16, 2018 at 05:35:38PM +0100, Gregory CLEMENT wrote:
> The 2 functions called from clk_disable_unprepare() already check that
> the clock pointer is valid: no need to test it before calling it.

Now I get it. 'called from' != 'calling' (what I understood). But also
!= 'called by' (what I would have ecpected, but I am neither a native
speaker).

You mean "clk_disable_unprepare() is NULL pointer safe."

> 
> Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
> ---
>  drivers/i2c/busses/i2c-mv64xxx.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c
> index a832c45276a4..f69066266faa 100644
> --- a/drivers/i2c/busses/i2c-mv64xxx.c
> +++ b/drivers/i2c/busses/i2c-mv64xxx.c
> @@ -950,9 +950,7 @@ mv64xxx_i2c_probe(struct platform_device *pd)
>  exit_reset:
>  	reset_control_assert(drv_data->rstc);
>  exit_clk:
> -	/* Not all platforms have a clk */
> -	if (!IS_ERR(drv_data->clk))
> -		clk_disable_unprepare(drv_data->clk);
> +	clk_disable_unprepare(drv_data->clk);
>  
>  	return rc;
>  }
> @@ -965,9 +963,7 @@ mv64xxx_i2c_remove(struct platform_device *dev)
>  	i2c_del_adapter(&drv_data->adapter);
>  	free_irq(drv_data->irq, drv_data);
>  	reset_control_assert(drv_data->rstc);
> -	/* Not all platforms have a clk */
> -	if (!IS_ERR(drv_data->clk))
> -		clk_disable_unprepare(drv_data->clk);
> +	clk_disable_unprepare(drv_data->clk);
>  
>  	return 0;
>  }
> -- 
> 2.15.1
> 

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v4 1/3] i2c: mv64xxx: Remove useless test before clk_disable_unprepare
@ 2018-01-26 17:48     ` Wolfram Sang
  0 siblings, 0 replies; 16+ messages in thread
From: Wolfram Sang @ 2018-01-26 17:48 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Jan 16, 2018 at 05:35:38PM +0100, Gregory CLEMENT wrote:
> The 2 functions called from clk_disable_unprepare() already check that
> the clock pointer is valid: no need to test it before calling it.

Now I get it. 'called from' != 'calling' (what I understood). But also
!= 'called by' (what I would have ecpected, but I am neither a native
speaker).

You mean "clk_disable_unprepare() is NULL pointer safe."

> 
> Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
> ---
>  drivers/i2c/busses/i2c-mv64xxx.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c
> index a832c45276a4..f69066266faa 100644
> --- a/drivers/i2c/busses/i2c-mv64xxx.c
> +++ b/drivers/i2c/busses/i2c-mv64xxx.c
> @@ -950,9 +950,7 @@ mv64xxx_i2c_probe(struct platform_device *pd)
>  exit_reset:
>  	reset_control_assert(drv_data->rstc);
>  exit_clk:
> -	/* Not all platforms have a clk */
> -	if (!IS_ERR(drv_data->clk))
> -		clk_disable_unprepare(drv_data->clk);
> +	clk_disable_unprepare(drv_data->clk);
>  
>  	return rc;
>  }
> @@ -965,9 +963,7 @@ mv64xxx_i2c_remove(struct platform_device *dev)
>  	i2c_del_adapter(&drv_data->adapter);
>  	free_irq(drv_data->irq, drv_data);
>  	reset_control_assert(drv_data->rstc);
> -	/* Not all platforms have a clk */
> -	if (!IS_ERR(drv_data->clk))
> -		clk_disable_unprepare(drv_data->clk);
> +	clk_disable_unprepare(drv_data->clk);
>  
>  	return 0;
>  }
> -- 
> 2.15.1
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180126/18797b1c/attachment-0001.sig>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v4 1/3] i2c: mv64xxx: Remove useless test before clk_disable_unprepare
  2018-01-16 16:35 ` [PATCH v4 1/3] i2c: mv64xxx: Remove useless test before clk_disable_unprepare Gregory CLEMENT
@ 2018-01-26 17:53     ` Wolfram Sang
  2018-01-26 17:48     ` Wolfram Sang
  2018-01-26 17:53     ` Wolfram Sang
  2 siblings, 0 replies; 16+ messages in thread
From: Wolfram Sang @ 2018-01-26 17:53 UTC (permalink / raw)
  To: Gregory CLEMENT
  Cc: linux-i2c, Jason Cooper, Andrew Lunn, Sebastian Hesselbarth,
	Thomas Petazzoni, linux-arm-kernel, Antoine Tenart,
	Miquèl Raynal, Nadav Haklai, Shadi Ammouri, Omri Itach,
	Hanna Hawa, Igal Liberman, Marcin Wojtas

[-- Attachment #1: Type: text/plain, Size: 346 bytes --]

On Tue, Jan 16, 2018 at 05:35:38PM +0100, Gregory CLEMENT wrote:
> The 2 functions called from clk_disable_unprepare() already check that
> the clock pointer is valid: no need to test it before calling it.
> 
> Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>

Applied to for-next with a shortened commit msg, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v4 1/3] i2c: mv64xxx: Remove useless test before clk_disable_unprepare
@ 2018-01-26 17:53     ` Wolfram Sang
  0 siblings, 0 replies; 16+ messages in thread
From: Wolfram Sang @ 2018-01-26 17:53 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Jan 16, 2018 at 05:35:38PM +0100, Gregory CLEMENT wrote:
> The 2 functions called from clk_disable_unprepare() already check that
> the clock pointer is valid: no need to test it before calling it.
> 
> Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>

Applied to for-next with a shortened commit msg, thanks!

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180126/b95cc222/attachment.sig>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v4 2/3] i2c: mv64xxx: Fix clock resource by adding an optional bus clock
  2018-01-16 16:35 ` [PATCH v4 2/3] i2c: mv64xxx: Fix clock resource by adding an optional bus clock Gregory CLEMENT
@ 2018-01-26 17:53     ` Wolfram Sang
  0 siblings, 0 replies; 16+ messages in thread
From: Wolfram Sang @ 2018-01-26 17:53 UTC (permalink / raw)
  To: Gregory CLEMENT
  Cc: linux-i2c, Jason Cooper, Andrew Lunn, Sebastian Hesselbarth,
	Thomas Petazzoni, linux-arm-kernel, Antoine Tenart,
	Miquèl Raynal, Nadav Haklai, Shadi Ammouri, Omri Itach,
	Hanna Hawa, Igal Liberman, Marcin Wojtas

[-- Attachment #1: Type: text/plain, Size: 419 bytes --]

On Tue, Jan 16, 2018 at 05:35:39PM +0100, Gregory CLEMENT wrote:
> On Armada 7K/8K we need to explicitly enable the bus clock. The bus clock
> is optional because not all the SoCs need them but at least for Armada
> 7K/8K it is actually mandatory.
> 
> The binding documentation is updating accordingly.
> 
> Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>

Applied to for-next, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v4 2/3] i2c: mv64xxx: Fix clock resource by adding an optional bus clock
@ 2018-01-26 17:53     ` Wolfram Sang
  0 siblings, 0 replies; 16+ messages in thread
From: Wolfram Sang @ 2018-01-26 17:53 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Jan 16, 2018 at 05:35:39PM +0100, Gregory CLEMENT wrote:
> On Armada 7K/8K we need to explicitly enable the bus clock. The bus clock
> is optional because not all the SoCs need them but at least for Armada
> 7K/8K it is actually mandatory.
> 
> The binding documentation is updating accordingly.
> 
> Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>

Applied to for-next, thanks!

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180126/08bd65eb/attachment.sig>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v4 3/3] i2c: mv64xxx: Add myslef as maintainer for this driver
  2018-01-16 16:35 ` [PATCH v4 3/3] i2c: mv64xxx: Add myslef as maintainer for this driver Gregory CLEMENT
@ 2018-01-26 17:55     ` Wolfram Sang
  0 siblings, 0 replies; 16+ messages in thread
From: Wolfram Sang @ 2018-01-26 17:55 UTC (permalink / raw)
  To: Gregory CLEMENT
  Cc: linux-i2c, Jason Cooper, Andrew Lunn, Sebastian Hesselbarth,
	Thomas Petazzoni, linux-arm-kernel, Antoine Tenart,
	Miquèl Raynal, Nadav Haklai, Shadi Ammouri, Omri Itach,
	Hanna Hawa, Igal Liberman, Marcin Wojtas

[-- Attachment #1: Type: text/plain, Size: 382 bytes --]

On Tue, Jan 16, 2018 at 05:35:40PM +0100, Gregory CLEMENT wrote:
> As requested by Wolfram Sang add myslef as maintainer of this driver.

Removed this line as I really 'asked for' not 'requested' it. And
removed the typo in $subject which is also in the line above.

> 
> Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>

Applied to for-next, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v4 3/3] i2c: mv64xxx: Add myslef as maintainer for this driver
@ 2018-01-26 17:55     ` Wolfram Sang
  0 siblings, 0 replies; 16+ messages in thread
From: Wolfram Sang @ 2018-01-26 17:55 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Jan 16, 2018 at 05:35:40PM +0100, Gregory CLEMENT wrote:
> As requested by Wolfram Sang add myslef as maintainer of this driver.

Removed this line as I really 'asked for' not 'requested' it. And
removed the typo in $subject which is also in the line above.

> 
> Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>

Applied to for-next, thanks!

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180126/c9879f21/attachment.sig>

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2018-01-26 17:55 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-16 16:35 [PATCH v4 0/3] i2c: mv64xxx: Fix clock resource for Armada 7K/8K Gregory CLEMENT
2018-01-16 16:35 ` [PATCH v4 1/3] i2c: mv64xxx: Remove useless test before clk_disable_unprepare Gregory CLEMENT
2018-01-26 17:40   ` Wolfram Sang
2018-01-26 17:40     ` Wolfram Sang
2018-01-26 17:48   ` Wolfram Sang
2018-01-26 17:48     ` Wolfram Sang
2018-01-26 17:53   ` Wolfram Sang
2018-01-26 17:53     ` Wolfram Sang
2018-01-16 16:35 ` [PATCH v4 2/3] i2c: mv64xxx: Fix clock resource by adding an optional bus clock Gregory CLEMENT
2018-01-26 17:53   ` Wolfram Sang
2018-01-26 17:53     ` Wolfram Sang
2018-01-16 16:35 ` [PATCH v4 3/3] i2c: mv64xxx: Add myslef as maintainer for this driver Gregory CLEMENT
2018-01-26 17:55   ` Wolfram Sang
2018-01-26 17:55     ` Wolfram Sang
2018-01-24  6:35 ` [PATCH v4 0/3] i2c: mv64xxx: Fix clock resource for Armada 7K/8K Wolfram Sang
2018-01-24  6:35   ` Wolfram Sang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.