platform/chrome: lightbar: Get drvdata from parent in suspend/resume
authorRajat Jain <rajatja@google.com>
Thu, 27 Jun 2019 21:47:38 +0000 (14:47 -0700)
committerEnric Balletbo i Serra <enric.balletbo@collabora.com>
Fri, 28 Jun 2019 10:37:21 +0000 (12:37 +0200)
The lightbar driver never assigned the drvdata in probe method, and
thus there is nothing there. Need to get the ec_dev from the parent's
drvdata.

Signed-off-by: Rajat Jain <rajatja@google.com>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
drivers/platform/chrome/cros_ec_lightbar.c

index 23a82ee4c785bc82492be1c2243e0cb47f9b5e22..609598bbb6c3218d6c25899fdd20e3302322fdc5 100644 (file)
@@ -600,7 +600,7 @@ static int cros_ec_lightbar_remove(struct platform_device *pd)
 
 static int __maybe_unused cros_ec_lightbar_resume(struct device *dev)
 {
-       struct cros_ec_dev *ec_dev = dev_get_drvdata(dev);
+       struct cros_ec_dev *ec_dev = dev_get_drvdata(dev->parent);
 
        if (userspace_control)
                return 0;
@@ -610,7 +610,7 @@ static int __maybe_unused cros_ec_lightbar_resume(struct device *dev)
 
 static int __maybe_unused cros_ec_lightbar_suspend(struct device *dev)
 {
-       struct cros_ec_dev *ec_dev = dev_get_drvdata(dev);
+       struct cros_ec_dev *ec_dev = dev_get_drvdata(dev->parent);
 
        if (userspace_control)
                return 0;