Re: [PATCH v2] 2c: mv64xxx: Use clk_enable_prepare and clk_disable_unprepare

2016-07-22 Thread Uwe Kleine-König
there is an i missing in the Subject.

On Wed, Jul 20, 2016 at 10:44:18AM +0530, Amitoj Kaur Chawla wrote:
> Replace clk_enable and clk_prepare with clk_enable_prepare and
> clk_disable and clk_unprepare with clk_disable_unprepare.
> 
> The Coccinelle semantic patch used to make this change is as follows:
> @@
> expression e;
> @@
> 
> - clk_prepare(e);
> - clk_enable(e);
> + clk_prepare_enable(e);
> 
> @@
> expression e;
> @@
> 
> - clk_disable(e);
> - clk_unprepare(e);
> + clk_disable_unprepare(e);
> 
> Signed-off-by: Amitoj Kaur Chawla 
> ---
> Changes in v2:
> -Rebased patch
> 
>  drivers/i2c/busses/i2c-mv64xxx.c | 18 ++
>  1 file changed, 6 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-mv64xxx.c 
> b/drivers/i2c/busses/i2c-mv64xxx.c
> index 43207f5..79bae48 100644
> --- a/drivers/i2c/busses/i2c-mv64xxx.c
> +++ b/drivers/i2c/busses/i2c-mv64xxx.c
> @@ -910,10 +910,8 @@ mv64xxx_i2c_probe(struct platform_device *pd)
>  #if defined(CONFIG_HAVE_CLK)
>   /* Not all platforms have a clk */
>   drv_data->clk = devm_clk_get(>dev, NULL);
> - if (!IS_ERR(drv_data->clk)) {
> - clk_prepare(drv_data->clk);
> - clk_enable(drv_data->clk);
> - }
> + if (!IS_ERR(drv_data->clk))
> + clk_prepare_enable(drv_data->clk);

When you touch this, better add error checking. I wonder why these
functions are not marked __must_check.

Also using IS_ERR(drv_data->clk) is wrong here, becauce devm_clk_get
might return -EPROBE_DEFER.

Best regards
Uwe

-- 
Pengutronix e.K.   | Uwe Kleine-König|
Industrial Linux Solutions | http://www.pengutronix.de/  |


Re: [PATCH v2] 2c: mv64xxx: Use clk_enable_prepare and clk_disable_unprepare

2016-07-22 Thread Uwe Kleine-König
there is an i missing in the Subject.

On Wed, Jul 20, 2016 at 10:44:18AM +0530, Amitoj Kaur Chawla wrote:
> Replace clk_enable and clk_prepare with clk_enable_prepare and
> clk_disable and clk_unprepare with clk_disable_unprepare.
> 
> The Coccinelle semantic patch used to make this change is as follows:
> @@
> expression e;
> @@
> 
> - clk_prepare(e);
> - clk_enable(e);
> + clk_prepare_enable(e);
> 
> @@
> expression e;
> @@
> 
> - clk_disable(e);
> - clk_unprepare(e);
> + clk_disable_unprepare(e);
> 
> Signed-off-by: Amitoj Kaur Chawla 
> ---
> Changes in v2:
> -Rebased patch
> 
>  drivers/i2c/busses/i2c-mv64xxx.c | 18 ++
>  1 file changed, 6 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-mv64xxx.c 
> b/drivers/i2c/busses/i2c-mv64xxx.c
> index 43207f5..79bae48 100644
> --- a/drivers/i2c/busses/i2c-mv64xxx.c
> +++ b/drivers/i2c/busses/i2c-mv64xxx.c
> @@ -910,10 +910,8 @@ mv64xxx_i2c_probe(struct platform_device *pd)
>  #if defined(CONFIG_HAVE_CLK)
>   /* Not all platforms have a clk */
>   drv_data->clk = devm_clk_get(>dev, NULL);
> - if (!IS_ERR(drv_data->clk)) {
> - clk_prepare(drv_data->clk);
> - clk_enable(drv_data->clk);
> - }
> + if (!IS_ERR(drv_data->clk))
> + clk_prepare_enable(drv_data->clk);

