summaryrefslogtreecommitdiff
path: root/drivers/hwmon/lm78.c
AgeCommit message (Collapse)Author
2014-10-20hwmon: drop owner assignment from platform_driversWolfram Sang
A platform_driver does not need to set an owner, it will be populated by the driver core. Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2014-08-04hwmon: (lm78) Convert to devm_hwmon_device_register_with_groupsAxel Lin
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-07-31hwmon: (lm78) Fix overflow problems seen when writing large temperature limitsGuenter Roeck
On platforms with sizeof(int) < sizeof(long), writing a temperature limit larger than MAXINT will result in unpredictable limit values written to the chip. Avoid auto-conversion from long to int to fix the problem. Cc: Axel Lin <axel.lin@ingics.com> Cc: stable@vger.kernel.org Reviewed-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 Delvare
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2013-12-12hwmon: Prevent some divide by zeros in FAN_TO_REG()Dan Carpenter
The "rpm * div" operations can overflow here, so this patch adds an upper limit to rpm to prevent that. Jean Delvare helped me with this patch. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Roger Lucas <vt8231@hiddenengine.co.uk> Cc: stable@vger.kernel.org Signed-off-by: Jean Delvare <khali@linux-fr.org>
2013-04-08hwmon: Fix checkpatch warning 'quoted string split across lines'Guenter Roeck
Cc: Corentin Labbe <corentin.labbe@geomatys.fr> Cc: Mark M. Hoffman <mhoffman@lightlink.com> Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: Juerg Haefliger <juergh@gmail.com> Cc: Andreas Herrmann <herrmann.der.user@googlemail.com> Cc: Rudolf Marek <r.marek@assembler.cz> Cc: Jim Cromie <jim.cromie@gmail.com> Cc: Roger Lucas <vt8231@hiddenengine.co.uk> Cc: Marc Hulsman <m.hulsman@tudelft.nl> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-01-26hwmon: Replace SENSORS_LIMIT with clamp_valGuenter Roeck
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-11-28hwmon: remove use of __devexitBill Pemberton
CONFIG_HOTPLUG is going away as an option so __devexit is no longer needed. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Cc: Hans de Goede <hdegoede@redhat.com> Cc: Jean Delvare <khali@linux-fr.org> Cc: Alistair John Strachan <alistair@devzero.co.uk> Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: Juerg Haefliger <juergh@gmail.com> Cc: Andreas Herrmann <herrmann.der.user@googlemail.com> Cc: Clemens Ladisch <clemens@ladisch.de> Cc: Rudolf Marek <r.marek@assembler.cz> Cc: Jim Cromie <jim.cromie@gmail.com> Cc: "Mark M. Hoffman" <mhoffman@lightlink.com> Cc: Roger Lucas <vt8231@hiddenengine.co.uk> Acked-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-28hwmon: remove use of __devinitBill Pemberton
CONFIG_HOTPLUG is going away as an option so __devinit is no longer needed. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Cc: Hans de Goede <hdegoede@redhat.com> Cc: Jean Delvare <khali@linux-fr.org> Cc: Alistair John Strachan <alistair@devzero.co.uk> Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: Juerg Haefliger <juergh@gmail.com> Cc: Andreas Herrmann <herrmann.der.user@googlemail.com> Cc: Clemens Ladisch <clemens@ladisch.de> Cc: Rudolf Marek <r.marek@assembler.cz> Cc: Jim Cromie <jim.cromie@gmail.com> Cc: "Mark M. Hoffman" <mhoffman@lightlink.com> Cc: Roger Lucas <vt8231@hiddenengine.co.uk> Acked-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-28hwmon: remove use of __devexit_pBill Pemberton
CONFIG_HOTPLUG is going away as an option so __devexit_p is no longer needed. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Cc: Hans de Goede <hdegoede@redhat.com> Cc: Jean Delvare <khali@linux-fr.org> Cc: Alistair John Strachan <alistair@devzero.co.uk> Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: Juerg Haefliger <juergh@gmail.com> Cc: Andreas Herrmann <herrmann.der.user@googlemail.com> Cc: Clemens Ladisch <clemens@ladisch.de> Cc: Rudolf Marek <r.marek@assembler.cz> Cc: Jim Cromie <jim.cromie@gmail.com> Cc: "Mark M. Hoffman" <mhoffman@lightlink.com> Cc: Roger Lucas <vt8231@hiddenengine.co.uk> Acked-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-22hwmon: (lm78) Convert to use devm_ functionsGuenter Roeck
Convert to use devm_ functions to reduce code size and simplify the code. Cc: Jean Delvare <khali@linux-fr.org> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Jean Delvare <khali@linux-fr.org>
2012-03-19hwmon: (lm78) Fix checkpatch issuesGuenter Roeck
Fixed: ERROR: code indent should use tabs where possible ERROR: do not use assignment in if condition ERROR: space prohibited before that close parenthesis ')' ERROR: space required after that ',' (ctx:VxV) ERROR: spaces required around that '<' (ctx:VxV) ERROR: spaces required around that '==' (ctx:VxV) ERROR: trailing statements should be on next line ERROR: trailing whitespace WARNING: simple_strtol is obsolete, use kstrtol instead WARNING: simple_strtoul is obsolete, use kstrtoul instead Modify multi-line comments to follow Documentation/CodingStyle. Not fixed (false positive): ERROR: Macros with multiple statements should be enclosed in a do - while loop Cc: Jean Delvare <khali@linux-fr.org> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Jean Delvare <khali@linux-fr.org>
2011-07-25hwmon: (lm78) Become the maintainerJean Delvare
Declare myself the maintainer of the lm78 driver. I still have a running system with one of these chips. Also count myself as a co-author of the driver. With 34 commits over 6 years, it seems fair. Signed-off-by: Jean Delvare <khali@linux-fr.org>
2011-07-25hwmon: (lm78) Make ISA interface depend on CONFIG_ISAJean Delvare
We should only include support for the ISA interface of the LM78/LM79 if CONFIG_ISA is set. Not only this makes the driver somewhat smaller on most architectures, but this also avoids poking at random I/O ports on these architectures. This is very similiar to what was done for the w83781d driver in October 2008. Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: Dean Nelson <dnelson@redhat.com>
2011-07-25hwmon: (lm78) Avoid forward declarationsJean Delvare
Move code around to avoid several forward declarations. Also group ISA-related functions together, to make future changes easier. Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: Dean Nelson <dnelson@redhat.com>
2011-01-12hwmon: (lm78) Use pr_fmt and pr_<level>Joe Perches
Added #define pr_fmt KBUILD_MODNAME ": " fmt Converted printks to pr_<level> Coalesced any long formats Removed prefixes from formats Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-02-05hwmon: (lm78) Request I/O ports individually for probingJean Delvare
Different motherboards have different PNP declarations for LM78/LM79 chips. Some declare the whole range of I/O ports (8 ports), some declare only the useful ports (2 ports at offset 5) and some declare fancy ranges, for example 4 ports at offset 4. To properly handle all cases, request all ports individually for probing. After we have determined that we really have an LM78 or LM79 chip, the useful port range will be requested again, as a single block. This fixes the driver on the Olivetti M3000 DT 540, at least. Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: stable@kernel.org
2009-12-14i2c: Drop I2C_CLIENT_INSMOD_2 to 8Jean Delvare
These macros simply declare an enum, so drivers might as well declare it themselves. This puts an end to the arbitrary limit of 8 chip types per i2c driver. Signed-off-by: Jean Delvare <khali@linux-fr.org> Tested-by: Wolfram Sang <w.sang@pengutronix.de>
2009-12-14i2c: Get rid of struct i2c_client_address_dataJean Delvare
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 <khali@linux-fr.org> Tested-by: Wolfram Sang <w.sang@pengutronix.de>
2009-12-14i2c: Drop the kind parameter from detect callbacksJean Delvare
The "kind" parameter always has value -1, and nobody is using it any longer, so we can remove it. Signed-off-by: Jean Delvare <khali@linux-fr.org> Tested-by: Wolfram Sang <w.sang@pengutronix.de>
2009-12-09hwmon: Clean up detect functionsJean Delvare
As kind is now hard-coded to -1, there is room for code clean-ups. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Corentin Labbe <corentin.labbe@geomatys.fr> Cc: "Mark M. Hoffman" <mhoffman@lightlink.com> Cc: Juerg Haefliger <juergh@gmail.com> Cc: Riku Voipio <riku.voipio@iki.fi> Acked-by: "Hans J. Koch" <hjk@linutronix.de> Cc: Rudolf Marek <r.marek@assembler.cz>
2009-09-15hwmon: Include <linux/io.h> instead of <asm/io.h>H Hartley Sweeten
Drivers should be including <linux/io.h> instead of <asm/io.h>. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Alistair John Strachan <alistair@devzero.co.uk> Cc: Nicolas Boichat <nicolas@boichat.ch> Cc: Juerg Haefliger <juergh@gmail.com> Cc: Frank Seidel <frank@f-seidel.de> Acked-by: Jim Cromie <jim.cromie@gmail.com> Cc: "Mark M. Hoffman" <mhoffman@lightlink.com> Cc: Roger Lucas <vt8231@hiddenengine.co.uk> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-06-01hwmon: (lm78) Add missing __devexit_p()Mike Frysinger
The remove function uses __devexit, so the .remove assignment needs __devexit_p() to fix a build error with hotplug disabled. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2008-10-17hwmon: (lm78) Convert to a new-style i2c driverJean Delvare
The new-style lm78 driver implements the optional detect() callback to cover the use cases of the legacy driver. Signed-off-by: Jean Delvare <khali@linux-fr.org>
2008-10-17hwmon: (lm78) Stop abusing struct i2c_client for ISA devicesJean Delvare
Upcoming changes to the I2C part of the lm78 driver will cause ISA devices to no longer have a struct i2c_client at hand. So, we must stop (ab)using it now. Signed-off-by: Jean Delvare <khali@linux-fr.org>
2008-10-17hwmon: (lm78) Prevent misdetection of Winbond chipsJean Delvare
The LM78 detection is relatively weak, and sometimes recent Winbond chips can be misdetected as an LM78. We have had repeated reports of this happening. We have an explicit check against this for the ISA access, do the same for I2C access now. Signed-off-by: Jean Delvare <khali@linux-fr.org>
2008-10-17hwmon: (lm78) Detect alias chipsJean Delvare
The LM78 and LM79 can be accessed either on the I2C bus or the ISA bus. We must not access the same chip through both interfaces. So far we were relying on the user passing the correct ignore parameter to skip the registration of the I2C interface as suggested by sensors-detect, but this is fragile: the user may load the lm78 driver without running sensors-detect, and the i2c bus numbers are not stable across reboots and hardware changes. So, better detect alias chips in the driver directly, and skip any I2C chip which is obviously an alias of the ISA chip. This is done by comparing the value of 26 selected registers. Signed-off-by: Jean Delvare <khali@linux-fr.org>
2008-10-17hwmon: (lm78) Fix I/O resource conflict with PNPJean Delvare
Only request I/O ports 0x295-0x296 instead of the full I/O address range. This solves a conflict with PNP resources on a few motherboards. Also request the I/O ports in two parts (4 low ports, 4 high ports) during device detection, otherwise the PNP resource make the request (and thus the detection) fail. This is the exact same fix that was applied to driver w83781d in March 2008 to address the same problem: http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2961cb22ef02850d90e7a12c28a14d74e327df8d Signed-off-by: Jean Delvare <khali@linux-fr.org>
2008-02-19hwmon: normal_i2c arrays should be constMark M. Hoffman
Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
2008-02-08hwmon: Discard useless I2C driver IDsJean Delvare
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 <khali@linux-fr.org> Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
2008-02-08hwmon: (lm78/w83781d) Probe fewer I2C addressesJean Delvare
We've never seen any device supported by the lm78 or w83781d driver at addresses 0x20-0x27, so let's stop probing these addresses. Extra probes cost time, and have potential for confusing or misdetecting other I2C devices. Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
2007-10-10hwmon: (lm78) Add individual alarm filesJean Delvare
Add individual alarm files to the lm78 driver, these are needed by the next version of libsensors. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Hans de Goede <j.w.r.degoede@hhs.nl> Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
2007-10-10hwmon: Convert from class_device to deviceTony Jones
Convert from class_device to device for hwmon_device_register/unregister Signed-off-by: Tony Jones <tonyj@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
2007-09-09hwmon: End of I/O region off-by-oneJean Delvare
Fix an off-by-one error in the I/O region declaration of two hardware monitoring drivers (lm78 and w83781d.) We were requesting one extra port at the end of the region. Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
2007-07-31hwmon: fix lm78 detection regressionHans de Goede
Here is a small but important bugfix to the lm78 driver. I found out about this problem because a Fedora user filed a bug that the lm78 driver no longer worked on his system: https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=249428 The problem is that sometime ago the isa lm78 detection was made more stringent and this new code now checks the chip-id, but does not accept a chip-id of 20h, however a chip-id of 20h is valid, and is excepted in the main probe function of the driver, see line 551. This fixed also makes the isa detection code accept the chip-id of 0x20 fixing this issue. Signed-off-by: Hans de Goede <j.w.r.degoede@hhs.nl> Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
2007-05-08hwmon/lm78: Use dynamic sysfs callbacksJean Delvare
This lets us get rid of macro-generated functions and shrinks the driver size significantly (about 10%). Signed-off-by: Jean Delvare <khali@linux-fr.org>
2007-05-08hwmon/lm78: Be less i2c_client-centricJean Delvare
Use the driver data structure as the main device reference, instead of the i2c client. It makes the driver a bit smaller, and makes more sense as this is an hybrid driver, supporting both I2C and ISA devices. Signed-off-by: Jean Delvare <khali@linux-fr.org>
2007-05-08hwmon/lm78: No longer use i2c-isaJean Delvare
Reimplement the ISA device support as a platform driver, so that we no longer rely on i2c-isa. Signed-off-by: Jean Delvare <khali@linux-fr.org>
2007-02-14hwmon: Cleanup a bogus legacy commentJean Delvare
Cleanup a bogus legacy comment that has been replicated to many hardware monitoring drivers. Signed-off-by: Jean Delvare <khali@linux-fr.org>
2006-10-18hwmon: Let w83781d and lm78 load againJean Delvare
Let the w83781d and lm78 hardware monitoring drivers load even when no chip was detected at the ISA address. There can still be supported chips connected to an I2C bus or SMBus. This fixes bug #7293. Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-09-28hwmon: Fix unchecked return status, batch 1Mark M. Hoffman
hwmon: Fix unchecked return status, batch 1 Fix up some hwmon drivers so that they no longer ignore return status from device_create_file(). Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com> Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-09-26i2c-isa: Restore driver ownerJean Delvare
i2c-isa: Restore driver owner Commit 2b48716d1d2f2edb1e7cbc5ecf1cb2cb39373e33 back in January 2006 was a bit overzealous. It removed .owner from all i2c drivers, including i2c-isa ones, while they still need it. Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-06-26spelling fixesAndreas Mohr
acquired (aquired) contiguous (contigious) successful (succesful, succesfull) surprise (suprise) whether (weather) some other misspellings Signed-off-by: Andreas Mohr <andi@lisas.de> Signed-off-by: Adrian Bunk <bunk@stusta.de>
2006-03-23[PATCH] I2C: hwmon: Rename register parametersDarren Jenkins
"register" is a reserved keyword so using it as a parameter name can confuse some compilers, most notably ICC. The patch below just renames all occurences to reg which fits the actual function declarations. Signed-off-by: Darren Jenkins <darrenrjenkins@gmail.com> Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-03-23[PATCH] hwmon: Semaphore to mutex conversionsIngo Molnar
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 <mingo@elte.hu> Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-01-06[PATCH] I2C: Remove .owner setting from i2c_driver as it's no longer neededGreg Kroah-Hartman
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 <gregkh@suse.de> Cc: Jean Delvare <khali@linux-fr.org>
2006-01-06[PATCH] i2c: Drop i2c_driver.{owner,name}, 3 of 11Laurent Riffard
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 <laurent.riffard@free.fr> Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-01-06[PATCH] i2c: Drop i2c_driver.flags, 2 of 3Jean Delvare
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 <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-11-24[PATCH] hwmon: Fix lm78 VID conversionJean Delvare
Fix the lm78 VID reading, which I accidentally broke while making this driver use the common vid_from_reg function rather than reimplementing its own in 2.6.14-rc1. I'm not proud of it, trust me. Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-10-28[PATCH] hwmon: Static function fixes, 2 of 4Ben Dooks
lm78.c and lm85.c have a number of items declared static then implemented without the static on them. The following patch fixes these sparse errors. Signed-off-by: Ben Dooks <ben-linux@fluff.org> Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>