On Tue Feb 11, 2025 at 11:30 AM -05, Andy Shevchenko wrote: > On Fri, Feb 07, 2025 at 10:45:58AM -0500, Kurt Borja wrote: >> Add WMI drivers for LEGACY and WMAX devices. >> >> This involves moving the platform device registration to a helper >> function that is now called from the driver's preferred WMI device >> driver probe. In the case of the WMAX this is done only if >> `!quirks->thermal` because the newer WMAX interface doesn't support any >> of the LED features of this driver. This also eliminates the need to >> check for `quirks->num_zones > 0` inside alienfx_probe(). >> >> Only one WMI driver is registered on module initialization to prevent >> registering a duplicate platform device. >> >> Additionally, create_thermal_profile() now takes wmi_device * instead of >> platform_device *. > > ... > >> +static int alienware_alienfx_setup(struct alienfx_platdata *pdata) >> +{ >> + struct device *dev = &pdata->wdev->dev; >> + struct platform_device *pdev; >> int ret; >> >> + pdev = platform_device_register_data(NULL, "alienware-wmi", >> + PLATFORM_DEVID_NONE, pdata, >> + sizeof(*pdata)); >> + if (IS_ERR(pdev)) >> + return PTR_ERR(pdev); >> + >> + dev_set_drvdata(dev, pdev); >> + ret = devm_add_action_or_reset(dev, alienware_alienfx_remove, pdev); >> + if (ret) >> + return ret; >> + >> + return 0; > > return devm_add_action_or_reset(...); Right! > >> +} > > ... > >> +static const struct wmi_device_id alienware_legacy_device_id_table[] = { >> + { LEGACY_CONTROL_GUID, NULL }, > > Drop that ' , NULL' part, it makes an additional burden if the type of the > driver_data is ever changed. Makes sense. > >> + { }, > > No comma in the terminator entries. Makes sense. > >> +}; > > ... > >> +static const struct wmi_device_id alienware_wmax_device_id_table[] = { >> + { WMAX_CONTROL_GUID, NULL }, >> + { }, >> +}; > > Ditto. > > ... > >> +static int __init alienware_wmax_wmi_init(void) >> +{ >> + return wmi_driver_register(&alienware_wmax_wmi_driver); >> +} >> + >> +static void __exit alienware_wmax_wmi_exit(void) >> +{ >> + wmi_driver_unregister(&alienware_wmax_wmi_driver); >> +} > > I believe we have module_wmi_driver() which can be used after the split > (haven't checked those patches yet). This module has two WMI drivers, so I believe this can't be used. -- ~ Kurt