Message ID | 20211128190031.405620-1-hdegoede@redhat.com (mailing list archive) |
---|---|
State | Accepted, archived |
Headers | show |
Series | [1/5] platform/x86: wmi: Replace read_takes_no_args with a flags field | expand |
On Sun, Nov 28, 2021 at 9:00 PM Hans de Goede <hdegoede@redhat.com> wrote: > > Replace the wmi_block.read_takes_no_args bool field with > an unsigned long flags field, used together with test_bit() > and friends. > > This is a preparation patch for fixing a driver->notify() vs ->probe() > race, which requires atomic flag handling. For patches 1,2,3 and 5 (after addressing minor spelling issues) are fine to me, Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> > Signed-off-by: Hans de Goede <hdegoede@redhat.com> > --- > drivers/platform/x86/wmi.c | 11 +++++++---- > 1 file changed, 7 insertions(+), 4 deletions(-) > > diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c > index c34341f4da76..46178e03aeca 100644 > --- a/drivers/platform/x86/wmi.c > +++ b/drivers/platform/x86/wmi.c > @@ -57,6 +57,10 @@ static_assert(sizeof(typeof_member(struct guid_block, guid)) == 16); > static_assert(sizeof(struct guid_block) == 20); > static_assert(__alignof__(struct guid_block) == 1); > > +enum { /* wmi_block flags */ > + WMI_READ_TAKES_NO_ARGS, > +}; > + > struct wmi_block { > struct wmi_device dev; > struct list_head list; > @@ -67,8 +71,7 @@ struct wmi_block { > wmi_notify_handler handler; > void *handler_data; > u64 req_buf_size; > - > - bool read_takes_no_args; > + unsigned long flags; > }; > > > @@ -367,7 +370,7 @@ static acpi_status __query_block(struct wmi_block *wblock, u8 instance, > wq_params[0].type = ACPI_TYPE_INTEGER; > wq_params[0].integer.value = instance; > > - if (instance == 0 && wblock->read_takes_no_args) > + if (instance == 0 && test_bit(WMI_READ_TAKES_NO_ARGS, &wblock->flags)) > input.count = 0; > > /* > @@ -1113,7 +1116,7 @@ static int wmi_create_device(struct device *wmi_bus_dev, > * laptops, WQxx may not be a method at all.) > */ > if (info->type != ACPI_TYPE_METHOD || info->param_count == 0) > - wblock->read_takes_no_args = true; > + set_bit(WMI_READ_TAKES_NO_ARGS, &wblock->flags); > > kfree(info); > > -- > 2.33.1 > -- With Best Regards, Andy Shevchenko
Hi, On 11/30/21 15:52, Andy Shevchenko wrote: > On Sun, Nov 28, 2021 at 9:00 PM Hans de Goede <hdegoede@redhat.com> wrote: >> >> Replace the wmi_block.read_takes_no_args bool field with >> an unsigned long flags field, used together with test_bit() >> and friends. >> >> This is a preparation patch for fixing a driver->notify() vs ->probe() >> race, which requires atomic flag handling. > > For patches 1,2,3 and 5 (after addressing minor spelling issues) are fine to me, > Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Thank you. I've added this series to my review-hans branch now, with your Reviewed-by added and the spelling issues addressed. Regards, Hans > > >> Signed-off-by: Hans de Goede <hdegoede@redhat.com> >> --- >> drivers/platform/x86/wmi.c | 11 +++++++---- >> 1 file changed, 7 insertions(+), 4 deletions(-) >> >> diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c >> index c34341f4da76..46178e03aeca 100644 >> --- a/drivers/platform/x86/wmi.c >> +++ b/drivers/platform/x86/wmi.c >> @@ -57,6 +57,10 @@ static_assert(sizeof(typeof_member(struct guid_block, guid)) == 16); >> static_assert(sizeof(struct guid_block) == 20); >> static_assert(__alignof__(struct guid_block) == 1); >> >> +enum { /* wmi_block flags */ >> + WMI_READ_TAKES_NO_ARGS, >> +}; >> + >> struct wmi_block { >> struct wmi_device dev; >> struct list_head list; >> @@ -67,8 +71,7 @@ struct wmi_block { >> wmi_notify_handler handler; >> void *handler_data; >> u64 req_buf_size; >> - >> - bool read_takes_no_args; >> + unsigned long flags; >> }; >> >> >> @@ -367,7 +370,7 @@ static acpi_status __query_block(struct wmi_block *wblock, u8 instance, >> wq_params[0].type = ACPI_TYPE_INTEGER; >> wq_params[0].integer.value = instance; >> >> - if (instance == 0 && wblock->read_takes_no_args) >> + if (instance == 0 && test_bit(WMI_READ_TAKES_NO_ARGS, &wblock->flags)) >> input.count = 0; >> >> /* >> @@ -1113,7 +1116,7 @@ static int wmi_create_device(struct device *wmi_bus_dev, >> * laptops, WQxx may not be a method at all.) >> */ >> if (info->type != ACPI_TYPE_METHOD || info->param_count == 0) >> - wblock->read_takes_no_args = true; >> + set_bit(WMI_READ_TAKES_NO_ARGS, &wblock->flags); >> >> kfree(info); >> >> -- >> 2.33.1 >> > > > -- > With Best Regards, > Andy Shevchenko >
diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c index c34341f4da76..46178e03aeca 100644 --- a/drivers/platform/x86/wmi.c +++ b/drivers/platform/x86/wmi.c @@ -57,6 +57,10 @@ static_assert(sizeof(typeof_member(struct guid_block, guid)) == 16); static_assert(sizeof(struct guid_block) == 20); static_assert(__alignof__(struct guid_block) == 1); +enum { /* wmi_block flags */ + WMI_READ_TAKES_NO_ARGS, +}; + struct wmi_block { struct wmi_device dev; struct list_head list; @@ -67,8 +71,7 @@ struct wmi_block { wmi_notify_handler handler; void *handler_data; u64 req_buf_size; - - bool read_takes_no_args; + unsigned long flags; }; @@ -367,7 +370,7 @@ static acpi_status __query_block(struct wmi_block *wblock, u8 instance, wq_params[0].type = ACPI_TYPE_INTEGER; wq_params[0].integer.value = instance; - if (instance == 0 && wblock->read_takes_no_args) + if (instance == 0 && test_bit(WMI_READ_TAKES_NO_ARGS, &wblock->flags)) input.count = 0; /* @@ -1113,7 +1116,7 @@ static int wmi_create_device(struct device *wmi_bus_dev, * laptops, WQxx may not be a method at all.) */ if (info->type != ACPI_TYPE_METHOD || info->param_count == 0) - wblock->read_takes_no_args = true; + set_bit(WMI_READ_TAKES_NO_ARGS, &wblock->flags); kfree(info);
Replace the wmi_block.read_takes_no_args bool field with an unsigned long flags field, used together with test_bit() and friends. This is a preparation patch for fixing a driver->notify() vs ->probe() race, which requires atomic flag handling. Signed-off-by: Hans de Goede <hdegoede@redhat.com> --- drivers/platform/x86/wmi.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)