All of lore.kernel.org
 help / color / mirror / Atom feed
From: jim.cromie@gmail.com (Jim Cromie)
To: lm-sensors@vger.kernel.org
Subject: [lm-sensors] [PATCH] W83627EHF driver update
Date: Wed, 07 Jun 2006 10:29:38 +0000	[thread overview]
Message-ID: <4486AA92.5010306@gmail.com> (raw)
In-Reply-To: <4485CB7A.9050209@sh.cvut.cz>

Rudolf Marek wrote:
>
> Please have a look to store_pwm_enable which has non-trivial locking. 
> I belive it is OK and I tested briefly, but better to be sure.
>

> +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.

> +			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.

> +			mutex_lock(&data->update_lock);
> +			data->pwm_enable[nr] = val;
> +			val--;
> +		}
> +		reg = (reg & ~(11 << W83627EHF_PWM_ENABLE_SHIFT[nr]));
> +		reg |= val << W83627EHF_PWM_ENABLE_SHIFT[nr];
> +		w83627ehf_write_value(client, W83627EHF_REG_PWM_ENABLE[nr],
> +					reg);
> +		mutex_unlock(&data->update_lock);
> +	}
> +	return count;
> +}
> +
>   
:-)


  parent reply	other threads:[~2006-06-07 10:29 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 [this message]
2006-06-07 20:51 ` David Hubbard
2006-06-07 21:00 ` Rudolf Marek
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=4486AA92.5010306@gmail.com \
    --to=jim.cromie@gmail.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.