Commit Graph

2419 Commits

Author SHA1 Message Date
Axel Lin 30190c3c61 hwmon: (nct6683) Fix probe unwind paths to properly unregister platform devices
Call platform_device_unregister() rather than platform_device_put() to
unregister successfully registered platform devices.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-05-24 08:28:24 -07:00
Himangi Saraogi e8cba3cda4 hwmon: (ultra45_env) Introduce managed version of kzalloc
This patch moves data allocated using kzalloc to managed data allocated
using devm_kzalloc and cleans now unnecessary kfrees in probe and remove
functions. Also, the unnecessary label out_free is removed.

The following Coccinelle semantic patch was used for making the change:

@platform@
identifier p, probefn, removefn;
@@
struct platform_driver p = {
  .probe = probefn,
  .remove = removefn,
};

@prb@
identifier platform.probefn, pdev;
expression e, e1, e2;
@@
probefn(struct platform_device *pdev, ...) {
  <+...
- e = kzalloc(e1, e2)
+ e = devm_kzalloc(&pdev->dev, e1, e2)
  ...
?-kfree(e);
  ...+>
}

@rem depends on prb@
identifier platform.removefn;
expression e;
@@
removefn(...) {
  <...
- kfree(e);
  ...>
}

Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-05-21 16:02:27 -07:00
Guenter Roeck 41082d66bf hwmon: Driver for NCT6683D
Nuvoton NCT6683D is an eSIO with hardware monitoring capabilities.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-05-21 16:02:27 -07:00
Guenter Roeck c254ffdefc hwmon: (lm80) Rearrange code to avoid forward declarations
Avoid need for forward declarations by rearranging code.

No functional change.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-05-21 16:02:26 -07:00
Guenter Roeck 85b3ee07b9 hwmon: (lm80) Convert fan display function macros into functions
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 <linux@roeck-us.net>
2014-05-21 16:02:26 -07:00
Guenter Roeck 1adf3a3e1c hwmon: (lm80) Convert voltage display function macros into functions
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 <linux@roeck-us.net>
2014-05-21 16:02:26 -07:00
Guenter Roeck 9711bcddde hwmon: (lm80) Convert temperature display function macros into functions
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 <linux@roeck-us.net>
2014-05-21 16:02:26 -07:00
Guenter Roeck 688a3174a2 hwmon: (lm80) Normalize all temperature values to 16 bit
Normalize all stored temperature values to 16 bit to simplify
temperature calculations.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-05-21 16:02:26 -07:00
Guenter Roeck 9028ff8e3d hwmon: (lm80) Simplify TEMP_FROM_REG
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 <linux@roeck-us.net>
2014-05-21 16:02:26 -07:00
Guenter Roeck a0ac840d99 hwmon: (lm83) Convert to use devm_hwmon_device_register_with_groups
Use devm_hwmon_device_register_with_groups API to attach attributes
to hwmon device, simplify code, and reduce code size.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-05-21 16:02:26 -07:00
Guenter Roeck 41936370f1 hwmon: (lm83) Rearange code to avoid forward declarations
Avoid forward declarations by rearranging code.
No functional change.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-05-21 16:02:26 -07:00
Guenter Roeck 0968deb4c8 hwmon: (lm83) Drop FSF address
The FSF address changes over time, so drop it.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-05-21 16:02:25 -07:00
Guenter Roeck 9f1513bd55 hwmon: (max1619) Convert to use devm_hwmon_device_register_with_groups
Use devm_hwmon_device_register_with_groups API to attach attributes
to hwmon device, simplify code, and reduce code size.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-05-21 16:02:25 -07:00
Guenter Roeck f83111964e hwmon: (max1619) Drop function macros
Function macros make the code larger and difficult ro read.
Drop them and reduce code size (on x86_64) by ~1800 bytes.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-05-21 16:02:25 -07:00
Guenter Roeck 40089a9fe2 hwmon: (max1619) Rearrange code to avoid forward declarations
Forward declarations are unnecessary and easy to avoid, so rearrange
code and drop them.