When you touch this, better add error checking. I wonder why these
functions are not marked __must_check.

Also using IS_ERR(drv_data->clk) is wrong here, becauce devm_clk_get
might return -EPROBE_DEFER.

Best regards
Uwe

-- 
Pengutronix e.K.   | Uwe Kleine-König|
Industrial Linux Solutions | http://www.pengutronix.de/  |


Re: [PATCH v2] 2c: mv64xxx: Use clk_enable_prepare and clk_disable_unprepare

2016-07-22 Thread Wolfram Sang
On Wed, Jul 20, 2016 at 10:44:18AM +0530, Amitoj Kaur Chawla wrote:
> Replace clk_enable and clk_prepare with clk_enable_prepare and
> clk_disable and clk_unprepare with clk_disable_unprepare.
> 
> The Coccinelle semantic patch used to make this change is as follows:
> @@
> expression e;
> @@
> 
> - clk_prepare(e);
> - clk_enable(e);
> + clk_prepare_enable(e);
> 
> @@
> expression e;
> @@
> 
> - clk_disable(e);
> - clk_unprepare(e);
> + clk_disable_unprepare(e);
> 
> Signed-off-by: Amitoj Kaur Chawla 
> ---
> Changes in v2:
> -Rebased patch

I still can't apply and nothing changed to the previous patch you sent?
To what did you rebase?



signature.asc
Description: PGP signature


Re: [PATCH v2] 2c: mv64xxx: Use clk_enable_prepare and clk_disable_unprepare

2016-07-22 Thread Wolfram Sang
On Wed, Jul 20, 2016 at 10:44:18AM +0530, Amitoj Kaur Chawla wrote:
> Replace clk_enable and clk_prepare with clk_enable_prepare and
> clk_disable and clk_unprepare with clk_disable_unprepare.
> 
> The Coccinelle semantic patch used to make this change is as follows:
> @@
> expression e;
> @@
> 
> - clk_prepare(e);
> - clk_enable(e);
> + clk_prepare_enable(e);
> 
> @@
> expression e;
> @@
> 
> - clk_disable(e);
> - clk_unprepare(e);
> + clk_disable_unprepare(e);
> 
> Signed-off-by: Amitoj Kaur Chawla 
> ---
> Changes in v2:
> -Rebased patch

I still can't apply and nothing changed to the previous patch you sent?
To what did you rebase?



signature.asc
Description: PGP signature


[PATCH v2] 2c: mv64xxx: Use clk_enable_prepare and clk_disable_unprepare

2016-07-19 Thread Amitoj Kaur Chawla
Replace clk_enable and clk_prepare with clk_enable_prepare and
clk_disable and clk_unprepare with clk_disable_unprepare.

The Coccinelle semantic patch used to make this change is as follows:
@@
expression e;
@@

- clk_prepare(e);
- clk_enable(e);
+ clk_prepare_enable(e);

@@
expression e;
@@

- clk_disable(e);
- clk_unprepare(e);
+ clk_disable_unprepare(e);

Signed-off-by: Amitoj Kaur Chawla 
---
Changes in v2:
-Rebased patch

 drivers/i2c/busses/i2c-mv64xxx.c | 18 ++
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c
index 43207f5..79bae48 100644
--- a/drivers/i2c/busses/i2c-mv64xxx.c
+++ b/drivers/i2c/busses/i2c-mv64xxx.c
@@ -910,10 +910,8 @@ mv64xxx_i2c_probe(struct platform_device *pd)
 #if defined(CONFIG_HAVE_CLK)
