mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chanwoo Choi <cw00.choi@samsung.com>
To: Laxman Dewangan <ldewangan@nvidia.com>
Cc: myungjoo.ham@samsung.com, devicetree-discuss@lists.ozlabs.org,
	rob@landley.net, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org, kishon@ti.com, gg@slimlogic.co.uk
Subject: Re: [PATCH V3] extcon: palmas: Option to disable ID/VBUS detection based on platform
Date: Thu, 11 Jul 2013 11:42:33 +0900	[thread overview]
Message-ID: <51DE1B99.6090403@samsung.com> (raw)
In-Reply-To: <1373448546-7531-1-git-send-email-ldewangan@nvidia.com>

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



  reply	other threads:[~2013-07-11  2:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-10  9:29 Laxman Dewangan
2013-07-11  2:42 ` Chanwoo Choi [this message]
2013-07-11  3:08   ` Laxman Dewangan
2013-07-11  4:30     ` Chanwoo Choi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51DE1B99.6090403@samsung.com \
    --to=cw00.choi@samsung.com \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=gg@slimlogic.co.uk \
    --cc=kishon@ti.com \
    --cc=ldewangan@nvidia.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=myungjoo.ham@samsung.com \
    --cc=rob@landley.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome