Skip to contentSkip to conversation

extcon: int3496: Switch to devm_acpi_dev_add_driver_gpios()

PATCH Applied Andy Shevchenko 2 participants 2 messages Jun 10, 2017 – Jun 12, 2017 External connector subsystem (extcon)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 extcon: int3496: Switch to devm_acpi_dev_add_driver_gpios()

Switch to use managed variant of acpi_dev_add_driver_gpios() to simplify error path and fix potentially wrong assingment if ->probe() fails.

---
 drivers/extcon/extcon-intel-int3496.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/extcon/extcon-intel-int3496.c +1 -4
index 9d17984bbbd4..d9f9afe45961 100644
@@ -94,8 +94,7 @@ static int int3496_probe(struct platform_device *pdev)
 	struct int3496_data *data;
 	int ret;
 
-	ret = acpi_dev_add_driver_gpios(ACPI_COMPANION(dev),
-					acpi_int3496_default_gpios);
+	ret = devm_acpi_dev_add_driver_gpios(dev, acpi_int3496_default_gpios);
 	if (ret) {
 		dev_err(dev, "can't add GPIO ACPI mapping\n");
 		return ret;
@@ -169,8 +168,6 @@ static int int3496_remove(struct platform_device *pdev)
 	devm_free_irq(&pdev->dev, data->usb_id_irq, data);
 	cancel_delayed_work_sync(&data->work);
 
-	acpi_dev_remove_driver_gpios(ACPI_COMPANION(&pdev->dev));
-
 	return 0;
 }
 
Signature · 1 line
2.11.0
maintainer Applied
#1 lore raw
Quoted 24 lines · Andy Shevchenko

Switch to use managed variant of acpi_dev_add_driver_gpios() to simplify error path and fix potentially wrong assingment if ->probe() fails.

---
 drivers/extcon/extcon-intel-int3496.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/extcon/extcon-intel-int3496.c +1 -2
index 9d17984bbbd4..d9f9afe45961 100644
@@ -94,8 +94,7 @@ static int int3496_probe(struct platform_device *pdev)
 	struct int3496_data *data;
 	int ret;
 
-	ret = acpi_dev_add_driver_gpios(ACPI_COMPANION(dev),
-					acpi_int3496_default_gpios);
+	ret = devm_acpi_dev_add_driver_gpios(dev, acpi_int3496_default_gpios);
 	if (ret) {
 		dev_err(dev, "can't add GPIO ACPI mapping\n");
 		return ret;

drivers/extcon/extcon-intel-int3496.c static int int3496_remove(struct platform_device *pdev) · line 173

Quoted 8 lines
drivers/extcon/extcon-intel-int3496.c +0 -2
@@ -169,8 +168,6 @@ static int int3496_remove(struct platform_device *pdev)
 	devm_free_irq(&pdev->dev, data->usb_id_irq, data);
 	cancel_delayed_work_sync(&data->work);
 
-	acpi_dev_remove_driver_gpios(ACPI_COMPANION(&pdev->dev));
-
 	return 0;
 }
 

Applied it. Thanks.

Signature · 3 lines
Best Regards,
Chanwoo Choi
Samsung Electronics