/* Not all platforms have a clk */
drv_data->clk = devm_clk_get(>dev, NULL);
-   if (!IS_ERR(drv_data->clk)) {
-   clk_prepare(drv_data->clk);
-   clk_enable(drv_data->clk);
-   }
+   if (!IS_ERR(drv_data->clk))
+   clk_prepare_enable(drv_data->clk);
 #endif
if (pdata) {
drv_data->freq_m = pdata->freq_m;
@@ -966,10 +964,8 @@ exit_reset:
 exit_clk:
 #if defined(CONFIG_HAVE_CLK)
/* Not all platforms have a clk */
-   if (!IS_ERR(drv_data->clk)) {
-   clk_disable(drv_data->clk);
-   clk_unprepare(drv_data->clk);
-   }
+   if (!IS_ERR(drv_data->clk))
+   clk_disable_unprepare(drv_data->clk);
 #endif
return rc;
 }
@@ -985,10 +981,8 @@ mv64xxx_i2c_remove(struct platform_device *dev)
reset_control_assert(drv_data->rstc);
 #if defined(CONFIG_HAVE_CLK)
/* Not all platforms have a clk */
-   if (!IS_ERR(drv_data->clk)) {
-   clk_disable(drv_data->clk);
-   clk_unprepare(drv_data->clk);
-   }
+   if (!IS_ERR(drv_data->clk))
+   clk_disable_unprepare(drv_data->clk);
 #endif
 
return 0;
-- 
1.9.1



[PATCH v2] 2c: mv64xxx: Use clk_enable_prepare and clk_disable_unprepare

2016-07-19 Thread Amitoj Kaur Chawla
Replace clk_enable and clk_prepare with clk_enable_prepare and
clk_disable and clk_unprepare with clk_disable_unprepare.

The Coccinelle semantic patch used to make this change is as follows:
@@
expression e;
@@

- clk_prepare(e);
- clk_enable(e);
+ clk_prepare_enable(e);

@@
expression e;
@@

- clk_disable(e);
- clk_unprepare(e);
+ clk_disable_unprepare(e);

Signed-off-by: Amitoj Kaur Chawla 
---
Changes in v2:
-Rebased patch

 drivers/i2c/busses/i2c-mv64xxx.c | 18 ++
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c
index 43207f5..79bae48 100644
--- a/drivers/i2c/busses/i2c-mv64xxx.c
+++ b/drivers/i2c/busses/i2c-mv64xxx.c
@@ -910,10 +910,8 @@ mv64xxx_i2c_probe(struct platform_device *pd)
 #if defined(CONFIG_HAVE_CLK)
/* Not all platforms have a clk */
drv_data->clk = devm_clk_get(>dev, NULL);
-   if (!IS_ERR(drv_data->clk)) {
-   clk_prepare(drv_data->clk);
-   clk_enable(drv_data->clk);
-   }
+   if (!IS_ERR(drv_data->clk))
+   clk_prepare_enable(drv_data->clk);
 #endif
if (pdata) {
drv_data->freq_m = pdata->freq_m;
@@ -966,10 +964,8 @@ exit_reset:
 exit_clk:
 #if defined(CONFIG_HAVE_CLK)
/* Not all platforms have a clk */
-   if (!IS_ERR(drv_data->clk)) {
-   clk_disable(drv_data->clk);
-   clk_unprepare(drv_data->clk);
-   }
+   if (!IS_ERR(drv_data->clk))
+   clk_disable_unprepare(drv_data->clk);
 #endif
return rc;
 }
@@ -985,10 +981,8 @@ mv64xxx_i2c_remove(struct platform_device *dev)
reset_control_assert(drv_data->rstc);
 #if defined(CONFIG_HAVE_CLK)
/* Not all platforms have a clk */
-   if (!IS_ERR(drv_data->clk)) {
-   clk_disable(drv_data->clk);
-   clk_unprepare(drv_data->clk);
-   }
+   if (!IS_ERR(drv_data->clk))
+   clk_disable_unprepare(drv_data->clk);
 #endif
 
return 0;
-- 
1.9.1