2019-06-27 21:50:02

by Rajat Jain

[permalink] [raw]
Subject: [PATCH] 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.

Signed-off-by: Rajat Jain <[email protected]>
---
drivers/platform/chrome/cros_ec_lightbar.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/chrome/cros_ec_lightbar.c b/drivers/platform/chrome/cros_ec_lightbar.c
index d30a6650b0b5..26117a8991b3 100644
--- a/drivers/platform/chrome/cros_ec_lightbar.c
+++ b/drivers/platform/chrome/cros_ec_lightbar.c
@@ -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


2019-06-27 22:16:10

by Gwendal Grignou

[permalink] [raw]
Subject: Re: [PATCH] platform/chrome: lightbar: Get drvdata from parent in suspend/resume

Reviewed-by: Gwendal Grignou <[email protected]>


On Thu, Jun 27, 2019 at 2:47 PM Rajat Jain <[email protected]> wrote:
>
> 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 <[email protected]>
> ---
> drivers/platform/chrome/cros_ec_lightbar.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/platform/chrome/cros_ec_lightbar.c b/drivers/platform/chrome/cros_ec_lightbar.c
> index d30a6650b0b5..26117a8991b3 100644
> --- a/drivers/platform/chrome/cros_ec_lightbar.c
> +++ b/drivers/platform/chrome/cros_ec_lightbar.c
> @@ -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
>

2019-06-28 10:52:08

by Enric Balletbo i Serra

[permalink] [raw]
Subject: Re: [PATCH] platform/chrome: lightbar: Get drvdata from parent in suspend/resume



On 27/6/19 23:47, Rajat Jain wrote:
> 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 <[email protected]>

Queued for 5.3

Thanks,
~ Enric

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