linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: rjw@sisk.pl (Rafael J. Wysocki)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v4] power: introduce library for device-specific OPPs
Date: Sat, 25 Sep 2010 22:55:20 +0200	[thread overview]
Message-ID: <201009252255.20933.rjw@sisk.pl> (raw)
In-Reply-To: <20100924193742.GJ2375@linux.vnet.ibm.com>

On Friday, September 24, 2010, Paul E. McKenney wrote:
> On Fri, Sep 24, 2010 at 07:50:40AM -0500, Nishanth Menon wrote:
...
> 
> Looks like a good start!!!  Some questions and suggestions about RCU
> usage interspersed below.
...
> > + * Locking: RCU reader.
> > + */
> > +int opp_get_opp_count(struct device *dev)
> > +{
> > +	struct device_opp *dev_opp;
> > +	struct opp *temp_opp;
> > +	int count = 0;
> > +
> > +	dev_opp = find_device_opp(dev);
> > +	if (IS_ERR(dev_opp))
> > +		return PTR_ERR(dev_opp);
> > +
> > +	rcu_read_lock();
> > +	list_for_each_entry_rcu(temp_opp, &dev_opp->opp_list, node) {
> > +		if (temp_opp->available)
> > +			count++;
> > +	}
> > +	rcu_read_unlock();
> 
> This one is OK as well.  You are returning a count, so if all of the
> counted structures are freed at this point, no problem.  The count was
> valid when it was accumulated, and the fact that it might now be obsolete
> is (usually) not a problem.

However, it looks like it should run rcu_read_lock() before calling
find_device_opp(dev), shouldn't it?

Rafael

  parent reply	other threads:[~2010-09-25 20:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <[PATCH v3] power: introduce library for device-specific OPPs>
2010-09-24 12:50 ` [PATCH v4] power: introduce library for device-specific OPPs Nishanth Menon
2010-09-24 19:37   ` Paul E. McKenney
2010-09-24 21:26     ` Nishanth Menon
2010-09-24 21:40       ` Paul E. McKenney
2010-09-27 14:29         ` Nishanth Menon
2010-09-25 20:55     ` Rafael J. Wysocki [this message]
2010-09-26  0:56       ` Paul E. McKenney
2010-09-27 14:25         ` Nishanth Menon
2010-09-27 19:53           ` Rafael J. Wysocki

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=201009252255.20933.rjw@sisk.pl \
    --to=rjw@sisk.pl \
    --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).