linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 5/5] OMAP: I2C: Convert i2c driver to use PM runtime api's
Date: Tue, 28 Sep 2010 08:48:40 +0100	[thread overview]
Message-ID: <20100928074840.GA29252@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <0680EC522D0CC943BC586913CF3768C003FF05988F@dbde02.ent.ti.com>

On Tue, Sep 28, 2010 at 12:29:01PM +0530, Nayak, Rajendra wrote:
> <snip>...
> > > >
> > > >  static int omap_i2c_init(struct omap_i2c_dev *dev)
> > > > @@ -356,6 +333,7 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)
> > > >  	unsigned long fclk_rate = 12000000;
> > > >  	unsigned long timeout;
> > > >  	unsigned long internal_clk = 0;
> > > > +	struct clk *fclk;
> > > >
> > > >  	if (dev->rev >= OMAP_I2C_REV_2) {
> > > >  		/* Disable I2C controller before soft reset */
> > > > @@ -414,7 +392,8 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)
> > > >  		 * always returns 12MHz for the functional clock, we can
> > > >  		 * do this bit unconditionally.
> > > >  		 */
> > > > -		fclk_rate = clk_get_rate(dev->fclk);
> > > > +		fclk = clk_get(dev->dev, "fck");
> > > > +		fclk_rate = clk_get_rate(fclk);
> > > >
> > > >  		/* TRM for 5912 says the I2C clock must be prescaled to be
> > > >  		 * between 7 - 12 MHz. The XOR input clock is typically
> > > > @@ -443,7 +422,8 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)
> > > >  			internal_clk = 9600;
> > > >  		else
> > > >  			internal_clk = 4000;
> > > > -		fclk_rate = clk_get_rate(dev->fclk) / 1000;
> > > > +		fclk = clk_get(dev->dev, "fck");
> > > > +		fclk_rate = clk_get_rate(fclk) / 1000;
> > >
> > > You don't put the clk after getting it and using it once?
> > 
> > clk_get needs an equivalent clk_put and not clk_get_rate. clk_get_rate
> > is used to merely know the existing rate of the clock.
> 
> Sorry, I guess you did mean the clk_get above the clk_get_rate does not have
> an equivalent clk_put.
> I could put a clk_put for readability, but a clk_put on OMAP actually does map
> to an empty function.
> See arch/arm/plat-omap/include/plat/clkdev.h
> clk_get merely returns a pointer to the clk struct and does not do any usecounting,
> hence a clk_put does not do anything.

That's no reason to avoid using it.

  reply	other threads:[~2010-09-28  7:48 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-21 14:07 [PATCH v3 0/5] Convert I2C driver to use omap_device/runtime PM Rajendra Nayak
2010-09-21 14:07 ` [PATCH v3 1/5] OMAP2xxx: hwmod: add I2C hwmods for OMAP2420, 2430 Rajendra Nayak
2010-09-21 14:07   ` [PATCH v3 2/5] OMAP3: hwmod: add I2C hwmods for OMAP3430 Rajendra Nayak
2010-09-21 14:07     ` [PATCH v3 3/5] OMAP4: hwmod: add I2C hwmods for OMAP4430 Rajendra Nayak
2010-09-21 14:07       ` [PATCH v3 4/5] OMAP: I2C: split device registration and convert OMAP2+ to omap_device Rajendra Nayak
2010-09-21 14:07         ` [PATCH v3 5/5] OMAP: I2C: Convert i2c driver to use PM runtime api's Rajendra Nayak
2010-09-27 22:36           ` Ben Dooks
2010-09-28  5:58             ` Nayak, Rajendra
2010-09-28  6:59               ` Nayak, Rajendra
2010-09-28  7:48                 ` Russell King - ARM Linux [this message]
2010-09-28  8:56                   ` Nayak, Rajendra
2010-09-28 23:33                 ` Ben Dooks
2010-09-29  4:00                   ` Nayak, Rajendra
2010-10-07 17:37                   ` Kevin Hilman
2010-10-27  7:35                     ` Ben Dooks
2010-11-09 17:41                       ` Kevin Hilman
2010-09-27 20:02 ` [PATCH v3 0/5] Convert I2C driver to use omap_device/runtime PM Kevin Hilman

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=20100928074840.GA29252@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --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).