Re: [PATCH 0/7] convert semaphore to mutex in struct class
From: Stefan Richter
Date: Mon Jan 07 2008 - 12:14:48 EST
Greg KH wrote:
> On Mon, Jan 07, 2008 at 02:23:33PM +0100, Stefan Richter wrote:
>> 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.
>
> If such functionality is needed, fine, I have no objection to that
> change to move the locking logic into the driver core.
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).
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...
--
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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/