Skip to content

Commit

Permalink
i2c-smbus: Use device_lock/device_unlock
Browse files Browse the repository at this point in the history
Use the new device locking/unlocking API.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
  • Loading branch information
Stephen Rothwell authored and Jean Delvare committed Mar 13, 2010
1 parent daf9fe2 commit f635a1e
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions drivers/i2c/i2c-smbus.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/device.h>
#include <linux/semaphore.h>
#include <linux/interrupt.h>
#include <linux/workqueue.h>
#include <linux/i2c.h>
Expand Down Expand Up @@ -55,15 +54,15 @@ 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);
else
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;
Expand Down

0 comments on commit f635a1e

Please sign in to comment.