OSDN Git Service

iio: light: tsl2563: Use dev_get_drvdata() directly in PM callbacks
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Wed, 7 Dec 2022 19:03:46 +0000 (21:03 +0200)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Wed, 28 Dec 2022 17:19:46 +0000 (17:19 +0000)
PM callbacks take struct device pointer as a parameter, use
dev_get_drvdata() to retrieve it instead of unneeded double
loop of referencing via i2c_get_clientdata(to_i2c_client(dev)).

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Tested-by: Ferry Toth <ftoth@exalondelft.nl>
Link: https://lore.kernel.org/r/20221207190348.9347-9-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/light/tsl2563.c

index c581454..f92190f 100644 (file)
@@ -795,7 +795,7 @@ static void tsl2563_remove(struct i2c_client *client)
 
 static int tsl2563_suspend(struct device *dev)
 {
-       struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
+       struct iio_dev *indio_dev = dev_get_drvdata(dev);
        struct tsl2563_chip *chip = iio_priv(indio_dev);
        int ret;
 
@@ -814,7 +814,7 @@ out:
 
 static int tsl2563_resume(struct device *dev)
 {
-       struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
+       struct iio_dev *indio_dev = dev_get_drvdata(dev);
        struct tsl2563_chip *chip = iio_priv(indio_dev);
        int ret;