[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0a3c11c7-2669-ca85-69d1-3b3faa2f7a3c@redhat.com>
Date: Sun, 29 May 2022 09:34:04 +0200
From: Javier Martinez Canillas <javierm@...hat.com>
To: Nathan Chancellor <nathan@...nel.org>
Cc: kernel test robot <lkp@...el.com>, llvm@...ts.linux.dev,
kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
Geert Uytterhoeven <geert+renesas@...der.be>
Subject: Re: drivers/gpu/drm/solomon/ssd130x-spi.c:154:35: warning: unused
variable 'ssd130x_spi_table'
Hello Nathan,
On 5/29/22 03:01, Nathan Chancellor wrote:
> On Sat, May 28, 2022 at 11:23:04PM +0200, Javier Martinez Canillas wrote:
>> Hello,
>>
>> On 5/28/22 22:58, kernel test robot wrote:
>>> Hi Javier,
>>>
>>> FYI, the error/warning still remains.
>>>
>>
>> Yes, but in my opinion is a false positive.
>
> I don't think it is a false positive for this particular configuration.
> MODULE_DEVICE_TABLE expands to nothing when the file it is included in
> is built into the kernel, as opposed to a module, so the variable truly
> is unused.
>
I know that is not used but my point is that we shouldn't need that table
in the first place. The only reason we add it is to workaround a bug in
the SPI core.
> $ curl -LSs https://download.01.org/0day-ci/archive/20220529/202205290422.eoxGqDMR-lkp@intel.com/config | rg CONFIG_DRM_SSD130X_SPI
> CONFIG_DRM_SSD130X_SPI=y
>
> 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.
> Cheers,
> Nathan
>
--
Best regards,
Javier Martinez Canillas
Linux Engineering
Red Hat
Powered by blists - more mailing lists