Skip to contentSkip to conversation

platform/chrome: lightbar: Get drvdata from parent in suspend/resume

PATCH In review Rajat Jain 3 participants 3 messages Jun 27, 2019 – Jun 28, 2019

Subsystems (2)
lore
Share & tools
lore

Rajat Jain

author
#0 lore raw

PATCH 1/1 platform/chrome: lightbar: Get drvdata from parent in suspend/resume

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.

---
 drivers/platform/chrome/cros_ec_lightbar.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/platform/chrome/cros_ec_lightbar.c +2 -2
index d30a6650b0b5..26117a8991b3 100644
@@ -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;
Signature · 1 line
2.22.0.410.gd8fdbe21b5-goog
Reviewed-by on v1 1/1
#1 lore raw
Quoted 35 lines · Rajat Jain

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.

---
 drivers/platform/chrome/cros_ec_lightbar.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/platform/chrome/cros_ec_lightbar.c +2 -3
index d30a6650b0b5..26117a8991b3 100644
@@ -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;
--

2.22.0.410.gd8fdbe21b5-goog

#2 lore raw
In reply to Rajat Jain
Quoted 5 lines · Rajat Jain

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.

Queued for 5.3

Thanks,
~ Enric

Quoted 27 lines
---
 drivers/platform/chrome/cros_ec_lightbar.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/platform/chrome/cros_ec_lightbar.c +2 -2
index d30a6650b0b5..26117a8991b3 100644
@@ -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;