* [PATCH] platform/x86: dell-wmi-sysman: work around for BIOS bug
@ 2020-12-02 6:56 Divya Bharathi
2020-12-02 12:21 ` Hans de Goede
0 siblings, 1 reply; 4+ messages in thread
From: Divya Bharathi @ 2020-12-02 6:56 UTC (permalink / raw)
To: dvhart, Hans de Goede
Cc: LKML, Linux Next Mailing List, platform-driver-x86,
Divya Bharathi, Mario Limonciello, Prasanth KSR
BIOS sets incorrect value (zero) when SET value passed for integer attribute
with + sign. Added workaround to remove + sign before passing input to BIOS
Co-developed-by: Mario Limonciello <mario.limonciello@dell.com>
Signed-off-by: Mario Limonciello <mario.limonciello@dell.com>
Co-developed-by: Prasanth KSR <prasanth.ksr@dell.com>
Signed-off-by: Prasanth KSR <prasanth.ksr@dell.com>
Signed-off-by: Divya Bharathi <divya.bharathi@dell.com>
---
drivers/platform/x86/dell-wmi-sysman/int-attributes.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/platform/x86/dell-wmi-sysman/int-attributes.c b/drivers/platform/x86/dell-wmi-sysman/int-attributes.c
index ea773d8e8d3a..f30d155135c3 100644
--- a/drivers/platform/x86/dell-wmi-sysman/int-attributes.c
+++ b/drivers/platform/x86/dell-wmi-sysman/int-attributes.c
@@ -39,7 +39,7 @@ static ssize_t current_value_show(struct kobject *kobj, struct kobj_attribute *a
* @instance_id: The instance on which input is validated
* @buf: Input value
*/
-static int validate_integer_input(int instance_id, const char *buf)
+static int validate_integer_input(int instance_id, char *buf)
{
int in_val;
int ret;
@@ -51,6 +51,12 @@ static int validate_integer_input(int instance_id, const char *buf)
in_val > wmi_priv.integer_data[instance_id].max_value)
return -EINVAL;
+ /* workaround for BIOS error.
+ * validate input to avoid setting 0 when integer input passed with + sign
+ */
+ if (*buf == '+')
+ memmove(buf, (buf + 1), strlen(buf));
+
return ret;
}
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] platform/x86: dell-wmi-sysman: work around for BIOS bug
2020-12-02 6:56 [PATCH] platform/x86: dell-wmi-sysman: work around for BIOS bug Divya Bharathi
@ 2020-12-02 12:21 ` Hans de Goede
0 siblings, 0 replies; 4+ messages in thread
From: Hans de Goede @ 2020-12-02 12:21 UTC (permalink / raw)
To: Divya Bharathi, dvhart
Cc: LKML, Linux Next Mailing List, platform-driver-x86,
Divya Bharathi, Mario Limonciello, Prasanth KSR
Hi,
On 12/2/20 7:56 AM, Divya Bharathi wrote:
> BIOS sets incorrect value (zero) when SET value passed for integer attribute
> with + sign. Added workaround to remove + sign before passing input to BIOS
>
> Co-developed-by: Mario Limonciello <mario.limonciello@dell.com>
> Signed-off-by: Mario Limonciello <mario.limonciello@dell.com>
> Co-developed-by: Prasanth KSR <prasanth.ksr@dell.com>
> Signed-off-by: Prasanth KSR <prasanth.ksr@dell.com>
> Signed-off-by: Divya Bharathi <divya.bharathi@dell.com>
> ---
> drivers/platform/x86/dell-wmi-sysman/int-attributes.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/platform/x86/dell-wmi-sysman/int-attributes.c b/drivers/platform/x86/dell-wmi-sysman/int-attributes.c
> index ea773d8e8d3a..f30d155135c3 100644
> --- a/drivers/platform/x86/dell-wmi-sysman/int-attributes.c
> +++ b/drivers/platform/x86/dell-wmi-sysman/int-attributes.c
> @@ -39,7 +39,7 @@ static ssize_t current_value_show(struct kobject *kobj, struct kobj_attribute *a
> * @instance_id: The instance on which input is validated
> * @buf: Input value
> */
> -static int validate_integer_input(int instance_id, const char *buf)
> +static int validate_integer_input(int instance_id, char *buf)
> {
> int in_val;
> int ret;
> @@ -51,6 +51,12 @@ static int validate_integer_input(int instance_id, const char *buf)
> in_val > wmi_priv.integer_data[instance_id].max_value)
> return -EINVAL;
>
> + /* workaround for BIOS error.
> + * validate input to avoid setting 0 when integer input passed with + sign
> + */
> + if (*buf == '+')
> + memmove(buf, (buf + 1), strlen(buf));
Can you please use "strlen(buf + 1) + 1" as last argument to the memmove?
I know the effect is the same but that makes it much clearer that you
are also moving the terminating 0 (which at first I thought you were not).
Otherwise this looks good to me.
Regards,
Hans
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] platform/x86: dell-wmi-sysman: work around for BIOS bug
2020-12-02 13:19 Divya Bharathi
@ 2020-12-07 14:05 ` Hans de Goede
0 siblings, 0 replies; 4+ messages in thread
From: Hans de Goede @ 2020-12-07 14:05 UTC (permalink / raw)
To: Divya Bharathi, dvhart
Cc: LKML, Linux Next Mailing List, platform-driver-x86,
Divya Bharathi, Mario Limonciello, Prasanth KSR
Hi,
On 12/2/20 2:19 PM, Divya Bharathi wrote:
> BIOS sets incorrect value (zero) when SET value passed for integer attribute
> with + sign. Added workaround to remove + sign before passing input to BIOS
>
> Co-developed-by: Mario Limonciello <mario.limonciello@dell.com>
> Signed-off-by: Mario Limonciello <mario.limonciello@dell.com>
> Co-developed-by: Prasanth KSR <prasanth.ksr@dell.com>
> Signed-off-by: Prasanth KSR <prasanth.ksr@dell.com>
> Signed-off-by: Divya Bharathi <divya.bharathi@dell.com>
Thank you for your patch, I've applied this patch to my review-hans
branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans
Note it will show up in my review-hans branch once I've pushed my
local branch there, which might take a while.
Once I've run some tests on this branch the patches there will be
added to the platform-drivers-x86/for-next branch and eventually
will be included in the pdx86 pull-request to Linus for the next
merge-window.
Regards,
Hans
> ---
> drivers/platform/x86/dell-wmi-sysman/int-attributes.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/platform/x86/dell-wmi-sysman/int-attributes.c b/drivers/platform/x86/dell-wmi-sysman/int-attributes.c
> index ea773d8e8d3a..75aedbb733be 100644
> --- a/drivers/platform/x86/dell-wmi-sysman/int-attributes.c
> +++ b/drivers/platform/x86/dell-wmi-sysman/int-attributes.c
> @@ -39,7 +39,7 @@ static ssize_t current_value_show(struct kobject *kobj, struct kobj_attribute *a
> * @instance_id: The instance on which input is validated
> * @buf: Input value
> */
> -static int validate_integer_input(int instance_id, const char *buf)
> +static int validate_integer_input(int instance_id, char *buf)
> {
> int in_val;
> int ret;
> @@ -51,6 +51,12 @@ static int validate_integer_input(int instance_id, const char *buf)
> in_val > wmi_priv.integer_data[instance_id].max_value)
> return -EINVAL;
>
> + /* workaround for BIOS error.
> + * validate input to avoid setting 0 when integer input passed with + sign
> + */
> + if (*buf == '+')
> + memmove(buf, (buf + 1), strlen(buf + 1) + 1);
> +
> return ret;
> }
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] platform/x86: dell-wmi-sysman: work around for BIOS bug
@ 2020-12-02 13:19 Divya Bharathi
2020-12-07 14:05 ` Hans de Goede
0 siblings, 1 reply; 4+ messages in thread
From: Divya Bharathi @ 2020-12-02 13:19 UTC (permalink / raw)
To: dvhart, Hans de Goede
Cc: LKML, Linux Next Mailing List, platform-driver-x86,
Divya Bharathi, Mario Limonciello, Prasanth KSR
BIOS sets incorrect value (zero) when SET value passed for integer attribute
with + sign. Added workaround to remove + sign before passing input to BIOS
Co-developed-by: Mario Limonciello <mario.limonciello@dell.com>
Signed-off-by: Mario Limonciello <mario.limonciello@dell.com>
Co-developed-by: Prasanth KSR <prasanth.ksr@dell.com>
Signed-off-by: Prasanth KSR <prasanth.ksr@dell.com>
Signed-off-by: Divya Bharathi <divya.bharathi@dell.com>
---
drivers/platform/x86/dell-wmi-sysman/int-attributes.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/platform/x86/dell-wmi-sysman/int-attributes.c b/drivers/platform/x86/dell-wmi-sysman/int-attributes.c
index ea773d8e8d3a..75aedbb733be 100644
--- a/drivers/platform/x86/dell-wmi-sysman/int-attributes.c
+++ b/drivers/platform/x86/dell-wmi-sysman/int-attributes.c
@@ -39,7 +39,7 @@ static ssize_t current_value_show(struct kobject *kobj, struct kobj_attribute *a
* @instance_id: The instance on which input is validated
* @buf: Input value
*/
-static int validate_integer_input(int instance_id, const char *buf)
+static int validate_integer_input(int instance_id, char *buf)
{
int in_val;
int ret;
@@ -51,6 +51,12 @@ static int validate_integer_input(int instance_id, const char *buf)
in_val > wmi_priv.integer_data[instance_id].max_value)
return -EINVAL;
+ /* workaround for BIOS error.
+ * validate input to avoid setting 0 when integer input passed with + sign
+ */
+ if (*buf == '+')
+ memmove(buf, (buf + 1), strlen(buf + 1) + 1);
+
return ret;
}
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-12-07 14:07 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-02 6:56 [PATCH] platform/x86: dell-wmi-sysman: work around for BIOS bug Divya Bharathi
2020-12-02 12:21 ` Hans de Goede
2020-12-02 13:19 Divya Bharathi
2020-12-07 14:05 ` Hans de Goede
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.