From: ppokorny@penguincomputing.com (Philip Pokorny)
To: lm-sensors@vger.kernel.org
Subject: [PATCH] i2c driver changes for 2.5.72
Date: Thu, 19 May 2005 06:24:00 +0000 [thread overview]
Message-ID: <3EF26740.2020903@penguincomputing.com> (raw)
In-Reply-To: <10559607053930@kroah.com>
The data->foo and device register need to be in sync. So I suppose both...
At first I thought that if I always updated the chip first and then the
data->foo cached value, I'd be OK, but it seemed like there were too
many exceptions where values were broken apart, or recombined...
The primary thing I was trying to avoid was one CPU writing a value
while another CPU was reading a value (and therefore calling
update_client) and the result being that the data->foo cached value was
different from actual device register.
:v)
Greg KH wrote:
> On Wed, Jun 18, 2003 at 10:25:57PM -0400, Mark M. Hoffman wrote:
>
>>* Greg KH <greg@kroah.com> [2003-06-18 11:25:07 -0700]:
>>
>>>ChangeSet 1.1318.3.2, 2003/06/16 11:31:43-07:00, margitsw@t-online.de
>>>
>>>[PATCH] I2C: lm85 fixups
>>>
>>>OK Here's the patch which :
>>>1) Fixes the race conditions
>>
>><cut>
>>
>>>@@ -437,10 +434,13 @@
>>> {
>>> struct i2c_client *client = to_i2c_client(dev);
>>> struct lm85_data *data = i2c_get_clientdata(client);
>>>+ int val;
>>>
>>>- int val = simple_strtol(buf, NULL, 10);
>>>+ down(&data->update_lock);
>>>+ val = simple_strtol(buf, NULL, 10);
>>> data->fan_min[nr] = FAN_TO_REG(val);
>>> lm85_write_value(client, LM85_REG_FAN_MIN(nr), data->fan_min[nr]);
>>>+ up(&data->update_lock);
>>> return count;
>>> }
>>
>>Ugh. Looks like this sort of fix is needed in every single chip
>>driver in 2.5. And the CVS chip drivers have the same problem.
>
>
> Hm, wait, what are we trying to protect with this lock? The data->
> values? Or access to the hardware? Or something else?
>
> thanks,
>
> greg k-h
>
--
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:24 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-06-18 18:24 [BK PATCH] i2c driver changes for 2.5.72 Greg KH
2005-05-19 6:24 ` Greg KH
2003-06-18 18:25 ` [PATCH] " Greg KH
2005-05-19 6:24 ` Greg KH
2003-06-18 18:25 ` Greg KH
2005-05-19 6:24 ` Greg KH
2003-06-18 18:25 ` Greg KH
2005-05-19 6:24 ` Greg KH
2003-06-18 18:25 ` Greg KH
2005-05-19 6:24 ` Greg KH
2003-06-18 18:25 ` Greg KH
2005-05-19 6:24 ` Greg KH
2003-06-18 18:25 ` Greg KH
2005-05-19 6:24 ` Greg KH
2003-06-18 18:25 ` Greg KH
2005-05-19 6:24 ` Greg KH
2003-06-18 18:25 ` Greg KH
2005-05-19 6:24 ` Greg KH
2005-05-19 6:24 ` Mark M. Hoffman
2005-05-19 6:24 ` Mark M. Hoffman
2005-05-19 6:24 ` Philip Pokorny [this message]
2005-05-19 6:24 ` Greg KH
2005-05-19 6:24 ` Mark M. Hoffman
2005-05-19 6:24 ` Greg KH
2005-05-19 6:24 ` Mark M. Hoffman
2005-05-19 6:24 ` Mark M. Hoffman
2005-05-19 6:24 ` Philip Pokorny
2005-05-19 6:24 ` Mark M. Hoffman
2005-05-19 6:24 ` Philip Pokorny
2005-05-19 6:24 ` Mark M. Hoffman
2005-05-19 6:24 ` Mark M. Hoffman
2005-05-19 6:24 ` Mark D. Studebaker
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=3EF26740.2020903@penguincomputing.com \
--to=ppokorny@penguincomputing.com \
--cc=lm-sensors@vger.kernel.org \
/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.