History log of /linux-master/drivers/hwmon/ad7418.c
Revision Date Author Comments
# c8b73e42 10-Aug-2023 Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

hwmon: (ad7418) fix Wvoid-pointer-to-enum-cast warning

'type' is an enum, thus cast of pointer on 64-bit compile test with W=1
causes:

ad7418.c:256:16: error: cast to smaller integer type 'enum chips' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast]

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20230810093157.94244-2-krzysztof.kozlowski@linaro.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>


# 39f03438 14-Jul-2023 Rob Herring <robh@kernel.org>

hwmon: Explicitly include correct DT includes

The DT of_device.h and of_platform.h date back to the separate
of_platform_bus_type before it as merged into the regular platform bus.
As part of that merge prepping Arm DT support 13 years ago, they
"temporarily" include each other. They also include platform_device.h
and of.h. As a result, there's a pretty much random mix of those include
files used throughout the tree. In order to detangle these headers and
replace the implicit includes with struct declarations, users need to
explicitly include the correct includes.

Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20230714174607.4057185-1-robh@kernel.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>


# 1975d167 05-May-2023 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

hwmon: Switch i2c drivers back to use .probe()

After commit b8a1a4cd5a98 ("i2c: Provide a temporary .probe_new()
call-back type"), all drivers being converted to .probe_new() and then
03c835f498b5 ("i2c: Switch .probe() to not take an id parameter") convert
back to (the new) .probe() to be able to eventually drop .probe_new() from
struct i2c_driver.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20230505131718.1210071-1-u.kleine-koenig@pengutronix.de
[groeck: Added missing change in pmbus/acbel-fsg032.c]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>


# 952a11ca 24-Sep-2021 Paul Fertser <fercerpav@gmail.com>

hwmon: cleanup non-bool "valid" data fields

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>


# 67487038 13-Aug-2020 Stephen Kitt <steve@sk2.org>

hwmon: use simple i2c probe function

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>


# a10e763b 31-May-2019 Thomas Gleixner <tglx@linutronix.de>

treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 372

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 version 2

extracted by the scancode license scanner the SPDX license identifier

GPL-2.0-only

has been chosen to replace the boilerplate/reference in 135 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Allison Randal <allison@lohutok.net>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190531081036.435762997@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# f4c2965e 28-Jan-2019 Linus Walleij <linus.walleij@linaro.org>

hwmon: (ad7418) Add device tree probing

This adds device tree probing for the AD7418 hwmon sensor.
When device tree is not enabled, stub functions will kick
in.

Tested on the Gateway Cambria GW2358-4.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
[groeck: Added missing {} to terminate ad7418_dt_ids]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>


# 45034e48 07-Feb-2019 Brandon Maier <brandon.maier@rockwellcollins.com>

hwmon: (ad7418) Catch I2C errors

If there is an i2c failure, the ad7416 reports its temperature as 0C.
Return an error code so users can properly detect errors.

Signed-off-by: Brandon Maier <brandon.maier@rockwellcollins.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>


# 6fdc5d7f 10-Dec-2018 Guenter Roeck <linux@roeck-us.net>

hwmon: (ad7418) Use permission specific SENSOR[_DEVICE]_ATTR variants

Use SENSOR[_DEVICE]_ATTR[_2]_{RO,RW,WO} to simplify the source code,
to improve readbility, 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>


# 337076f9 01-Jul-2014 Axel Lin <axel.lin@ingics.com>

hwmon: (ad7418) 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>


# 991763a9 01-Jul-2014 Axel Lin <axel.lin@ingics.com>

hwmon: (ad7418) Avoid forward declaration

Move ad7418_driver to proper place to avoid forward declaration.
Also move ad7418_init_client() close to ad7418_probe().

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>


# d5282926 02-Jun-2012 Guenter Roeck <linux@roeck-us.net>

hwmon: (ad7418) 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>


# f0967eea 20-Jan-2012 Axel Lin <axel.lin@gmail.com>

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>


# e91aef22 08-Jan-2012 Frans Meulenbroeks <fransmeulenbroeks@gmail.com>

hwmon: (ad7418) fix checkpatch issues

fixed:
WARNING: simple_strtol is obsolete, use kstrtol instead
+ long temp = simple_strtol(buf, NULL, 10);

ERROR: do not use assignment in if condition
+ if (!(data = kzalloc(sizeof(struct ad7418_data), GFP_KERNEL))) {

ERROR: do not use assignment in if condition
+ if ((err = sysfs_create_group(&client->dev.kobj, &data->attrs)))

Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>


# 90f4102c 03-Nov-2011 Jean Delvare <khali@linux-fr.org>

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>


# 5a0e3ad6 24-Mar-2010 Tejun Heo <tj@kernel.org>

include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h

percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.

percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.

http://userweb.kernel.org/~tj/misc/slabh-sweep.py

The script does the followings.

* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.

* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.

* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.

The conversion was done in the following steps.

1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.

2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.

3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.

4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.

5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.

6. percpu.h was updated not to include slab.h.

7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).

* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig

8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.

Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.

Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>


# 369932f6 16-Jul-2008 Jean Delvare <khali@linux-fr.org>

hwmon: (ad7418) Convert to a new-style i2c driver

The ad7418 driver is only used on embedded platforms where i2c
devices can easily be declared in platform code. Thus a new-style
i2c driver makes perfect sense. This lets us get rid of quirky
detection code (these chips have no identification registers) and
shrinks the binary driver size by 38%.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Alessandro Zummo <a.zummo@towertech.it>


# 25e9c86d 17-Feb-2008 Mark M. Hoffman <mhoffman@lightlink.com>

hwmon: normal_i2c arrays should be const

Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>


# 1beeffe4 20-Aug-2007 Tony Jones <tonyj@suse.de>

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>


# 5bfedac0 16-Aug-2007 Christian Hohnstaedt <chohnstaedt@innominate.com>

hwmon: Allow writing of negative trigger temperatures

- replace differing temperature variable types by long
- use strtol() instead of strtoul() for conversion

Signed-off-by: Christian Hohnstaedt <chohnstaedt@innominate.com>
Acked-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>


# 2d8dd65f 08-May-2007 Alessandro Zummo <azummo-lists@towertech.it>

hwmon: New AD7416, AD7417 and AD7418 driver

A driver for the Analog Devices AD7416, AD7417 and AD7418 chips.

Signed-off-by: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Jean Delvare <khali@linux-fr.org>