[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAAe_U6J_AGArYEj1-sUmEeVkMmbkhp=WZxOuN-y-L6E5SDJM=Q@mail.gmail.com>
Date: Fri, 28 Sep 2012 15:10:59 +0530
From: "ABRAHAM, KISHON VIJAY" <kishon@...com>
To: Russell King - ARM Linux <linux@....linux.org.uk>
Cc: grant.likely@...retlab.ca, rob.herring@...xeda.com,
rob@...dley.net, linux-usb@...r.kernel.org,
linux-omap@...r.kernel.org, devicetree-discuss@...ts.ozlabs.org,
linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, Felipe Balbi <balbi@...com>,
Moiz Sonasath <m-sonasath@...com>
Subject: Re: [PATCH v2 1/2] usb: phy: add a new driver for usb3 phy
Hi,
On Thu, Sep 27, 2012 at 7:48 PM, Russell King - ARM Linux
<linux@....linux.org.uk> wrote:
> On Thu, Sep 27, 2012 at 07:34:07PM +0530, Kishon Vijay Abraham I wrote:
>> +static int omap5_usb_phy_power(struct omap_usb *phy, bool on)
>> +{
>> + u32 val;
>> + unsigned long rate;
>> + struct clk *sys_clk;
>> +
>> + sys_clk = clk_get(NULL, "sys_clkin");
>> + if (IS_ERR(sys_clk)) {
>> + pr_err("%s: unable to get sys_clkin\n", __func__);
>> + return -EINVAL;
>> + }
>> +
>> + rate = clk_get_rate(sys_clk);
>> + rate = rate/1000000;
>> + clk_put(sys_clk);
>
> Actually, you're supposed to hold on to the struct clk all the time your
> driver is making use of that - you're not supposed to drop it.
>
> That has several advantages: if clk_get() fails, then you're failing
> earlier on (when the driver is being probed) and when some event occurs.
Ok. Will post a patch fixing it.
Thanks
Kishon
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists