media: cros-ec-cec: do not bail on device_init_wakeup failure
Subsystems (4)
PATCH v3 1/1 media: cros-ec-cec: do not bail on device_init_wakeup failure
Do not fail probing when device_init_wakeup fails. Also clear wakeup on remove.
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 /proc/acpi/wakeup)
- 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 consider device_init_wakeup failure as a fatal error and proceed regardless of whether it succeeds or not.
Changes since v2:
- disabled wakeup in remove
- CC'ing stable
- description fixed
Changes since v1:
- added Fixes tag
--- drivers/media/cec/platform/cros-ec/cros-ec-cec.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/media/cec/platform/cros-ec/cros-ec-cec.c +4 -6
@@ -277,12 +277,6 @@ 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; - } - cros_ec_cec->adap = cec_allocate_adapter(&cros_ec_cec_ops, cros_ec_cec, DRV_NAME, CEC_CAP_DEFAULTS |
@@ -310,6 +304,8 @@ static int cros_ec_cec_probe(struct platform_device *pdev)if (ret <0 ) goto out_probe_notify; +device_init_wakeup (&pdev->dev,1 ); +return 0 ; out_probe_notify:
@@ -339,6 +335,8 @@ static int cros_ec_cec_remove(struct platform_device *pdev) cros_ec_cec->adap);cec_unregister_adapter (cros_ec_cec->adap); +device_init_wakeup (&pdev->dev,0 ); +return 0 ; }
Signature · 1 line
2.27.0.212.ge8ba1cc988-goog
Quoted 22 lines · Dariusz Marcinkiewicz
Do not fail probing when
device_init_wakeupfails. Also clear wakeup on remove.
device_init_wakeupfails 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/proc/acpi/wakeup)
- 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 consider
device_init_wakeupfailure as a fatal error and proceed regardless of whether it succeeds or not.Changes since v2:
- disabled wakeup in remove
- CC'ing stable
- description fixed
Changes since v1:
- added Fixes tag
Quoted 3 lines
Fixes cd70de2d356ee ("media: platform: Add ChromeOS EC CEC driver")Signed-off-by Dariusz Marcinkiewicz <[email protected]>
Quoted 42 lines
--- drivers/media/cec/platform/cros-ec/cros-ec-cec.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)drivers/media/cec/platform/cros-ec/cros-ec-cec.c +4
-7@@ -277,12 +277,6 @@ 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; - } - cros_ec_cec->adap = cec_allocate_adapter(&cros_ec_cec_ops, cros_ec_cec, DRV_NAME, CEC_CAP_DEFAULTS |@@ -310,6 +304,8 @@ static int cros_ec_cec_probe(struct platform_device *pdev)if (ret <0 ) goto out_probe_notify; +device_init_wakeup (&pdev->dev,1 ); +return 0 ; out_probe_notify:@@ -339,6 +335,8 @@ static int cros_ec_cec_remove(struct platform_device *pdev) cros_ec_cec->adap);cec_unregister_adapter (cros_ec_cec->adap); +device_init_wakeup (&pdev->dev,0 ); +return 0 ; } --2.27.0.212.ge8ba1cc988-goog