From: Guenter Roeck <guenter.roeck@ericsson.com>
To: lm-sensors@vger.kernel.org
Subject: Re: [lm-sensors] [PATCH 6/6] hwmon: (f75375s) Catch some attempts to write to r/o registers
Date: Thu, 23 Feb 2012 02:27:22 +0000 [thread overview]
Message-ID: <20120223022722.GB5280@ericsson.com> (raw)
In-Reply-To: <1329949129-4265-7-git-send-email-mail@microschulz.de>
On Wed, Feb 22, 2012 at 05:18:49PM -0500, Nikolaus Schulz wrote:
> It makes no sense to attempt to manually configure the fan in auto mode,
> or set the duty cycle directly in closed loop mode. The corresponding
> registers are then read-only. If the user tries it nonetheless, error out
> with EBUSY instead of silently doing nothing.
>
> Signed-off-by: Nikolaus Schulz <mail@microschulz.de>
> ---
> drivers/hwmon/f75375s.c | 32 ++++++++++++++++++++++++++++++++
> 1 files changed, 32 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/hwmon/f75375s.c b/drivers/hwmon/f75375s.c
> index 29b11c6..0e7fe3a 100644
> --- a/drivers/hwmon/f75375s.c
> +++ b/drivers/hwmon/f75375s.c
> @@ -281,6 +281,21 @@ static bool duty_mode_enabled(u8 pwm_enable)
> }
> }
>
> +static bool auto_mode_enabled(u8 pwm_enable)
> +{
> + switch (pwm_enable) {
> + case 0: /* Manual, duty mode (full speed) */
> + case 1: /* Manual, duty mode */
> + case 3: /* Manual, speed mode */
> + return false;
> + case 2: /* Auto, speed mode */
> + case 4: /* Auto, duty mode */
> + return true;
> + default:
> + BUG();
> + }
> +}
> +
Same as the other one ...
return pwm_enable = 2 || pwm_enable = 4;
would be much simpler.
Thanks,
Guenter
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
next prev parent reply other threads:[~2012-02-23 2:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-22 22:18 [lm-sensors] [PATCH 6/6] hwmon: (f75375s) Catch some attempts to write to r/o registers Nikolaus Schulz
2012-02-23 1:35 ` Guenter Roeck
2012-02-23 2:27 ` Guenter Roeck [this message]
2012-02-23 19:40 ` Nikolaus Schulz
2012-02-23 19:59 ` Guenter Roeck
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=20120223022722.GB5280@ericsson.com \
--to=guenter.roeck@ericsson.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.