Re: [PATCH v2 1/3] platform/x86: wmi: move struct wmi_device_id to mod_devicetable.h

From: Mattias Jacobsson
Date: Mon Jan 28 2019 - 08:55:07 EST


Hi Andy,

Thanks for reviewing!

On 2019-01-27, Andy Shevchenko wrote:
> On Sun, Jan 27, 2019 at 9:04 PM Mattias Jacobsson <2pi@xxxxxx> wrote:
> >
> > In preparation for adding WMI support to MODULE_DEVICE_TABLE() move the
> > definition of struct wmi_device_id to mod_devicetable.h and inline
> > guid_string in the struct.
> >
> > Changing guid_string to an inline char array changes the loop conditions
> > when looping over an array of struct wmi_device_id. Therefore update
> > wmi_dev_match()'s loop to check for an empty guid_string instead of a
> > NULL pointer.
>
> Below some minor comments.
>
> > - while (id->guid_string) {
> > + while (id->guid_string[0] != '\0') {
>
> Hmm.. I would rather put it as
>
> while (*id->guid_string) {

Sure.

>
> > +#define WMI_MODULE_PREFIX "wmi:"
>
> > +#define WMI_GUID_STRING_LEN 36
>
> Isn't this already defined in UUID namespace?
> (include/linux/uuid.h IIRC)

Kind of, UUID_STRING_LEN is defined in uuid.h. It is included behind a
#ifdef __KERNEL__, but others seam to use things included through it so
I guess it is alright...

Let me know how you want it.

>
> > #include <linux/device.h>
> > #include <linux/acpi.h>
>
> > +#include <linux/mod_devicetable.h>
>
> Not sure it's needed since acpi.h includes that.

It is included in acpi.h(behind CONFIG_ACPI), I thought it was cleaner
with it included explicitly. Plus that we aren't relying on others to
include it.

Let me know how you want it.

>
> --
> With Best Regards,
> Andy Shevchenko

Thanks,
Mattias