* [PATCH] i2c: update for semaphore to mutex conversion of devices
@ 2010-03-08 23:28 Stephen Rothwell
2010-03-08 23:59 ` Greg KH
2010-03-09 8:25 ` Jean Delvare
0 siblings, 2 replies; 9+ messages in thread
From: Stephen Rothwell @ 2010-03-08 23:28 UTC (permalink / raw)
To: Linus, Andrew Morton; +Cc: Greg KH, LKML, linux-next, Jean Delvare
I have been carrying this patch in linux-next for some time and now
mainline needs it.
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
drivers/i2c/i2c-smbus.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/i2c/i2c-smbus.c b/drivers/i2c/i2c-smbus.c
index 333527c..52aa775 100644
--- a/drivers/i2c/i2c-smbus.c
+++ b/drivers/i2c/i2c-smbus.c
@@ -27,6 +27,7 @@
#include <linux/workqueue.h>
#include <linux/i2c.h>
#include <linux/i2c-smbus.h>
+#include <linux/mutex.h>
struct i2c_smbus_alert {
unsigned int alert_edge_triggered:1;
@@ -55,7 +56,7 @@ static int smbus_do_alert(struct device *dev, void *addrp)
* Drivers should either disable alerts, or provide at least
* a minimal handler. Lock so client->driver won't change.
*/
- down(&dev->sem);
+ device_lock(dev);
if (client->driver) {
if (client->driver->alert)
client->driver->alert(client, data->flag);
@@ -63,7 +64,7 @@ static int smbus_do_alert(struct device *dev, void *addrp)
dev_warn(&client->dev, "no driver alert()!\n");
} else
dev_dbg(&client->dev, "alert with no driver\n");
- up(&dev->sem);
+ device_unlock(dev);
/* Stop iterating after we find the device */
return -EBUSY;
--
1.6.6.2
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] i2c: update for semaphore to mutex conversion of devices
2010-03-08 23:28 [PATCH] i2c: update for semaphore to mutex conversion of devices Stephen Rothwell
@ 2010-03-08 23:59 ` Greg KH
2010-03-09 1:50 ` Stephen Rothwell
2010-03-09 16:04 ` Peter Zijlstra
2010-03-09 8:25 ` Jean Delvare
1 sibling, 2 replies; 9+ messages in thread
From: Greg KH @ 2010-03-08 23:59 UTC (permalink / raw)
To: Stephen Rothwell; +Cc: Linus, Andrew Morton, LKML, linux-next, Jean Delvare
On Tue, Mar 09, 2010 at 10:28:28AM +1100, Stephen Rothwell wrote:
> I have been carrying this patch in linux-next for some time and now
> mainline needs it.
Well, it's not required, but it is nice to have. I didn't merge the
"convert the driver core semaphore to a mutex" patch as it was causing
too many false-positive lockdep warnings.
Hopefully the lockdep core will be tweaked to handle the locking tree
that the device core requires and then when that happens, I will merge
the patch that will require this fix in order to keep the build from
breaking.
But for now, it's not a requirement, although, it does make my life
easier.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] i2c: update for semaphore to mutex conversion of devices
2010-03-08 23:59 ` Greg KH
@ 2010-03-09 1:50 ` Stephen Rothwell
2010-03-09 2:27 ` Greg KH
2010-03-09 16:04 ` Peter Zijlstra
1 sibling, 1 reply; 9+ messages in thread
From: Stephen Rothwell @ 2010-03-09 1:50 UTC (permalink / raw)
To: Greg KH; +Cc: Linus, Andrew Morton, LKML, linux-next, Jean Delvare
[-- Attachment #1: Type: text/plain, Size: 657 bytes --]
Hi Greg,
On Mon, 8 Mar 2010 15:59:53 -0800 Greg KH <greg@kroah.com> wrote:
>
> On Tue, Mar 09, 2010 at 10:28:28AM +1100, Stephen Rothwell wrote:
> > I have been carrying this patch in linux-next for some time and now
> > mainline needs it.
>
> Well, it's not required, but it is nice to have. I didn't merge the
> "convert the driver core semaphore to a mutex" patch as it was causing
> too many false-positive lockdep warnings.
Ah, I missed that, sorry.
Strangely, I was assuming that what was in linux-next would get merged :-)
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] i2c: update for semaphore to mutex conversion of devices
2010-03-09 1:50 ` Stephen Rothwell
@ 2010-03-09 2:27 ` Greg KH
0 siblings, 0 replies; 9+ messages in thread
From: Greg KH @ 2010-03-09 2:27 UTC (permalink / raw)
To: Stephen Rothwell; +Cc: Linus, Andrew Morton, LKML, linux-next, Jean Delvare
On Tue, Mar 09, 2010 at 12:50:37PM +1100, Stephen Rothwell wrote:
> Hi Greg,
>
> On Mon, 8 Mar 2010 15:59:53 -0800 Greg KH <greg@kroah.com> wrote:
> >
> > On Tue, Mar 09, 2010 at 10:28:28AM +1100, Stephen Rothwell wrote:
> > > I have been carrying this patch in linux-next for some time and now
> > > mainline needs it.
> >
> > Well, it's not required, but it is nice to have. I didn't merge the
> > "convert the driver core semaphore to a mutex" patch as it was causing
> > too many false-positive lockdep warnings.
>
> Ah, I missed that, sorry.
>
> Strangely, I was assuming that what was in linux-next would get merged :-)
That is normally the case, but when patches are found to have problems,
due to the testing that happens with linux-next, they can then be not
sent to Linus, right?
That's what happened here, we need more infrastructure to be able to
accept them. I see it as a validation that our development model is
working properly that this happened :)
thanks,
greg k-h
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] i2c: update for semaphore to mutex conversion of devices
2010-03-08 23:28 [PATCH] i2c: update for semaphore to mutex conversion of devices Stephen Rothwell
2010-03-08 23:59 ` Greg KH
@ 2010-03-09 8:25 ` Jean Delvare
2010-03-09 10:36 ` Stephen Rothwell
1 sibling, 1 reply; 9+ messages in thread
From: Jean Delvare @ 2010-03-09 8:25 UTC (permalink / raw)
To: Stephen Rothwell; +Cc: Linus, Andrew Morton, Greg KH, LKML, linux-next
On Tue, 9 Mar 2010 10:28:28 +1100, Stephen Rothwell wrote:
> I have been carrying this patch in linux-next for some time and now
> mainline needs it.
>
> Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
> ---
> drivers/i2c/i2c-smbus.c | 5 +++--
> 1 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/i2c/i2c-smbus.c b/drivers/i2c/i2c-smbus.c
> index 333527c..52aa775 100644
> --- a/drivers/i2c/i2c-smbus.c
> +++ b/drivers/i2c/i2c-smbus.c
> @@ -27,6 +27,7 @@
> #include <linux/workqueue.h>
> #include <linux/i2c.h>
> #include <linux/i2c-smbus.h>
> +#include <linux/mutex.h>
>
> struct i2c_smbus_alert {
> unsigned int alert_edge_triggered:1;
> @@ -55,7 +56,7 @@ static int smbus_do_alert(struct device *dev, void *addrp)
> * Drivers should either disable alerts, or provide at least
> * a minimal handler. Lock so client->driver won't change.
> */
> - down(&dev->sem);
> + device_lock(dev);
> if (client->driver) {
> if (client->driver->alert)
> client->driver->alert(client, data->flag);
> @@ -63,7 +64,7 @@ static int smbus_do_alert(struct device *dev, void *addrp)
> dev_warn(&client->dev, "no driver alert()!\n");
> } else
> dev_dbg(&client->dev, "alert with no driver\n");
> - up(&dev->sem);
> + device_unlock(dev);
>
> /* Stop iterating after we find the device */
> return -EBUSY;
Thanks for the reminder Stephen. I was only waiting for device_lock()
to become usable in mainline. Now that it happened, I will take the
patch above in my i2c tree, and send it to Linus in my next batch.
--
Jean Delvare
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] i2c: update for semaphore to mutex conversion of devices
2010-03-09 8:25 ` Jean Delvare
@ 2010-03-09 10:36 ` Stephen Rothwell
2010-03-09 10:39 ` Jean Delvare
0 siblings, 1 reply; 9+ messages in thread
From: Stephen Rothwell @ 2010-03-09 10:36 UTC (permalink / raw)
To: Jean Delvare; +Cc: Linus, Andrew Morton, Greg KH, LKML, linux-next
[-- Attachment #1: Type: text/plain, Size: 645 bytes --]
Hi Jean,
On Tue, 9 Mar 2010 09:25:08 +0100 Jean Delvare <khali@linux-fr.org> wrote:
>
> Thanks for the reminder Stephen. I was only waiting for device_lock()
> to become usable in mainline. Now that it happened, I will take the
> patch above in my i2c tree, and send it to Linus in my next batch.
Thanks. The include of mutex.h is not actually needed yet as Greg didn't
send the semaphore to mutex change to Linus due to other issues. The
device_lock/unlock part would be useful, though for when the change does
happen.
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] i2c: update for semaphore to mutex conversion of devices
2010-03-09 10:36 ` Stephen Rothwell
@ 2010-03-09 10:39 ` Jean Delvare
2010-03-09 10:47 ` Stephen Rothwell
0 siblings, 1 reply; 9+ messages in thread
From: Jean Delvare @ 2010-03-09 10:39 UTC (permalink / raw)
To: Stephen Rothwell; +Cc: Linus, Andrew Morton, Greg KH, LKML, linux-next
On Tue, 9 Mar 2010 21:36:50 +1100, Stephen Rothwell wrote:
> Hi Jean,
>
> On Tue, 9 Mar 2010 09:25:08 +0100 Jean Delvare <khali@linux-fr.org> wrote:
> >
> > Thanks for the reminder Stephen. I was only waiting for device_lock()
> > to become usable in mainline. Now that it happened, I will take the
> > patch above in my i2c tree, and send it to Linus in my next batch.
>
> Thanks. The include of mutex.h is not actually needed yet as Greg didn't
> send the semaphore to mutex change to Linus due to other issues.
It will never be needed, and I also removed the include of semaphore.h.
The beauty of the new API is that it hides the implementation details
from the caller!
> The
> device_lock/unlock part would be useful, though for when the change does
> happen.
Of course.
--
Jean Delvare
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] i2c: update for semaphore to mutex conversion of devices
2010-03-09 10:39 ` Jean Delvare
@ 2010-03-09 10:47 ` Stephen Rothwell
0 siblings, 0 replies; 9+ messages in thread
From: Stephen Rothwell @ 2010-03-09 10:47 UTC (permalink / raw)
To: Jean Delvare; +Cc: Linus, Andrew Morton, Greg KH, LKML, linux-next
[-- Attachment #1: Type: text/plain, Size: 769 bytes --]
Hi Jean,
On Tue, 9 Mar 2010 11:39:50 +0100 Jean Delvare <khali@linux-fr.org> wrote:
>
> > Thanks. The include of mutex.h is not actually needed yet as Greg didn't
> > send the semaphore to mutex change to Linus due to other issues.
>
> It will never be needed, and I also removed the include of semaphore.h.
> The beauty of the new API is that it hides the implementation details
> from the caller!
Yeah, except it scares me a little since device.h currently does not
directly include semaphore.h and the patch that changes the semaphore to
a mutex does not include mutex.h in device.h either ...
I guess that is a problem for Greg, though.
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] i2c: update for semaphore to mutex conversion of devices
2010-03-08 23:59 ` Greg KH
2010-03-09 1:50 ` Stephen Rothwell
@ 2010-03-09 16:04 ` Peter Zijlstra
1 sibling, 0 replies; 9+ messages in thread
From: Peter Zijlstra @ 2010-03-09 16:04 UTC (permalink / raw)
To: Greg KH
Cc: Stephen Rothwell, Linus, Andrew Morton, LKML, linux-next,
Jean Delvare, tglx
On Mon, 2010-03-08 at 15:59 -0800, Greg KH wrote:
>
> Hopefully the lockdep core will be tweaked to handle the locking tree
> that the device core requires and then when that happens, I will merge
> the patch that will require this fix in order to keep the build from
> breaking.
>
?! Thomas send you patch shutting lockdep up for device mutex, look for
<alpine.LFD.2.00.1002181116410.2811@localhost.localdomain> in your
inbox.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2010-03-09 16:04 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-08 23:28 [PATCH] i2c: update for semaphore to mutex conversion of devices Stephen Rothwell
2010-03-08 23:59 ` Greg KH
2010-03-09 1:50 ` Stephen Rothwell
2010-03-09 2:27 ` Greg KH
2010-03-09 16:04 ` Peter Zijlstra
2010-03-09 8:25 ` Jean Delvare
2010-03-09 10:36 ` Stephen Rothwell
2010-03-09 10:39 ` Jean Delvare
2010-03-09 10:47 ` Stephen Rothwell
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).