Skip to contentSkip to conversation

media: cros-ec-cec: disable the device wakeup on remove

PATCH In review Dariusz Marcinkiewicz 2 participants 3 messages Jul 6, 2020 – Jul 7, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media: cros-ec-cec: disable the device wakeup on remove

The device is enabled for wake up while the driver is loaded. For symmetry, disable wakeup when it is removed.

---
 drivers/media/cec/platform/cros-ec/cros-ec-cec.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/media/cec/platform/cros-ec/cros-ec-cec.c +4 -2
index 2d95e16cd248..3881ed7bc3d9 100644
@@ -277,8 +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;
 
-	device_init_wakeup(&pdev->dev, 1);
-
 	cros_ec_cec->adap = cec_allocate_adapter(&cros_ec_cec_ops, cros_ec_cec,
 						 DRV_NAME,
 						 CEC_CAP_DEFAULTS |
@@ -306,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:
@@ -335,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
#1 lore raw
Quoted 3 lines · Dariusz Marcinkiewicz

The device is enabled for wake up while the driver is loaded. For symmetry, disable wakeup when it is removed.

This is not necessary as it is handled by the core properly. There are currently 73 calls to device_init_wakeup that are not necessary, this would add one more.

Quoted 39 lines
---
 drivers/media/cec/platform/cros-ec/cros-ec-cec.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/media/cec/platform/cros-ec/cros-ec-cec.c +4 -2
index 2d95e16cd248..3881ed7bc3d9 100644
@@ -277,8 +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;
 
-	device_init_wakeup(&pdev->dev, 1);
-
 	cros_ec_cec->adap = cec_allocate_adapter(&cros_ec_cec_ops, cros_ec_cec,
 						 DRV_NAME,
 						 CEC_CAP_DEFAULTS |
@@ -306,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:
@@ -335,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
Signature · 3 lines
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#2 lore raw
Quoted 10 lines · Alexandre Belloni
Quoted 3 lines · Dariusz Marcinkiewicz

The device is enabled for wake up while the driver is loaded. For symmetry, disable wakeup when it is removed.

This is not necessary as it is handled by the core properly. There are currently 73 calls to device_init_wakeup that are not necessary, this would add one more.

Thank you.

To make sure - your comment applies even if the device node in question is not actually removed, as it is the case here? This is a platform dev, which won't be freed when the driver is unloaded.

Regards.

Quoted 44 lines
Quoted 37 lines
---
 drivers/media/cec/platform/cros-ec/cros-ec-cec.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/media/cec/platform/cros-ec/cros-ec-cec.c +4 -3
index 2d95e16cd248..3881ed7bc3d9 100644
@@ -277,8 +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;
 
-     device_init_wakeup(&pdev->dev, 1);
-
      cros_ec_cec->adap = cec_allocate_adapter(&cros_ec_cec_ops, cros_ec_cec,
                                               DRV_NAME,
                                               CEC_CAP_DEFAULTS |
@@ -306,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:
@@ -335,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;
 }
 
--
Quoted 2 lines

2.27.0.212.ge8ba1cc988-goog

--
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com