1
0
Fork 0
Commit Graph

37 Commits (74ba9207e1adf1966c57450340534ae9742d00af)

Author SHA1 Message Date
Thomas Gleixner 74ba9207e1 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 61
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 <tglx@linutronix.de>
Reviewed-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)
Reviewed-by: Richard Fontana <rfontana@redhat.com>
Reviewed-by: Allison Randal <allison@lohutok.net>
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190520071858.739733335@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-24 17:36:45 +02:00
Guenter Roeck 8f3bcb360a hwmon: (gl518sm) Use permission specific SENSOR[_DEVICE]_ATTR variants
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>
2019-02-18 14:23:29 -08:00
Guenter Roeck f80e868cb9 hwmon: (gl518sm) Fix overflows seen when writing into limit attributes
Writes into limit attributes can overflow due to additions and
multiplications with unchecked parameters.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2017-01-10 08:58:36 -08:00
Axel Lin 18faf5b9be hwmon: (gl518sm) Convert to devm_hwmon_device_register_with_groups
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-08-04 07:01:36 -07:00
Axel Lin d4a972a339 hwmon: (gl518sm) Avoid forward declaration
Reorder functions to avoid forward declaration.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-08-04 07:01:36 -07:00
Jean Delvare 7c81c60f37 Update Jean Delvare's e-mail address
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2014-01-29 20:40:08 +01:00
Guenter Roeck b55f375725 hwmon: Fix checkpatch warning 'quoted string split across lines'
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-04-07 21:16:40 -07:00
Guenter Roeck 2a844c148e hwmon: Replace SENSORS_LIMIT with clamp_val
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>
2013-01-25 21:03:54 -08:00
Guenter Roeck bba636d059 hwmon: (gl518sm) Convert to use devm_ functions
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-07-21 21:48:39 -07:00
Guenter Roeck 228f8e0c60 hwmon: (gl518sm) Fix checkpatch issues
Fixed:
ERROR: do not use assignment in if condition
ERROR: space required after that ',' (ctx:VxV)
ERROR: spaces required around that '?' (ctx:VxE)
ERROR: spaces required around that '<' (ctx:VxV)
ERROR: spaces required around 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
WARNING: line over 80 characters
WARNING: simple_strtol is obsolete, use kstrtol instead
WARNING: simple_strtoul is obsolete, use kstrtoul instead

Modify multi-line comments to follow Documentation/CodingStyle.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2012-03-18 18:27:22 -07:00
Axel Lin f0967eea80 hwmon: convert drivers/hwmon/* to use module_i2c_driver()
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-03-18 18:26:50 -07:00
Jean Delvare 90f4102ce5 hwmon: Use i2c_smbus_{read,write}_word_swapped
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>
2011-11-04 12:00:47 +01:00
Jean Delvare e5e9f44c24 i2c: Drop I2C_CLIENT_INSMOD_2 to 8
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-14 21:17:27 +01:00
Jean Delvare c3813d6af1 i2c: Get rid of struct i2c_client_address_data
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-14 21:17:25 +01:00
Jean Delvare 310ec79210 i2c: Drop the kind parameter from detect callbacks
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-14 21:17:23 +01:00
Jean Delvare 52df6440a2 hwmon: Clean up detect functions
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-12-09 20:35:57 +01:00
Jean Delvare 95d80e7c83 hwmon: (gl518sm) Convert to a new-style i2c driver
The new-style gl518sm 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-07-16 19:30:13 +02:00
Mark M. Hoffman 25e9c86d5a hwmon: normal_i2c arrays should be const
Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
2008-02-18 21:58:15 -05:00
Jean Delvare 72240307e9 hwmon: (gl518sm) Fix the reported fan speed
The fan speeds reported by the gl518sm driver are twice as much as they
should. It's currently reporting the number of pulses per minute, not
rotations per minute, while typical fans emit two pulses per rotation.
This explains why all reports with this driver had very high speed
values (between 9000 to 12000 RPM). Odd that nobody ever actually
complained about this bug.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
2008-02-07 20:39:41 -05:00
Jean Delvare 21df67b191 hwmon: (gl518sm) Report error on invalid fan div value
If the user attempts to write a fan clock divider not supported by
the chip, an error should be returned.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
2008-02-07 20:39:41 -05:00
Jean Delvare da6848da29 hwmon: (gl518sm) Add individual alarm and beep files
The new libsensors needs these.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
2008-02-07 20:39:41 -05:00
Jean Delvare 28292e79dc hwmon: (gl518sm) Refactor fan functions
This makes the code more readable and the binary smaller (by 5% or so).

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
2008-02-07 20:39:41 -05:00
Jean Delvare 5314f5c1ab hwmon: (gl518sm) Don't create sysfs files for missing features
The early revisions of the GL518SM do not report voltage values for
the first 3 voltage channels. We should not create sysfs attributes
for these missing features.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
2008-02-07 20:39:41 -05:00
Jean Delvare a5955ed274 hwmon: (gl518sm) Various cleanups
* Drop history, it doesn't belong there
* Drop unused struct member
* Drop bogus struct member comment
* Drop unused driver ID
* Rename new_client to client
* Drop redundant initializations to 0
* Drop useless cast
* Drop trailing space
* Fix comment
* Drop duplicate comment

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
2008-02-07 20:39:41 -05:00
Tony Jones 1beeffe433 hwmon: Convert from class_device to device
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-10-09 22:56:30 -04:00
Jean Delvare 87808be4f9 Fix unchecked return status, batch 5
hwmon: Fix unchecked return status, batch 5

Fix up some hwmon drivers so that they no longer ignore return status
from device_create_file().

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-09-28 15:31:18 -07:00
Ingo Molnar 9a61bf6300 [PATCH] hwmon: Semaphore to mutex conversions
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-03-23 14:21:52 -08:00
Greg Kroah-Hartman 2b48716d1d [PATCH] I2C: Remove .owner setting from i2c_driver as it's no longer needed
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-05 22:16:25 -08:00
Laurent Riffard cdaf79349c [PATCH] i2c: Drop i2c_driver.{owner,name}, 3 of 11
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-05 22:16:23 -08:00
Jean Delvare 8a9947552d [PATCH] i2c: Drop i2c_driver.flags, 2 of 3
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>
2006-01-05 22:16:21 -08:00
Deepak Saxena ba9c2e8d15 [PATCH] hwmon: kzalloc conversion
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>
2005-10-28 14:02:12 -07:00
Jean Delvare f4b5026120 [PATCH] hwmon: hwmon vs i2c, second round (06/11)
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>
2005-09-05 09:14:21 -07:00
Jean Delvare 2ed2dc3c11 [PATCH] hwmon: hwmon vs i2c, second round (04/11)
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>
2005-09-05 09:14:20 -07:00
Jean Delvare 7bef559455 [PATCH] I2C: refactor message in i2c_detach_client
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>
2005-09-05 09:14:14 -07:00
Jean Delvare 5071860aba [PATCH] I2C: Separate non-i2c hwmon drivers from i2c-core (7/9)
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>
2005-09-05 09:14:12 -07:00
Mark M. Hoffman 943b0830ce [PATCH] I2C hwmon: add hwmon sysfs class to drivers
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>
2005-09-05 09:14:08 -07:00
Jean Delvare 8d5d45fb14 [PATCH] I2C: Move hwmon drivers (2/3)
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>
2005-07-11 14:42:50 -07:00