summaryrefslogtreecommitdiff
path: root/drivers/hwmon/emc6w201.c
AgeCommit message (Collapse)AuthorFilesLines
2016-12-12hwmon: (emcw201) Fix overflows seen when writing into limit attributesGuenter Roeck1-3/+5
Writes into temperature and voltage limit attributes can overflow due to multiplications with unchecked parameters. Also, the input parameter to DIV_ROUND_CLOSEST() needis to be range checked. Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2016-06-28hwmon: (emc6w201): trivial fix of spelling mistake "Unknwown" -> "Unknown"Colin Ian King1-1/+1
trivial fix to spelling mistake in dev_dbg message Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-08-06hwmon: (emc6w201) Fix temperature limit rangeGuenter Roeck1-2/+2
Temperature limit range is [-127, 127], not [-127, 128]. The wrong range caused a bad limit to be written into the chip if the limit was set to a value of 128 degrees C or above. Also use DIV_ROUND_CLOSEST instead of a plain divide operation to reduce the rounding error when writing temperature limits. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Jean Delvare <jdelvare@suse.de>
2014-08-04hwmon: (emc6w201) Convert to devm_hwmon_device_register_with_groupsAxel Lin1-45/+19
Use ATTRIBUTE_GROUPS macro and devm_hwmon_device_register_with_groups() to simplify the code a bit. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-01-29Update Jean Delvare's e-mail addressJean Delvare1-2/+2
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2013-09-06hwmon: (emc6w201) Do not declare enum variableGuenter Roeck1-1/+1
Fix the following smatch warning: emc6w201.c:52:26: warning: symbol 'subfeature' was not declared. Should it be static? 'enum { } subtype' declares an enum as (global) variable which we don't want. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2013-01-26hwmon: Replace SENSORS_LIMIT with clamp_valGuenter Roeck1-3/+3
SENSORS_LIMIT and the generic clamp_val have the same functionality, and clamp_val is more efficient. This patch reduces text size by 9052 bytes and bss size by 11624 bytes for x86_64 builds. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Acked-by: George Joseph <george.joseph@fairview5.com> Acked-by: Jean Delvare <khali@linux-fr.org>
2012-12-22hwmon: (emc6w201) Fix DIV_ROUND_CLOSEST problem with unsigned divisorsGuenter Roeck1-1/+1
Result of DIV_ROUND_CLOSEST is undefined for negative dividends if the divisor variable type is unsigned. Fix by declaring divisor as signed variable. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Jean Delvare <khali@linux-fr.org>
2012-10-10hwmon: Drop needless includes of <linux/delay.h>Jean Delvare1-1/+0
These drivers use no sleep or delay functions so they don't need to include <linux/delay.h>. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Guenter Roeck <linux@roeck-us.net> Cc: Rudolf Marek <r.marek@assembler.cz>
2012-07-22hwmon: (emc6w201) Convert to use devm_ functionsGuenter Roeck1-10/+5
Convert to use devm_ functions to reduce code size and simplify the code. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Jean Delvare <khali@linux-fr.org>
2012-03-19hwmon: convert drivers/hwmon/* to use module_i2c_driver()Axel Lin1-11/+1
This patch converts the drivers in drivers/hwmon/* to use the module_i2c_driver() macro which makes the code smaller and a bit simpler. Signed-off-by: Axel Lin <axel.lin@gmail.com> Cc: Corentin Labbe <corentin.labbe@geomatys.fr> Cc: Dirk Eibach <eibach@gdsys.de> Cc: "Mark M. Hoffman" <mhoffman@lightlink.com> Cc: Steve Glendinning <steve.glendinning@smsc.com> Cc: Riku Voipio <riku.voipio@iki.fi> Cc: Guillaume Ligneul <guillaume.ligneul@gmail.com> Cc: David George <david.george@ska.ac.za> Cc: "Hans J. Koch" <hjk@hansjkoch.de> Cc: Marc Hulsman <m.hulsman@tudelft.nl> Cc: Rudolf Marek <r.marek@assembler.cz> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2012-01-05hwmon: replaced strict_str* with kstr*Frans Meulenbroeks1-3/+3
replaced strict_strtol with kstrtol and replaced strict_strtuol with kstrtuol This satisfies checkpatch -f Compile tested only: no warnings or errors given Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2011-07-03hwmon: (emc6w201) Properly handle all errorsJean Delvare1-14/+44
Handle errors on 8-bit register reads and writes too. Also use likely and unlikely to make the functions faster on success. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
2011-05-25hwmon: New driver for the SMSC EMC6W201Jean Delvare1-0/+539
This is a new driver for the SMSC EMC6W201 hardware monitoring device. The device is functionally close to the EMC6D100 series, but is register-incompatible. Signed-off-by: Jean Delvare <khali@linux-fr.org> Tested-by: Harry G McGavran Jr <w5pny@arrl.net> Tested-by: Jeff Rickman <jrickman@myamigos.us> Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>