diff mbox series

[RESEND] media: cros-ec-cec: do not bail on device_init_wakeup failure

Message ID 20200622100520.143622-1-darekm@google.com (mailing list archive)
State New, archived
Headers show
Series [RESEND] media: cros-ec-cec: do not bail on device_init_wakeup failure | expand

Commit Message

Dariusz Marcinkiewicz June 22, 2020, 10:05 a.m. UTC
Do not fail probing when device_init_wakeup fails.

device_init_wakeup fails when the device is already enabled as wakeup
device. Hence, the driver fails to probe the device if:
- The device has already been enabled for wakeup (via e.g. sysfs)
- The driver has been unloaded and is being loaded again.

This goal of the patch is to fix the above cases.

Overwhelming majority of the drivers do not check device_init_wakeup
return value.

Signed-off-by: Dariusz Marcinkiewicz <darekm@google.com>
---
 drivers/media/cec/platform/cros-ec/cros-ec-cec.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

Comments

Hans Verkuil June 22, 2020, 10:23 a.m. UTC | #1
On 22/06/2020 12:05, Dariusz Marcinkiewicz wrote:
> Do not fail probing when device_init_wakeup fails.
> 
> device_init_wakeup fails when the device is already enabled as wakeup
> device. Hence, the driver fails to probe the device if:
> - The device has already been enabled for wakeup (via e.g. sysfs)
> - The driver has been unloaded and is being loaded again.
> 
> This goal of the patch is to fix the above cases.
> 
> Overwhelming majority of the drivers do not check device_init_wakeup
> return value.
> 
> Signed-off-by: Dariusz Marcinkiewicz <darekm@google.com>

This can be CCed to stable, I guess?

Can you provide a Fixes: tag as well?

Regards,

	Hans