No functional change.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-05-21 16:02:25 -07:00
Guenter Roeck b09489ecce hwmon: (max1619) Drop FSF address
The FSF address may chance over time, so drop it.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-05-21 16:02:25 -07:00
Guenter Roeck 628c6d27c0 hwmon: (max1619) Fix critical alarm display
The overtemperature status bit, which is used to display critical alarm status,
matches the output of the OVERT signal 1:1. If that signal is active-low, the
bit will read 1 if there is no alarm. It is therefore necessary to reverse
the bit in this case.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-05-21 16:02:25 -07:00
Guenter Roeck 175c490c9e hwmon: (jc42) Add support for STTS2004 and AT30TSE004
Also fix links to datasheets for other supported sensors from
ST Microelectronics, and add links to several Atmel datasheets.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-05-21 16:02:25 -07:00
Guenter Roeck 10192bc654 hwmon: (jc42) Convert function macros into functions
Convert function macros into functions to make the code
easier to read and reduce code size.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-05-21 16:02:25 -07:00
Guenter Roeck d397276b0c hwmon: (jc42) Rearrange code to avoid forward declarations
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-05-21 16:02:24 -07:00
Guenter Roeck 51585befb4 hwmon: (emc1403) Add device IDs for EMC1412, EMC1413, and EMC1414
EMC1412, EMC1413, and EMC1414 are fully compatible to EMC1402, EMC1403,
and EMC1404, and even report the same chip ID. Add to device ID table
to enable instantiation with correct chip names.

Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-05-21 16:02:24 -07:00
Guenter Roeck 54392ce444 hwmon: (emc1403) Add support for min_hyst attributes
The hysteresis value applies to all limits, so add support for
tempX_min_hyst.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-05-21 16:02:24 -07:00
Guenter Roeck a9a7400686 hwmon: (emc1403) Add support for max_hyst attributes
The hysteresis value applies to all limits, so add support for
tempX_max_hyst.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-05-21 16:02:24 -07:00
Guenter Roeck ceeaa70c0f hwmon: (emc1403) Relax hysteresis limit write checks
Writing the hysteresis limit returned -ERANGE if the written hysteresis
was too high or too low. Relax error check and adjust the hysteresis
value to its valid range.

Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-05-21 16:02:24 -07:00
Guenter Roeck 84899d394e hwmon: (emc1403) Make all hyst attributes except for temp1_crit_hyst read-only
All chips in this chip series only support a single hysteresis value. Having
multiple writable hysteresis attributes is therefore confusing, since a single
write affects all hysteresis temperatures. Make all but one (temp1_crit_hyst)
read-only.

Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-05-21 16:02:24 -07:00
Guenter Roeck 03f49f641a hwmon: (emc1403) Add support for alarm and diode fault status on EMC14x2
Alarm and fault status register on EMC1402, EMC1412, and EMC1422 is reported
in a different register than with other chips. Add support for it.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-05-21 16:02:24 -07:00
Guenter Roeck d8850c19b5 hwmon: (emc1403) Report external diode fault status
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-05-21 16:02:24 -07:00
Guenter Roeck 4cab259f86 hwmon: (emc1403) Convert to use regmap
Convert to regmap to be able to use its register caching mechanism.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-05-21 16:02:23 -07:00
Josef Gajdusek be7f5c4d48 hwmon: (emc1403) Add support for emc14x2
Add support for emc1402/emc1412/emc1422 temperature monitoring chips.
This line of sensors only has 2 temperature channels (internal and external)
in comparison to the emc14x3 (3 channels) and emc14x4 (4 channels).

