[i2c] [PATCH] i2c: fix sparse warning in i2c.h

Mark M. Hoffman mhoffman at lightlink.com
Sun Apr 29 18:34:27 CEST 2007


Hi Jean:

i2c: fix sparse warning in i2c.h
    
Kill a sparse warning by un-nesting two container_of() calls.
    
Signed-off-by: Mark M. Hoffman <mhoffman at lightlink.com>

diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 9428092..acd88fa 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -166,7 +166,8 @@ struct i2c_client {
 
 static inline struct i2c_client *kobj_to_i2c_client(struct kobject *kobj)
 {
-	return to_i2c_client(container_of(kobj, struct device, kobj));
+	struct device * const dev = container_of(kobj, struct device, kobj);
+	return to_i2c_client(dev);
 }
 
 static inline void *i2c_get_clientdata (struct i2c_client *dev)
-- 
Mark M. Hoffman
mhoffman at lightlink.com




More information about the i2c mailing list