summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/lm92.c
Commit message (Collapse)AuthorAgeFilesLines
* hwmon: cleanup non-bool "valid" data fieldsPaul Fertser2021-10-121-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We have bool so use it consistently in all the drivers. The following Coccinelle script was used: @@ identifier T; type t = { char, int }; @@ struct T { ... - t valid; + bool valid; ... } @@ identifier v; @@ ( - v->valid = 0 + v->valid = false | - v->valid = 1 + v->valid = true ) followed by sed to fixup the comments: sed '/bool valid;/{s/!=0/true/;s/zero/false/}' Few whitespace changes were fixed manually. All modified drivers were compile-tested. Signed-off-by: Paul Fertser <fercerpav@gmail.com> Link: https://lore.kernel.org/r/20210924195202.27917-1-fercerpav@gmail.com [groeck: Fixed up 'u8 valid' to 'boool valid' in atxp1.c] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: use simple i2c probe functionStephen Kitt2020-09-231-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 <steve@sk2.org> Link: https://lore.kernel.org/r/20200813160222.1503401-1-steve@sk2.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157Thomas Gleixner2019-05-301-10/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Based on 3 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 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 [author] [kishon] [vijay] [abraham] [i] [kishon]@[ti] [com] 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 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 [author] [graeme] [gregory] [gg]@[slimlogic] [co] [uk] [author] [kishon] [vijay] [abraham] [i] [kishon]@[ti] [com] [based] [on] [twl6030]_[usb] [c] [author] [hema] [hk] [hemahk]@[ti] [com] 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 extracted by the scancode license scanner the SPDX license identifier GPL-2.0-or-later has been chosen to replace the boilerplate/reference in 1105 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Allison Randal <allison@lohutok.net> Reviewed-by: Richard Fontana <rfontana@redhat.com> Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190527070033.202006027@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* hwmon: (lm92) Use permission specific SENSOR[_DEVICE]_ATTR variantsGuenter Roeck2019-02-181-21/+18
| | | | | | | | | | | | | | | | 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 <linux@roeck-us.net>
* hwmon: (lm92) Fix whitespace issuesGuenter Roeck2018-10-101-6/+8
| | | | | | | | | | | Smatch complains: drivers/hwmon/lm92.c:209 set_temp_hyst() warn: inconsistent indenting While at it, fix various other whitespace issues reported by checkpatch (double empty lines, missing empty lines, whitespace at empty line). Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (lm92) Add max6635 to lm92_id[]Alvaro G. M2018-03-221-2/+3
| | | | | | | | | Since autodetection of this chip was removed, it makes sense to add prefix max6635 so that the device can be instantiated by its actual name. Signed-off-by: Alvaro Gamez Machado <alvaro.gamez@hazent.com> Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (lm92) Do not try to detect MAX6635Alvaro G. M2018-03-221-58/+0
| | | | | | | | | | | | Maxim MAX663x family are mostly compatible with LM92, but they lack any identification register. Weakening the detect function would make it prone to false positives, and current one doesn't detect all chips. Therefore, the detect function for max6635 devices is removed in favor of explicit device instatiation. Signed-off-by: Alvaro Gamez Machado <alvaro.gamez@hazent.com> Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (lm92) use permission-specific DEVICE_ATTR variantsJulia Lawall2017-01-021-5/+5
| | | | | | | | | | | | | 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 <Julia.Lawall@lip6.fr> [groeck: Update description] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (lm92) Prevent overflow problem when writing large limitsAxel Lin2014-08-051-7/+6
| | | | | | | | | | | | | | | | | | | | 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. The hysteresis temperature range depends on the value of data->temp[attr->index], since val is subtracted from it. Use a wider clamp, [-120000, 220000] should do to cover the possible range. Also add missing TEMP_TO_REG() on writes into cached hysteresis value. Also uses clamp_val to simplify the code a bit. Signed-off-by: Axel Lin <axel.lin@ingics.com> [Guenter Roeck: Fixed double TEMP_TO_REG on hysteresis updates] Cc: stable@vger.kernel.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (lm92) Convert to use devm_hwmon_device_register_with_groupsGuenter Roeck2014-05-211-41/+15
| | | | | | | | Use devm_hwmon_device_register_with_groups API to attach attributes to hwmon device, simplify code, and reduce code size. Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (lm92) Drop function macrosGuenter Roeck2014-05-211-83/+84
| | | | | | | Function macros obfuscate code and increase code size, so drop them. Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (lm92) Drop FSF mailing addressGuenter Roeck2014-05-211-4/+0
| | | | | | | The FSF mailing address may change, so drop it. Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (lm92) Drop unnecessary forward declarationGuenter Roeck2014-05-211-3/+0
| | | | | Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: Avoid initializing the same field twiceJean Delvare2014-04-041-1/+0
| | | | | | | | All hwmon drivers allocate their data structure with some form of kzalloc, so setting data fields to zero explicitly is a waste of time. Signed-off-by: Jean Delvare <jdelvare@suse.de> Reviewed-by: Guenter Roeck <linux@roeck-us.net>
* Update Jean Delvare's e-mail addressJean Delvare2014-01-291-2/+2
| | | | Signed-off-by: Jean Delvare <khali@linux-fr.org>
* hwmon: Add missing inclusions of <linux/jiffies.h>Jean Delvare2012-10-101-0/+1
| | | | | | | | | | | | Many hwmon drivers use jiffies but omit the inclusion of the header file. Fix that, and also fix one driver which was including the header file but didn't need it. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Luca Tettamanti <kronos.it@gmail.com> Cc: Marc Hulsman <m.hulsman@tudelft.nl> Cc: Rudolf Marek <r.marek@assembler.cz>
* hwmon: (lm92) Convert to use devm_ functionsGuenter Roeck2012-07-211-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>
* hwmon: (lm92) Fix checkpatch issuesGuenter Roeck2012-03-181-36/+62
| | | | | | | | | | | | | | | | | | | Fixed: ERROR: code indent should use tabs where possible ERROR: do not use assignment in if condition ERROR: spaces required around that '<' (ctx:VxV) ERROR: spaces required around that '=' (ctx:VxV) ERROR: spaces required around that '*=' (ctx:VxV) ERROR: trailing whitespace WARNING: line over 80 characters WARNING: please, no space before tabs WARNING: please, no spaces at the start of a line WARNING: simple_strtol is obsolete, use kstrtol instead Modify multi-line comments to follow Documentation/CodingStyle. Cc: Jean Delvare <khali@linux-fr.org> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: convert drivers/hwmon/* to use module_i2c_driver()Axel Lin2012-03-181-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 <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>
* hwmon: Use i2c_smbus_{read,write}_word_swappedJean Delvare2011-11-041-13/+13
| | | | | | | | | | | | | Make use of the new i2c_smbus_{read,write}_word_swapped functions. This makes the driver code more compact and readable. It also ensures proper error handling. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Jonathan Cameron <jic23@cam.ac.uk> Acked-by: Guenter Roeck <guenter.roeck@ericsson.com> Cc: Dirk Eibach <eibach@gdsys.de> Cc: "Mark M. Hoffman" <mhoffman@lightlink.com> Cc: Guillaume Ligneul <guillaume.ligneul@gmail.com>
* i2c: Drop I2C_CLIENT_INSMOD_1Jean Delvare2009-12-141-4/+1
| | | | | | | | This macro simply declares an enum, so drivers might as well declare it themselves. Signed-off-by: Jean Delvare <khali@linux-fr.org> Tested-by: Wolfram Sang <w.sang@pengutronix.de>
* i2c: Get rid of struct i2c_client_address_dataJean Delvare2009-12-141-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 <khali@linux-fr.org> Tested-by: Wolfram Sang <w.sang@pengutronix.de>
* i2c: Drop the kind parameter from detect callbacksJean Delvare2009-12-141-1/+1
| | | | | | | | 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>
* hwmon: Clean up detect functionsJean Delvare2009-12-091-20/+11
| | | | | | | | | | | | 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>
* hwmon: (lm92) Convert to a new-style i2c driverJean Delvare2008-07-161-58/+40
| | | | | | | The new-style lm92 driver implements the optional detect() callback to cover the use cases of the legacy driver. Signed-off-by: Jean Delvare <khali@linux-fr.org>
* hwmon: normal_i2c arrays should be constMark M. Hoffman2008-02-181-2/+2
| | | | Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
* hwmon: (lm92) Add individual alarm filesJean Delvare2008-02-171-1/+15
| | | | | | | | The new libsensors needs these individual alarm files. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Juerg Haefliger <juergh at gmail.com> Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
* hwmon: Discard useless I2C driver IDsJean Delvare2008-02-071-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 <khali@linux-fr.org> Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
* hwmon: Convert from class_device to deviceTony Jones2007-10-091-5/+5
| | | | | | | | | 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>
* hwmon: Fix unchecked return status, batch 2Mark M. Hoffman2006-09-281-10/+24
| | | | | | | | | | | | 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 <mhoffman@lightlink.com> Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] hwmon: Semaphore to mutex conversionsIngo Molnar2006-03-231-8/+9
| | | | | | | | | | | | | 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>
* [PATCH] I2C: Remove .owner setting from i2c_driver as it's no longer neededGreg Kroah-Hartman2006-01-051-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 <gregkh@suse.de> Cc: Jean Delvare <khali@linux-fr.org>
* [PATCH] i2c: Drop i2c_driver.{owner,name}, 3 of 11Laurent Riffard2006-01-051-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 <laurent.riffard@free.fr> Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] i2c: Drop i2c_driver.flags, 2 of 3Jean Delvare2006-01-051-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 <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] hwmon: kzalloc conversionDeepak Saxena2005-10-281-2/+1
| | | | | | | | | Use kzalloc instead of kmalloc+memset in all hardware monitoring drivers. Signed-off-by: Deepak Saxena <dsaxena@plexity.net> Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] hwmon: hwmon vs i2c, second round (06/11)Jean Delvare2005-09-051-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 <gregkh@suse.de>
* [PATCH] hwmon: hwmon vs i2c, second round (04/11)Jean Delvare2005-09-051-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 <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] I2C: refactor message in i2c_detach_clientJean Delvare2005-09-051-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 <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] I2C: Separate non-i2c hwmon drivers from i2c-core (7/9)Jean Delvare2005-09-051-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 <gregkh@suse.de>
* [PATCH] I2C hwmon: add hwmon sysfs class to driversMark M. Hoffman2005-09-051-2/+15
| | | | | | | | | This patch modifies sensors chip drivers to make use of the new sysfs class "hwmon". 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>
* [PATCH] I2C: Move hwmon drivers (2/3)Jean Delvare2005-07-111-0/+429
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 <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>