Signed-off-by: Josef Gajdusek <atx@atx.name>
[Guenter Roeck: ordered i2c address list, updated description/headline]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-05-21 16:02:23 -07:00
LABBE Corentin 962a75a2d5 hwmon: (adm1029) Update Corentin Labbe's email
Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-05-21 16:02:23 -07:00
Jingoo Han cfe03d641e hwmon: (iio_hwmon) Make of_device_id array const
Make of_device_id array const, because all OF functions
handle it as const.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-05-21 16:02:23 -07:00
Jingoo Han 6de709c5ee hwmon: (gpio-fan) Make of_device_id array const
Make of_device_id array const, because all OF functions
handle it as const.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-05-21 16:02:23 -07:00
Jingoo Han adaa50b0dd hwmon: (g762) Make of_device_id array const
Make of_device_id array const, because all OF functions
handle it as const.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-05-21 16:02:22 -07:00
Guenter Roeck 86b89d73f9 hwmon: (ltc2945) Fix 1st comment line
Somehow a couple of spaces got added to the first line. Remove them.
No code change.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-05-21 16:02:22 -07:00
Jingoo Han 5b20995ee7 hwmon: (vt1211) remove unnecessary OOM messages
The site-specific OOM messages are unnecessary, because they
duplicate the MM subsystem generic OOM message.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-05-21 16:02:22 -07:00
Jingoo Han eefb6b76b1 hwmon: (s3c-hwmon) remove unnecessary OOM messages
The site-specific OOM messages are unnecessary, because they
duplicate the MM subsystem generic OOM message.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-05-21 16:02:22 -07:00
Jingoo Han 2f89b072c9 hwmon: (pc87427) remove unnecessary OOM messages
The site-specific OOM messages are unnecessary, because they
duplicate the MM subsystem generic OOM message.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-05-21 16:02:22 -07:00
Jingoo Han 6122de8f8c hwmon: (max197) remove unnecessary OOM messages
The site-specific OOM messages are unnecessary, because they
duplicate the MM subsystem generic OOM message.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-05-21 16:02:22 -07:00
Jingoo Han 611cd8aec8 hwmon: (max1111) remove unnecessary OOM messages
The site-specific OOM messages are unnecessary, because they
duplicate the MM subsystem generic OOM message.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-05-21 16:02:22 -07:00
Jingoo Han 567817de85 hwmon: (lm93) remove unnecessary OOM messages
The site-specific OOM messages are unnecessary, because they
duplicate the MM subsystem generic OOM message.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-05-21 16:02:22 -07:00
Jingoo Han 6d33d304e2 hwmon: (ibmpex) remove unnecessary OOM messages
The site-specific OOM messages are unnecessary, because they
duplicate the MM subsystem generic OOM message.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Jean Delvare <jdelvare@suse.de>
Acked-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-05-21 16:02:21 -07:00
Jingoo Han b83207fdda hwmon: (f71805f) remove unnecessary OOM messages
The site-specific OOM messages are unnecessary, because they
duplicate the MM subsystem generic OOM message.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-05-21 16:02:21 -07:00
Guenter Roeck 030004b1ed hwmon: (lm92) Convert to use devm_hwmon_device_register_with_groups
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>
2014-05-21 16:02:21 -07:00
Guenter Roeck b8fe58e953 hwmon: (lm92) Drop function macros
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>
2014-05-21 16:02:21 -07:00
Guenter Roeck c6f1e7ab91 hwmon: (lm92) Drop FSF mailing address
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>
2014-05-21 16:02:21 -07:00
Guenter Roeck ddfe44bfee hwmon: (lm92) Drop unnecessary forward declaration
Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-05-21 16:02:21 -07:00
Guenter Roeck d663ec496d hwmon: (lm75) Convert to use hwmon_device_register_with_groups
Simplify code and attach hwmon attributes to hwmon device.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-05-21 16:02:21 -07:00
Guenter Roeck 5975dfbf40 hwmon: (lm77) Convert to use devm_hwmon_device_register_with_groups
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>
2014-05-21 16:02:21 -07:00
Guenter Roeck 48dbd6ff14 hwmon: (lm77) Drop function macros
Function macros make the code harder to read and increase code size,
so drop them.

Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-05-21 16:02:20 -07:00
Guenter Roeck 50bf46509f hwmon: (lm77) Do not preserve hysteresis when updating critical temp limit
Updating the hysteresis value when updating the critical temperature limit
was following the rule of 'least surprise'. However, it had the undesirable
side effect of changing the hysteresis for all other attributes, which
defeats the purpose of least surprise. In addition, it could result in
invalid hysteresis values if the resulting hysteresis was too large. In such
cases the resulting hysteresis ended up changed anyway, which again defeats
the purpose. So drop that code and document the new behavior.

Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-05-21 16:02:20 -07:00