mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Lechner <david@lechnology.com>
To: ahaslam@baylibre.com, gregkh@linuxfoundation.org,
	stern@rowland.harvard.edu, khilman@kernel.org, kishon@ti.com
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [v5,1/5] USB: ohci: da8xx: use ohci priv data instead of globals
Date: Sat, 19 Nov 2016 20:58:51 -0600	[thread overview]
Message-ID: <75e1a8a4-062b-28db-3743-b16fd8c98fa0@lechnology.com> (raw)
In-Reply-To: <20161114144103.12120-2-ahaslam@baylibre.com>

On 11/14/2016 08:40 AM, ahaslam@baylibre.com wrote:
> Instead of global variables, use the extra_priv_size of
> the ohci driver.
>
> We cannot yet move the ocic mask because this is used on
> the interrupt handler which is registerded through platform
> data and does not have an hcd pointer. This will be moved
> on a later patch.
>
> Signed-off-by: Axel Haslam <ahaslam@baylibre.com>
> ---
>  drivers/usb/host/ohci-da8xx.c | 73 +++++++++++++++++++++++++------------------
>  1 file changed, 43 insertions(+), 30 deletions(-)
>
> diff --git a/drivers/usb/host/ohci-da8xx.c b/drivers/usb/host/ohci-da8xx.c
> index b3de8bc..438970b 100644
> --- a/drivers/usb/host/ohci-da8xx.c
> +++ b/drivers/usb/host/ohci-da8xx.c
...
> @@ -238,25 +246,29 @@ static int ohci_da8xx_probe(struct platform_device *pdev)
>  	if (hub == NULL)
>  		return -ENODEV;
>
> -	usb11_clk = devm_clk_get(&pdev->dev, "usb11");
> -	if (IS_ERR(usb11_clk)) {
> -		if (PTR_ERR(usb11_clk) != -EPROBE_DEFER)
> +	hcd = usb_create_hcd(&ohci_da8xx_hc_driver, &pdev->dev,
> +				dev_name(&pdev->dev));
> +	if (!hcd)
> +		return -ENOMEM;
> +
> +	da8xx_ohci = to_da8xx_ohci(hcd);
> +
> +	da8xx_ohci->usb11_clk = devm_clk_get(&pdev->dev, "usb11");
> +	if (IS_ERR(da8xx_ohci->usb11_clk)) {
> +		if (PTR_ERR(da8xx_ohci->usb11_clk) != -EPROBE_DEFER)
>  			dev_err(&pdev->dev, "Failed to get clock.\n");
> -		return PTR_ERR(usb11_clk);
> +		error = PTR_ERR(da8xx_ohci->usb11_clk);
> +		goto err;
>  	}

Small thing, but this could be written slightly cleaner as:

	da8xx_ohci->usb11_clk = devm_clk_get(&pdev->dev, "usb11");
	if (IS_ERR(da8xx_ohci->usb11_clk)) {
		error = PTR_ERR(da8xx_ohci->usb11_clk);
		if (error != -EPROBE_DEFER)
			dev_err(&pdev->dev, "Failed to get clock.\n");
		goto err;
	}

>
> -	usb11_phy = devm_phy_get(&pdev->dev, "usb-phy");
> -	if (IS_ERR(usb11_phy)) {
> -		if (PTR_ERR(usb11_phy) != -EPROBE_DEFER)
> +	da8xx_ohci->usb11_phy = devm_phy_get(&pdev->dev, "usb-phy");
> +	if (IS_ERR(da8xx_ohci->usb11_phy)) {
> +		if (PTR_ERR(da8xx_ohci->usb11_phy) != -EPROBE_DEFER)
>  			dev_err(&pdev->dev, "Failed to get phy.\n");
> -		return PTR_ERR(usb11_phy);
> +		error = PTR_ERR(da8xx_ohci->usb11_phy);
> +		goto err;
>  	}

same here

...


Tested-by: David Lechner <david@lechnology.com>

  reply	other threads:[~2016-11-20  2:58 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-14 14:40 [PATCH v5 0/5] USB: ohci-da8xx: Add device tree support Axel Haslam
2016-11-14 14:40 ` [PATCH v5 1/5] USB: ohci: da8xx: use ohci priv data instead of globals Axel Haslam
2016-11-20  2:58   ` David Lechner [this message]
2016-11-21  9:07     ` [v5,1/5] " Axel Haslam
2016-11-14 14:41 ` [PATCH v5 2/5] USB: ohci: da8xx: Add wrappers for platform callbacks Axel Haslam
2016-11-14 14:41 ` [PATCH v5 3/5] USB: ohci: da8xx: Allow a regulator to handle VBUS Axel Haslam
2016-11-20  3:31   ` [v5,3/5] " David Lechner
2016-11-20  3:37     ` David Lechner
2016-11-21 10:22     ` Axel Haslam
2016-11-21 16:29       ` David Lechner
2016-11-22 14:18         ` Axel Haslam
2016-11-14 14:41 ` [PATCH v5 4/5] USB: ohci: da8xx: Add devicetree bindings Axel Haslam
2016-11-16 13:26   ` Rob Herring
2016-11-14 14:41 ` [PATCH v5 5/5] USB: ohci: da8xx: Allow probing from DT Axel Haslam

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=75e1a8a4-062b-28db-3743-b16fd8c98fa0@lechnology.com \
    --to=david@lechnology.com \
    --cc=ahaslam@baylibre.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=khilman@kernel.org \
    --cc=kishon@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    /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

all inboxes | Powered by JetHome®