lkml.org 
[lkml]   [2008]   [Jan]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 0/7] convert semaphore to mutex in struct class
David Brownell wrote:
> On Monday 07 January 2008, Greg KH wrote:
>> Most of the non-driver core code should be converted to not use the
>> lock in the class at all. They should use a local lock instead.
>
> Or better yet, that yet-to-be-written class_for_each_instance()
> iterator ... :)

By far most of the usages of class.semaphore or class.mutex in drivers
are to protect the class.devices list. The only¹ right thing to do
there is to keep using the class.{semaphore,mutex}. The more elegant
variation of this would be David's class_for_each_instance() iterator
which would allow us to hide the locking details from the drivers.

-------
¹) Well, another correct thing to do would be to not take any locks or
mutexes in the driver core but instead let the drivers do the necessary
serialization between calls like class_device_add() and the likes and
list iterations. But this would complicate the API because of the
additional locking requirements, and hence would invariably result in
buggy usages of the API.
--
Stefan Richter
-=====-==--- ---= --===
http://arcgraph.de/sr/
--
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/

\
 
 \ /
  Last update: 2008-01-07 14:27    [W:0.125 / U:0.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site