Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 73638
b: refs/heads/master
c: 4bfe660
h: refs/heads/master
v: v3
  • Loading branch information
Matthias Kaehlcke authored and Mark M. Hoffman committed Nov 8, 2007
1 parent 6bfefd8 commit 046b64b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8de577095d65e8a51135793bf48c7be6c6c5bc77
refs/heads/master: 4bfe66048e97d29ab229519e9a821dbd4d929bd9
11 changes: 6 additions & 5 deletions trunk/drivers/hwmon/lm70.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,15 @@
#include <linux/err.h>
#include <linux/sysfs.h>
#include <linux/hwmon.h>
#include <linux/mutex.h>
#include <linux/spi/spi.h>
#include <asm/semaphore.h>


#define DRVNAME "lm70"

struct lm70 {
struct device *hwmon_dev;
struct semaphore sem;
struct mutex lock;
};

/* sysfs hook function */
Expand All @@ -51,7 +52,7 @@ static ssize_t lm70_sense_temp(struct device *dev,
s16 raw=0;
struct lm70 *p_lm70 = dev_get_drvdata(&spi->dev);

if (down_interruptible(&p_lm70->sem))
if (mutex_lock_interruptible(&p_lm70->lock))
return -ERESTARTSYS;

/*
Expand Down Expand Up @@ -83,7 +84,7 @@ static ssize_t lm70_sense_temp(struct device *dev,
val = ((int)raw/32) * 250;
status = sprintf(buf, "%d\n", val); /* millidegrees Celsius */
out:
up(&p_lm70->sem);
mutex_unlock(&p_lm70->lock);
return status;
}

Expand Down Expand Up @@ -112,7 +113,7 @@ static int __devinit lm70_probe(struct spi_device *spi)
if (!p_lm70)
return -ENOMEM;

init_MUTEX(&p_lm70->sem);
mutex_init(&p_lm70->lock);

/* sysfs hook */
p_lm70->hwmon_dev = hwmon_device_register(&spi->dev);
Expand Down

0 comments on commit 046b64b

Please sign in to comment.