Re: drivers/gpu/drm/solomon/ssd130x-spi.c:154:35: warning: unused variable 'ssd130x_spi_table'

From: Javier Martinez Canillas
Date: Mon May 30 2022 - 11:14:56 EST


On 5/29/22 09:34, Javier Martinez Canillas wrote:
> Hello Nathan,

[snip]

>>
>> You'll see the same warning with GCC and a similar configuration:
>>
>
> Yes, I'm not saying that the compiler warning is a false positive but
> that the reported error for this driver is. Since the correct fix on
> a driver that support SPI platform devices would be to use the table
> and set it to the struct spi_driver .id field.
>
>> drivers/gpu/drm/solomon/ssd130x-spi.c:154:35: error: ‘ssd130x_spi_table’ defined but not used [-Werror=unused-const-variable=]
>> 154 | static const struct spi_device_id ssd130x_spi_table[] = {
>> | ^~~~~~~~~~~~~~~~~
>> cc1: all warnings being treated as errors
>>
>> At the end of the day, this warning only shows up under W=1, so take it
>> as you will. The kernel test robot is a sign, not a cop :)
>>
>
> I guess something that could be done is to guard the definition of the
> ssd130x_spi_table with a `if IS_MODULE(CONFIG_DRM_SSD130X_SPI)`, since
> if the symbol is 'y' and the driver built-in, then won't be used indeed.
>

I posted https://lists.freedesktop.org/archives/dri-devel/2022-May/357088.html
to fix this compile warning. Thanks folks!

--
Best regards,

Javier Martinez Canillas
Linux Engineering
Red Hat