aboutsummaryrefslogtreecommitdiff
path: root/drivers/hwmon/lm80.c
AgeCommit message (Collapse)AuthorFilesLines
2020-09-23hwmon: use simple i2c probe functionStephen Kitt1-3/+2
Many hwmon drivers don't use the id information provided by the old i2c probe function, and the remainder can easily be adapted to the new form ("probe_new") by calling i2c_match_id explicitly. This avoids scanning the identifier tables during probes. Drivers which didn't use the id are converted as-is; drivers which did are modified as follows: * if the information in i2c_client is sufficient, that's used instead (client->name); * anything else is handled by calling i2c_match_id() with the same level of error-handling (if any) as before. A few drivers aren't included in this patch because they have a different set of maintainers. They will be covered by other patches. Signed-off-by: Stephen Kitt <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Guenter Roeck <[email protected]>
2019-05-24treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 61Thomas Gleixner1-14/+1
Based on 1 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms of the gnu general public license as published by the free software foundation either version 2 of the license or at your option any later version this program is distributed in the hope that it will be useful but without any warranty without even the implied warranty of merchantability or fitness for a particular purpose see the gnu general public license for more details you should have received a copy of the gnu general public license along with this program if not write to the free software foundation inc 675 mass ave cambridge ma 02139 usa extracted by the scancode license scanner the SPDX license identifier GPL-2.0-or-later has been chosen to replace the boilerplate/reference in 441 file(s). Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Michael Ellerman <[email protected]> (powerpc) Reviewed-by: Richard Fontana <[email protected]> Reviewed-by: Allison Randal <[email protected]> Reviewed-by: Kate Stewart <[email protected]> Cc: [email protected] Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-02-18hwmon: (lm80) Use permission specific SENSOR[_DEVICE]_ATTR variantsGuenter Roeck1-79/+59
Use SENSOR[_DEVICE]_ATTR[_2]_{RO,RW,WO} to simplify the source code, to improve readability, and to reduce the chance of inconsistencies. Also replace any remaining S_<PERMS> in the driver with octal values. The conversion was done automatically with coccinelle. The semantic patches and the scripts used to generate this commit log are available at https://github.com/groeck/coccinelle-patches/hwmon/. This patch does not introduce functional changes. It was verified by compiling the old and new files and comparing text and data sizes. Signed-off-by: Guenter Roeck <[email protected]>
2019-01-06hwmon: (lm80) Fix missing unlock on error in set_fan_div()Wei Yongjun1-1/+3
Add the missing unlock before return from function set_fan_div() in the error handling case. Fixes: c9c63915519b ("hwmon: (lm80) fix a missing check of the status of SMBus read") Signed-off-by: Wei Yongjun <[email protected]> Signed-off-by: Guenter Roeck <[email protected]>
2018-12-21hwmon: (lm80) fix a missing check of bus read in lm80 probeKangjie Lu1-2/+9
In lm80_probe(), if lm80_read_value() fails, it returns a negative error number which is stored to data->fan[f_min] and will be further used. We should avoid using the data if the read fails. The fix checks if lm80_read_value() fails, and if so, returns with the error number. Signed-off-by: Kangjie Lu <[email protected]> Signed-off-by: Guenter Roeck <[email protected]>
2018-12-21hwmon: (lm80) fix a missing check of the status of SMBus readKangjie Lu1-5/+10
If lm80_read_value() fails, it returns a negative number instead of the correct read data. Therefore, we should avoid using the data if it fails. The fix checks if lm80_read_value() fails, and if so, returns with the error number. Signed-off-by: Kangjie Lu <[email protected]> [groeck: One variable for return values is enough] Signed-off-by: Guenter Roeck <[email protected]>
2017-01-02hwmon: (lm80) use permission-specific DEVICE_ATTR variantsJulia Lawall1-2/+2
Use DEVICE_ATTR_RO for read-only attributes. This simplifies the source code, improves readbility, and reduces the chance of inconsistencies. The conversion was done automatically using coccinelle. It was validated by compiling both the old and the new source code and comparing its text, data, and bss size. Signed-off-by: Julia Lawall <[email protected]> [groeck: Updated description] Signed-off-by: Guenter Roeck <[email protected]>
2014-05-21hwmon: (lm80) Rearrange code to avoid forward declarationsGuenter Roeck1-151/+139
Avoid need for forward declarations by rearranging code. No functional change. Signed-off-by: Guenter Roeck <[email protected]>
2014-05-21hwmon: (lm80) Convert fan display function macros into functionsGuenter Roeck1-34/+41
Convert fan display function macros into functions to reduce code size and improve code readability. Code size reduction is about 200 bytes on x86_64. Signed-off-by: Guenter Roeck <[email protected]>
2014-05-21hwmon: (lm80) Convert voltage display function macros into functionsGuenter Roeck1-72/+76
Convert voltage display function macros into functions to reduce code size and improve code readability. Code size reduction is about 600 bytes on x86_64. Signed-off-by: Guenter Roeck <[email protected]>
2014-05-21hwmon: (lm80) Convert temperature display function macros into functionsGuenter Roeck1-75/+59
Convert temperature display function macros into functions to reduce code size and improve code readability. Code size reduction is about 2k on x86_64. Signed-off-by: Guenter Roeck <[email protected]>
2014-05-21hwmon: (lm80) Normalize all temperature values to 16 bitGuenter Roeck1-18/+14
Normalize all stored temperature values to 16 bit to simplify temperature calculations. Signed-off-by: Guenter Roeck <[email protected]>
2014-05-21hwmon: (lm80) Simplify TEMP_FROM_REGGuenter Roeck1-14/+3
TEMP_FROM_REG gets 12 bits of temperature data in the upper 12 bit of a signed 16 bit parameter, with the integer part (including sign) in the upper 8 bit and the remainder in bit 4..7. The lower 4 bit of the 16 bit data is always 0. We can use that information to convert the temperature directly into display data (1/1000th of degree C). Note that the stored temperature data is not shifted right as the comment claimed, so remove that misleading comment. Signed-off-by: Guenter Roeck <[email protected]>
2014-04-04hwmon: (lm80) Convert to use devm_hwmon_device_register_with_groupsGuenter Roeck1-48/+22
Simplify code, reduce code size, and attach hwmon attributes to hwmon device. Signed-off-by: Guenter Roeck <[email protected]> Signed-off-by: Jean Delvare <[email protected]>
2013-04-07hwmon: Fix checkpatch warning 'quoted string split across lines'Guenter Roeck1-2/+3
Cc: Corentin Labbe <[email protected]> Cc: Mark M. Hoffman <[email protected]> Cc: Fenghua Yu <[email protected]> Cc: Juerg Haefliger <[email protected]> Cc: Andreas Herrmann <[email protected]> Cc: Rudolf Marek <[email protected]> Cc: Jim Cromie <[email protected]> Cc: Roger Lucas <[email protected]> Cc: Marc Hulsman <[email protected]> Signed-off-by: Guenter Roeck <[email protected]>
2013-01-25hwmon: Replace SENSORS_LIMIT with clamp_valGuenter Roeck1-4/+4
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 <[email protected]> Acked-by: George Joseph <[email protected]> Acked-by: Jean Delvare <[email protected]>
2012-07-21hwmon: (lm80) Convert to use devm_ functionsGuenter Roeck1-10/+4
Convert to use devm_ functions to reduce code size and simplify the code. Signed-off-by: Guenter Roeck <[email protected]> Acked-by: Jean Delvare <[email protected]>
2012-03-18hwmon: (lm80) Add detection of NatSemi/TI LM96080Jean Delvare1-9/+35
Add detection of the National Semiconductor (now Texas Instruments) LM96080. It is functionally compatible with the LM80 but detection is completely different. Signed-off-by: Jean Delvare <[email protected]> Cc: Guenter Roeck <[email protected]> Cc: Frans Meulenbroeks <[email protected]> Signed-off-by: Guenter Roeck <[email protected]>
2012-03-18hwmon: (lm80) Fix multi-line commentsGuenter Roeck1-13/+19
Signed-off-by: Guenter Roeck <[email protected]> Acked-by: Jean Delvare <[email protected]>
2012-03-18hwmon: convert drivers/hwmon/* to use module_i2c_driver()Axel Lin1-12/+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 <[email protected]> Cc: Corentin Labbe <[email protected]> Cc: Dirk Eibach <[email protected]> Cc: "Mark M. Hoffman" <[email protected]> Cc: Steve Glendinning <[email protected]> Cc: Riku Voipio <[email protected]> Cc: Guillaume Ligneul <[email protected]> Cc: David George <[email protected]> Cc: "Hans J. Koch" <[email protected]> Cc: Marc Hulsman <[email protected]> Cc: Rudolf Marek <[email protected]> Signed-off-by: Guenter Roeck <[email protected]>
2012-03-18hwmon: (lm80) reset device if error occurredFrans Meulenbroeks1-0/+6
If an error occurs while updating (e.g. because the chip was disconnected) the device needs to be reinitialized in order to get back to 11 bit temperature and set the fan divider. Signed-off-by: Frans Meulenbroeks <[email protected]> Signed-off-by: Guenter Roeck <[email protected]>
2012-03-18hwmon: (lm80) fix checkpatch warningsFrans Meulenbroeks1-4/+16
fix: WARNING: simple_strtol is obsolete, use kstrtol instead WARNING: simple_strtoul is obsolete, use kstrtoul instead Signed-off-by: Frans Meulenbroeks <[email protected]> [[email protected]: kstrtol->kstrtoul where appropriate] Signed-off-by: Guenter Roeck <[email protected]>
2012-03-18hwmon: (lm80) add error handlingFrans Meulenbroeks1-31/+101
The LM80 driver currently does not return errors after I2C access failures. Add it. Signed-off-by: Frans Meulenbroeks <[email protected]> Signed-off-by: Guenter Roeck <[email protected]>
2012-01-05hwmon: (lm80) fix checkpatch messagesFrans Meulenbroeks1-28/+42
Fixed all checkpatch messages except simple_strto* -> kstr* This will be addressed in a separate patch Also left one line-too-long message as it was only a little bit too long and would become less readable compile-tested: no warnings or errors Signed-off-by: Frans Meulenbroeks <[email protected]> Signed-off-by: Guenter Roeck <[email protected]>
2009-12-14i2c: Drop I2C_CLIENT_INSMOD_1Jean Delvare1-4/+1
This macro simply declares an enum, so drivers might as well declare it themselves. Signed-off-by: Jean Delvare <[email protected]> Tested-by: Wolfram Sang <[email protected]>
2009-12-14i2c: Get rid of struct i2c_client_address_dataJean Delvare1-1/+1
Struct i2c_client_address_data only contains one field at this point, which makes its usefulness questionable. Get rid of it and pass simple address lists around instead. Signed-off-by: Jean Delvare <[email protected]> Tested-by: Wolfram Sang <[email protected]>
2009-12-14i2c: Drop the kind parameter from detect callbacksJean Delvare1-4/+2
The "kind" parameter always has value -1, and nobody is using it any longer, so we can remove it. Signed-off-by: Jean Delvare <[email protected]> Tested-by: Wolfram Sang <[email protected]>
2008-07-16hwmon: (lm80) Convert to a new-style i2c driverJean Delvare1-51/+43
The new-style lm80 driver implements the optional detect() callback to cover the use cases of the legacy driver. Signed-off-by: Jean Delvare <[email protected]>
2008-02-18hwmon: normal_i2c arrays should be constMark M. Hoffman1-2/+2
Signed-off-by: Mark M. Hoffman <[email protected]>
2008-02-07hwmon: (lm80) Add individual alarm filesJean Delvare1-1/+30
The new libsensors needs these individual alarm files. Signed-off-by: Jean Delvare <[email protected]> Signed-off-by: Mark M. Hoffman <[email protected]>
2008-02-07hwmon: (lm80) De-macro the sysfs callbacksJean Delvare1-135/+112
Use standard dynamic sysfs callbacks instead of macro-generated functions. This makes the code more readable, and the binary smaller (by about 34%). As a side note, another benefit of this type of cleanup is that they shrink the build time. For example, this cleanup saves about 29% of the lm80 driver build time. Signed-off-by: Jean Delvare <[email protected]> Signed-off-by: Mark M. Hoffman <[email protected]>
2008-02-07hwmon: (lm80) Various cleanupsJean Delvare1-25/+24
* Drop trailing whitespace * Fold a long line * Rename new_client to client * Drop redundant initializations to 0 * Drop bogus comment Signed-off-by: Jean Delvare <[email protected]> Signed-off-by: Mark M. Hoffman <[email protected]>
2008-02-07hwmon: Discard useless I2C driver IDsJean Delvare1-1/+0
Many I2C hwmon drivers define a driver ID but no other code references these, meaning that they are useless. Discard them, along with a few IDs which are defined but never used at all. Signed-off-by: Jean Delvare <[email protected]> Signed-off-by: Mark M. Hoffman <[email protected]>
2007-10-09hwmon: Convert from class_device to deviceTony Jones1-5/+5
Convert from class_device to device for hwmon_device_register/unregister Signed-off-by: Tony Jones <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Kay Sievers <[email protected]> Signed-off-by: Mark M. Hoffman <[email protected]>
2006-09-28hwmon: Fix unchecked return status, batch 2Mark M. Hoffman1-36/+49
hwmon: Fix unchecked return status, batch 2 Fix up some hwmon drivers so that they no longer ignore return status from device_create_file(). Signed-off-by: Mark M. Hoffman <[email protected]> Signed-off-by: Jean Delvare <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2006-06-26spelling fixesAndreas Mohr1-1/+1
acquired (aquired) contiguous (contigious) successful (succesful, succesfull) surprise (suprise) whether (weather) some other misspellings Signed-off-by: Andreas Mohr <[email protected]> Signed-off-by: Adrian Bunk <[email protected]>
2006-03-23[PATCH] hwmon: Semaphore to mutex conversionsIngo Molnar1-13/+14
convert drivers/hwmon/*.c semaphore use to mutexes. the conversion was generated via scripts, and the result was validated automatically via a script as well. all affected hwmon drivers were build-tested. Signed-off-by: Ingo Molnar <[email protected]> Signed-off-by: Jean Delvare <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2006-01-05[PATCH] I2C: Remove .owner setting from i2c_driver as it's no longer neededGreg Kroah-Hartman1-1/+0
Now that i2c_add_driver() doesn't need the module owner to be set by hand, we can delete it from the drivers. This patch catches all of the drivers that I found in the current tree (if a driver sets the .owner by hand, it's not a problem, just not needed.) Signed-off-by: Greg Kroah-Hartman <[email protected]> Cc: Jean Delvare <[email protected]>
2006-01-05[PATCH] i2c: Drop i2c_driver.{owner,name}, 3 of 11Laurent Riffard1-2/+4
We should use the i2c_driver.driver's .name and .owner fields instead of the i2c_driver's ones. This patch updates the hwmon drivers. Signed-off-by: Laurent Riffard <[email protected]> Signed-off-by: Jean Delvare <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2006-01-05[PATCH] i2c: Drop i2c_driver.flags, 2 of 3Jean Delvare1-1/+0
Just about every i2c chip driver sets the I2C_DF_NOTIFY flag, so we can simply make it the default and drop the flag. If any driver really doesn't want to be notified when i2c adapters are added, that driver can simply omit to set .attach_adapter. This approach is also more robust as it prevents accidental NULL pointer dereferences. Signed-off-by: Jean Delvare <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2005-10-28[PATCH] hwmon: Static function fixes, 3 of 4Ben Dooks1-1/+1
Fixup functions that have been declared static and then actually defined without the static on. Signed-off-by: Ben Dooks <[email protected]> Signed-off-by: Jean Delvare <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2005-10-28[PATCH] hwmon: kzalloc conversionDeepak Saxena1-2/+1
Use kzalloc instead of kmalloc+memset in all hardware monitoring drivers. Signed-off-by: Deepak Saxena <[email protected]> Signed-off-by: Jean Delvare <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2005-09-05[PATCH] hwmon: hwmon vs i2c, second round (06/11)Jean Delvare1-2/+1
The only thing left in i2c-sensor.h are module parameter definition macros. It's only an extension of what i2c.h offers, and this extension is not sensors-specific. As a matter of fact, a few non-sensors drivers use them. So we better merge them in i2c.h, and get rid of i2c-sensor.h altogether. Signed-off-by: Jean Delvare <khali@linux-fr> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2005-09-05[PATCH] hwmon: hwmon vs i2c, second round (04/11)Jean Delvare1-1/+1
i2c_probe and i2c_detect now do the exact same thing and operate on the same data structure, so we can have everyone call i2c_probe. Signed-off-by: Jean Delvare <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2005-09-05[PATCH] I2C: refactor message in i2c_detach_clientJean Delvare1-4/+1
We could refactor the error message 34 different i2c drivers print if i2c_detach_client() fails in this function itself. Saves quite a few lines of code. Documentation is updated to reflect that change. Note that this patch should be applied after Rudolf Marek's w83792d patches. Signed-off-by: Jean Delvare <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2005-09-05[PATCH] I2C: Separate non-i2c hwmon drivers from i2c-core (7/9)Jean Delvare1-1/+0
Kill normal_isa in header files, documentation and all chip drivers, as it is no more used. normal_i2c could be renamed to normal, but I decided not to do so at the moment, so as to limit the number of changes. This might be done later as part of the i2c_probe/i2c_detect merge. Signed-off-by: Greg Kroah-Hartman <[email protected]>
2005-09-05[PATCH] I2C hwmon: add hwmon sysfs class to driversMark M. Hoffman1-1/+15
This patch modifies sensors chip drivers to make use of the new sysfs class "hwmon". Signed-off-by: Mark M. Hoffman <[email protected]> Signed-off-by: Jean Delvare <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2005-07-11[PATCH] I2C: Move hwmon drivers (2/3)Jean Delvare1-0/+601
Part 2: Move the driver files themselves. Note that the patch "adds trailing whitespace", because it does move the files as-is, and some files happen to have trailing whitespace. From: Jean Delvare <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>