lkml.org 
[lkml]   [2020]   [Mar]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 5/9] x86/quirks: Convert DMI matching to use a table
On Mon, Mar 16, 2020 at 05:27:30PM +0200, Alexander Shishkin wrote:
> Andy Shevchenko <andriy.shevchenko@linux.intel.com> writes:
>
> > +static const struct dmi_system_id x86_machine_table[] __initconst = {
> > + {
> > + .ident = "x86 Apple Macintosh",
> > + .matches = {
> > + DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."),
> > + },
> > + .driver_data = &x86_apple_machine,
> > + },
> > + {
> > + .ident = "x86 Apple Macintosh",
> > + .matches = {
> > + DMI_MATCH(DMI_SYS_VENDOR, "Apple Computer, Inc."),
> > + },
> > + .driver_data = &x86_apple_machine,
> > + },
> > + {}
> > +};
> > +
> > +static void __init early_platform_detect_quirk(void)
> > +{
> > + const struct dmi_system_id *id;
> > +
> > + id = dmi_first_match(x86_machine_table);
> > + if (!id)
> > + return;
> > +
> > + printk(KERN_DEBUG "Detected %s platform\n", id->ident);
> > + *((bool *)id->driver_data) = true;
>
> I'd suggest that x86_apple_machine and the ones that you add further
> down this patchset, be made functions instead. That way you could at
> first hide the global bool(s) and then replace this with something a
> little more type safe.

I'm not sure we will get any benefit of the proposed change. Also it will be
more intrusive since we have dozen of modules that are using it in the form of
exported boolean.

--
With Best Regards,
Andy Shevchenko


\
 
 \ /
  Last update: 2020-03-16 16:54    [W:0.067 / U:1.232 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site