Linux-Hwmon Archive on lore.kernel.org
 help / Atom feed
* [PATCH 0/7] hwmon: adm1029: Fix most style problem
@ 2019-01-18 14:03 Corentin Labbe
  2019-01-18 14:03 ` [PATCH 1/7] hwmon: adm1029: Remove write to FFF paragraph Corentin Labbe
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Corentin Labbe @ 2019-01-18 14:03 UTC (permalink / raw)
  To: jdelvare, linux; +Cc: linux-hwmon, linux-kernel, Corentin Labbe

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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/7] hwmon: adm1029: Remove write to FFF paragraph
  2019-01-18 14:03 [PATCH 0/7] hwmon: adm1029: Fix most style problem Corentin Labbe
@ 2019-01-18 14:03 ` Corentin Labbe
  2019-01-18 14:03 ` [PATCH 2/7] hwmon: adm1029: Add SPDX header Corentin Labbe
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Corentin Labbe @ 2019-01-18 14:03 UTC (permalink / raw)
  To: jdelvare, linux; +Cc: linux-hwmon, linux-kernel, Corentin Labbe

As suggested by checkpatch, remove the "write to FFF" paragraph.

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
 drivers/hwmon/adm1029.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/hwmon/adm1029.c b/drivers/hwmon/adm1029.c
index 8c5cdb560258..3dd4c84ec89e 100644
--- a/drivers/hwmon/adm1029.c
+++ b/drivers/hwmon/adm1029.c
@@ -19,10 +19,6 @@
  * 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.
  */
 
 #include <linux/module.h>
-- 
2.19.2


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 2/7] hwmon: adm1029: Add SPDX header
  2019-01-18 14:03 [PATCH 0/7] hwmon: adm1029: Fix most style problem Corentin Labbe
  2019-01-18 14:03 ` [PATCH 1/7] hwmon: adm1029: Remove write to FFF paragraph Corentin Labbe
@ 2019-01-18 14:03 ` Corentin Labbe
  2019-01-18 14:03 ` [PATCH 3/7] hwmon: adm1029: replace S_IXXX macros by their numeric values Corentin Labbe
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Corentin Labbe @ 2019-01-18 14:03 UTC (permalink / raw)
  To: jdelvare, linux; +Cc: linux-hwmon, linux-kernel, Corentin Labbe

This patch addes SPDX header to adm1029

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
 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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 3/7] hwmon: adm1029: replace S_IXXX macros by their numeric values
  2019-01-18 14:03 [PATCH 0/7] hwmon: adm1029: Fix most style problem Corentin Labbe
  2019-01-18 14:03 ` [PATCH 1/7] hwmon: adm1029: Remove write to FFF paragraph Corentin Labbe
  2019-01-18 14:03 ` [PATCH 2/7] hwmon: adm1029: Add SPDX header Corentin Labbe
@ 2019-01-18 14:03 ` Corentin Labbe
  2019-01-18 14:03 ` [PATCH 4/7] hwmon: adm1029: Add blank line after declarations Corentin Labbe
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Corentin Labbe @ 2019-01-18 14:03 UTC (permalink / raw)
  To: jdelvare, linux; +Cc: linux-hwmon, linux-kernel, Corentin Labbe

As requested by checkpatch, this patch replace S_IXXX macros by their numeric values.

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
 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[] = {
 	&sensor_dev_attr_temp1_input.dev_attr.attr,
-- 
2.19.2


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 4/7] hwmon: adm1029: Add blank line after declarations
  2019-01-18 14:03 [PATCH 0/7] hwmon: adm1029: Fix most style problem Corentin Labbe
                   ` (2 preceding siblings ...)
  2019-01-18 14:03 ` [PATCH 3/7] hwmon: adm1029: replace S_IXXX macros by their numeric values Corentin Labbe
@ 2019-01-18 14:03 ` Corentin Labbe
  2019-01-18 14:03 ` [PATCH 5/7] hwmon: adm1029: Fix Logical continuations should be on the previous line checkpatch warning Corentin Labbe
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Corentin Labbe @ 2019-01-18 14:03 UTC (permalink / raw)
  To: jdelvare, linux; +Cc: linux-hwmon, linux-kernel, Corentin Labbe

As requested by checkpatch, this patch adds a blank line after declarations

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
 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, &val);
+
 	if (ret < 0)
 		return ret;
 
-- 
2.19.2


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 5/7] hwmon: adm1029: Fix Logical continuations should be on the previous line checkpatch warning
  2019-01-18 14:03 [PATCH 0/7] hwmon: adm1029: Fix most style problem Corentin Labbe
                   ` (3 preceding siblings ...)
  2019-01-18 14:03 ` [PATCH 4/7] hwmon: adm1029: Add blank line after declarations Corentin Labbe
