Message ID | 20230612141632.5232-1-hdegoede@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [1/2] platform/x86: int3472: discrete: Fix getting active_value | expand |
Hi, On 6/12/23 16:18, Andy Shevchenko wrote: > On Mon, Jun 12, 2023 at 5:16 PM Hans de Goede <hdegoede@redhat.com> wrote: >> >> acpi_object.integer.value is 64 bit, so to get bits 31-24 >> the value not only needs to be shifted but also masked. > > Why? The type of active_value is u8. How does this make any difference? Ah right I forgot about that, I'll drop this patch and drop the & 0xff for the second patch. Regards, Hans
diff --git a/drivers/platform/x86/intel/int3472/discrete.c b/drivers/platform/x86/intel/int3472/discrete.c index fc839a73e411..4ef60883154d 100644 --- a/drivers/platform/x86/intel/int3472/discrete.c +++ b/drivers/platform/x86/intel/int3472/discrete.c @@ -179,7 +179,7 @@ static int skl_int3472_handle_gpio_resources(struct acpi_resource *ares, int3472_get_func_and_polarity(type, &func, &polarity); /* If bits 31-24 of the _DSM entry are all 0 then the signal is inverted */ - active_value = obj->integer.value >> 24; + active_value = (obj->integer.value >> 24) & 0xff; if (!active_value) polarity ^= GPIO_ACTIVE_LOW;
acpi_object.integer.value is 64 bit, so to get bits 31-24 the value not only needs to be shifted but also masked. Signed-off-by: Hans de Goede <hdegoede@redhat.com> --- drivers/platform/x86/intel/int3472/discrete.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)