devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Thompson <daniel.thompson@linaro.org>
To: Jiancheng Xue <xuejiancheng@hisilicon.com>,
	sboyd@codeaurora.org, robh+dt@kernel.org, kishon@ti.com,
	xuwei5@hisilicon.com, catalin.marinas@arm.com, balbi@kernel.org
Cc: linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org,
	linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-usb@vger.kernel.org, project-aspen-dev@linaro.org,
	yanhaifeng@hisilicon.com, Pengcheng Li <lpc.li@hisilicon.com>
Subject: Re: [project-aspen-dev] [PATCH 3/5] phy: add inno-usb2-phy driver for hi3798cv200 SoC
Date: Wed, 21 Jun 2017 11:52:56 +0100	[thread overview]
Message-ID: <53b0ac0f-91b8-1ad3-91a4-a776b028fc8f@linaro.org> (raw)
In-Reply-To: <1498035645-22804-4-git-send-email-xuejiancheng@hisilicon.com>

On 21/06/17 10:00, Jiancheng Xue wrote:
> From: Pengcheng Li <lpc.li@hisilicon.com>
> 
> Add inno-usb2-phy driver for hi3798cv200 SoC.
> 
> Signed-off-by: Pengcheng Li <lpc.li@hisilicon.com>
> Signed-off-by: Jiancheng Xue <xuejiancheng@hisilicon.com>
> ---
>   drivers/phy/Kconfig              |  10 ++
>   drivers/phy/Makefile             |   1 +
>   drivers/phy/phy-hisi-inno-usb2.c | 287 +++++++++++++++++++++++++++++++++++++++
>   3 files changed, 298 insertions(+)
>   create mode 100644 drivers/phy/phy-hisi-inno-usb2.c
> 
> ...
> diff --git a/drivers/phy/phy-hisi-inno-usb2.c b/drivers/phy/phy-hisi-inno-usb2.c
> new file mode 100644
> index 0000000..582c500
> --- /dev/null
> +++ b/drivers/phy/phy-hisi-inno-usb2.c
> @@ -0,0 +1,287 @@
 > ...> +static int hisi_inno_phy_of_get_ports(struct device *dev,
> +					struct  hisi_inno_phy_priv *priv)
> +{
> +	struct device_node *node = dev->of_node;
> +	struct device_node *child;
> +	int port = 0;
> +	int ret;
> +
> +	priv->port_num = of_get_child_count(node);
> +	if (priv->port_num > MAX_PORTS) {
> +		dev_err(dev, "too many ports : %d (max = %d)\n",
> +				priv->port_num, MAX_PORTS);
> +		return -EINVAL;
> +	}
> +
> +	priv->ports = devm_kcalloc(dev, priv->port_num,
> +				sizeof(struct hisi_inno_phy_port), GFP_KERNEL);
> +	if (!priv->ports)
> +		return -ENOMEM;
> +
> +	for_each_child_of_node(node, child) {
> +		struct hisi_inno_phy_port *phy_port = &priv->ports[port];
> +
> +		phy_port->utmi_clk = devm_get_clk_from_child(dev, child, NULL);
> +		if (IS_ERR(phy_port->utmi_clk)) {
> +			ret = PTR_ERR(phy_port->utmi_clk);
> +			goto fail;
> +		}
> +
> +		phy_port->port_rst = of_reset_control_get_exclusive(child, "port_rst"); > +		if (IS_ERR(phy_port->port_rst)) {
> +			ret = PTR_ERR(phy_port->port_rst);
> +			goto fail;
> +		}
> +
> +		phy_port->utmi_rst = of_reset_control_get_exclusive(child, "utmi_rst");
> +		if (IS_ERR(phy_port->utmi_rst)) {
> +			ret = PTR_ERR(phy_port->utmi_rst);
> +			reset_control_put(phy_port->port_rst);
> +			goto fail;
> +		}
> +		port++;
> +	}
> +
> +	return 0;
> +
> +fail:
> +	while (--port >= 0) {
> +		struct hisi_inno_phy_port *phy_port = &priv->ports[port];
> +
> +		reset_control_put(phy_port->utmi_rst);
> +		reset_control_put(phy_port->port_rst) > +		clk_put(phy_port->utmi_clk);

clk_put() should not be needed here.

> +	}

Do we also need clean up code like this in a remove callback?


Daniel.

  reply	other threads:[~2017-06-21 10:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-21  9:00 [PATCH 0/5] enable usb2 function on poplar board Jiancheng Xue
2017-06-21  9:00 ` [PATCH 1/5] clk: hisilicon: add usb2 clocks for hi3798cv200 SoC Jiancheng Xue
2017-06-21 17:46   ` Stephen Boyd
     [not found] ` <1498035645-22804-1-git-send-email-xuejiancheng-C8/M+/jPZTeaMJb+Lgu22Q@public.gmane.org>
2017-06-21  9:00   ` [PATCH 2/5] dt-bindings: phy-hisi-inno-usb2: add support for hisi-inno-usb2 phy Jiancheng Xue
2017-06-22  8:23     ` Jiancheng Xue
2017-06-26 15:56     ` Rob Herring
2017-06-21  9:00 ` [PATCH 3/5] phy: add inno-usb2-phy driver for hi3798cv200 SoC Jiancheng Xue
2017-06-21 10:52   ` Daniel Thompson [this message]
2017-06-21  9:00 ` [PATCH 4/5] arm64: dts: hisilicon: add usb2 controller and phy nodes for poplar board Jiancheng Xue
2017-06-21  9:00 ` [PATCH 5/5] arm64: defconfig: enable some drivers and configs for hi3798cv200-poplar board Jiancheng Xue

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=53b0ac0f-91b8-1ad3-91a4-a776b028fc8f@linaro.org \
    --to=daniel.thompson@linaro.org \
    --cc=balbi@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=devicetree@vger.kernel.org \
    --cc=kishon@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=lpc.li@hisilicon.com \
    --cc=project-aspen-dev@linaro.org \
    --cc=robh+dt@kernel.org \
    --cc=sboyd@codeaurora.org \
    --cc=xuejiancheng@hisilicon.com \
    --cc=xuwei5@hisilicon.com \
    --cc=yanhaifeng@hisilicon.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).