linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] i2c: mediatek: remove redundant null check
@ 2020-09-30  8:42 Xu Wang
  2020-10-26  1:31 ` Qii Wang
  2022-03-01 15:23 ` Wolfram Sang
  0 siblings, 2 replies; 3+ messages in thread
From: Xu Wang @ 2020-09-30  8:42 UTC (permalink / raw)
  To: qii.wang, matthias.bgg; +Cc: linux-i2c, linux-kernel

Because clk_disable_unprepare already checked NULL clock parameter,
so the additional checks are unnecessary, just remove it

Signed-off-by: Xu Wang <vulab@iscas.ac.cn>
---
 drivers/i2c/busses/i2c-mt65xx.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/i2c/busses/i2c-mt65xx.c b/drivers/i2c/busses/i2c-mt65xx.c
index 0cbdfbe605b5..48d37de827e1 100644
--- a/drivers/i2c/busses/i2c-mt65xx.c
+++ b/drivers/i2c/busses/i2c-mt65xx.c
@@ -449,8 +449,7 @@ static int mtk_i2c_clock_enable(struct mtk_i2c *i2c)
 	return 0;
 
 err_arb:
-	if (i2c->have_pmic)
-		clk_disable_unprepare(i2c->clk_pmic);
+	clk_disable_unprepare(i2c->clk_pmic);
 err_pmic:
 	clk_disable_unprepare(i2c->clk_main);
 err_main:
@@ -461,11 +460,9 @@ static int mtk_i2c_clock_enable(struct mtk_i2c *i2c)
 
 static void mtk_i2c_clock_disable(struct mtk_i2c *i2c)
 {
-	if (i2c->clk_arb)
-		clk_disable_unprepare(i2c->clk_arb);
+	clk_disable_unprepare(i2c->clk_arb);
 
-	if (i2c->have_pmic)
-		clk_disable_unprepare(i2c->clk_pmic);
+	clk_disable_unprepare(i2c->clk_pmic);
 
 	clk_disable_unprepare(i2c->clk_main);
 	clk_disable_unprepare(i2c->clk_dma);
-- 
2.17.1


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

* Re: [PATCH] i2c: mediatek: remove redundant null check
  2020-09-30  8:42 [PATCH] i2c: mediatek: remove redundant null check Xu Wang
@ 2020-10-26  1:31 ` Qii Wang
  2022-03-01 15:23 ` Wolfram Sang
  1 sibling, 0 replies; 3+ messages in thread
From: Qii Wang @ 2020-10-26  1:31 UTC (permalink / raw)
  To: Xu Wang; +Cc: Leilk.Liu, matthias.bgg, linux-i2c, linux-kernel

Thanks, it looks good for me, it would be better to remove all useless
members

On Wed, 2020-09-30 at 08:42 +0000, Xu Wang wrote:
> Because clk_disable_unprepare already checked NULL clock parameter,
> so the additional checks are unnecessary, just remove it
> 
> Signed-off-by: Xu Wang <vulab@iscas.ac.cn>
> ---
>  drivers/i2c/busses/i2c-mt65xx.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-mt65xx.c b/drivers/i2c/busses/i2c-mt65xx.c
> index 0cbdfbe605b5..48d37de827e1 100644
> --- a/drivers/i2c/busses/i2c-mt65xx.c
> +++ b/drivers/i2c/busses/i2c-mt65xx.c
> @@ -449,8 +449,7 @@ static int mtk_i2c_clock_enable(struct mtk_i2c *i2c)
>  	return 0;
>  
>  err_arb:
> -	if (i2c->have_pmic)
> -		clk_disable_unprepare(i2c->clk_pmic);
> +	clk_disable_unprepare(i2c->clk_pmic);
>  err_pmic:
>  	clk_disable_unprepare(i2c->clk_main);
>  err_main:
> @@ -461,11 +460,9 @@ static int mtk_i2c_clock_enable(struct mtk_i2c *i2c)
>  
>  static void mtk_i2c_clock_disable(struct mtk_i2c *i2c)
>  {
> -	if (i2c->clk_arb)
> -		clk_disable_unprepare(i2c->clk_arb);
> +	clk_disable_unprepare(i2c->clk_arb);
>  
> -	if (i2c->have_pmic)
> -		clk_disable_unprepare(i2c->clk_pmic);
> +	clk_disable_unprepare(i2c->clk_pmic);
>  
>  	clk_disable_unprepare(i2c->clk_main);
>  	clk_disable_unprepare(i2c->clk_dma);


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

* Re: [PATCH] i2c: mediatek: remove redundant null check
  2020-09-30  8:42 [PATCH] i2c: mediatek: remove redundant null check Xu Wang
  2020-10-26  1:31 ` Qii Wang
@ 2022-03-01 15:23 ` Wolfram Sang
  1 sibling, 0 replies; 3+ messages in thread
From: Wolfram Sang @ 2022-03-01 15:23 UTC (permalink / raw)
  To: Xu Wang; +Cc: qii.wang, matthias.bgg, linux-i2c, linux-kernel

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

On Wed, Sep 30, 2020 at 08:42:33AM +0000, Xu Wang wrote:
> Because clk_disable_unprepare already checked NULL clock parameter,
> so the additional checks are unnecessary, just remove it
> 
> Signed-off-by: Xu Wang <vulab@iscas.ac.cn>

Missed Qii Wang's ack so far, sorry. Applied to for-next, thanks!


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

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

end of thread, other threads:[~2022-03-01 15:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-30  8:42 [PATCH] i2c: mediatek: remove redundant null check Xu Wang
2020-10-26  1:31 ` Qii Wang
2022-03-01 15:23 ` Wolfram Sang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).