lkml.org 
[lkml]   [2008]   [Jan]   [8]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateTue, 8 Jan 2008 15:05:10 +0800
From"Dave Young" <>
SubjectRe: [PATCH 0/7] convert semaphore to mutex in struct class
On Jan 8, 2008 1:20 AM, Greg KH <gregkh@suse.de> wrote:
> On Mon, Jan 07, 2008 at 06:13:37PM +0100, Stefan Richter wrote:
> > It's already in the driver core to the most part.  It remains to be seen
> > what is less complicated in the end:  Transparent mutex-protected list
> > accesses provided by driver core (requires the iterator), or all the
> > necessary locking done by the drivers themselves (requires some more
> > lock-taking but perhaps fewer lock instances overall in the drivers, and
> > respective redefinitions and documentation of the driver core API).
>
> I favor changing the driver core api and doing this kind of thing there.
> It keeps the drivers simpler and should hopefully make their lives
> easier.

What about this?

#define class_for_each_dev(pos, head, member) \
        for (mutex_lock(&(container_of(head, struct class, devices))->mutex), po
s = list_entry((head)->next, typeof(*pos), member); \
        prefetch(pos->member.next), &pos->member != (head) ? 1 : (mutex_unlock(&
(container_of(head, struct class, devices))->mutex), 0); \
        pos = list_entry(pos->member.next, typeof(*pos), member))

>
> > Semi off-topic:  What about struct device.sem?  Is there any chance to
> > rip this out of the driver core and let drivers serialize everything?  I
> > suppose not...
>
> See the previous long threads about this very topic, that is what caused
> this class.sem patches :)
>
> thanks,
>
> greg k-h
>


\
 
 \ /
  Last update: 2008-01-08 07:07    [W:0.424 / U:0.020 seconds]
©2003-2008 Jasper Spaans