* drivers/gpu/drm/solomon/ssd130x-spi.c:154:35: warning: unused variable 'ssd130x_spi_table'
@ 2022-05-28 20:58 kernel test robot
2022-05-28 21:23 ` Javier Martinez Canillas
0 siblings, 1 reply; 5+ messages in thread
From: kernel test robot @ 2022-05-28 20:58 UTC (permalink / raw)
To: Javier Martinez Canillas
Cc: llvm, kbuild-all, linux-kernel, Geert Uytterhoeven
Hi Javier,
FYI, the error/warning still remains.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 9d004b2f4fea97cde123e7f1939b80e77bf2e695
commit: 74373977d2ca26e5735377f8874be70bc2f030f5 drm/solomon: Add SSD130x OLED displays SPI support
date: 5 weeks ago
config: hexagon-randconfig-r033-20220529 (https://download.01.org/0day-ci/archive/20220529/202205290422.eoxGqDMR-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 0fbe3f3f486e01448121f7931a4ca29fac1504ab)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=74373977d2ca26e5735377f8874be70bc2f030f5
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 74373977d2ca26e5735377f8874be70bc2f030f5
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/gpu/drm/solomon/
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> drivers/gpu/drm/solomon/ssd130x-spi.c:154:35: warning: unused variable 'ssd130x_spi_table' [-Wunused-const-variable]
static const struct spi_device_id ssd130x_spi_table[] = {
^
1 warning generated.
vim +/ssd130x_spi_table +154 drivers/gpu/drm/solomon/ssd130x-spi.c
145
146 /*
147 * The SPI core always reports a MODALIAS uevent of the form "spi:<dev>", even
148 * if the device was registered via OF. This means that the module will not be
149 * auto loaded, unless it contains an alias that matches the MODALIAS reported.
150 *
151 * To workaround this issue, add a SPI device ID table. Even when this should
152 * not be needed for this driver to match the registered SPI devices.
153 */
> 154 static const struct spi_device_id ssd130x_spi_table[] = {
155 { "sh1106", SH1106_ID },
156 { "ssd1305", SSD1305_ID },
157 { "ssd1306", SSD1306_ID },
158 { "ssd1307", SSD1307_ID },
159 { "ssd1309", SSD1309_ID },
160 { /* sentinel */ }
161 };
162 MODULE_DEVICE_TABLE(spi, ssd130x_spi_table);
163
--
0-DAY CI Kernel Test Service
https://01.org/lkp
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: drivers/gpu/drm/solomon/ssd130x-spi.c:154:35: warning: unused variable 'ssd130x_spi_table'
2022-05-28 20:58 drivers/gpu/drm/solomon/ssd130x-spi.c:154:35: warning: unused variable 'ssd130x_spi_table' kernel test robot
@ 2022-05-28 21:23 ` Javier Martinez Canillas
2022-05-29 1:01 ` Nathan Chancellor
0 siblings, 1 reply; 5+ messages in thread
From: Javier Martinez Canillas @ 2022-05-28 21:23 UTC (permalink / raw)
To: kernel test robot; +Cc: llvm, kbuild-all, linux-kernel, Geert Uytterhoeven
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.
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: 9d004b2f4fea97cde123e7f1939b80e77bf2e695
> commit: 74373977d2ca26e5735377f8874be70bc2f030f5 drm/solomon: Add SSD130x OLED displays SPI support
> date: 5 weeks ago
> config: hexagon-randconfig-r033-20220529 (https://download.01.org/0day-ci/archive/20220529/202205290422.eoxGqDMR-lkp@intel.com/config)
> compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 0fbe3f3f486e01448121f7931a4ca29fac1504ab)
> reproduce (this is a W=1 build):
> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=74373977d2ca26e5735377f8874be70bc2f030f5
> git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> git fetch --no-tags linus master
> git checkout 74373977d2ca26e5735377f8874be70bc2f030f5
> # save the config file
> mkdir build_dir && cp config build_dir/.config
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/gpu/drm/solomon/
>
> If you fix the issue, kindly add following tag where applicable
> Reported-by: kernel test robot <lkp@intel.com>
>
> All warnings (new ones prefixed by >>):
>
>>> drivers/gpu/drm/solomon/ssd130x-spi.c:154:35: warning: unused variable 'ssd130x_spi_table' [-Wunused-const-variable]
> static const struct spi_device_id ssd130x_spi_table[] = {
> ^
> 1 warning generated.
>
>
> vim +/ssd130x_spi_table +154 drivers/gpu/drm/solomon/ssd130x-spi.c
>
> 145
> 146 /*
> 147 * The SPI core always reports a MODALIAS uevent of the form "spi:<dev>", even
> 148 * if the device was registered via OF. This means that the module will not be
> 149 * auto loaded, unless it contains an alias that matches the MODALIAS reported.
> 150 *
> 151 * To workaround this issue, add a SPI device ID table. Even when this should
> 152 * not be needed for this driver to match the registered SPI devices.
> 153 */
> > 154 static const struct spi_device_id ssd130x_spi_table[] = {
This comment is quite clear about it, the table only exists due a limitation in how
the SPI subsystem reports the module aliases. It always report a "spi:<device> even
if it was registered by OF, and that's the only reason why we need it.
Setting the struct spi_driver .id field just to make this warning go away would be
the wrong thing to do IMO, since always the struct of_device_id should be used.
--
Best regards,
Javier Martinez Canillas
Linux Engineering
Red Hat
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: drivers/gpu/drm/solomon/ssd130x-spi.c:154:35: warning: unused variable 'ssd130x_spi_table'
2022-05-28 21:23 ` Javier Martinez Canillas
@ 2022-05-29 1:01 ` Nathan Chancellor
2022-05-29 7:34 ` Javier Martinez Canillas
0 siblings, 1 reply; 5+ messages in thread
From: Nathan Chancellor @ 2022-05-29 1:01 UTC (permalink / raw)
To: Javier Martinez Canillas
Cc: kernel test robot, llvm, kbuild-all, linux-kernel, Geert Uytterhoeven
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.
$ 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:
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 :)
Cheers,
Nathan
> > tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> > head: 9d004b2f4fea97cde123e7f1939b80e77bf2e695
> > commit: 74373977d2ca26e5735377f8874be70bc2f030f5 drm/solomon: Add SSD130x OLED displays SPI support
> > date: 5 weeks ago
> > config: hexagon-randconfig-r033-20220529 (https://download.01.org/0day-ci/archive/20220529/202205290422.eoxGqDMR-lkp@intel.com/config)
> > compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 0fbe3f3f486e01448121f7931a4ca29fac1504ab)
> > reproduce (this is a W=1 build):
> > wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> > chmod +x ~/bin/make.cross
> > # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=74373977d2ca26e5735377f8874be70bc2f030f5
> > git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> > git fetch --no-tags linus master
> > git checkout 74373977d2ca26e5735377f8874be70bc2f030f5
> > # save the config file
> > mkdir build_dir && cp config build_dir/.config
> > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/gpu/drm/solomon/
> >
> > If you fix the issue, kindly add following tag where applicable
> > Reported-by: kernel test robot <lkp@intel.com>
> >
> > All warnings (new ones prefixed by >>):
> >
> >>> drivers/gpu/drm/solomon/ssd130x-spi.c:154:35: warning: unused variable 'ssd130x_spi_table' [-Wunused-const-variable]
> > static const struct spi_device_id ssd130x_spi_table[] = {
> > ^
> > 1 warning generated.
> >
> >
> > vim +/ssd130x_spi_table +154 drivers/gpu/drm/solomon/ssd130x-spi.c
> >
> > 145
> > 146 /*
> > 147 * The SPI core always reports a MODALIAS uevent of the form "spi:<dev>", even
> > 148 * if the device was registered via OF. This means that the module will not be
> > 149 * auto loaded, unless it contains an alias that matches the MODALIAS reported.
> > 150 *
> > 151 * To workaround this issue, add a SPI device ID table. Even when this should
> > 152 * not be needed for this driver to match the registered SPI devices.
> > 153 */
> > > 154 static const struct spi_device_id ssd130x_spi_table[] = {
>
> This comment is quite clear about it, the table only exists due a limitation in how
> the SPI subsystem reports the module aliases. It always report a "spi:<device> even
> if it was registered by OF, and that's the only reason why we need it.
>
> Setting the struct spi_driver .id field just to make this warning go away would be
> the wrong thing to do IMO, since always the struct of_device_id should be used.
>
> --
> Best regards,
>
> Javier Martinez Canillas
> Linux Engineering
> Red Hat
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: drivers/gpu/drm/solomon/ssd130x-spi.c:154:35: warning: unused variable 'ssd130x_spi_table'
2022-05-29 1:01 ` Nathan Chancellor
@ 2022-05-29 7:34 ` Javier Martinez Canillas
2022-05-30 14:13 ` Javier Martinez Canillas
0 siblings, 1 reply; 5+ messages in thread
From: Javier Martinez Canillas @ 2022-05-29 7:34 UTC (permalink / raw)
To: Nathan Chancellor
Cc: kernel test robot, llvm, kbuild-all, linux-kernel, Geert Uytterhoeven
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: drivers/gpu/drm/solomon/ssd130x-spi.c:154:35: warning: unused variable 'ssd130x_spi_table'
2022-05-29 7:34 ` Javier Martinez Canillas
@ 2022-05-30 14:13 ` Javier Martinez Canillas
0 siblings, 0 replies; 5+ messages in thread
From: Javier Martinez Canillas @ 2022-05-30 14:13 UTC (permalink / raw)
To: Nathan Chancellor
Cc: kernel test robot, llvm, kbuild-all, linux-kernel, Geert Uytterhoeven
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
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-05-30 15:14 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-28 20:58 drivers/gpu/drm/solomon/ssd130x-spi.c:154:35: warning: unused variable 'ssd130x_spi_table' kernel test robot
2022-05-28 21:23 ` Javier Martinez Canillas
2022-05-29 1:01 ` Nathan Chancellor
2022-05-29 7:34 ` Javier Martinez Canillas
2022-05-30 14:13 ` Javier Martinez Canillas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).