[PATCH 1/2] drivers/i2c/busses/i2c-sh7760.c: use clk API instead of direct dereferences

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Julia Lawall <Julia.Lawall@xxxxxxx>

A struct clk value is intended to be an abstract pointer, so it should be
manipulated using the various API functions.

The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression e,e1;
identifier i;
@@

*e = clk_get(...)
 ... when != e = e1
     when any
*e->i
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@xxxxxxx>

---
I am not able to compile this code.  Furthermore, the documentation on
clk_get_rate says that the result is only valid if the clock has been
enabled, and I don't know if that is the case here.

 drivers/i2c/busses/i2c-sh7760.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-sh7760.c b/drivers/i2c/busses/i2c-sh7760.c
index 3a2253e..972eafe 100644
--- a/drivers/i2c/busses/i2c-sh7760.c
+++ b/drivers/i2c/busses/i2c-sh7760.c
@@ -401,7 +401,7 @@ static int calc_CCR(unsigned long scl_hz)
 	if (IS_ERR(mclk)) {
 		return PTR_ERR(mclk);
 	} else {
-		mck = mclk->rate;
+		mck = clk_get_rate(mclk);
 		clk_put(mclk);
 	}
 

--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux