X86 platform drivers
 help / color / mirror / Atom feed
From: Jean Delvare <khali@linux-fr.org>
To: Guenter Roeck <linux@roeck-us.net>
Cc: lm-sensors@lm-sensors.org,
	"Mark M. Hoffman" <mhoffman@lightlink.com>,
	George Joseph <george.joseph@fairview5.com>,
	Juerg Haefliger <juergh@gmail.com>,
	Steve Glendinning <steve.glendinning@shawell.net>,
	Riku Voipio <riku.voipio@iki.fi>,
	Guillaume Ligneul <guillaume.ligneul@gmail.com>,
	"Hans J. Koch" <hjk@hansjkoch.de>,
	Roger Lucas <vt8231@hiddenengine.co.uk>,
	Marc Hulsman <m.hulsman@tudelft.nl>,
	Rudolf Marek <r.marek@assembler.cz>,
	Corentin Chary <corentin.chary@gmail.com>,
	Matthew Garrett <mjg@redhat.com>,
	platform-driver-x86@vger.kernel.org
Subject: Re: [PATCH 3/3] hwmon: Retire SENSORS_LIMIT
Date: Wed, 9 Jan 2013 23:03:12 +0100	[thread overview]
Message-ID: <20130109230312.215abe51@endymion.delvare> (raw)
In-Reply-To: <1357750750-30512-3-git-send-email-linux@roeck-us.net>

On Wed,  9 Jan 2013 08:59:09 -0800, Guenter Roeck wrote:
> SENSORS_LIMIT and clamp_val have the same functionality, so retire SENSORS_LIMIT
> as it is no longer needed.
> 
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
>  Documentation/hwmon/sysfs-interface |    8 ++++----
>  include/linux/hwmon.h               |   12 ------------
>  2 files changed, 4 insertions(+), 16 deletions(-)
> 
> diff --git a/Documentation/hwmon/sysfs-interface b/Documentation/hwmon/sysfs-interface
> index 1f4dd85..79f8257 100644
> --- a/Documentation/hwmon/sysfs-interface
> +++ b/Documentation/hwmon/sysfs-interface
> @@ -722,14 +722,14 @@ add/subtract if it has been divided before the add/subtract.
>  What to do if a value is found to be invalid, depends on the type of the
>  sysfs attribute that is being set. If it is a continuous setting like a
>  tempX_max or inX_max attribute, then the value should be clamped to its
> -limits using SENSORS_LIMIT(value, min_limit, max_limit). If it is not
> -continuous like for example a tempX_type, then when an invalid value is
> -written, -EINVAL should be returned.
> +limits using clamp_val(value, min_limit, max_limit). If it is not continuous
> +like for example a tempX_type, then when an invalid value is written,
> +-EINVAL should be returned.
>  
>  Example1, temp1_max, register is a signed 8 bit value (-128 - 127 degrees):
>  
>  	long v = simple_strtol(buf, NULL, 10) / 1000;
> -	v = SENSORS_LIMIT(v, -128, 127);
> +	v = clamp_val(v, -128, 127);
>  	/* write v to register */
>  
>  Example2, fan divider setting, valid values 2, 4 and 8:
> diff --git a/include/linux/hwmon.h b/include/linux/hwmon.h
> index 82b29ae..b2514f7 100644
> --- a/include/linux/hwmon.h
> +++ b/include/linux/hwmon.h
> @@ -20,16 +20,4 @@ struct device *hwmon_device_register(struct device *dev);
>  
>  void hwmon_device_unregister(struct device *dev);
>  
> -/* Scale user input to sensible values */
> -static inline int SENSORS_LIMIT(long value, long low, long high)
> -{
> -	if (value < low)
> -		return low;
> -	else if (value > high)
> -		return high;
> -	else
> -		return value;
> -}
> -
>  #endif
> -

Acked-by: Jean Delvare <khali@linux-fr.org>

-- 
Jean Delvare

  reply	other threads:[~2013-01-09 22:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-09 16:59 [PATCH 1/3] hwmon: Replace SENSORS_LIMIT with clamp_val Guenter Roeck
2013-01-09 16:59 ` [PATCH 2/3] platform/x86: (eeepc-laptop) " Guenter Roeck
2013-01-09 22:01   ` Jean Delvare
2013-01-09 16:59 ` [PATCH 3/3] hwmon: Retire SENSORS_LIMIT Guenter Roeck
2013-01-09 22:03   ` Jean Delvare [this message]
2013-01-09 21:58 ` [PATCH 1/3] hwmon: Replace SENSORS_LIMIT with clamp_val Jean Delvare
2013-01-09 23:50   ` 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=20130109230312.215abe51@endymion.delvare \
    --to=khali@linux-fr.org \
    --cc=corentin.chary@gmail.com \
    --cc=george.joseph@fairview5.com \
    --cc=guillaume.ligneul@gmail.com \
    --cc=hjk@hansjkoch.de \
    --cc=juergh@gmail.com \
    --cc=linux@roeck-us.net \
    --cc=lm-sensors@lm-sensors.org \
    --cc=m.hulsman@tudelft.nl \
    --cc=mhoffman@lightlink.com \
    --cc=mjg@redhat.com \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=r.marek@assembler.cz \
    --cc=riku.voipio@iki.fi \
    --cc=steve.glendinning@shawell.net \
    --cc=vt8231@hiddenengine.co.uk \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox