All of lore.kernel.org
 help / color / mirror / Atom feed
From: Roland Stigge <stigge@antcom.de>
To: lm-sensors@vger.kernel.org
Subject: Re: [lm-sensors] [PATCH 1/2] hwmon: (max6639) Fix FAN_FROM_REG calculation
Date: Tue, 21 Feb 2012 19:30:53 +0000	[thread overview]
Message-ID: <4F43F0ED.20203@antcom.de> (raw)
In-Reply-To: <1329850735-9876-2-git-send-email-guenter.roeck@ericsson.com>

On 21/02/12 19:58, Guenter Roeck wrote:
> From: Chris D Schimp <silverchris@gmail.com>
> 
> RPM calculation from tachometer value does not depend on PPR.
> Also, do not report negative RPM values.
> 
> Signed-off-by: Chris D Schimp <silverchris@gmail.com>
> [guenter.roeck@ericsson.com: do not report negative RPM values]
> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>

Acked-by: Roland Stigge <stigge@antcom.de>

> ---
>  drivers/hwmon/max6639.c |    6 +++---
>  1 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/hwmon/max6639.c b/drivers/hwmon/max6639.c
> index e10a092..13e58a1 100644
> --- a/drivers/hwmon/max6639.c
> +++ b/drivers/hwmon/max6639.c
> @@ -72,8 +72,8 @@ static unsigned short normal_i2c[] = { 0x2c, 0x2e, 0x2f, I2C_CLIENT_END };
>  
>  static const int rpm_ranges[] = { 2000, 4000, 8000, 16000 };
>  
> -#define FAN_FROM_REG(val, div, rpm_range)	((val) = 0 ? -1 : \
> -	(val) = 255 ? 0 : (rpm_ranges[rpm_range] * 30) / ((div + 1) * (val)))
> +#define FAN_FROM_REG(val, rpm_range)	((val) = 0 || (val) = 255 ? \
> +				0 : (rpm_ranges[rpm_range] * 30) / (val))
>  #define TEMP_LIMIT_TO_REG(val)	SENSORS_LIMIT((val) / 1000, 0, 255)
>  
>  /*
> @@ -333,7 +333,7 @@ static ssize_t show_fan_input(struct device *dev,
>  		return PTR_ERR(data);
>  
>  	return sprintf(buf, "%d\n", FAN_FROM_REG(data->fan[attr->index],
> -		       data->ppr, data->rpm_range));
> +		       data->rpm_range));
>  }
>  
>  static ssize_t show_alarm(struct device *dev,


_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

      reply	other threads:[~2012-02-21 19:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-21 18:58 [lm-sensors] [PATCH 1/2] hwmon: (max6639) Fix FAN_FROM_REG calculation Guenter Roeck
2012-02-21 19:30 ` Roland Stigge [this message]

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=4F43F0ED.20203@antcom.de \
    --to=stigge@antcom.de \
    --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.