linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Chen <peter.chen@nxp.com>
To: Fabio Estevam <festevam@gmail.com>
Cc: "gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>
Subject: Re: [PATCH 1/3] usb: phy: phy-mxs-usb: Use of_device_get_match_data()
Date: Wed, 25 Nov 2020 01:15:16 +0000	[thread overview]
Message-ID: <20201125011447.GD9929@b29397-desktop> (raw)
In-Reply-To: <20201124163912.12074-1-festevam@gmail.com>

On 20-11-24 13:39:10, Fabio Estevam wrote:
> The retrieval of driver data via of_device_get_match_data() can make
> the code simpler.
> 
> Use of_device_get_match_data() to simplify the code. 
> 
> Signed-off-by: Fabio Estevam <festevam@gmail.com>
> ---
>  drivers/usb/phy/phy-mxs-usb.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c
> index 67b39dc62b37..8a262c5a0408 100644
> --- a/drivers/usb/phy/phy-mxs-usb.c
> +++ b/drivers/usb/phy/phy-mxs-usb.c
> @@ -714,14 +714,9 @@ static int mxs_phy_probe(struct platform_device *pdev)
>  	struct clk *clk;
>  	struct mxs_phy *mxs_phy;
>  	int ret;
> -	const struct of_device_id *of_id;
>  	struct device_node *np = pdev->dev.of_node;
>  	u32 val;
>  
> -	of_id = of_match_device(mxs_phy_dt_ids, &pdev->dev);
> -	if (!of_id)
> -		return -ENODEV;
> -
>  	base = devm_platform_ioremap_resource(pdev, 0);
>  	if (IS_ERR(base))
>  		return PTR_ERR(base);
> @@ -797,7 +792,7 @@ static int mxs_phy_probe(struct platform_device *pdev)
>  	mxs_phy->phy.charger_detect	= mxs_phy_charger_detect;
>  
>  	mxs_phy->clk = clk;
> -	mxs_phy->data = of_id->data;
> +	mxs_phy->data = of_device_get_match_data(&pdev->dev);

You may forget the error handling for it, eg, -ENODEV.

Peter
>  
>  	platform_set_drvdata(pdev, mxs_phy);
>  
> -- 
> 2.17.1
> 

-- 

Thanks,
Peter Chen

  parent reply	other threads:[~2020-11-25  1:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-24 16:39 [PATCH 1/3] usb: phy: phy-mxs-usb: Use of_device_get_match_data() Fabio Estevam
2020-11-24 16:39 ` [PATCH 2/3] usb: chipidea: usbmisc_imx: " Fabio Estevam
2020-11-24 16:39 ` [PATCH 3/3] usb: chipidea: ci_hdrc_imx: " Fabio Estevam
2020-11-25  1:15 ` Peter Chen [this message]
2020-11-25  1:21   ` [PATCH 1/3] usb: phy: phy-mxs-usb: " Fabio Estevam
2020-11-25  1:58     ` Peter Chen
2020-11-25  2:13       ` Fabio Estevam
2020-11-25  4:48 ` Peter Chen

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=20201125011447.GD9929@b29397-desktop \
    --to=peter.chen@nxp.com \
    --cc=festevam@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-usb@vger.kernel.org \
    /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).