linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: balbi@ti.com (Felipe Balbi)
To: linux-arm-kernel@lists.infradead.org
Subject: [Patch v7 1/3] usb: dwc3: Add Qualcomm DWC3 glue layer driver
Date: Mon, 30 Jun 2014 11:52:52 -0500	[thread overview]
Message-ID: <20140630165252.GC31442@saruman.home> (raw)
In-Reply-To: <1404144233-17222-2-git-send-email-agross@codeaurora.org>

Hi,

On Mon, Jun 30, 2014 at 11:03:51AM -0500, Andy Gross wrote:
> +static int dwc3_qcom_probe(struct platform_device *pdev)
> +{
> +	struct device_node *node = pdev->dev.of_node;
> +	struct dwc3_qcom *qdwc;
> +	int ret = 0;
> +
> +	qdwc = devm_kzalloc(&pdev->dev, sizeof(*qdwc), GFP_KERNEL);
> +	if (!qdwc)
> +		return -ENOMEM;
> +
> +	platform_set_drvdata(pdev, qdwc);
> +
> +	qdwc->dev = &pdev->dev;
> +
> +	qdwc->gdsc = devm_regulator_get(qdwc->dev, "gdsc");
> +
> +	qdwc->core_clk = devm_clk_get(qdwc->dev, "core");
> +	if (IS_ERR(qdwc->core_clk)) {
> +		dev_dbg(qdwc->dev, "failed to get core clock\n");
> +		return PTR_ERR(qdwc->core_clk);
> +	}
> +
> +	qdwc->iface_clk = devm_clk_get(qdwc->dev, "iface");
> +	if (IS_ERR(qdwc->iface_clk)) {
> +		dev_dbg(qdwc->dev, "failed to get iface clock, skipping\n");
> +		qdwc->iface_clk = NULL;

so this clock and sleep_clk are optional, that's fine...

> +	}
> +
> +	qdwc->sleep_clk = devm_clk_get(qdwc->dev, "sleep");
> +	if (IS_ERR(qdwc->sleep_clk)) {
> +		dev_dbg(qdwc->dev, "failed to get sleep clock, skipping\n");
> +		qdwc->sleep_clk = NULL;
> +	}
> +
> +	if (!IS_ERR(qdwc->gdsc)) {
> +		ret = regulator_enable(qdwc->gdsc);
> +		if (ret)
> +			dev_err(qdwc->dev, "cannot enable gdsc\n");
> +	}
> +
> +	clk_prepare_enable(qdwc->core_clk);
> +
> +	if (qdwc->iface_clk)
> +		clk_prepare_enable(qdwc->iface_clk);

... right here you can drop the NULL check because clk_prepare_enable()
is safe against NULL pointers.

-- 
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140630/6fa2844b/attachment.sig>

  reply	other threads:[~2014-06-30 16:52 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-30 16:03 [Patch v7 0/3] DWC3 USB support for Qualcomm platform Andy Gross
2014-06-30 16:03 ` [Patch v7 1/3] usb: dwc3: Add Qualcomm DWC3 glue layer driver Andy Gross
2014-06-30 16:52   ` Felipe Balbi [this message]
2014-07-18  2:10   ` Jingoo Han
2014-06-30 16:03 ` [Patch v7 2/3] usb: phy: Add Qualcomm DWC3 HS/SS PHY drivers Andy Gross
2014-06-30 17:00   ` Felipe Balbi
     [not found]   ` <CA+neC=McWS8=iSi2XShJyvc85Aw4PSmF-osNpVgJv42d9or1WQ@mail.gmail.com>
2014-07-17 10:30     ` kiran.padwal at smartplayin.com
2014-07-17 18:28       ` Andy Gross
2014-06-30 16:03 ` [Patch v7 3/3] usb: dwc3: qcom: Add device tree binding Andy Gross
2014-06-30 17:37   ` Kumar Gala
2014-07-01  5:04   ` Rob Herring
2014-07-01 18:01     ` Andy Gross
2014-07-01 19:47       ` Rob Herring
2014-07-02  8:43         ` Ivan T. Ivanov
2014-07-02 12:48           ` Arnd Bergmann
2014-07-02 15:54             ` Felipe Balbi

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=20140630165252.GC31442@saruman.home \
    --to=balbi@ti.com \
    --cc=linux-arm-kernel@lists.infradead.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).