diff options
author | Geliang Tang <geliangtang@163.com> | 2015-12-28 10:00:16 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-02-08 02:01:45 -0500 |
commit | 8c99d8e6de0474bf5a7004e41c044ac4dcacbae1 (patch) | |
tree | 63873c53965a2c89e325277839fbcb95bc4c0ced | |
parent | 50e6315dba721cbc24ccd6d7b299f1782f210a98 (diff) |
misc: apds990x, bh1770glc, lis3lv02d: use to_i2c_client
Use to_i2c_client() instead of open-coding it.
Signed-off-by: Geliang Tang <geliangtang@163.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/misc/apds990x.c | 8 | ||||
-rw-r--r-- | drivers/misc/bh1770glc.c | 8 | ||||
-rw-r--r-- | drivers/misc/lis3lv02d/lis3lv02d_i2c.c | 8 |
3 files changed, 12 insertions, 12 deletions
diff --git a/drivers/misc/apds990x.c b/drivers/misc/apds990x.c index a3e789b85cc8..dfb72ecfa604 100644 --- a/drivers/misc/apds990x.c +++ b/drivers/misc/apds990x.c | |||
@@ -1215,7 +1215,7 @@ static int apds990x_remove(struct i2c_client *client) | |||
1215 | #ifdef CONFIG_PM_SLEEP | 1215 | #ifdef CONFIG_PM_SLEEP |
1216 | static int apds990x_suspend(struct device *dev) | 1216 | static int apds990x_suspend(struct device *dev) |
1217 | { | 1217 | { |
1218 | struct i2c_client *client = container_of(dev, struct i2c_client, dev); | 1218 | struct i2c_client *client = to_i2c_client(dev); |
1219 | struct apds990x_chip *chip = i2c_get_clientdata(client); | 1219 | struct apds990x_chip *chip = i2c_get_clientdata(client); |
1220 | 1220 | ||
1221 | apds990x_chip_off(chip); | 1221 | apds990x_chip_off(chip); |
@@ -1224,7 +1224,7 @@ static int apds990x_suspend(struct device *dev) | |||
1224 | 1224 | ||
1225 | static int apds990x_resume(struct device *dev) | 1225 | static int apds990x_resume(struct device *dev) |
1226 | { | 1226 | { |
1227 | struct i2c_client *client = container_of(dev, struct i2c_client, dev); | 1227 | struct i2c_client *client = to_i2c_client(dev); |
1228 | struct apds990x_chip *chip = i2c_get_clientdata(client); | 1228 | struct apds990x_chip *chip = i2c_get_clientdata(client); |
1229 | 1229 | ||
1230 | /* | 1230 | /* |
@@ -1240,7 +1240,7 @@ static int apds990x_resume(struct device *dev) | |||
1240 | #ifdef CONFIG_PM | 1240 | #ifdef CONFIG_PM |
1241 | static int apds990x_runtime_suspend(struct device *dev) | 1241 | static int apds990x_runtime_suspend(struct device *dev) |
1242 | { | 1242 | { |
1243 | struct i2c_client *client = container_of(dev, struct i2c_client, dev); | 1243 | struct i2c_client *client = to_i2c_client(dev); |
1244 | struct apds990x_chip *chip = i2c_get_clientdata(client); | 1244 | struct apds990x_chip *chip = i2c_get_clientdata(client); |
1245 | 1245 | ||
1246 | apds990x_chip_off(chip); | 1246 | apds990x_chip_off(chip); |
@@ -1249,7 +1249,7 @@ static int apds990x_runtime_suspend(struct device *dev) | |||
1249 | 1249 | ||
1250 | static int apds990x_runtime_resume(struct device *dev) | 1250 | static int apds990x_runtime_resume(struct device *dev) |
1251 | { | 1251 | { |
1252 | struct i2c_client *client = container_of(dev, struct i2c_client, dev); | 1252 | struct i2c_client *client = to_i2c_client(dev); |
1253 | struct apds990x_chip *chip = i2c_get_clientdata(client); | 1253 | struct apds990x_chip *chip = i2c_get_clientdata(client); |
1254 | 1254 | ||
1255 | apds990x_chip_on(chip); | 1255 | apds990x_chip_on(chip); |
diff --git a/drivers/misc/bh1770glc.c b/drivers/misc/bh1770glc.c index 753d7ecdadaa..845466e45b95 100644 --- a/drivers/misc/bh1770glc.c +++ b/drivers/misc/bh1770glc.c | |||
@@ -1323,7 +1323,7 @@ static int bh1770_remove(struct i2c_client *client) | |||
1323 | #ifdef CONFIG_PM_SLEEP | 1323 | #ifdef CONFIG_PM_SLEEP |
1324 | static int bh1770_suspend(struct device *dev) | 1324 | static int bh1770_suspend(struct device *dev) |
1325 | { | 1325 | { |
1326 | struct i2c_client *client = container_of(dev, struct i2c_client, dev); | 1326 | struct i2c_client *client = to_i2c_client(dev); |
1327 | struct bh1770_chip *chip = i2c_get_clientdata(client); | 1327 | struct bh1770_chip *chip = i2c_get_clientdata(client); |
1328 | 1328 | ||
1329 | bh1770_chip_off(chip); | 1329 | bh1770_chip_off(chip); |
@@ -1333,7 +1333,7 @@ static int bh1770_suspend(struct device *dev) | |||
1333 | 1333 | ||
1334 | static int bh1770_resume(struct device *dev) | 1334 | static int bh1770_resume(struct device *dev) |
1335 | { | 1335 | { |
1336 | struct i2c_client *client = container_of(dev, struct i2c_client, dev); | 1336 | struct i2c_client *client = to_i2c_client(dev); |
1337 | struct bh1770_chip *chip = i2c_get_clientdata(client); | 1337 | struct bh1770_chip *chip = i2c_get_clientdata(client); |
1338 | int ret = 0; | 1338 | int ret = 0; |
1339 | 1339 | ||
@@ -1361,7 +1361,7 @@ static int bh1770_resume(struct device *dev) | |||
1361 | #ifdef CONFIG_PM | 1361 | #ifdef CONFIG_PM |
1362 | static int bh1770_runtime_suspend(struct device *dev) | 1362 | static int bh1770_runtime_suspend(struct device *dev) |
1363 | { | 1363 | { |
1364 | struct i2c_client *client = container_of(dev, struct i2c_client, dev); | 1364 | struct i2c_client *client = to_i2c_client(dev); |
1365 | struct bh1770_chip *chip = i2c_get_clientdata(client); | 1365 | struct bh1770_chip *chip = i2c_get_clientdata(client); |
1366 | 1366 | ||
1367 | bh1770_chip_off(chip); | 1367 | bh1770_chip_off(chip); |
@@ -1371,7 +1371,7 @@ static int bh1770_runtime_suspend(struct device *dev) | |||
1371 | 1371 | ||
1372 | static int bh1770_runtime_resume(struct device *dev) | 1372 | static int bh1770_runtime_resume(struct device *dev) |
1373 | { | 1373 | { |
1374 | struct i2c_client *client = container_of(dev, struct i2c_client, dev); | 1374 | struct i2c_client *client = to_i2c_client(dev); |
1375 | struct bh1770_chip *chip = i2c_get_clientdata(client); | 1375 | struct bh1770_chip *chip = i2c_get_clientdata(client); |
1376 | 1376 | ||
1377 | bh1770_chip_on(chip); | 1377 | bh1770_chip_on(chip); |
diff --git a/drivers/misc/lis3lv02d/lis3lv02d_i2c.c b/drivers/misc/lis3lv02d/lis3lv02d_i2c.c index 0c3bb7e3ee80..14b7d539fed6 100644 --- a/drivers/misc/lis3lv02d/lis3lv02d_i2c.c +++ b/drivers/misc/lis3lv02d/lis3lv02d_i2c.c | |||
@@ -209,7 +209,7 @@ static int lis3lv02d_i2c_remove(struct i2c_client *client) | |||
209 | #ifdef CONFIG_PM_SLEEP | 209 | #ifdef CONFIG_PM_SLEEP |
210 | static int lis3lv02d_i2c_suspend(struct device *dev) | 210 | static int lis3lv02d_i2c_suspend(struct device *dev) |
211 | { | 211 | { |
212 | struct i2c_client *client = container_of(dev, struct i2c_client, dev); | 212 | struct i2c_client *client = to_i2c_client(dev); |
213 | struct lis3lv02d *lis3 = i2c_get_clientdata(client); | 213 | struct lis3lv02d *lis3 = i2c_get_clientdata(client); |
214 | 214 | ||
215 | if (!lis3->pdata || !lis3->pdata->wakeup_flags) | 215 | if (!lis3->pdata || !lis3->pdata->wakeup_flags) |
@@ -219,7 +219,7 @@ static int lis3lv02d_i2c_suspend(struct device *dev) | |||
219 | 219 | ||
220 | static int lis3lv02d_i2c_resume(struct device *dev) | 220 | static int lis3lv02d_i2c_resume(struct device *dev) |
221 | { | 221 | { |
222 | struct i2c_client *client = container_of(dev, struct i2c_client, dev); | 222 | struct i2c_client *client = to_i2c_client(dev); |
223 | struct lis3lv02d *lis3 = i2c_get_clientdata(client); | 223 | struct lis3lv02d *lis3 = i2c_get_clientdata(client); |
224 | 224 | ||
225 | /* | 225 | /* |
@@ -238,7 +238,7 @@ static int lis3lv02d_i2c_resume(struct device *dev) | |||
238 | #ifdef CONFIG_PM | 238 | #ifdef CONFIG_PM |
239 | static int lis3_i2c_runtime_suspend(struct device *dev) | 239 | static int lis3_i2c_runtime_suspend(struct device *dev) |
240 | { | 240 | { |
241 | struct i2c_client *client = container_of(dev, struct i2c_client, dev); | 241 | struct i2c_client *client = to_i2c_client(dev); |
242 | struct lis3lv02d *lis3 = i2c_get_clientdata(client); | 242 | struct lis3lv02d *lis3 = i2c_get_clientdata(client); |
243 | 243 | ||
244 | lis3lv02d_poweroff(lis3); | 244 | lis3lv02d_poweroff(lis3); |
@@ -247,7 +247,7 @@ static int lis3_i2c_runtime_suspend(struct device *dev) | |||
247 | 247 | ||
248 | static int lis3_i2c_runtime_resume(struct device *dev) | 248 | static int lis3_i2c_runtime_resume(struct device *dev) |
249 | { | 249 | { |
250 | struct i2c_client *client = container_of(dev, struct i2c_client, dev); | 250 | struct i2c_client *client = to_i2c_client(dev); |
251 | struct lis3lv02d *lis3 = i2c_get_clientdata(client); | 251 | struct lis3lv02d *lis3 = i2c_get_clientdata(client); |
252 | 252 | ||
253 | lis3lv02d_poweron(lis3); | 253 | lis3lv02d_poweron(lis3); |