From: r.marek@sh.cvut.cz (Rudolf Marek)
To: lm-sensors@vger.kernel.org
Subject: [lm-sensors] [PATCH] W83627EHF driver update
Date: Wed, 07 Jun 2006 21:00:01 +0000 [thread overview]
Message-ID: <44873E51.5050404@sh.cvut.cz> (raw)
In-Reply-To: <4485CB7A.9050209@sh.cvut.cz>
Hi Jim,
>> +static ssize_t
>> +store_pwm_enable(struct device *dev, struct device_attribute *attr,
>> + const char *buf, size_t count)
>> +{
>>
>> + if (data->pwm_enable[nr] != val) {
>>
> I guess *here* is where you mean non-trivial.
>
> why not take the lock here -> instead of in both branches of if ?
>
>> + if (!val) {
>>
> you specifically and knowingly dont protect this call,
> and advised us of it in your msg. It certainly warrants a comment here too.
The call protect itself because it locks on its own. If the lock would be
before, it tries to lock 2 times and will deadlock.
>
>> + store_pwm(dev, attr, "255", 3);
>>
> and now take the lock.
>> + mutex_lock(&data->update_lock);
>> + data->pwm_enable[nr] = val;
>> + }
>> + else {
>>
> repeating, this lock could be hoisted, but for the missing/unstated reason.
I know this code is not perfect, but how can it be done without more locking or
more confusing temporary variables?
Thanks,
regards
Rudolf
next prev parent reply other threads:[~2006-06-07 21:00 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-06-06 18:37 [lm-sensors] [PATCH] W83627EHF driver update Rudolf Marek
2006-06-06 21:02 ` David Hubbard
2006-06-07 10:29 ` Jim Cromie
2006-06-07 20:51 ` David Hubbard
2006-06-07 21:00 ` Rudolf Marek [this message]
2006-06-07 21:06 ` Rudolf Marek
2006-06-07 22:13 ` Sylvain Jeaugey
2006-06-08 1:01 ` David Hubbard
2006-06-08 7:51 ` Sylvain Jeaugey
2006-06-12 16:30 ` Jean Delvare
2006-06-12 23:12 ` David Hubbard
2006-06-13 8:53 ` Jean Delvare
2006-06-13 16:03 ` David Hubbard
2006-06-14 12:48 ` Rudolf Marek
2006-06-14 15:06 ` Jean Delvare
2006-06-14 15:14 ` Rudolf Marek
2006-06-14 15:50 ` Jean Delvare
2006-06-14 21:29 ` Rudolf Marek
2006-06-15 14:55 ` David Hubbard
2006-06-15 15:20 ` Sylvain Jeaugey
2006-06-16 4:29 ` David Hubbard
2006-06-16 21:33 ` Rudolf Marek
2006-06-19 15:53 ` David Hubbard
2006-06-20 12:41 ` Jean Delvare
2006-06-21 15:10 ` David Hubbard
2006-06-24 16:42 ` Rudolf Marek
2006-06-25 14:04 ` Jean Delvare
2006-06-25 16:00 ` Rudolf Marek
2006-06-26 19:33 ` Jean Delvare
2006-06-26 20:34 ` Rudolf Marek
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=44873E51.5050404@sh.cvut.cz \
--to=r.marek@sh.cvut.cz \
--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.