linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/7] i2c : convert semaphore to mutex in struct class
@ 2008-01-03  5:54 Dave Young
  2008-01-06 15:56 ` Jean Delvare
  0 siblings, 1 reply; 2+ messages in thread
From: Dave Young @ 2008-01-03  5:54 UTC (permalink / raw)
  To: khali; +Cc: linux-kernel, i2c

Use mutex instead of semaphore in struct class.

Signed-off-by: Dave Young <hidave.darkstar@gmail.com> 
---
drivers/i2c/i2c-core.c |    9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)

diff -upr linux/drivers/i2c/i2c-core.c linux.new/drivers/i2c/i2c-core.c
--- linux/drivers/i2c/i2c-core.c	2007-12-28 10:06:58.000000000 +0800
+++ linux.new/drivers/i2c/i2c-core.c	2008-01-03 09:31:38.000000000 +0800
@@ -34,7 +34,6 @@
 #include <linux/mutex.h>
 #include <linux/completion.h>
 #include <asm/uaccess.h>
-#include <asm/semaphore.h>
 
 #include "i2c-core.h"
 
@@ -597,12 +596,12 @@ int i2c_register_driver(struct module *o
 	if (driver->attach_adapter) {
 		struct i2c_adapter *adapter;
 
-		down(&i2c_adapter_class.sem);
+		mutex_lock(&i2c_adapter_class.mutex);
 		list_for_each_entry(adapter, &i2c_adapter_class.devices,
 				    dev.node) {
 			driver->attach_adapter(adapter);
 		}
-		up(&i2c_adapter_class.sem);
+		mutex_unlock(&i2c_adapter_class.mutex);
 	}
 
 	mutex_unlock(&core_lock);
@@ -631,7 +630,7 @@ void i2c_del_driver(struct i2c_driver *d
 	 * attached. If so, detach them to be able to kill the driver
 	 * afterwards.
 	 */
-	down(&i2c_adapter_class.sem);
+	mutex_lock(&i2c_adapter_class.mutex);
 	list_for_each_entry(adap, &i2c_adapter_class.devices, dev.node) {
 		if (driver->detach_adapter) {
 			if (driver->detach_adapter(adap)) {
@@ -656,7 +655,7 @@ void i2c_del_driver(struct i2c_driver *d
 			}
 		}
 	}
-	up(&i2c_adapter_class.sem);
+	mutex_unlock(&i2c_adapter_class.mutex);
 
  unregister:
 	driver_unregister(&driver->driver);

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 2/7] i2c : convert semaphore to mutex in struct class
  2008-01-03  5:54 [PATCH 2/7] i2c : convert semaphore to mutex in struct class Dave Young
@ 2008-01-06 15:56 ` Jean Delvare
  0 siblings, 0 replies; 2+ messages in thread
From: Jean Delvare @ 2008-01-06 15:56 UTC (permalink / raw)
  To: Dave Young; +Cc: linux-kernel, i2c

On Thu, 3 Jan 2008 13:54:41 +0800, Dave Young wrote:
> Use mutex instead of semaphore in struct class.
> 
> Signed-off-by: Dave Young <hidave.darkstar@gmail.com> 
> ---
> drivers/i2c/i2c-core.c |    9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)

Acked-by: Jean Delvare <khali@linux-fr.org>

-- 
Jean Delvare

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-01-06 15:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-03  5:54 [PATCH 2/7] i2c : convert semaphore to mutex in struct class Dave Young
2008-01-06 15:56 ` Jean Delvare

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).