platform/chrome: cros_ec_sensorhub: simplify getting .driver_data
authorWolfram Sang <wsa+renesas@sang-engineering.com>
Mon, 20 Sep 2021 09:05:20 +0000 (11:05 +0200)
committerEnric Balletbo i Serra <enric.balletbo@collabora.com>
Mon, 27 Sep 2021 07:18:58 +0000 (09:18 +0200)
We should get 'driver_data' from 'struct device' directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Link: https://lore.kernel.org/r/20210920090522.23784-9-wsa+renesas@sang-engineering.com
drivers/platform/chrome/cros_ec_sensorhub.c

index 9c4af76a9956ed567752f6920ec8db3671b2ab35..31fb8bdaad5a35b6fba851f660927ae44152ec01 100644 (file)
@@ -224,8 +224,7 @@ static int cros_ec_sensorhub_probe(struct platform_device *pdev)
  */
 static int cros_ec_sensorhub_suspend(struct device *dev)
 {
-       struct platform_device *pdev = to_platform_device(dev);
-       struct cros_ec_sensorhub *sensorhub = platform_get_drvdata(pdev);
+       struct cros_ec_sensorhub *sensorhub = dev_get_drvdata(dev);
        struct cros_ec_dev *ec = sensorhub->ec;
 
        if (cros_ec_check_features(ec, EC_FEATURE_MOTION_SENSE_FIFO))
@@ -235,8 +234,7 @@ static int cros_ec_sensorhub_suspend(struct device *dev)
 
 static int cros_ec_sensorhub_resume(struct device *dev)
 {
-       struct platform_device *pdev = to_platform_device(dev);
-       struct cros_ec_sensorhub *sensorhub = platform_get_drvdata(pdev);
+       struct cros_ec_sensorhub *sensorhub = dev_get_drvdata(dev);
        struct cros_ec_dev *ec = sensorhub->ec;
 
        if (cros_ec_check_features(ec, EC_FEATURE_MOTION_SENSE_FIFO))