Re: [PATCH] i2c/busses: fix -Wmissing-variable-declarations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Nick,

On Tue, Aug 08, 2023 at 09:56:16AM -0700, Nick Desaulniers wrote:
> I'm looking to enable -Wmissing-variable-declarations behind W=1. 0day
> bot spotted the following instance:
> 
>   drivers/i2c/busses/i2c-amd756.c:286:20: warning: no previous extern
>   declaration for non-static variable 'amd756_smbus'
>   [-Wmissing-variable-declarations]
>   286 | struct i2c_adapter amd756_smbus = {
>       |                    ^
>   drivers/i2c/busses/i2c-amd756.c:286:1: note: declare 'static' if the
>   variable is not intended to be used outside of this translation unit
>   286 | struct i2c_adapter amd756_smbus = {
>       | ^
> 
> This symbol is referenced by more than one translation unit, so create
> then include the correct header for their declarations.
> 
> Reported-by: kernel test robot <lkp@xxxxxxxxx>
> Closes: https://lore.kernel.org/llvm/202308081000.tTL1ElTr-lkp@xxxxxxxxx/
> Signed-off-by: Nick Desaulniers <ndesaulniers@xxxxxxxxxx>

You might want to have a Fixes tag here and

Cc: Jean Delvare <jdelvare@xxxxxxxx>

[...]

> --- /dev/null
> +++ b/drivers/i2c/busses/i2c-amd756.h
> @@ -0,0 +1,3 @@
> +/* SPDX-License-Identifier: GPL-2.0 */

Please, leave a space here.

And you might also want to have something like:

#ifndef __I2C_AMD_756_H__
#define __I2C_AMD_756_H__

> +#include <linux/i2c.h>

space here.

> +extern struct i2c_adapter amd756_smbus;

#endif /* __I2C_AMD_756_H__ */

Jean, any opinion on this patch, I don't really know this driver,
but is there a way to avoid this extern declaration.

Thanks,
Andi



[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux