From: "Luca Ceresoli" <luca.ceresoli@bootlin.com>
To: "Sun Jian" <sun.jian.kdev@gmail.com>,
"Thierry Reding" <thierry.reding@gmail.com>
Cc: "Jonathan Hunter" <jonathanh@nvidia.com>,
"Sowjanya Komatineni" <skomatineni@nvidia.com>,
"Mauro Carvalho Chehab" <mchehab@kernel.org>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
<linux-media@vger.kernel.org>, <linux-tegra@vger.kernel.org>,
<linux-staging@lists.linux.dev>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] staging: media: tegra-video: move tegra210_csi_soc declaration to csi.h
Date: Wed, 31 Dec 2025 10:29:57 +0100 [thread overview]
Message-ID: <DFCAOR6T9DPE.2MOL0K9O3HP1N@bootlin.com> (raw)
In-Reply-To: <20251229070125.98741-1-sun.jian.kdev@gmail.com>
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
next prev parent reply other threads:[~2025-12-31 9:30 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-29 7:01 [PATCH] staging: media: tegra-video: move tegra210_csi_soc declaration to csi.h Sun Jian
2025-12-31 9:29 ` Luca Ceresoli [this message]
2025-12-31 12:39 ` [PATCH v2 0/2] staging: media: tegra-video: clean up shared SoC declarations Sun Jian
2025-12-31 12:39 ` [PATCH v2 1/2] staging: media: tegra-video: move tegra210_csi_soc declaration to csi.h Sun Jian
2025-12-31 14:01 ` Luca Ceresoli
2025-12-31 12:39 ` [PATCH v2 2/2] staging: media: tegra-video: move tegra20_vip_soc declaration to vip.h Sun Jian
2025-12-31 14:01 ` Luca Ceresoli
2026-01-02 11:44 ` [PATCH v3 0/2] staging: media: tegra-video: move shared SoC declarations to headers Sun Jian
2026-01-02 11:45 ` [PATCH v3 1/2] staging: media: tegra-video: move tegra210_csi_soc declaration to csi.h Sun Jian
2026-01-02 11:45 ` [PATCH v3 2/2] staging: media: tegra-video: move tegra20_vip_soc declaration to vip.h Sun Jian
2026-01-02 15:53 ` [PATCH v3 0/2] staging: media: tegra-video: move shared SoC declarations to headers Luca Ceresoli
2026-01-05 15:43 ` sun jian
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DFCAOR6T9DPE.2MOL0K9O3HP1N@bootlin.com \
--to=luca.ceresoli@bootlin.com \
--cc=gregkh@linuxfoundation.org \
--cc=jonathanh@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=linux-tegra@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=skomatineni@nvidia.com \
--cc=sun.jian.kdev@gmail.com \
--cc=thierry.reding@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.