login
Login
/
Register
Search
Forums
News
Blogs
Features
Site
Home
»
Mailing list archives
»
linux-kernel
»
2008
»
January
»
14
Re: [PATCH 1/7] driver-core : add class iteration api
view
thread
!MAILaRCHIVE_VOTE_RePLACE
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
[view in full thread]
From:
Dave Young <hidave.darkstar@...>
To: Jarek Poplawski <jarkao2@...>
Cc: Greg KH <gregkh@...>, <stefanr@...>, <James.Bottomley@...>, <a.zummo@...>, <peterz@...>, <cbou@...>, <linux-kernel@...>, David Brownell <david-b@...>, <krh@...>, <stern@...>, <dwmw2@...>, <davem@...>
Subject:
Re: [PATCH 1/7] driver-core : add class iteration api
Date: Sunday, January 13, 2008 - 9:36 pm
On Jan 13, 2008 4:11 AM, Jarek Poplawski <jarkao2@gmail.com> wrote:
quoted text
> > On Sat, Jan 12, 2008 at 05:47:54PM +0800, Dave Young wrote: > > Add the following class iteration functions for driver use: > > class_for_each_device > > class_find_device > > class_for_each_child > > class_find_child > > > > Signed-off-by: Dave Young <hidave.darkstar@gmail.com> > > > > --- > > drivers/base/class.c | 159 +++++++++++++++++++++++++++++++++++++++++++++++++ > > include/linux/device.h | 8 ++ > > 2 files changed, 167 insertions(+) > > > > diff -upr linux/drivers/base/class.c linux.new/drivers/base/class.c > > --- linux/drivers/base/class.c 2008-01-12 14:42:24.000000000 +0800 > > +++ linux.new/drivers/base/class.c 2008-01-12 14:42:24.000000000 +0800 > > @@ -798,6 +798,165 @@ void class_device_put(struct class_devic > > kobject_put(&class_dev->kobj); > > } > > > > +/** > > + * class_for_each_device - device iterator > > + * @class: the class we're iterating > > + * @data: data for the callback > > + * @fn: function to be called for each device > > + * > > + * Iterate over @class's list of devices, and call @fn for each, > > + * passing it @data. > > + * > > + * We check the return of @fn each time. If it returns anything > > + * other than 0, we break out and return that value. > > + */ > > +int class_for_each_device(struct class *class, void *data, > > + int (*fn)(struct device *, void *)) > > +{ > > + struct device *dev; > > + int error = 0; > > + > > + if (!class) > > + return -EINVAL; > > + down(&class->sem); > > + list_for_each_entry(dev, &class->devices, node) { > > Probably some tiny oversight, but I see this comment to struct class > doesn't mention devices list, so maybe this needs to be updated BTW?: > > (from include/linux/device.h) > " struct semaphore sem; /* locks both the children and interfaces lists */"
Sorry for my lazy, I think so too. IMHO, it should be updated after the comments.
quoted text
> > Regards, > Jarek P. >
--
unsubscribe notice
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to
majordomo@vger.kernel.org
More majordomo info at
http://vger.kernel.org/majordomo-info.html
Please read the FAQ at
http://www.tux.org/lkml/
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
Messages in current thread:
[PATCH 1/7] driver-core : add class iteration api
, Dave Young
, (Sat Jan 12, 5:47 am)
[PATCH 1/6] driver-core : add class iteration api
, Dave Young
, (Tue Jan 22, 1:54 am)
Re: [PATCH 1/6] driver-core : add class iteration api
, David Brownell
, (Tue Jan 22, 2:24 am)
Re: [PATCH 1/6] driver-core : add class iteration api
, Dave Young
, (Tue Jan 22, 3:27 am)
Re: [PATCH 1/6] driver-core : add class iteration api
, Greg KH
, (Tue Jan 22, 6:25 pm)
Re: [PATCH 1/6] driver-core : add class iteration api
, Cornelia Huck
, (Tue Jan 22, 4:44 am)
Re: [PATCH 1/6] driver-core : add class iteration api
, Dave Young
, (Tue Jan 22, 2:30 am)
Re: [PATCH 1/6] driver-core : add class iteration api
, Dave Young
, (Tue Jan 22, 2:06 am)
Re: [PATCH 1/7] driver-core : add class iteration api
, Dave Young
, (Tue Jan 15, 5:13 am)
Re: [PATCH 1/7] driver-core : add class iteration api
, Cornelia Huck
, (Tue Jan 15, 5:45 am)
Re: [PATCH 1/7] driver-core : add class iteration api
, Cornelia Huck
, (Mon Jan 14, 8:13 am)
Re: [PATCH 1/7] driver-core : add class iteration api
, Dave Young
, (Mon Jan 14, 8:17 pm)
Re: [PATCH 1/7] driver-core : add class iteration api
, Jarek Poplawski
, (Sat Jan 12, 4:11 pm)
Re: [PATCH 1/7] driver-core : add class iteration api
, Dave Young
, (Sun Jan 13, 9:36 pm)
Re: [PATCH 1/7] driver-core : add class iteration api
, Jarek Poplawski
, (Mon Jan 14, 2:58 am)
Re: [PATCH 1/7] driver-core : add class iteration api
, Dave Young
, (Mon Jan 14, 3:00 am)
Re: [PATCH 1/7] driver-core : add class iteration api
, Stefan Richter
, (Sat Jan 12, 6:50 am)
Re: [PATCH 1/7] driver-core : add class iteration api
, Dave Young
, (Sun Jan 13, 9:32 pm)
Navigation
Create content
Mailing list archives
Recent posts
Popular discussions
linux-kernel
:
Zach Brown
[PATCH 3 of 4] Teach paths to wake a specific void * target instead of a whole tas...
Paul Jackson
Re: cpuset-remove-sched-domain-hooks-from-cpusets
Jeff Garzik
Re: Linux 2.6.23-rc9 and a heads-up for the 2.6.24 series..
Greg Kroah-Hartman
[PATCH 002/196] Chinese: rephrase English introduction in HOWTO
linux-netdev
:
Eric Dumazet
Re: [PATCH] tcp: splice as many packets as possible at once
Jarek Poplawski
[PATCH] pkt_sched: Destroy gen estimators under rtnl_lock().
Ingo Molnar
Re: [GIT]: Networking
Alexey Dobriyan
[PATCH 06/53] netns xfrm: per-netns xfrm_state_bysrc hash
git
:
openbsd-misc
:
Colocation donated by:
Who's online
There are currently
2 users
and
991 guests
online.
Online users
Jeremy
maheshdm
Syndicate