lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <DFCAOR6T9DPE.2MOL0K9O3HP1N@bootlin.com>
Date: Wed, 31 Dec 2025 10:29:57 +0100
From: "Luca Ceresoli" <luca.ceresoli@...tlin.com>
To: "Sun Jian" <sun.jian.kdev@...il.com>, "Thierry Reding"
 <thierry.reding@...il.com>
Cc: "Jonathan Hunter" <jonathanh@...dia.com>, "Sowjanya Komatineni"
 <skomatineni@...dia.com>, "Mauro Carvalho Chehab" <mchehab@...nel.org>,
 "Greg Kroah-Hartman" <gregkh@...uxfoundation.org>,
 <linux-media@...r.kernel.org>, <linux-tegra@...r.kernel.org>,
 <linux-staging@...ts.linux.dev>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] staging: media: tegra-video: move tegra210_csi_soc
 declaration to csi.h

Hello Sun,

On Mon Dec 29, 2025 at 8:01 AM CET, Sun Jian wrote:
> Sparse warns that tegra210_csi_soc is not declared in tegra210.c.
> The symbol is referenced from csi.c, so it must remain global. Move the
> declaration to csi.h so users see it via the header and avoid extern
> declarations in .c files.

Can you please add the exact sparse message to your commit log?

>  drivers/staging/media/tegra-video/csi.c | 4 ----
>  drivers/staging/media/tegra-video/csi.h | 4 ++++
>  2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/staging/media/tegra-video/csi.c b/drivers/staging/media/tegra-video/csi.c
> index 604185c00a1a..3c3f6e3fd1ec 100644
> --- a/drivers/staging/media/tegra-video/csi.c
> +++ b/drivers/staging/media/tegra-video/csi.c
> @@ -835,10 +835,6 @@ static void tegra_csi_remove(struct platform_device *pdev)
>  	pm_runtime_disable(&pdev->dev);
>  }
>
> -#if defined(CONFIG_ARCH_TEGRA_210_SOC)
> -extern const struct tegra_csi_soc tegra210_csi_soc;
> -#endif
> -
>  static const struct of_device_id tegra_csi_of_id_table[] = {
>  #if defined(CONFIG_ARCH_TEGRA_210_SOC)
>  	{ .compatible = "nvidia,tegra210-csi", .data = &tegra210_csi_soc },
> diff --git a/drivers/staging/media/tegra-video/csi.h b/drivers/staging/media/tegra-video/csi.h
> index 3e6e5ee1bb1e..609c5952e050 100644
> --- a/drivers/staging/media/tegra-video/csi.h
> +++ b/drivers/staging/media/tegra-video/csi.h
> @@ -130,6 +130,10 @@ struct tegra_csi_soc {
>  	unsigned int tpg_frmrate_table_size;
>  };
>
> +#if defined(CONFIG_ARCH_TEGRA_210_SOC)
> +extern const struct tegra_csi_soc tegra210_csi_soc;
> +#endif

Looks like a good idea indeed.

I checked how other structs shared across .c files are implemented by using
'git grep -w extern -- drivers/staging/media/tegra-video/' and I
discovered:

 * tegra20_vip_soc uses the exact same pattern you are fixing (extern
   declaration in .c file)
 * tegra20_vi_soc and tegra210_vi_soc have the extern declaration in an
   include file already, as you are proposing

So it would be nice to convert tegra20_vip_soc as well, in the same way as
tegra210_csi_soc. It can be a second patch in your v2 series.

Luca

--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