> ---
>  drivers/media/cec/platform/cros-ec/cros-ec-cec.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/drivers/media/cec/platform/cros-ec/cros-ec-cec.c b/drivers/media/cec/platform/cros-ec/cros-ec-cec.c
> index 0e7e2772f08f..2d95e16cd248 100644
> --- a/drivers/media/cec/platform/cros-ec/cros-ec-cec.c
> +++ b/drivers/media/cec/platform/cros-ec/cros-ec-cec.c
> @@ -277,11 +277,7 @@ static int cros_ec_cec_probe(struct platform_device *pdev)
>  	platform_set_drvdata(pdev, cros_ec_cec);
>  	cros_ec_cec->cros_ec = cros_ec;
>  
> -	ret = device_init_wakeup(&pdev->dev, 1);
> -	if (ret) {
> -		dev_err(&pdev->dev, "failed to initialize wakeup\n");
> -		return ret;
> -	}
> +	device_init_wakeup(&pdev->dev, 1);
>  
>  	cros_ec_cec->adap = cec_allocate_adapter(&cros_ec_cec_ops, cros_ec_cec,
>  						 DRV_NAME,
>
Dariusz Marcinkiewicz June 24, 2020, 12:40 p.m. UTC | #2
Hello.

I realized that I sent the previous answer using HTML, and as a
consequence it was blocked from mailing lists. Sending it again
(apologies for double posting).

On Mon, Jun 22, 2020 at 12:23 PM Hans Verkuil <hverkuil-cisco@xs4all.nl> wrote:
>
> On 22/06/2020 12:05, Dariusz Marcinkiewicz wrote:
> > Do not fail probing when device_init_wakeup fails.
> >
> > device_init_wakeup fails when the device is already enabled as wakeup
> > device. Hence, the driver fails to probe the device if:
> > - The device has already been enabled for wakeup (via e.g. sysfs)
> > - The driver has been unloaded and is being loaded again.
> >
> > This goal of the patch is to fix the above cases.
> >
> > Overwhelming majority of the drivers do not check device_init_wakeup
> > return value.
> >
> > Signed-off-by: Dariusz Marcinkiewicz <darekm@google.com>
>
> This can be CCed to stable, I guess?
>

That issue is not a recent regression but has been in there since the
very beginning.  So it might be argued that is it not severe enough to
warrant cc'ing stable. Happy to do that anyways if you think
otherwise.

> Can you provide a Fixes: tag as well?
>

Done, submitted v2 with that a couple of days ago.

Thank you and best regards.
Guenter Roeck June 24, 2020, 2:45 p.m. UTC | #3
On Wed, Jun 24, 2020 at 5:40 AM Dariusz Marcinkiewicz <darekm@google.com> wrote:
>
> Hello.
>
> I realized that I sent the previous answer using HTML, and as a
> consequence it was blocked from mailing lists. Sending it again
> (apologies for double posting).
>
> On Mon, Jun 22, 2020 at 12:23 PM Hans Verkuil <hverkuil-cisco@xs4all.nl> wrote:
> >
> > On 22/06/2020 12:05, Dariusz Marcinkiewicz wrote:
> > > Do not fail probing when device_init_wakeup fails.
> > >
> > > device_init_wakeup fails when the device is already enabled as wakeup
> > > device. Hence, the driver fails to probe the device if:
> > > - The device has already been enabled for wakeup (via e.g. sysfs)
> > > - The driver has been unloaded and is being loaded again.
> > >
> > > This goal of the patch is to fix the above cases.
> > >
> > > Overwhelming majority of the drivers do not check device_init_wakeup
> > > return value.
> > >
> > > Signed-off-by: Dariusz Marcinkiewicz <darekm@google.com>
> >
> > This can be CCed to stable, I guess?
> >
>
> That issue is not a recent regression but has been in there since the
> very beginning.  So it might be argued that is it not severe enough to
> warrant cc'ing stable. Happy to do that anyways if you think
> otherwise.
>

Confused. Internally you would like to have this patch applied to
chromeos-4.4. Here you suggest that it may not be important enough to
apply to stable releases. Which one is it ?

Thanks,
Guenter

> > Can you provide a Fixes: tag as well?
> >
>
> Done, submitted v2 with that a couple of days ago.
>
> Thank you and best regards.
Dariusz Marcinkiewicz June 24, 2020, 4:39 p.m. UTC | #4
Hi.

On Wed, Jun 24, 2020 at 4:45 PM Guenter Roeck <groeck@google.com> wrote:

> > On Mon, Jun 22, 2020 at 12:23 PM Hans Verkuil <hverkuil-cisco@xs4all.nl> wrote:
> > >
> > > > Signed-off-by: Dariusz Marcinkiewicz <darekm@google.com>
> > >
> > > This can be CCed to stable, I guess?
> > >
> >
> > That issue is not a recent regression but has been in there since the
> > very beginning.  So it might be argued that is it not severe enough to
> > warrant cc'ing stable. Happy to do that anyways if you think
> > otherwise.
> >
>
> Confused. Internally you would like to have this patch applied to
> chromeos-4.4. Here you suggest that it may not be important enough to
> apply to stable releases. Which one is it ?
>

It affects us on 4.4, hence the backport to 4.4. I have nothing
against this being merged into the mainline stable. I simply wasn't
sure if that should be considered severe enough to be backported
there. As said before, I am happy to CC this to stable.

Thank you and best regards.

(apologies for double post again)
diff mbox series

Patch

diff --git a/drivers/media/cec/platform/cros-ec/cros-ec-cec.c b/drivers/media/cec/platform/cros-ec/cros-ec-cec.c
index 0e7e2772f08f..2d95e16cd248 100644
--- a/drivers/media/cec/platform/cros-ec/cros-ec-cec.c
+++ b/drivers/media/cec/platform/cros-ec/cros-ec-cec.c
@@ -277,11 +277,7 @@  static int cros_ec_cec_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, cros_ec_cec);
 	cros_ec_cec->cros_ec = cros_ec;
 
-	ret = device_init_wakeup(&pdev->dev, 1);
-	if (ret) {
-		dev_err(&pdev->dev, "failed to initialize wakeup\n");
-		return ret;
-	}
+	device_init_wakeup(&pdev->dev, 1);
 
 	cros_ec_cec->adap = cec_allocate_adapter(&cros_ec_cec_ops, cros_ec_cec,
 						 DRV_NAME,