diff mbox

[v2] platform/x86: wmi: Fix printing info about WDG structure

Message ID 1497092231-505-1-git-send-email-pali.rohar@gmail.com (mailing list archive)
State Accepted, archived
Delegated to: Darren Hart
Headers show

Commit Message

Pali Rohár June 10, 2017, 10:57 a.m. UTC
object_id and notify_id are in one union structure and their meaning is
defined by flags. Therefore do not print notify_id for non-event block and
do not print object_id for event block. Remove also reserved member as it
does not have any defined meaning or type yet.

As object_id and notify_id union members overlaps and have different types,
it caused that kernel print to dmesg binary data. This patch eliminates it.

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
---
Changes since v2:
 * Use %2pE instead of %c%c as suggested by Andy Shevchenko
---
 drivers/platform/x86/wmi.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Andy Shevchenko June 10, 2017, 11:22 a.m. UTC | #1
On Sat, Jun 10, 2017 at 1:57 PM, Pali Rohár <pali.rohar@gmail.com> wrote:
> object_id and notify_id are in one union structure and their meaning is
> defined by flags. Therefore do not print notify_id for non-event block and
> do not print object_id for event block. Remove also reserved member as it
> does not have any defined meaning or type yet.
>
> As object_id and notify_id union members overlaps and have different types,
> it caused that kernel print to dmesg binary data. This patch eliminates it.
>
> Signed-off-by: Pali Rohár <pali.rohar@gmail.com>

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

> ---
> Changes since v2:
>  * Use %2pE instead of %c%c as suggested by Andy Shevchenko
> ---
>  drivers/platform/x86/wmi.c |    7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c
> index ceeb8c1..6d6f2a9 100644
> --- a/drivers/platform/x86/wmi.c
> +++ b/drivers/platform/x86/wmi.c
> @@ -352,9 +352,10 @@ acpi_status wmi_set_block(const char *guid_string, u8 instance,
>  static void wmi_dump_wdg(const struct guid_block *g)
>  {
>         pr_info("%pUL:\n", g->guid);
> -       pr_info("\tobject_id: %c%c\n", g->object_id[0], g->object_id[1]);
> -       pr_info("\tnotify_id: %02X\n", g->notify_id);
> -       pr_info("\treserved: %02X\n", g->reserved);
> +       if (g->flags & ACPI_WMI_EVENT)
> +               pr_info("\tnotify_id: 0x%02X\n", g->notify_id);
> +       else
> +               pr_info("\tobject_id: %2pE\n", g->object_id);
>         pr_info("\tinstance_count: %d\n", g->instance_count);
>         pr_info("\tflags: %#x", g->flags);
>         if (g->flags) {
> --
> 1.7.9.5
>
Darren Hart June 13, 2017, 4:52 p.m. UTC | #2
On Sat, Jun 10, 2017 at 02:22:50PM +0300, Andy Shevchenko wrote:
> On Sat, Jun 10, 2017 at 1:57 PM, Pali Rohár <pali.rohar@gmail.com> wrote:
> > object_id and notify_id are in one union structure and their meaning is
> > defined by flags. Therefore do not print notify_id for non-event block and
> > do not print object_id for event block. Remove also reserved member as it
> > does not have any defined meaning or type yet.
> >
> > As object_id and notify_id union members overlaps and have different types,
> > it caused that kernel print to dmesg binary data. This patch eliminates it.
> >
> > Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
> 
> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

Thanks Pali, nice fix. Queued to testing.
diff mbox

Patch

diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c
index ceeb8c1..6d6f2a9 100644
--- a/drivers/platform/x86/wmi.c
+++ b/drivers/platform/x86/wmi.c
@@ -352,9 +352,10 @@  acpi_status wmi_set_block(const char *guid_string, u8 instance,
 static void wmi_dump_wdg(const struct guid_block *g)
 {
 	pr_info("%pUL:\n", g->guid);
-	pr_info("\tobject_id: %c%c\n", g->object_id[0], g->object_id[1]);
-	pr_info("\tnotify_id: %02X\n", g->notify_id);
-	pr_info("\treserved: %02X\n", g->reserved);
+	if (g->flags & ACPI_WMI_EVENT)
+		pr_info("\tnotify_id: 0x%02X\n", g->notify_id);
+	else
+		pr_info("\tobject_id: %2pE\n", g->object_id);
 	pr_info("\tinstance_count: %d\n", g->instance_count);
 	pr_info("\tflags: %#x", g->flags);
 	if (g->flags) {