linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Chen <hzpeterchen@gmail.com>
To: Chanwoo Choi <cw00.choi@samsung.com>
Cc: balbi@kernel.org, gregkh@linuxfoundation.org, kishon@ti.com,
	sre@kernel.org, Peter.Chen@nxp.com, wens@csie.org,
	yoshihiro.shimoda.uh@renesas.com,
	maxime.ripard@free-electrons.com, b-liu@ti.com,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org,
	linux-usb@vger.kernel.org, linux-omap@vger.kernel.org,
	linux-renesas-soc@vger.kernel.org, chanwoo@kernel.org
Subject: Re: [PATCH 05/12] usb: chipdata: Replace the extcon API
Date: Fri, 2 Dec 2016 14:59:58 +0800	[thread overview]
Message-ID: <20161202065958.GB23234@b29397-desktop> (raw)
In-Reply-To: <1480485460-2663-6-git-send-email-cw00.choi@samsung.com>

On Wed, Nov 30, 2016 at 02:57:33PM +0900, Chanwoo Choi wrote:
> This patch uses the resource-managed extcon API for extcon_register_notifier()
> and replaces the deprecated extcon API as following:
> - extcon_get_cable_state_() -> extcon_get_state()
> 
> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
> ---
>  drivers/usb/chipidea/core.c | 30 ++++++------------------------
>  1 file changed, 6 insertions(+), 24 deletions(-)
> 
> diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
> index 69426e644d17..a5b44963eaea 100644
> --- a/drivers/usb/chipidea/core.c
> +++ b/drivers/usb/chipidea/core.c
> @@ -742,7 +742,7 @@ static int ci_get_platdata(struct device *dev,
>  	cable->edev = ext_vbus;
>  
>  	if (!IS_ERR(ext_vbus)) {
> -		ret = extcon_get_cable_state_(cable->edev, EXTCON_USB);
> +		ret = extcon_get_state(cable->edev, EXTCON_USB);
>  		if (ret)
>  			cable->state = true;
>  		else
> @@ -754,7 +754,7 @@ static int ci_get_platdata(struct device *dev,
>  	cable->edev = ext_id;
>  
>  	if (!IS_ERR(ext_id)) {
> -		ret = extcon_get_cable_state_(cable->edev, EXTCON_USB_HOST);
> +		ret = extcon_get_state(cable->edev, EXTCON_USB_HOST);
>  		if (ret)
>  			cable->state = false;
>  		else
> @@ -771,8 +771,8 @@ static int ci_extcon_register(struct ci_hdrc *ci)
>  	id = &ci->platdata->id_extcon;
>  	id->ci = ci;
>  	if (!IS_ERR(id->edev)) {
> -		ret = extcon_register_notifier(id->edev, EXTCON_USB_HOST,
> -					       &id->nb);
> +		ret = devm_extcon_register_notifier(ci->dev, id->edev,
> +						EXTCON_USB_HOST, &id->nb);
>  		if (ret < 0) {
>  			dev_err(ci->dev, "register ID failed\n");
>  			return ret;
> @@ -782,11 +782,9 @@ static int ci_extcon_register(struct ci_hdrc *ci)
>  	vbus = &ci->platdata->vbus_extcon;
>  	vbus->ci = ci;
>  	if (!IS_ERR(vbus->edev)) {
> -		ret = extcon_register_notifier(vbus->edev, EXTCON_USB,
> -					       &vbus->nb);
> +		ret = devm_extcon_register_notifier(ci->dev, vbus->edev,
> +						EXTCON_USB, &vbus->nb);
>  		if (ret < 0) {
> -			extcon_unregister_notifier(id->edev, EXTCON_USB_HOST,
> -						   &id->nb);
>  			dev_err(ci->dev, "register VBUS failed\n");
>  			return ret;
>  		}
> @@ -795,20 +793,6 @@ static int ci_extcon_register(struct ci_hdrc *ci)
>  	return 0;
>  }
>  
> -static void ci_extcon_unregister(struct ci_hdrc *ci)
> -{
> -	struct ci_hdrc_cable *cable;
> -
> -	cable = &ci->platdata->id_extcon;
> -	if (!IS_ERR(cable->edev))
> -		extcon_unregister_notifier(cable->edev, EXTCON_USB_HOST,
> -					   &cable->nb);
> -
> -	cable = &ci->platdata->vbus_extcon;
> -	if (!IS_ERR(cable->edev))
> -		extcon_unregister_notifier(cable->edev, EXTCON_USB, &cable->nb);
> -}
> -
>  static DEFINE_IDA(ci_ida);
>  
>  struct platform_device *ci_hdrc_add_device(struct device *dev,
> @@ -1053,7 +1037,6 @@ static int ci_hdrc_probe(struct platform_device *pdev)
>  	if (!ret)
>  		return 0;
>  
> -	ci_extcon_unregister(ci);
>  stop:
>  	ci_role_destroy(ci);
>  deinit_phy:
> @@ -1073,7 +1056,6 @@ static int ci_hdrc_remove(struct platform_device *pdev)
>  	}
>  
>  	dbg_remove_files(ci);
> -	ci_extcon_unregister(ci);
>  	ci_role_destroy(ci);
>  	ci_hdrc_enter_lpm(ci, true);
>  	ci_usb_phy_exit(ci);
> -- 

Acked-by: Peter Chen <peter.chen@nxp.com>

-- 

Best Regards,
Peter Chen

  reply	other threads:[~2016-12-02  6:59 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-30  5:57 [PATCH 00/12] extcon: Replace the deprecated extcon API Chanwoo Choi
2016-11-30  5:57 ` [PATCH 01/12] phy: rcar-gen3-usb2: " Chanwoo Choi
2016-12-06  0:25   ` Chanwoo Choi
2016-12-06  1:35   ` Yoshihiro Shimoda
     [not found] ` <1480485460-2663-1-git-send-email-cw00.choi-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2016-11-30  5:57   ` [PATCH 02/12] phy: sun4i-usb: " Chanwoo Choi
2016-11-30  5:57   ` [PATCH 05/12] usb: chipdata: Replace the " Chanwoo Choi
2016-12-02  6:59     ` Peter Chen [this message]
2016-11-30  5:57   ` [PATCH 07/12] usb: sunxi: Uses the resource-managed extcon API when registering extcon notifier Chanwoo Choi
2016-11-30  8:45     ` Maxime Ripard
2016-12-05 16:32       ` Bin Liu
2016-12-06  0:21         ` Chanwoo Choi
2016-11-30  5:57   ` [PATCH 08/12] usb: phy: msm: Replace the extcon API Chanwoo Choi
2016-11-30 10:40     ` Felipe Balbi
2016-11-30  5:57 ` [PATCH 03/12] power_supply: axp288_charger: " Chanwoo Choi
2016-12-06  0:26   ` Chanwoo Choi
2016-12-07  3:05     ` Sebastian Reichel
2016-12-07  3:45       ` Chanwoo Choi
2016-11-30  5:57 ` [PATCH 04/12] power_supply: qcom_smbb: Replace the deprecated " Chanwoo Choi
2016-11-30  5:57 ` [PATCH 06/12] usb: dwc3: omap: Replace the " Chanwoo Choi
2016-11-30 10:36   ` Felipe Balbi
     [not found]     ` <877f7lntjq.fsf-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2016-12-02  7:52       ` Chanwoo Choi
2016-12-02  9:03         ` Felipe Balbi
2016-12-02 13:20           ` Chanwoo Choi
2016-12-30  2:46           ` Chanwoo Choi
2016-12-30  6:45             ` Chanwoo Choi
2016-11-30  5:57 ` [PATCH 09/12] usb: phy: omap-otg: " Chanwoo Choi
2016-11-30 10:41   ` Felipe Balbi
2016-11-30  5:57 ` [PATCH 10/12] usb: phy: qcom-8x16-usb: " Chanwoo Choi
2016-11-30 10:42   ` Felipe Balbi
2016-11-30  5:57 ` [PATCH 11/12] usb: phy: tahvo: Replace the deprecated " Chanwoo Choi
     [not found]   ` <1480485460-2663-12-git-send-email-cw00.choi-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2016-11-30 10:42     ` Felipe Balbi
2016-11-30  5:57 ` [PATCH 12/12] usb: renesas_usbhs: " Chanwoo Choi
2016-11-30 10:43   ` Felipe Balbi
     [not found]   ` <1480485460-2663-13-git-send-email-cw00.choi-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2016-12-06  1:35     ` Yoshihiro Shimoda

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=20161202065958.GB23234@b29397-desktop \
    --to=hzpeterchen@gmail.com \
    --cc=Peter.Chen@nxp.com \
    --cc=b-liu@ti.com \
    --cc=balbi@kernel.org \
    --cc=chanwoo@kernel.org \
    --cc=cw00.choi@samsung.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kishon@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=maxime.ripard@free-electrons.com \
    --cc=sre@kernel.org \
    --cc=wens@csie.org \
    --cc=yoshihiro.shimoda.uh@renesas.com \
    /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;
as well as URLs for NNTP newsgroup(s).