From: Ben Dooks <ben.dooks@codethink.co.uk>
To: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Cc: balbi@ti.com, linux-usb@vger.kernel.org, robh+dt@kernel.org,
pawel.moll@arm.com, mark.rutland@arm.com,
ijc+devicetree@hellion.org.uk, galak@codeaurora.org,
grant.likely@linaro.org, devicetree@vger.kernel.org,
gregkh@linuxfoundation.org, linux-sh@vger.kernel.org,
valentine.barshak@cogentembedded.com, rob@landley.net,
linux-doc@vger.kernel.org
Subject: Re: [PATCH] phy-rcar-gen2-usb: add device tree support
Date: Thu, 27 Feb 2014 16:06:04 +0000 [thread overview]
Message-ID: <530F626C.5020900@codethink.co.uk> (raw)
In-Reply-To: <201402270312.51588.sergei.shtylyov@cogentembedded.com>
On 27/02/14 00:12, Sergei Shtylyov wrote:
> Add support of the device tree probing for the Renesas R-Car generation 2 SoCs
> documenting the device tree binding as necessary.
You've popped in some fixes for the driver probe in here as well.
Could you do the fixes as a patch and send those before the devicetree
code is done?
> +
> static int rcar_gen2_usb_phy_probe(struct platform_device *pdev)
> {
> struct device *dev = &pdev->dev;
> + struct device_node *np = dev->of_node;
> struct rcar_gen2_phy_platform_data *pdata;
> struct rcar_gen2_usb_phy_priv *priv;
> struct resource *res;
> @@ -177,13 +210,19 @@ static int rcar_gen2_usb_phy_probe(struc
> struct clk *clk;
> int retval;
>
> - pdata = dev_get_platdata(dev);
> + if (np)
> + pdata = rcar_gen2_usb_phy_parse_dt(dev);
> + else
> + pdata = dev_get_platdata(dev);
> if (!pdata) {
> dev_err(dev, "No platform data\n");
> return -EINVAL;
> }
>
> - clk = devm_clk_get(dev, "usbhs");
> + if (np)
> + clk = of_clk_get_by_name(np, "usbhs");
> + else
> + clk = clk_get(dev, "usbhs");
Can be removed, just add a clock-name of usbhs in the device node.
> if (IS_ERR(clk)) {
> dev_err(dev, "Can't get the clock\n");
> return PTR_ERR(clk);
> @@ -191,13 +230,16 @@ static int rcar_gen2_usb_phy_probe(struc
>
> res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> base = devm_ioremap_resource(dev, res);
> - if (IS_ERR(base))
> - return PTR_ERR(base);
> + if (IS_ERR(base)) {
> + retval = PTR_ERR(base);
> + goto error;
> + }
>
> priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
> if (!priv) {
> dev_err(dev, "Memory allocation failed\n");
> - return -ENOMEM;
> + retval = -ENOMEM;
> + goto error;
> }
Probably should be separate patch to fix probe issues.
>
> spin_lock_init(&priv->lock);
> @@ -216,12 +258,16 @@ static int rcar_gen2_usb_phy_probe(struc
> retval = usb_add_phy_dev(&priv->phy);
> if (retval < 0) {
> dev_err(dev, "Failed to add USB phy\n");
> - return retval;
> + goto error;
> }
>
> platform_set_drvdata(pdev, priv);
>
> return retval;
> +
> +error:
> + clk_put(clk);
> + return retval;
> }
Again, should have been rolled into fix patch.
--
Ben Dooks http://www.codethink.co.uk/
Senior Engineer Codethink - Providing Genius
next prev parent reply other threads:[~2014-02-27 16:06 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-26 23:13 [PATCH] phy-rcar-gen2-usb: add device tree support Sergei Shtylyov
2014-02-27 0:12 ` Sergei Shtylyov
2014-02-27 12:57 ` Ben Dooks
[not found] ` <530F3637.5050000-4yDnlxn2s6sWdaTGBSpHTA@public.gmane.org>
2014-02-27 15:50 ` Sergei Shtylyov
2014-02-27 15:50 ` Sergei Shtylyov
[not found] ` <201402270312.51588.sergei.shtylyov-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>
2014-02-27 15:56 ` Mark Rutland
2014-02-27 15:56 ` Mark Rutland
[not found] ` <20140227155657.GD8647-NuALmloUBlrZROr8t4l/smS4ubULX0JqMm0uRHvK7Nw@public.gmane.org>
2014-02-28 21:23 ` Sergei Shtylyov
2014-02-28 22:23 ` Sergei Shtylyov
2014-02-27 16:06 ` Ben Dooks [this message]
2014-02-27 16:34 ` Sergei Shtylyov
2014-02-27 16:34 ` Sergei Shtylyov
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=530F626C.5020900@codethink.co.uk \
--to=ben.dooks@codethink.co.uk \
--cc=balbi@ti.com \
--cc=devicetree@vger.kernel.org \
--cc=galak@codeaurora.org \
--cc=grant.likely@linaro.org \
--cc=gregkh@linuxfoundation.org \
--cc=ijc+devicetree@hellion.org.uk \
--cc=linux-doc@vger.kernel.org \
--cc=linux-sh@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=pawel.moll@arm.com \
--cc=rob@landley.net \
--cc=robh+dt@kernel.org \
--cc=sergei.shtylyov@cogentembedded.com \
--cc=valentine.barshak@cogentembedded.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.