Re: [PATCH] hwmon: Convert remaining drivers to use SPDX identifier
On Thu, Jun 20, 2019 at 06:19:46AM -0700, Guenter Roeck wrote: > This gets rid of the unnecessary license boilerplate, and avoids > having to deal with individual patches one by one. > > No functional changes intended. > > Signed-off-by: Guenter Roeck > --- > drivers/hwmon/adm1029.c| 10 -- > drivers/hwmon/adt7411.c| 5 + > drivers/hwmon/adt7475.c| 5 + > drivers/hwmon/iio_hwmon.c | 5 + > drivers/hwmon/max197.c | 5 + > drivers/hwmon/scpi-hwmon.c | 10 +- > 6 files changed, 5 insertions(+), 35 deletions(-) > > diff --git a/drivers/hwmon/adm1029.c b/drivers/hwmon/adm1029.c > index 388060ff85e7..f7752a5bef31 100644 > --- a/drivers/hwmon/adm1029.c > +++ b/drivers/hwmon/adm1029.c > @@ -10,16 +10,6 @@ > * Very rare chip please let me know if you use it > * > * http://www.analog.com/UploadedFiles/Data_Sheets/ADM1029.pdf > - * > - * > - * 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 of the License > - * > - * 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. > */ > > #include For adm1029 Reviewed-by: Corentin Labbe
[PATCH 4/7] hwmon: adm1029: Add blank line after declarations
As requested by checkpatch, this patch adds a blank line after declarations Signed-off-by: Corentin Labbe --- drivers/hwmon/adm1029.c | 4 1 file changed, 4 insertions(+) diff --git a/drivers/hwmon/adm1029.c b/drivers/hwmon/adm1029.c index 092f16ad774f..f9f4f1f4a4c7 100644 --- a/drivers/hwmon/adm1029.c +++ b/drivers/hwmon/adm1029.c @@ -171,6 +171,7 @@ show_temp(struct device *dev, struct device_attribute *devattr, char *buf) { struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); struct adm1029_data *data = adm1029_update_device(dev); + return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp[attr->index])); } @@ -180,6 +181,7 @@ show_fan(struct device *dev, struct device_attribute *devattr, char *buf) struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); struct adm1029_data *data = adm1029_update_device(dev); u16 val; + if (data->fan[attr->index] == 0 || (data->fan_div[attr->index] & 0xC0) == 0 || data->fan[attr->index] == 255) { @@ -196,6 +198,7 @@ show_fan_div(struct device *dev, struct device_attribute *devattr, char *buf) { struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); struct adm1029_data *data = adm1029_update_device(dev); + if ((data->fan_div[attr->index] & 0xC0) == 0) return sprintf(buf, "0\n"); return sprintf(buf, "%d\n", DIV_FROM_REG(data->fan_div[attr->index])); @@ -210,6 +213,7 @@ static ssize_t set_fan_div(struct device *dev, u8 reg; long val; int ret = kstrtol(buf, 10, ); + if (ret < 0) return ret; -- 2.19.2
[PATCH 3/7] hwmon: adm1029: replace S_IXXX macros by their numeric values
As requested by checkpatch, this patch replace S_IXXX macros by their numeric values. Signed-off-by: Corentin Labbe --- drivers/hwmon/adm1029.c | 37 - 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/drivers/hwmon/adm1029.c b/drivers/hwmon/adm1029.c index 381bfae6b04b..092f16ad774f 100644 --- a/drivers/hwmon/adm1029.c +++ b/drivers/hwmon/adm1029.c @@ -250,32 +250,27 @@ static ssize_t set_fan_div(struct device *dev, return count; } -/* - * Access rights on sysfs. S_IRUGO: Is Readable by User, Group and Others - *S_IWUSR: Is Writable by User. - */ -static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL, 0); -static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, show_temp, NULL, 1); -static SENSOR_DEVICE_ATTR(temp3_input, S_IRUGO, show_temp, NULL, 2); +/* Access rights on sysfs. */ +static SENSOR_DEVICE_ATTR(temp1_input, 0444, show_temp, NULL, 0); +static SENSOR_DEVICE_ATTR(temp2_input, 0444, show_temp, NULL, 1); +static SENSOR_DEVICE_ATTR(temp3_input, 0444, show_temp, NULL, 2); -static SENSOR_DEVICE_ATTR(temp1_max, S_IRUGO, show_temp, NULL, 3); -static SENSOR_DEVICE_ATTR(temp2_max, S_IRUGO, show_temp, NULL, 4); -static SENSOR_DEVICE_ATTR(temp3_max, S_IRUGO, show_temp, NULL, 5); +static SENSOR_DEVICE_ATTR(temp1_max, 0444, show_temp, NULL, 3); +static SENSOR_DEVICE_ATTR(temp2_max, 0444, show_temp, NULL, 4); +static SENSOR_DEVICE_ATTR(temp3_max, 0444, show_temp, NULL, 5); -static SENSOR_DEVICE_ATTR(temp1_min, S_IRUGO, show_temp, NULL, 6); -static SENSOR_DEVICE_ATTR(temp2_min, S_IRUGO, show_temp, NULL, 7); -static SENSOR_DEVICE_ATTR(temp3_min, S_IRUGO, show_temp, NULL, 8); +static SENSOR_DEVICE_ATTR(temp1_min, 0444, show_temp, NULL, 6); +static SENSOR_DEVICE_ATTR(temp2_min, 0444, show_temp, NULL, 7); +static SENSOR_DEVICE_ATTR(temp3_min, 0444, show_temp, NULL, 8); -static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, show_fan, NULL, 0); -static SENSOR_DEVICE_ATTR(fan2_input, S_IRUGO, show_fan, NULL, 1); +static SENSOR_DEVICE_ATTR(fan1_input, 0444, show_fan, NULL, 0); +static SENSOR_DEVICE_ATTR(fan2_input, 0444, show_fan, NULL, 1); -static SENSOR_DEVICE_ATTR(fan1_min, S_IRUGO, show_fan, NULL, 2); -static SENSOR_DEVICE_ATTR(fan2_min, S_IRUGO, show_fan, NULL, 3); +static SENSOR_DEVICE_ATTR(fan1_min, 0444, show_fan, NULL, 2); +static SENSOR_DEVICE_ATTR(fan2_min, 0444, show_fan, NULL, 3); -static SENSOR_DEVICE_ATTR(fan1_div, S_IRUGO | S_IWUSR, - show_fan_div, set_fan_div, 0); -static SENSOR_DEVICE_ATTR(fan2_div, S_IRUGO | S_IWUSR, - show_fan_div, set_fan_div, 1); +static SENSOR_DEVICE_ATTR(fan1_div, 0644, show_fan_div, set_fan_div, 0); +static SENSOR_DEVICE_ATTR(fan2_div, 0644, show_fan_div, set_fan_div, 1); static struct attribute *adm1029_attrs[] = { _dev_attr_temp1_input.dev_attr.attr, -- 2.19.2
[PATCH 0/7] hwmon: adm1029: Fix most style problem
Hello Thirteen years later, coding style have change a bit. This patch series fixes the gap. This patch serie was tested on my precious so rare real hardware. Regards Corentin Labbe (7): hwmon: adm1029: Remove write to FFF paragraph hwmon: adm1029: Add SPDX header hwmon: adm1029: replace S_IXXX macros by their numeric values hwmon: adm1029: Add blank line after declarations hwmon: adm1029: Fix Logical continuations should be on the previous line checkpatch warning hwmon: adm1029: Fix function alignment hwmon: adm1029: Add a comment for locking mutex drivers/hwmon/adm1029.c | 67 +++-- 1 file changed, 31 insertions(+), 36 deletions(-) -- 2.19.2
[PATCH 7/7] hwmon: adm1029: Add a comment for locking mutex
Checkpatch complains that mutex does not have any comment. This patch fix that. Signed-off-by: Corentin Labbe --- drivers/hwmon/adm1029.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hwmon/adm1029.c b/drivers/hwmon/adm1029.c index e9fe4fc3489e..e561279aea21 100644 --- a/drivers/hwmon/adm1029.c +++ b/drivers/hwmon/adm1029.c @@ -108,7 +108,7 @@ static const u8 ADM1029_REG_FAN_DIV[] = { struct adm1029_data { struct i2c_client *client; - struct mutex update_lock; + struct mutex update_lock; /* protect register access */ char valid; /* zero until following fields are valid */ unsigned long last_updated; /* in jiffies */ -- 2.19.2
[PATCH 6/7] hwmon: adm1029: Fix function alignment
This patch fix the "Alignment should match open parenthesis" checkpatch warning. Signed-off-by: Corentin Labbe --- drivers/hwmon/adm1029.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/hwmon/adm1029.c b/drivers/hwmon/adm1029.c index 4339f6b864a1..e9fe4fc3489e 100644 --- a/drivers/hwmon/adm1029.c +++ b/drivers/hwmon/adm1029.c @@ -203,8 +203,8 @@ show_fan_div(struct device *dev, struct device_attribute *devattr, char *buf) return sprintf(buf, "%d\n", DIV_FROM_REG(data->fan_div[attr->index])); } -static ssize_t set_fan_div(struct device *dev, - struct device_attribute *devattr, const char *buf, size_t count) +static ssize_t set_fan_div(struct device *dev, struct device_attribute *devattr, + const char *buf, size_t count) { struct adm1029_data *data = dev_get_drvdata(dev); struct i2c_client *client = data->client; @@ -322,7 +322,7 @@ static int adm1029_detect(struct i2c_client *client, temp_devices_installed = i2c_smbus_read_byte_data(client, ADM1029_REG_TEMP_DEVICES_INSTALLED); nb_fan_support = i2c_smbus_read_byte_data(client, - ADM1029_REG_NB_FAN_SUPPORT); + ADM1029_REG_NB_FAN_SUPPORT); /* 0x41 is Analog Devices */ if (man_id != 0x41 || (temp_devices_installed & 0xf9) != 0x01 || nb_fan_support != 0x03) -- 2.19.2
[PATCH 5/7] hwmon: adm1029: Fix Logical continuations should be on the previous line checkpatch warning
This patchs fix the "Logical continuations should be on the previous line" checkpatch warning. Signed-off-by: Corentin Labbe --- drivers/hwmon/adm1029.c | 13 ++--- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/hwmon/adm1029.c b/drivers/hwmon/adm1029.c index f9f4f1f4a4c7..4339f6b864a1 100644 --- a/drivers/hwmon/adm1029.c +++ b/drivers/hwmon/adm1029.c @@ -131,8 +131,7 @@ static struct adm1029_data *adm1029_update_device(struct device *dev) * Use the "cache" Luke, don't recheck values * if there are already checked not a long time later */ - if (time_after(jiffies, data->last_updated + HZ * 2) -|| !data->valid) { + if (time_after(jiffies, data->last_updated + HZ * 2) || !data->valid) { int nr; dev_dbg(>dev, "Updating adm1029 data\n"); @@ -182,9 +181,9 @@ show_fan(struct device *dev, struct device_attribute *devattr, char *buf) struct adm1029_data *data = adm1029_update_device(dev); u16 val; - if (data->fan[attr->index] == 0 - || (data->fan_div[attr->index] & 0xC0) == 0 - || data->fan[attr->index] == 255) { + if (data->fan[attr->index] == 0 || + (data->fan_div[attr->index] & 0xC0) == 0 || + data->fan[attr->index] == 255) { return sprintf(buf, "0\n"); } @@ -325,8 +324,8 @@ static int adm1029_detect(struct i2c_client *client, nb_fan_support = i2c_smbus_read_byte_data(client, ADM1029_REG_NB_FAN_SUPPORT); /* 0x41 is Analog Devices */ - if (man_id != 0x41 || (temp_devices_installed & 0xf9) != 0x01 - || nb_fan_support != 0x03) + if (man_id != 0x41 || (temp_devices_installed & 0xf9) != 0x01 || + nb_fan_support != 0x03) return -ENODEV; if ((chip_id & 0xF0) != 0x00) { -- 2.19.2
[PATCH 2/7] hwmon: adm1029: Add SPDX header
This patch addes SPDX header to adm1029 Signed-off-by: Corentin Labbe --- drivers/hwmon/adm1029.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/hwmon/adm1029.c b/drivers/hwmon/adm1029.c index 3dd4c84ec89e..381bfae6b04b 100644 --- a/drivers/hwmon/adm1029.c +++ b/drivers/hwmon/adm1029.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * adm1029.c - Part of lm_sensors, Linux kernel modules for hardware monitoring * -- 2.19.2
[PATCH 1/2] hwmon: fix typo build -> built
This patch fix a typo where build is used instead of built. Signed-off-by: Corentin Labbe --- drivers/hwmon/Kconfig | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index 532a0532d01b..100b7fce1412 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig @@ -179,7 +179,7 @@ config SENSORS_ADT7X10 This module contains common code shared by the ADT7310/ADT7320 and ADT7410/ADT7420 temperature monitoring chip drivers. - If build as a module, the module will be called adt7x10. + If built as a module, the module will be called adt7x10. config SENSORS_ADT7310 tristate "Analog Devices ADT7310/ADT7320" @@ -242,7 +242,7 @@ config SENSORS_ADT7475 ADT7473, ADT7475, ADT7476 and ADT7490 hardware monitoring chips. - This driver can also be build as a module. If so, the module + This driver can also be built as a module. If so, the module will be called adt7475. config SENSORS_ASC7621 @@ -666,7 +666,7 @@ config SENSORS_JZ4740 If you say yes here you get support for reading adc values from the ADCIN pin on Ingenic JZ4740 SoC based boards. - This driver can also be build as a module. If so, the module will be + This driver can also be built as a module. If so, the module will be called jz4740-hwmon. config SENSORS_JC42 @@ -1594,7 +1594,7 @@ config SENSORS_AMC6821 If you say yes here you get support for the Texas Instruments AMC6821 hardware monitoring chips. - This driver can also be build as a module. If so, the module + This driver can also be built as a module. If so, the module will be called amc6821. config SENSORS_INA209 -- 2.18.1
[PATCH 2/2] hwmon: Remove multiple space after dot
This patch remove extra space after a dot. Signed-off-by: Corentin Labbe --- drivers/hwmon/Kconfig | 236 +- 1 file changed, 118 insertions(+), 118 deletions(-) diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index 100b7fce1412..3ed91b21f368 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig @@ -11,7 +11,7 @@ menuconfig HWMON of a system. Most modern motherboards include such a device. It can include temperature sensors, voltage sensors, fan speed sensors and various additional features such as the ability to - control the speed of the fans. If you want this support you + control the speed of the fans. If you want this support you should say Y here and also to the specific driver(s) for your sensors chip(s) below. @@ -19,7 +19,7 @@ menuconfig HWMON sensors-detect script from the lm_sensors package. Read for details. - This support can also be built as a module. If so, the module + This support can also be built as a module. If so, the module will be called hwmon. if HWMON @@ -46,7 +46,7 @@ config SENSORS_AB8500 AB8500 die and two GPADC channels. The GPADC channel are preferably used to access sensors outside the AB8500 chip. - This driver can also be built as a module. If so, the module + This driver can also be built as a module. If so, the module will be called abx500-temp. config SENSORS_ABITUGURU @@ -61,7 +61,7 @@ config SENSORS_ABITUGURU of which motherboards have which revision see Documentation/hwmon/abituguru - This driver can also be built as a module. If so, the module + This driver can also be built as a module. If so, the module will be called abituguru. config SENSORS_ABITUGURU3 @@ -75,7 +75,7 @@ config SENSORS_ABITUGURU3 2005). For more info and a list of which motherboards have which revision see Documentation/hwmon/abituguru3 - This driver can also be built as a module. If so, the module + This driver can also be built as a module. If so, the module will be called abituguru3. config SENSORS_AD7314 @@ -116,7 +116,7 @@ config SENSORS_ADM1021 and ADM1023 sensor chips and clones: Maxim MAX1617 and MAX1617A, Genesys Logic GL523SM, National Semiconductor LM84 and TI THMC10. - This driver can also be built as a module. If so, the module + This driver can also be built as a module. If so, the module will be called adm1021. config SENSORS_ADM1025 @@ -127,7 +127,7 @@ config SENSORS_ADM1025 If you say yes here you get support for Analog Devices ADM1025 and Philips NE1619 sensor chips. - This driver can also be built as a module. If so, the module + This driver can also be built as a module. If so, the module will be called adm1025. config SENSORS_ADM1026 @@ -138,7 +138,7 @@ config SENSORS_ADM1026 If you say yes here you get support for Analog Devices ADM1026 sensor chip. - This driver can also be built as a module. If so, the module + This driver can also be built as a module. If so, the module will be called adm1026. config SENSORS_ADM1029 @@ -149,7 +149,7 @@ config SENSORS_ADM1029 sensor chip. Very rare chip, please let us know you use it. - This driver can also be built as a module. If so, the module + This driver can also be built as a module. If so, the module will be called adm1029. config SENSORS_ADM1031 @@ -159,7 +159,7 @@ config SENSORS_ADM1031 If you say yes here you get support for Analog Devices ADM1031 and ADM1030 sensor chips. - This driver can also be built as a module. If so, the module + This driver can also be built as a module. If so, the module will be called adm1031. config SENSORS_ADM9240 @@ -170,7 +170,7 @@ config SENSORS_ADM9240 If you say yes here you get support for Analog Devices ADM9240, Dallas DS1780, National Semiconductor LM81 sensor chips. - This driver can also be built as a module. If so, the module + This driver can also be built as a module. If so, the module will be called adm9240. config SENSORS_ADT7X10 @@ -242,7 +242,7 @@ config SENSORS_ADT7475 ADT7473, ADT7475, ADT7476 and ADT7490 hardware monitoring chips. - This driver can also be built as a module. If so, the module + This driver can also be built as a module. If so, the module will be called adt7475. config SENSORS_ASC7621 @@ -255,7 +255,7 @@ config SENSORS_ASC7621 aSC7621 aSC7621a - This driver can also be built as a module. If so, the module + This driver can also
[PATCH] hwmon: sch56xx: Remove unneeded linux/miscdevice.h include
drivers/hwmon/sch56xx-common.c does not contain any miscdevice so the inclusion of linux/miscdevice.h is uncessary. Signed-off-by: Corentin Labbe <clabbe.montj...@gmail.com> --- drivers/hwmon/sch56xx-common.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/hwmon/sch56xx-common.c b/drivers/hwmon/sch56xx-common.c index 68c350c..bda3d52 100644 --- a/drivers/hwmon/sch56xx-common.c +++ b/drivers/hwmon/sch56xx-common.c @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include "sch56xx-common.h" -- 2.10.2 -- To unsubscribe from this list: send the line "unsubscribe linux-hwmon" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html