Skip to content

Commit fc74b1c

Browse files
Fix read and write failure to ‘fan1_target’ attribute of ‘dni_dps460’ driver. (sonic-net#183)
- Updated the pmbus_data structure in ‘dni_dps460’ driver’s patch to the one present in ‘pmbus_core.c’ in the latest kernel version used. - Reverted patch to use ‘kstrtol_from_user’ instead of ‘kstrtol’ for set operation in the driver. Signed-off-by: Arun Saravanan Balachandran <Arun_Saravanan_Balac@dell.com>
1 parent 173ebe7 commit fc74b1c

3 files changed

+32
-44
lines changed

patch/driver-hwmon-pmbus-dni_dps460-update-pmbus-core.patch

+32-12
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,31 @@
1-
Update pmbus_data data structure to meet kernel implementation
2-
3-
From: Shuotian Cheng <shuche@microsoft.com>
1+
From 9cfc597034ffe58527ea5ce1799dfcbad770ea30 Mon Sep 17 00:00:00 2001
2+
From: Arun Saravanan Balachandran <Arun_Saravanan_Balac@dell.com>
3+
Date: Mon, 18 Jan 2021 09:00:44 +0000
4+
Subject: [PATCH] Update pmbus_data data structure to meet kernel
5+
implementation
46

57
The pmbus_data data structure is pasted in the driver.
68
Cumulus patch is for kernel 3.2.x.
7-
Update this data structure to meet current kernel (3.16.x) implementation.
9+
Update this data structure to meet current kernel (4.19.x) implementation.
10+
11+
Signed-off-by: Arun Saravanan Balachandran <Arun_Saravanan_Balac@dell.com>
812
---
9-
drivers/hwmon/pmbus/dni_dps460.c | 42 +++++++++++++++-----------------------
10-
1 file changed, 17 insertions(+), 25 deletions(-)
13+
drivers/hwmon/pmbus/dni_dps460.c | 48 ++++++++++++++++++----------------------
14+
1 file changed, 22 insertions(+), 26 deletions(-)
1115

1216
diff --git a/drivers/hwmon/pmbus/dni_dps460.c b/drivers/hwmon/pmbus/dni_dps460.c
13-
index ad29134c4..7332480d4 100644
17+
index 2c67410..d314c1f 100644
1418
--- a/drivers/hwmon/pmbus/dni_dps460.c
1519
+++ b/drivers/hwmon/pmbus/dni_dps460.c
16-
@@ -39,41 +39,32 @@ enum chips { dni_dps460 };
20+
@@ -19,6 +19,7 @@
21+
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22+
*/
23+
24+
+#include <linux/debugfs.h>
25+
#include <linux/kernel.h>
26+
#include <linux/module.h>
27+
#include <linux/init.h>
28+
@@ -39,41 +40,33 @@ enum chips { dni_dps460 };
1729
#define FAN_VALUE_MAX 0x64
1830

1931
/* Needed to access the mutex. Copied from pmbus_core.c */
@@ -44,6 +56,7 @@ index ad29134c4..7332480d4 100644
4456
- struct attribute **attributes;
4557
struct attribute_group group;
4658
+ const struct attribute_group *groups[2];
59+
+ struct dentry *debugfs; /* debugfs device directory */
4760

4861
- /*
4962
- * Sensors cover both sensor and limit registers.
@@ -68,15 +81,19 @@ index ad29134c4..7332480d4 100644
6881

6982
struct mutex update_lock;
7083
bool valid;
71-
@@ -84,6 +75,7 @@ struct pmbus_data {
84+
@@ -83,7 +76,10 @@ struct pmbus_data {
85+
* A single status register covers multiple attributes,
7286
* so we keep them all together.
7387
*/
74-
u8 status[PB_NUM_STATUS_REG];
75-
+ u8 status_register;
88+
- u8 status[PB_NUM_STATUS_REG];
89+
+ u16 status[PB_NUM_STATUS_REG];
90+
+
91+
+ bool has_status_word; /* device uses STATUS_WORD register */
92+
+ int (*read_status)(struct i2c_client *client, int page);
7693

7794
u8 currpage;
7895
};
79-
@@ -123,14 +115,14 @@ static ssize_t set_target(struct device *dev, struct device_attribute *devattr,
96+
@@ -123,14 +119,14 @@ static ssize_t set_target(struct device *dev, struct device_attribute *devattr,
8097
struct i2c_client *client = to_i2c_client(dev);
8198
struct pmbus_data *data = i2c_get_clientdata(client);
8299
int err;
@@ -94,3 +111,6 @@ index ad29134c4..7332480d4 100644
94111

95112
mutex_lock(&data->update_lock);
96113

114+
--
115+
2.7.4
116+

patch/driver-hwmon-pmbus-dni_dps460-use-kstrtol-from-user.patch

-31
This file was deleted.

patch/series

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ driver-hwmon-max6620-update.patch
2222
driver-hwmon-max6658-fix-write-convrate.patch
2323
driver-hwmon-pmbus-dni_dps460.patch
2424
driver-hwmon-pmbus-dni_dps460-update-pmbus-core.patch
25-
driver-hwmon-pmbus-dni_dps460-use-kstrtol-from-user.patch
2625
driver-hwmon-pmbus-dps1900.patch
2726
driver-support-tun-config-carrier-enable.patch
2827
driver-support-optoe.patch

0 commit comments

Comments
 (0)