* [lm-sensors] [PATCH] Hardware Monitor LM70: Convert semaphore to
@ 2007-10-24 12:59 ` Matthias Kaehlcke
0 siblings, 0 replies; 5+ messages in thread
From: Matthias Kaehlcke @ 2007-10-24 12:59 UTC (permalink / raw)
To: mhoffman, Jean Delvare, Greg Kroah-Hartman, lm-sensors; +Cc: linux-kernel, akpm
Hardware Monitor LM70: Convert the semaphore lm70->sem to the mutex
API
Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com>
--
diff --git a/drivers/hwmon/lm70.c b/drivers/hwmon/lm70.c
index dd36688..d435f00 100644
--- a/drivers/hwmon/lm70.c
+++ b/drivers/hwmon/lm70.c
@@ -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 */
@@ -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;
/*
@@ -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;
}
@@ -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);
--
Matthias Kaehlcke
Linux Application Developer
Barcelona
We build too many walls and not enough bridges
(Isaac Newton)
.''`.
using free software / Debian GNU/Linux | http://debian.org : :' :
`. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4 `-
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH] Hardware Monitor LM70: Convert semaphore to mutex
@ 2007-10-24 12:59 ` Matthias Kaehlcke
0 siblings, 0 replies; 5+ messages in thread
From: Matthias Kaehlcke @ 2007-10-24 12:59 UTC (permalink / raw)
To: mhoffman, Jean Delvare, Greg Kroah-Hartman, lm-sensors; +Cc: linux-kernel, akpm
Hardware Monitor LM70: Convert the semaphore lm70->sem to the mutex
API
Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com>
--
diff --git a/drivers/hwmon/lm70.c b/drivers/hwmon/lm70.c
index dd36688..d435f00 100644
--- a/drivers/hwmon/lm70.c
+++ b/drivers/hwmon/lm70.c
@@ -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 */
@@ -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;
/*
@@ -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;
}
@@ -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);
--
Matthias Kaehlcke
Linux Application Developer
Barcelona
We build too many walls and not enough bridges
(Isaac Newton)
.''`.
using free software / Debian GNU/Linux | http://debian.org : :' :
`. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4 `-
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [lm-sensors] [PATCH] Hardware Monitor LM70: Convert semaphore
2007-10-24 12:59 ` [PATCH] Hardware Monitor LM70: Convert semaphore to mutex Matthias Kaehlcke
(?)
@ 2007-10-24 21:06 ` Jean Delvare
-1 siblings, 0 replies; 5+ messages in thread
From: Jean Delvare @ 2007-10-24 21:06 UTC (permalink / raw)
To: lm-sensors
Hi Matthias,
Please don't include half of the known world in Cc for such a trivial
patch. Stripping the Cc list to the bare minimum.
On Wed, 24 Oct 2007 14:59:09 +0200, Matthias Kaehlcke wrote:
> Hardware Monitor LM70: Convert the semaphore lm70->sem to the mutex
> API
>
> Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com>
>
> --
>
> diff --git a/drivers/hwmon/lm70.c b/drivers/hwmon/lm70.c
> index dd36688..d435f00 100644
> --- a/drivers/hwmon/lm70.c
> +++ b/drivers/hwmon/lm70.c
> @@ -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 */
> @@ -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;
>
> /*
> @@ -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;
> }
>
> @@ -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);
>
I thought we had converted all the hwmon drivers long ago but it seems
that this was slipped through. Good catch.
Acked-by: Jean Delvare <khali@linux-fr.org>
--
Jean Delvare
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [lm-sensors] [PATCH] Hardware Monitor LM70: Convert semaphore
2007-10-24 12:59 ` [PATCH] Hardware Monitor LM70: Convert semaphore to mutex Matthias Kaehlcke
@ 2007-10-25 2:18 ` Mark M. Hoffman
-1 siblings, 0 replies; 5+ messages in thread
From: Mark M. Hoffman @ 2007-10-25 2:18 UTC (permalink / raw)
To: Matthias Kaehlcke, Jean Delvare, Greg Kroah-Hartman, lm-sensors,
linux-kernel, akpm
Hi:
* Matthias Kaehlcke <matthias.kaehlcke@gmail.com> [2007-10-24 14:59:09 +0200]:
> Hardware Monitor LM70: Convert the semaphore lm70->sem to the mutex
> API
>
> Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com>
Applied to hwmon-2.6.git/testing, thanks.
--
Mark M. Hoffman
mhoffman@lightlink.com
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Hardware Monitor LM70: Convert semaphore to mutex
@ 2007-10-25 2:18 ` Mark M. Hoffman
0 siblings, 0 replies; 5+ messages in thread
From: Mark M. Hoffman @ 2007-10-25 2:18 UTC (permalink / raw)
To: Matthias Kaehlcke, Jean Delvare, Greg Kroah-Hartman, lm-sensors,
linux-kernel, akpm
Hi:
* Matthias Kaehlcke <matthias.kaehlcke@gmail.com> [2007-10-24 14:59:09 +0200]:
> Hardware Monitor LM70: Convert the semaphore lm70->sem to the mutex
> API
>
> Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com>
Applied to hwmon-2.6.git/testing, thanks.
--
Mark M. Hoffman
mhoffman@lightlink.com
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-10-25 2:23 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-24 12:59 [lm-sensors] [PATCH] Hardware Monitor LM70: Convert semaphore to Matthias Kaehlcke
2007-10-24 12:59 ` [PATCH] Hardware Monitor LM70: Convert semaphore to mutex Matthias Kaehlcke
2007-10-24 21:06 ` [lm-sensors] [PATCH] Hardware Monitor LM70: Convert semaphore Jean Delvare
2007-10-25 2:18 ` Mark M. Hoffman
2007-10-25 2:18 ` [PATCH] Hardware Monitor LM70: Convert semaphore to mutex Mark M. Hoffman
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.