summaryrefslogtreecommitdiff
path: root/drivers/hwmon/sch5627.c
AgeCommit message (Collapse)Author
2021-06-17hwmon: (sch56xx) Use devres functions for watchdogArmin Wolf
Use devm_kzalloc()/devm_watchdog_register() for watchdog registration since it allows us to remove the sch56xx_watchdog_data struct from the drivers own data structs. Remove sch56xx_watchdog_unregister since devres takes care of that now. Signed-off-by: Armin Wolf <W_Armin@gmx.de> Link: https://lore.kernel.org/r/20210508131457.12780-2-W_Armin@gmx.de Reviewed-by: Hans de Goede <hdegoede@redhat.com> [groeck: Dropped unnecessary return; at end of void function] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2021-04-20hwmon: (sch5627) Remove unnecessary error pathArmin Wolf
Calling remove() on error whould have only unregistered the watchdog, and since a failure in registering him is considered non-fatal and happens last, remove the error path and return the error codes directly. Signed-off-by: Armin Wolf <W_Armin@gmx.de> Link: https://lore.kernel.org/r/20210417210920.15496-3-W_Armin@gmx.de Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2021-04-20hwmon: (sch5627) Use devres functionArmin Wolf
Use devm_hwmon_device_register_with_info() and remove hwmon_dev from sch5627_data struct as it is not needed anymore. Signed-off-by: Armin Wolf <W_Armin@gmx.de> Link: https://lore.kernel.org/r/20210417210920.15496-2-W_Armin@gmx.de Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2021-04-20hwmon: (sch5627) Split sch5627_update_device()Armin Wolf
An error in sch5627_update_device() could cause sch5627_read() to fail even if the error did not affect the target sensor type. Split sch5627_update_device() to prevent that. Tested on a Fujitsu Esprimo P720. Signed-off-by: Armin Wolf <W_Armin@gmx.de> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20210411164225.11967-3-W_Armin@gmx.de Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2021-04-20hwmon: (sch5627) Convert to hwmon_device_register_with_info()Armin Wolf
hwmon_device_register() is deprecated. Convert driver to use hwmon_device_register_with_info() and remove sysfs attributes which are now being handled by the hwmon subsystem. Channel handling was inspired by corsair-cpro. Tested on a Fujitsu Esprimo P720. Signed-off-by: Armin Wolf <W_Armin@gmx.de> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20210411164225.11967-2-W_Armin@gmx.de [groeck: Replaced 0 with NULL] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2021-04-20hwmon: replace snprintf in show functions with sysfs_emitGuenter Roeck
coccicheck complains about the use of snprintf() in sysfs show functions. drivers/hwmon/ina3221.c:701:8-16: WARNING: use scnprintf or sprintf This results in a large number of patch submissions. Fix it all in one go using the following coccinelle rules. Use sysfs_emit instead of scnprintf or sprintf since that makes more sense. @depends on patch@ identifier show, dev, attr, buf; @@ ssize_t show(struct device *dev, struct device_attribute *attr, char *buf) { <... return - snprintf(buf, \( PAGE_SIZE \| PAGE_SIZE - 1 \), + sysfs_emit(buf, ...); ...> } @depends on patch@ identifier show, dev, attr, buf, rc; @@ ssize_t show(struct device *dev, struct device_attribute *attr, char *buf) { <... rc = - snprintf(buf, \( PAGE_SIZE \| PAGE_SIZE - 1 \), + sysfs_emit(buf, ...); ...> } While at it, remove unnecessary braces and as well as unnecessary else after return statements to address checkpatch warnings in the resulting patch. Cc: Zihao Tang <tangzihao1@hisilicon.com> Cc: Jay Fang <f.fangjian@huawei.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-05-30treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156Thomas Gleixner
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 59 temple place suite 330 boston ma 02111 1307 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 1334 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Allison Randal <allison@lohutok.net> Reviewed-by: Richard Fontana <rfontana@redhat.com> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190527070033.113240726@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-02-18hwmon: (sch5627) Use permission specific SENSOR[_DEVICE]_ATTR variantsGuenter Roeck
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. Cc: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2017-01-02hwmon: (sch5627) use permission-specific DEVICE_ATTR variantsJulia Lawall
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: Updated description] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
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>
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-09-23hwmon: (sch5627) Convert to use devm_ functionsGuenter Roeck
Convert to use devm_ functions to reduce code size and simplify the code. Cc: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2012-05-30watchdog: sch56xx: Use watchdog coreHans de Goede
Convert sch56xx drivers to the generic watchdog core. Note this patch depends on the "watchdog: Add multiple device support" patch from Alan Cox. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
2012-03-20hwmon: (sch56xx) Add support for the integrated watchdog (v2)Hans de Goede
Add support for the watchdog integrated into the SMSC SCH5627 and SCH5636 superio-s. Since the watchdog is part of the hwmon logical device and thus shares ioports with it, the watchdog driver is integrated into the existing hwmon drivers for these. Note that this version of the watchdog support for sch56xx superio-s implements the watchdog chardev interface itself, rather then relying on the recently added watchdog core / watchdog_dev. This is done because currently some needed functionality is missing from watchdog_dev, as soon as this functionality is added (which is being discussed on the linux-watchdog mailinglist), I'll convert this driver over to using watchdog_dev. Signed-off-by: Hans de Goede <hdegoede@redhat.com> [guenter.roeck@ericsson.com: Added missing linux/slab.h include] Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2011-11-26hwmon: convert drivers/hwmon/* to use module_platform_driver()Axel Lin
This patch converts the drivers in drivers/hwmon/* to use the module_platform_driver() macro which makes the code smaller and a bit simpler. Cc: Donggeun Kim <dg77.kim@samsung.com> Cc: Simon Guinot <sguinot@lacie.com> Cc: Lars-Peter Clausen <lars@metafoo.de> Cc: MyungJoo Ham <myungjoo.ham@samsung.com> Cc: Ben Dooks <ben@simtec.co.uk> Cc: Hans de Goede <hdegoede@redhat.com> Cc: J Keerthy <j-keerthy@ti.com> Cc: David S. Miller <davem@davemloft.net> Cc: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Axel Lin <axel.lin@gmail.com> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2011-07-25hwmon: (sch5627) Factor out some code shared with sch5636 driverHans de Goede
This patch adds a new sch56xx-common.ko which contains code which will also be used in the new sch5636 driver. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2011-07-03hwmon: Use <> rather than () around my e-mail addressHans de Goede
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2011-05-25hwmon: (sch5627) Trigger Vbat measurementsHans de Goede
The sch5627 needs to be explicitly told to start an adc conversion for Vbat, once in a while. Without this Vbat may read 0, and will never get updated. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2011-05-25hwmon: (sch5627) Add sch5627_send_cmd functionHans de Goede
This patch generalizes sch5627_read_virtual_reg so that it can be used to write virtual regs too. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Sigend-off-by: Jean Delvare <khali@linux-fr.org>
2011-03-21hwmon: New driver for SMSC SCH5627Hans de Goede
SMSC SCH5627 Super I/O chips include complete hardware monitoring capabilities. They can monitor up to 5 voltages, 4 fans and 8 temperatures. The hardware monitoring part of the SMSC SCH5627 is accessed by talking through an embedded microcontroller. An application note describing the protocol for communicating with the microcontroller is available upon request. Please mail me if you want a copy. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>