Message ID | 20250409122314.2848028-3-arnd@kernel.org (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | -Wunused-const-variable warning fixes | expand |
On Wed, Apr 09, 2025 at 02:22:55PM +0200, Arnd Bergmann wrote: > From: Arnd Bergmann <arnd@arndb.de> > > When compile tested with W=1 on x86_64 with driver as built-in: > > stmpe-ts.c:371:34: error: unused variable 'stmpe_ts_ids' [-Werror,-Wunused-const-variable] > > Ideally this would be referenced from the platform_driver, but since > the compatible string is already matched by the mfd driver for its > parent device, that would break probing. > > In this case, the of_device_id table just serves as a module alias > for loading the driver, while the device itself is probed using > the platform device name. > > Remove the table and instead use a module alias that reflects how > the driver is actually probed. ... > +MODULE_ALIAS("platform:stmpe-ts"); Isn't the preferable way to have platform device ID table instead? Krzysztof?
On 09/04/2025 17:33, Andy Shevchenko wrote: > On Wed, Apr 09, 2025 at 02:22:55PM +0200, Arnd Bergmann wrote: >> From: Arnd Bergmann <arnd@arndb.de> >> >> When compile tested with W=1 on x86_64 with driver as built-in: >> >> stmpe-ts.c:371:34: error: unused variable 'stmpe_ts_ids' [-Werror,-Wunused-const-variable] >> >> Ideally this would be referenced from the platform_driver, but since >> the compatible string is already matched by the mfd driver for its >> parent device, that would break probing. >> >> In this case, the of_device_id table just serves as a module alias >> for loading the driver, while the device itself is probed using >> the platform device name. >> >> Remove the table and instead use a module alias that reflects how >> the driver is actually probed. > > ... > >> +MODULE_ALIAS("platform:stmpe-ts"); > > Isn't the preferable way to have platform device ID table instead? > Krzysztof? There is no ID table currently and I (usually) object for having both: ID tables and aliases. In this case it is just simpler to have alias than entire table and MODULE_DEVICE_TABLE(). Also it is unlikely it will grow into many aliases. If it tries, then I will object. Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Best regards, Krzysztof
diff --git a/drivers/input/touchscreen/stmpe-ts.c b/drivers/input/touchscreen/stmpe-ts.c index a94a1997f96b..af0fb38bcfdc 100644 --- a/drivers/input/touchscreen/stmpe-ts.c +++ b/drivers/input/touchscreen/stmpe-ts.c @@ -366,12 +366,7 @@ static struct platform_driver stmpe_ts_driver = { }; module_platform_driver(stmpe_ts_driver); -static const struct of_device_id stmpe_ts_ids[] = { - { .compatible = "st,stmpe-ts", }, - { }, -}; -MODULE_DEVICE_TABLE(of, stmpe_ts_ids); - +MODULE_ALIAS("platform:stmpe-ts"); MODULE_AUTHOR("Luotao Fu <l.fu@pengutronix.de>"); MODULE_DESCRIPTION("STMPEXXX touchscreen driver"); MODULE_LICENSE("GPL");