From fc74b1ce22d093088b91f38d94c0c1ed645d54d0 Mon Sep 17 00:00:00 2001 From: Arun Saravanan Balachandran <52521751+ArunSaravananBalachandran@users.noreply.github.com> Date: Wed, 20 Jan 2021 11:18:24 +0000 Subject: [PATCH] =?UTF-8?q?Fix=20read=20and=20write=20failure=20to=20?= =?UTF-8?q?=E2=80=98fan1=5Ftarget=E2=80=99=20attribute=20of=20=E2=80=98dni?= =?UTF-8?q?=5Fdps460=E2=80=99=20driver.=20(#183)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- ...n-pmbus-dni_dps460-update-pmbus-core.patch | 44 ++++++++++++++----- ...bus-dni_dps460-use-kstrtol-from-user.patch | 31 ------------- patch/series | 1 - 3 files changed, 32 insertions(+), 44 deletions(-) delete mode 100644 patch/driver-hwmon-pmbus-dni_dps460-use-kstrtol-from-user.patch diff --git a/patch/driver-hwmon-pmbus-dni_dps460-update-pmbus-core.patch b/patch/driver-hwmon-pmbus-dni_dps460-update-pmbus-core.patch index 0389ef0b9e00..032904a16db2 100644 --- a/patch/driver-hwmon-pmbus-dni_dps460-update-pmbus-core.patch +++ b/patch/driver-hwmon-pmbus-dni_dps460-update-pmbus-core.patch @@ -1,19 +1,31 @@ -Update pmbus_data data structure to meet kernel implementation - -From: Shuotian Cheng +From 9cfc597034ffe58527ea5ce1799dfcbad770ea30 Mon Sep 17 00:00:00 2001 +From: Arun Saravanan Balachandran +Date: Mon, 18 Jan 2021 09:00:44 +0000 +Subject: [PATCH] Update pmbus_data data structure to meet kernel + implementation The pmbus_data data structure is pasted in the driver. Cumulus patch is for kernel 3.2.x. -Update this data structure to meet current kernel (3.16.x) implementation. +Update this data structure to meet current kernel (4.19.x) implementation. + +Signed-off-by: Arun Saravanan Balachandran --- - drivers/hwmon/pmbus/dni_dps460.c | 42 +++++++++++++++----------------------- - 1 file changed, 17 insertions(+), 25 deletions(-) + drivers/hwmon/pmbus/dni_dps460.c | 48 ++++++++++++++++++---------------------- + 1 file changed, 22 insertions(+), 26 deletions(-) diff --git a/drivers/hwmon/pmbus/dni_dps460.c b/drivers/hwmon/pmbus/dni_dps460.c -index ad29134c4..7332480d4 100644 +index 2c67410..d314c1f 100644 --- a/drivers/hwmon/pmbus/dni_dps460.c +++ b/drivers/hwmon/pmbus/dni_dps460.c -@@ -39,41 +39,32 @@ enum chips { dni_dps460 }; +@@ -19,6 +19,7 @@ + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + ++#include + #include + #include + #include +@@ -39,41 +40,33 @@ enum chips { dni_dps460 }; #define FAN_VALUE_MAX 0x64 /* Needed to access the mutex. Copied from pmbus_core.c */ @@ -44,6 +56,7 @@ index ad29134c4..7332480d4 100644 - struct attribute **attributes; struct attribute_group group; + const struct attribute_group *groups[2]; ++ struct dentry *debugfs; /* debugfs device directory */ - /* - * Sensors cover both sensor and limit registers. @@ -68,15 +81,19 @@ index ad29134c4..7332480d4 100644 struct mutex update_lock; bool valid; -@@ -84,6 +75,7 @@ struct pmbus_data { +@@ -83,7 +76,10 @@ struct pmbus_data { + * A single status register covers multiple attributes, * so we keep them all together. */ - u8 status[PB_NUM_STATUS_REG]; -+ u8 status_register; +- u8 status[PB_NUM_STATUS_REG]; ++ u16 status[PB_NUM_STATUS_REG]; ++ ++ bool has_status_word; /* device uses STATUS_WORD register */ ++ int (*read_status)(struct i2c_client *client, int page); u8 currpage; }; -@@ -123,14 +115,14 @@ static ssize_t set_target(struct device *dev, struct device_attribute *devattr, +@@ -123,14 +119,14 @@ static ssize_t set_target(struct device *dev, struct device_attribute *devattr, struct i2c_client *client = to_i2c_client(dev); struct pmbus_data *data = i2c_get_clientdata(client); int err; @@ -94,3 +111,6 @@ index ad29134c4..7332480d4 100644 mutex_lock(&data->update_lock); +-- +2.7.4 + diff --git a/patch/driver-hwmon-pmbus-dni_dps460-use-kstrtol-from-user.patch b/patch/driver-hwmon-pmbus-dni_dps460-use-kstrtol-from-user.patch deleted file mode 100644 index 8e1d48463748..000000000000 --- a/patch/driver-hwmon-pmbus-dni_dps460-use-kstrtol-from-user.patch +++ /dev/null @@ -1,31 +0,0 @@ -use kstrtol_from_user to convert user data - -From: Guohan Lu - - ---- - drivers/hwmon/pmbus/dni_dps460.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/drivers/hwmon/pmbus/dni_dps460.c b/drivers/hwmon/pmbus/dni_dps460.c -index 9d684ea5c..893864652 100644 ---- a/drivers/hwmon/pmbus/dni_dps460.c -+++ b/drivers/hwmon/pmbus/dni_dps460.c -@@ -118,7 +118,7 @@ static ssize_t set_target(struct device *dev, struct device_attribute *devattr, - unsigned long val; - unsigned long rpm; - -- err = kstrtol(buf, 10, &rpm); -+ err = kstrtol_from_user(buf, count, 10, &rpm); - if (err) - return err; - -@@ -150,7 +150,7 @@ static ssize_t set_pec(struct device *dev, struct device_attribute *dummy, - long val; - int err; - -- err = kstrtol(buf, 10, &val); -+ err = kstrtol_from_user(buf, count, 10, &val); - if (err < 0) - return err; - diff --git a/patch/series b/patch/series index 303a2f47407a..1dd9dfa627f8 100755 --- a/patch/series +++ b/patch/series @@ -22,7 +22,6 @@ driver-hwmon-max6620-update.patch driver-hwmon-max6658-fix-write-convrate.patch driver-hwmon-pmbus-dni_dps460.patch driver-hwmon-pmbus-dni_dps460-update-pmbus-core.patch -driver-hwmon-pmbus-dni_dps460-use-kstrtol-from-user.patch driver-hwmon-pmbus-dps1900.patch driver-support-tun-config-carrier-enable.patch driver-support-optoe.patch