From: ppokorny@penguincomputing.com (Philip Pokorny)
To: Greg KH <greg@kroah.com>
Cc: linux-kernel@vger.kernel.org, sensors@Stimpy.netroedge.com
Subject: [PATCH] More i2c driver changes for 2.5.70
Date: Thu, 19 May 2005 06:23:59 +0000 [thread overview]
Message-ID: <3EE7E809.1000005@penguincomputing.com> (raw)
In-Reply-To: 10553638062379@kroah.com
I think there is a race condition here in the "set" functions.
I had added a down()/up() semaphore pair to the write clauses of the
functions in the pre-sysfs driver to prevent the xx_update_client() call
from modifying the cached values at the same time that the set_xxx()
function was trying to change them.
So for example:
> static ssize_t set_temp_max(struct device *dev, const char *buf,
> size_t count, int nr)
> {
> struct i2c_client *client = to_i2c_client(dev);
> struct lm85_data *data = i2c_get_clientdata(client);
>
> int val = simple_strtol(buf, NULL, 10);
> + down(&data->update_lock);
> data->temp_max[nr] = TEMP_TO_REG(val);
> lm85_write_value(client, LM85_REG_TEMP_MAX(nr),
> data->temp_max[nr]);
> + up(&data->update_lock);
> return count;
> }
Isn't that still needed?
:v)
Greg KH wrote:
> ChangeSet 1.1419.1.3, 2003/06/11 11:42:47-07:00, margitsw@t-online.de
>
> [PATCH] I2C: add LM85 driver
>
> Nothing extra in sysfs (yet) but I have left the way open in the driver
> to do this.
> Provides vid, vrm, fan_input(1-4), fan_min(1-4), pwm(1-3),
> pwm_enable(1-3), in_input(0-4), in_min(0-4), in_max(0-4),
> temp_input(1-3), temp_min(1-3), temp_max(1-3), alarms.
>
>
> drivers/i2c/chips/Kconfig | 19
> drivers/i2c/chips/Makefile | 1
> drivers/i2c/chips/lm85.c | 1223 +++++++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 1241 insertions(+), 2 deletions(-)
>
> +static ssize_t show_temp_max(struct device *dev, char *buf, int nr)
> +{
> + struct i2c_client *client = to_i2c_client(dev);
> + struct lm85_data *data = i2c_get_clientdata(client);
> +
> + lm85_update_client(client);
> + return sprintf(buf,"%d\n", TEMP_FROM_REG(data->temp_max[nr]) );
> +}
> +static ssize_t set_temp_max(struct device *dev, const char *buf,
> + size_t count, int nr)
> +{
> + struct i2c_client *client = to_i2c_client(dev);
> + struct lm85_data *data = i2c_get_clientdata(client);
> +
> + int val = simple_strtol(buf, NULL, 10);
> + data->temp_max[nr] = TEMP_TO_REG(val);
> + lm85_write_value(client, LM85_REG_TEMP_MAX(nr), data->temp_max[nr]);
> + return count;
> +}
--
Philip Pokorny, Director of Engineering
Tel: 415-358-2635 Fax: 415-358-2646 Toll Free: 888-PENGUIN
PENGUIN COMPUTING, INC.
www.penguincomputing.com
WARNING: multiple messages have this Message-ID (diff)
From: Philip Pokorny <ppokorny@penguincomputing.com>
To: Greg KH <greg@kroah.com>
Cc: linux-kernel@vger.kernel.org, sensors@Stimpy.netroedge.com
Subject: Re: [PATCH] More i2c driver changes for 2.5.70
Date: Wed, 11 Jun 2003 19:40:09 -0700 [thread overview]
Message-ID: <3EE7E809.1000005@penguincomputing.com> (raw)
In-Reply-To: 10553638062379@kroah.com
I think there is a race condition here in the "set" functions.
I had added a down()/up() semaphore pair to the write clauses of the
functions in the pre-sysfs driver to prevent the xx_update_client() call
from modifying the cached values at the same time that the set_xxx()
function was trying to change them.
So for example:
> static ssize_t set_temp_max(struct device *dev, const char *buf,
> size_t count, int nr)
> {
> struct i2c_client *client = to_i2c_client(dev);
> struct lm85_data *data = i2c_get_clientdata(client);
>
> int val = simple_strtol(buf, NULL, 10);
> + down(&data->update_lock);
> data->temp_max[nr] = TEMP_TO_REG(val);
> lm85_write_value(client, LM85_REG_TEMP_MAX(nr),
> data->temp_max[nr]);
> + up(&data->update_lock);
> return count;
> }
Isn't that still needed?
:v)
Greg KH wrote:
> ChangeSet 1.1419.1.3, 2003/06/11 11:42:47-07:00, margitsw@t-online.de
>
> [PATCH] I2C: add LM85 driver
>
> Nothing extra in sysfs (yet) but I have left the way open in the driver
> to do this.
> Provides vid, vrm, fan_input(1-4), fan_min(1-4), pwm(1-3),
> pwm_enable(1-3), in_input(0-4), in_min(0-4), in_max(0-4),
> temp_input(1-3), temp_min(1-3), temp_max(1-3), alarms.
>
>
> drivers/i2c/chips/Kconfig | 19
> drivers/i2c/chips/Makefile | 1
> drivers/i2c/chips/lm85.c | 1223 +++++++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 1241 insertions(+), 2 deletions(-)
>
> +static ssize_t show_temp_max(struct device *dev, char *buf, int nr)
> +{
> + struct i2c_client *client = to_i2c_client(dev);
> + struct lm85_data *data = i2c_get_clientdata(client);
> +
> + lm85_update_client(client);
> + return sprintf(buf,"%d\n", TEMP_FROM_REG(data->temp_max[nr]) );
> +}
> +static ssize_t set_temp_max(struct device *dev, const char *buf,
> + size_t count, int nr)
> +{
> + struct i2c_client *client = to_i2c_client(dev);
> + struct lm85_data *data = i2c_get_clientdata(client);
> +
> + int val = simple_strtol(buf, NULL, 10);
> + data->temp_max[nr] = TEMP_TO_REG(val);
> + lm85_write_value(client, LM85_REG_TEMP_MAX(nr), data->temp_max[nr]);
> + return count;
> +}
--
Philip Pokorny, Director of Engineering
Tel: 415-358-2635 Fax: 415-358-2646 Toll Free: 888-PENGUIN
PENGUIN COMPUTING, INC.
www.penguincomputing.com
next prev parent reply other threads:[~2005-05-19 6:23 UTC|newest]
Thread overview: 98+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-06-11 20:35 [BK PATCH] More i2c driver changes for 2.5.70 Greg KH
2005-05-19 6:23 ` Greg KH
2003-06-11 20:36 ` [PATCH] " Greg KH
2005-05-19 6:23 ` Greg KH
2003-06-11 20:36 ` Greg KH
2005-05-19 6:23 ` Greg KH
2003-06-11 20:36 ` Greg KH
2005-05-19 6:23 ` Greg KH
2003-06-11 20:36 ` Greg KH
2005-05-19 6:23 ` Greg KH
2003-06-11 20:36 ` Greg KH
2005-05-19 6:23 ` Greg KH
2003-06-11 20:36 ` Greg KH
2005-05-19 6:23 ` Greg KH
2003-06-12 2:40 ` Philip Pokorny [this message]
2005-05-19 6:23 ` Philip Pokorny
-- strict thread matches above, loose matches on Subject: below --
2003-06-12 10:22 Margit Schubert-While
2003-06-16 18:42 ` Greg KH
2003-06-18 12:18 ` Margit Schubert-While
2003-06-18 14:22 ` Greg KH
2003-06-18 15:53 ` Margit Schubert-While
2003-06-12 9:16 Margit Schubert-While
2003-05-09 23:55 [BK PATCH] More i2c driver changes for 2.5.69 Greg KH
2005-05-19 6:23 ` Greg KH
2003-05-09 23:56 ` [PATCH] " Greg KH
2005-05-19 6:23 ` Greg KH
2003-05-09 23:56 ` Greg KH
2005-05-19 6:23 ` Greg KH
2003-05-09 23:56 ` Greg KH
2005-05-19 6:23 ` Greg KH
2003-05-09 23:56 ` Greg KH
2005-05-19 6:23 ` Greg KH
2003-05-09 23:56 ` Greg KH
2005-05-19 6:23 ` Greg KH
2003-05-09 23:56 ` Greg KH
2005-05-19 6:23 ` Greg KH
2003-04-03 0:14 [BK PATCH] More i2c driver changes for 2.5.66 Greg KH
2003-04-03 0:15 ` [PATCH] " Greg KH
2003-04-03 0:15 ` Greg KH
2003-04-03 0:15 ` Greg KH
2003-04-03 0:15 ` Greg KH
2003-04-03 0:15 ` Greg KH
2003-04-03 0:15 ` Greg KH
2005-05-19 6:23 ` Greg KH
2003-04-03 0:15 ` Greg KH
2003-04-03 0:15 ` Greg KH
2005-05-19 6:23 ` Greg KH
2003-04-03 0:15 ` Greg KH
2003-04-03 0:15 ` Greg KH
2003-04-03 0:15 ` Greg KH
2003-04-03 0:15 ` Greg KH
2003-04-03 0:15 ` Greg KH
2003-04-03 0:15 ` Greg KH
2003-04-03 0:15 ` Greg KH
2003-04-03 6:21 ` Albert Cranford
2005-05-19 6:23 ` Albert Cranford
2003-04-03 6:33 ` Greg KH
2005-05-19 6:23 ` Greg KH
2003-04-03 13:06 ` Albert Cranford
2005-05-19 6:23 ` Albert Cranford
2003-04-03 16:37 ` Greg KH
2005-05-19 6:23 ` Greg KH
2003-03-22 1:04 [BK PATCH] More i2c driver changes for 2.5.65 Greg KH
2005-05-19 6:23 ` Greg KH
2003-03-22 1:04 ` [PATCH] " Greg KH
2005-05-19 6:23 ` Greg KH
2003-03-22 1:04 ` Greg KH
2005-05-19 6:23 ` Greg KH
2003-03-22 1:04 ` Greg KH
2005-05-19 6:23 ` Greg KH
2003-03-22 1:04 ` Greg KH
2005-05-19 6:23 ` Greg KH
2003-03-22 1:04 ` Greg KH
2005-05-19 6:23 ` Greg KH
2003-03-22 1:04 ` Greg KH
2005-05-19 6:23 ` Greg KH
2003-03-22 1:04 ` Greg KH
2005-05-19 6:23 ` Greg KH
2003-03-22 1:04 ` Greg KH
2005-05-19 6:23 ` Greg KH
2003-03-22 1:04 ` Greg KH
2005-05-19 6:23 ` Greg KH
2003-03-25 9:35 ` Pavel Machek
2005-05-19 6:23 ` Pavel Machek
2003-03-25 1:29 ` Greg KH
2005-05-19 6:23 ` Greg KH
2003-03-25 2:04 ` Dave Jones
2005-05-19 6:23 ` Dave Jones
2003-03-25 3:34 ` Greg KH
2005-05-19 6:23 ` Greg KH
2005-05-19 6:23 ` [PATCH] More i2c driver changes for 2.5.66 Greg KH
2005-05-19 6:23 ` Albert Cranford
2005-05-19 6:23 ` Mark M. Hoffman
2005-05-19 6:23 ` [PATCH] More i2c driver changes for 2.5.69 Philip Pokorny
2003-03-22 2:33 ` [PATCH] More i2c driver changes for 2.5.65 Petr Vandrovec
2005-05-19 6:23 ` Petr Vandrovec
2003-03-23 8:49 ` Greg KH
2005-05-19 6:23 ` Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3EE7E809.1000005@penguincomputing.com \
--to=ppokorny@penguincomputing.com \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sensors@Stimpy.netroedge.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.