ACPI: EC: Fix debugfs_create_*() usage
authorGeert Uytterhoeven <geert+renesas@glider.be>
Tue, 2 Jan 2018 15:26:31 +0000 (16:26 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 13 Apr 2018 17:48:10 +0000 (19:48 +0200)
[ Upstream commit 3522f867c13b63cf62acdf1b8ca5664c549a716a ]

acpi_ec.gpe is "unsigned long", hence treating it as "u32" would expose
the wrong half on big-endian 64-bit systems.  Fix this by changing its
type to "u32" and removing the cast, as all other code already uses u32
or sometimes even only u8.

Fixes: 1195a098168fcacf (ACPI: Provide /sys/kernel/debug/ec/...)
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/acpi/ec.c
drivers/acpi/ec_sys.c
drivers/acpi/internal.h

index c3bcb7f5986e704c4b0bdc67956ae5b999702b17..307b3e28f34cec2cb4ffb6ce57c79c4bec7d149c 100644 (file)
@@ -1518,7 +1518,7 @@ static int acpi_ec_setup(struct acpi_ec *ec, bool handle_events)
        }
 
        acpi_handle_info(ec->handle,
-                        "GPE=0x%lx, EC_CMD/EC_SC=0x%lx, EC_DATA=0x%lx\n",
+                        "GPE=0x%x, EC_CMD/EC_SC=0x%lx, EC_DATA=0x%lx\n",
                         ec->gpe, ec->command_addr, ec->data_addr);
        return ret;
 }
index 6c7dd7af789e453ce3d16ae80b849ef38bc4a3c0..dd70d6c2bca03eb227fe834fa14e33636f842d48 100644 (file)
@@ -128,7 +128,7 @@ static int acpi_ec_add_debugfs(struct acpi_ec *ec, unsigned int ec_device_count)
                return -ENOMEM;
        }
 
-       if (!debugfs_create_x32("gpe", 0444, dev_dir, (u32 *)&first_ec->gpe))
+       if (!debugfs_create_x32("gpe", 0444, dev_dir, &first_ec->gpe))
                goto error;
        if (!debugfs_create_bool("use_global_lock", 0444, dev_dir,
                                 &first_ec->global_lock))
index 08b3ca0ead69f3dc9f8139a1b2dff658fe74510c..b012e94b7d9f9787f008ad1208b88eb9fe2e488a 100644 (file)
@@ -158,7 +158,7 @@ static inline void acpi_early_processor_osc(void) {}
    -------------------------------------------------------------------------- */
 struct acpi_ec {
        acpi_handle handle;
-       unsigned long gpe;
+       u32 gpe;
        unsigned long command_addr;
        unsigned long data_addr;
        bool global_lock;