@ 2019-01-18 14:03 ` Corentin Labbe
  2019-01-18 14:03 ` [PATCH 6/7] hwmon: adm1029: Fix function alignment Corentin Labbe
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Corentin Labbe @ 2019-01-18 14:03 UTC (permalink / raw)
  To: jdelvare, linux; +Cc: linux-hwmon, linux-kernel, Corentin Labbe

This patchs fix the "Logical continuations should be on the previous line" checkpatch warning.

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
 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(&client->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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 6/7] hwmon: adm1029: Fix function alignment
  2019-01-18 14:03 [PATCH 0/7] hwmon: adm1029: Fix most style problem Corentin Labbe
                   ` (4 preceding siblings ...)
  2019-01-18 14:03 ` [PATCH 5/7] hwmon: adm1029: Fix Logical continuations should be on the previous line checkpatch warning Corentin Labbe
@ 2019-01-18 14:03 ` Corentin Labbe
  2019-01-18 14:03 ` [PATCH 7/7] hwmon: adm1029: Add a comment for locking mutex Corentin Labbe
  2019-01-18 14:20 ` [PATCH 0/7] hwmon: adm1029: Fix most style problem Guenter Roeck
  7 siblings, 0 replies; 9+ messages in thread
From: Corentin Labbe @ 2019-01-18 14:03 UTC (permalink / raw)
  To: jdelvare, linux; +Cc: linux-hwmon, linux-kernel, Corentin Labbe

This patch fix the "Alignment should match open parenthesis" checkpatch
warning.

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
 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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 7/7] hwmon: adm1029: Add a comment for locking mutex
  2019-01-18 14:03 [PATCH 0/7] hwmon: adm1029: Fix most style problem Corentin Labbe
                   ` (5 preceding siblings ...)
  2019-01-18 14:03 ` [PATCH 6/7] hwmon: adm1029: Fix function alignment Corentin Labbe
@ 2019-01-18 14:03 ` Corentin Labbe
  2019-01-18 14:20 ` [PATCH 0/7] hwmon: adm1029: Fix most style problem Guenter Roeck
  7 siblings, 0 replies; 9+ messages in thread
From: Corentin Labbe @ 2019-01-18 14:03 UTC (permalink / raw)
  To: jdelvare, linux; +Cc: linux-hwmon, linux-kernel, Corentin Labbe

Checkpatch complains that mutex does not have any comment.
This patch fix that.

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
 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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/7] hwmon: adm1029: Fix most style problem
  2019-01-18 14:03 [PATCH 0/7] hwmon: adm1029: Fix most style problem Corentin Labbe
                   ` (6 preceding siblings ...)
  2019-01-18 14:03 ` [PATCH 7/7] hwmon: adm1029: Add a comment for locking mutex Corentin Labbe
@ 2019-01-18 14:20 ` Guenter Roeck
  7 siblings, 0 replies; 9+ messages in thread
From: Guenter Roeck @ 2019-01-18 14:20 UTC (permalink / raw)
  To: Corentin Labbe; +Cc: jdelvare, linux-hwmon, linux-kernel

On Fri, Jan 18, 2019 at 03:03:22PM +0100, Corentin Labbe wrote:
> 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.
> 
Series applied to hwmon-next.

Thanks,
Guenter

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, back to index

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-18 14:03 [PATCH 0/7] hwmon: adm1029: Fix most style problem Corentin Labbe
2019-01-18 14:03 ` [PATCH 1/7] hwmon: adm1029: Remove write to FFF paragraph Corentin Labbe
2019-01-18 14:03 ` [PATCH 2/7] hwmon: adm1029: Add SPDX header Corentin Labbe
2019-01-18 14:03 ` [PATCH 3/7] hwmon: adm1029: replace S_IXXX macros by their numeric values Corentin Labbe
2019-01-18 14:03 ` [PATCH 4/7] hwmon: adm1029: Add blank line after declarations Corentin Labbe
2019-01-18 14:03 ` [PATCH 5/7] hwmon: adm1029: Fix Logical continuations should be on the previous line checkpatch warning Corentin Labbe
2019-01-18 14:03 ` [PATCH 6/7] hwmon: adm1029: Fix function alignment Corentin Labbe
2019-01-18 14:03 ` [PATCH 7/7] hwmon: adm1029: Add a comment for locking mutex Corentin Labbe
2019-01-18 14:20 ` [PATCH 0/7] hwmon: adm1029: Fix most style problem Guenter Roeck

Linux-Hwmon Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-hwmon/0 linux-hwmon/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-hwmon linux-hwmon/ https://lore.kernel.org/linux-hwmon \
		linux-hwmon@vger.kernel.org linux-hwmon@archiver.kernel.org
	public-inbox-index linux-hwmon


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-hwmon


AGPL code for this site: git clone https://public-inbox.org/ public-inbox