[PATCH V3] extcon: palmas: Option to disable ID/VBUS detection based on platform
Chanwoo Choi
cw00.choi at samsung.com
Thu Jul 11 12:42:33 EST 2013
Hi Laxman,
> static int palmas_usb_probe(struct platform_device *pdev)
> @@ -137,20 +140,26 @@ static int palmas_usb_probe(struct platform_device *pdev)
> struct palmas_usb *palmas_usb;
> int status;
>
> - if (node && !pdata) {
> - pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
> -
> - if (!pdata)
> - return -ENOMEM;
> + palmas_usb = devm_kzalloc(&pdev->dev, sizeof(*palmas_usb), GFP_KERNEL);
> + if (!palmas_usb)
> + return -ENOMEM;
>
> - pdata->wakeup = of_property_read_bool(node, "ti,wakeup");
> + if (node && !pdata) {
> + palmas_usb->wakeup = of_property_read_bool(node, "ti,wakeup");
> + palmas_usb->enable_id_detection = of_property_read_bool(node,
> + "ti,enable-id-detection");
> + palmas_usb->enable_vbus_detection = of_property_read_bool(node,
> + "ti,enable-vbus-detection");
> + } else if (pdata) {
> + palmas_usb->wakeup = pdata->wakeup;
> + palmas_usb->enable_id_detection = true;
> + palmas_usb->enable_vbus_detection = true;
> } else if (!pdata) {
> - return -EINVAL;
> + palmas_usb->wakeup = true;
> + palmas_usb->enable_id_detection = true;
> + palmas_usb->enable_vbus_detection = true;
> }
I think we could modify it as following patch to remove duplicate line.
If you agree about below modification, I will apply your patch with following patch.
index 5c218d2..56909cc 100644
--- a/drivers/extcon/extcon-palmas.c
+++ b/drivers/extcon/extcon-palmas.c
@@ -150,16 +150,14 @@ static int palmas_usb_probe(struct platform_device *pdev)
"ti,enable-id-detection");
palmas_usb->enable_vbus_detection = of_property_read_bool(node,
"ti,enable-vbus-detection");
- } else if (pdata) {
- palmas_usb->wakeup = pdata->wakeup;
- palmas_usb->enable_id_detection = true;
- palmas_usb->enable_vbus_detection = true;
- } else if (!pdata) {
+ } else {
palmas_usb->wakeup = true;
palmas_usb->enable_id_detection = true;
palmas_usb->enable_vbus_detection = true;
- }
+ if (pdata)
+ palmas_usb->wakeup = pdata->wakeup;
+ }
palmas->usb = palmas_usb;
palmas_usb->palmas = palmas;
Thanks,
Chanwoo Choi
More information about the devicetree-discuss
mailing list