Skip to contentSkip to conversation

extcon: palmas: explicitly set edev name as node name

PATCH In review Kishon Vijay Abraham I 3 participants 4 messages Mar 28, 2014 – Apr 23, 2014 External connector subsystem (extcon)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 extcon: palmas: explicitly set edev name as node name

commit ca488 (extcon: of: Remove unnecessary function call by using the name of device_node) started using node name instead of device name to get the extcon device. This breaks dwc3-omap since it's not able to get the extcon device anymore. Fixed it by setting edev name of palmas to be the same as its node name.

---
 drivers/extcon/extcon-palmas.c |    5 +++++
 1 file changed, 5 insertions(+)
drivers/extcon/extcon-palmas.c +5 -0
index 2aea4bc..51dee21 100644
@@ -23,6 +23,7 @@
 #include <linux/module.h>
 #include <linux/interrupt.h>
 #include <linux/platform_device.h>
+#include <linux/slab.h>
 #include <linux/err.h>
 #include <linux/mfd/palmas.h>
 #include <linux/of.h>
@@ -188,11 +189,13 @@ static int palmas_usb_probe(struct platform_device *pdev)
 
 	palmas_usb->edev.supported_cable = palmas_extcon_cable;
 	palmas_usb->edev.dev.parent = palmas_usb->dev;
+	palmas_usb->edev.name = kstrdup(node->name, GFP_KERNEL);
 	palmas_usb->edev.mutually_exclusive = mutually_exclusive;
 
 	status = extcon_dev_register(&palmas_usb->edev);
 	if (status) {
 		dev_err(&pdev->dev, "failed to register extcon device\n");
+		kfree(palmas_usb->edev.name);
 		return status;
 	}
 
@@ -230,6 +233,7 @@ static int palmas_usb_probe(struct platform_device *pdev)
 
 fail_extcon:
 	extcon_dev_unregister(&palmas_usb->edev);
+	kfree(palmas_usb->edev.name);
 
 	return status;
 }
@@ -239,6 +243,7 @@ static int palmas_usb_remove(struct platform_device *pdev)
 	struct palmas_usb *palmas_usb = platform_get_drvdata(pdev);
 
 	extcon_dev_unregister(&palmas_usb->edev);
+	kfree(palmas_usb->edev.name);
 
 	return 0;
 }
Signature · 1 line
1.7.9.5
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Kishon Vijay Abraham I

commit ca488 (extcon: of: Remove unnecessary function call by using the name of device_node) started using node name instead of device name to get the extcon device. This breaks dwc3-omap since it's not able to get the extcon device anymore. Fixed it by setting edev name of palmas to be the same as its node name.

Thanks Kishon, I tested something similar yesterday and I saw that it helped a lot. I'm still missing something (maybe DTS) because dwc3 still didn't probe even after fixing this.

Quoted 49 lines
---
 drivers/extcon/extcon-palmas.c |    5 +++++
 1 file changed, 5 insertions(+)
drivers/extcon/extcon-palmas.c +5 -0
index 2aea4bc..51dee21 100644
@@ -23,6 +23,7 @@
 #include <linux/module.h>
 #include <linux/interrupt.h>
 #include <linux/platform_device.h>
+#include <linux/slab.h>
 #include <linux/err.h>
 #include <linux/mfd/palmas.h>
 #include <linux/of.h>
@@ -188,11 +189,13 @@ static int palmas_usb_probe(struct platform_device *pdev)
 
 	palmas_usb->edev.supported_cable = palmas_extcon_cable;
 	palmas_usb->edev.dev.parent = palmas_usb->dev;
+	palmas_usb->edev.name = kstrdup(node->name, GFP_KERNEL);
 	palmas_usb->edev.mutually_exclusive = mutually_exclusive;
 
 	status = extcon_dev_register(&palmas_usb->edev);
 	if (status) {
 		dev_err(&pdev->dev, "failed to register extcon device\n");
+		kfree(palmas_usb->edev.name);
 		return status;
 	}
 
@@ -230,6 +233,7 @@ static int palmas_usb_probe(struct platform_device *pdev)
 
 fail_extcon:
 	extcon_dev_unregister(&palmas_usb->edev);
+	kfree(palmas_usb->edev.name);
 
 	return status;
 }
@@ -239,6 +243,7 @@ static int palmas_usb_remove(struct platform_device *pdev)
 	struct palmas_usb *palmas_usb = platform_get_drvdata(pdev);
 
 	extcon_dev_unregister(&palmas_usb->edev);
+	kfree(palmas_usb->edev.name);
 
 	return 0;
 }
Signature · 1 line
1.7.9.5
Signature · 1 line
balbi
maintainer
#2 lore raw
In reply to Kishon Vijay Abraham I

Hi Kishon,

Quoted 9 lines · Kishon Vijay Abraham I

commit ca488 (extcon: of: Remove unnecessary function call by using the name of device_node) started using node name instead of device name to get the extcon device. This breaks dwc3-omap since it's not able to get the extcon device anymore. Fixed it by setting edev name of palmas to be the same as its node name.

---

Applied this patch
but, you could check this patch on extcon-next branch after few days. becuase I have firewall issue of kerner.org.

Thanks,
Chanwoo Choi

#3 lore raw

Hi Chanwoo,

Quoted 9 lines · Chanwoo Choi

Hi Kishon,

Quoted 6 lines · Kishon Vijay Abraham I

commit ca488 (extcon: of: Remove unnecessary function call by using the name of device_node) started using node name instead of device name to get the extcon device. This breaks dwc3-omap since it's not able to get the extcon device anymore. Fixed it by setting edev name of palmas to be the same as its node name.

Quoted 7 lines
Quoted 3 lines

---

Applied this patch
but, you could check this patch on extcon-next branch after few days. becuase I have firewall issue of kerner.org.

I see the commit being merged in extcon-next branch. Will you be sending it in this -rc cycle?

Thanks
Kishon