Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1307286
| From | Juri Lelli <juri.lelli@arm.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [RFC PATCH 04/19] cpufreq: bring data structures close to their locks |
| Date | 2016-01-12 12:30 +0100 |
| Message-ID | <qQ5jb-cc-3@gated-at.bofh.it> (permalink) |
| References | <qPOBH-5zs-9@gated-at.bofh.it> <qPOLn-5E8-1@gated-at.bofh.it> <qPSP1-7w-31@gated-at.bofh.it> <qQ3AJ-7rn-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Hi,
On 12/01/16 14:57, Viresh Kumar wrote:
> On 11-01-16, 23:07, Peter Zijlstra wrote:
> > On Mon, Jan 11, 2016 at 05:35:45PM +0000, Juri Lelli wrote:
> > > +/**
> > > + * Iterate over governors
> > > + *
> > > + * cpufreq_governor_list is protected by cpufreq_governor_mutex.
> > > + */
> > > +static LIST_HEAD(cpufreq_governor_list);
> > > +static DEFINE_MUTEX(cpufreq_governor_mutex);
> > > +#define for_each_governor(__governor) \
> > > + list_for_each_entry(__governor, &cpufreq_governor_list, governor_list)
> >
> > So you could stuff the lockdep_assert_held() you later add intididually
> > into the for_each_governor macro, impossible to forget that way.
>
> How exactly? I couldn't see how it can be done in a neat and clean
> way.
>
I tried to see if something like for_each_domain() can be done, but here
we use list_for_each_entry() macro. Peter, do you mean something like
the following?
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 78b1e2f..1a847a6 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -39,6 +39,7 @@
static LIST_HEAD(cpufreq_governor_list);
static DEFINE_MUTEX(cpufreq_governor_mutex);
#define for_each_governor(__governor) \
+ lockdep_assert_held(&cpufreq_governor_mutex); \
list_for_each_entry(__governor, &cpufreq_governor_list, governor_list)
/**
@@ -508,7 +509,6 @@ static struct cpufreq_governor *find_governor(const char *str_governor)
{
struct cpufreq_governor *t;
- lockdep_assert_held(&cpufreq_governor_mutex);
for_each_governor(t)
if (!strncasecmp(str_governor, t->name, CPUFREQ_NAME_LEN))
return t;
Since for_each_governor() is not used in if conditions that should be
fine?
Thanks,
- Juri
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[RFC PATCH 04/19] cpufreq: bring data structures close to their locks Juri Lelli <juri.lelli@arm.com> - 2016-01-11 18:50 +0100
Re: [RFC PATCH 04/19] cpufreq: bring data structures close to their locks Peter Zijlstra <peterz@infradead.org> - 2016-01-11 23:10 +0100
Re: [RFC PATCH 04/19] cpufreq: bring data structures close to their locks "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-01-12 00:10 +0100
Re: [RFC PATCH 04/19] cpufreq: bring data structures close to their locks Peter Zijlstra <peterz@infradead.org> - 2016-01-12 09:30 +0100
Re: [RFC PATCH 04/19] cpufreq: bring data structures close to their locks Juri Lelli <juri.lelli@arm.com> - 2016-01-12 11:50 +0100
Re: [RFC PATCH 04/19] cpufreq: bring data structures close to their locks "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-01-12 17:50 +0100
Re: [RFC PATCH 04/19] cpufreq: bring data structures close to their locks Peter Zijlstra <peterz@infradead.org> - 2016-01-11 23:10 +0100
Re: [RFC PATCH 04/19] cpufreq: bring data structures close to their locks Viresh Kumar <viresh.kumar@linaro.org> - 2016-01-12 10:40 +0100
Re: [RFC PATCH 04/19] cpufreq: bring data structures close to their locks Juri Lelli <juri.lelli@arm.com> - 2016-01-12 12:30 +0100
Re: [RFC PATCH 04/19] cpufreq: bring data structures close to their locks Peter Zijlstra <peterz@infradead.org> - 2016-01-12 13:00 +0100
Re: [RFC PATCH 04/19] cpufreq: bring data structures close to their locks Juri Lelli <juri.lelli@arm.com> - 2016-01-12 13:40 +0100
Re: [RFC PATCH 04/19] cpufreq: bring data structures close to their locks Juri Lelli <juri.lelli@arm.com> - 2016-01-12 16:30 +0100
Re: [RFC PATCH 04/19] cpufreq: bring data structures close to their locks Peter Zijlstra <peterz@infradead.org> - 2016-01-12 17:00 +0100
csiph-web