public inbox for linux-staging@lists.linux.dev
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Arnd Bergmann <arnd@kernel.org>
Cc: Dave Penkler <dpenkler@gmail.com>, Arnd Bergmann <arnd@arndb.de>,
	Dan Carpenter <dan.carpenter@linaro.org>,
	Nihar Chaithanya <niharchaithanya@gmail.com>,
	Rohit Chavan <roheetchavan@gmail.com>,
	linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] gpib: mark pnp_device_id tables as __maybe_unused
Date: Wed, 5 Feb 2025 13:25:11 +0100	[thread overview]
Message-ID: <2025020532-roast-shortage-4086@gregkh> (raw)
In-Reply-To: <20250205121244.322054-1-arnd@kernel.org>

On Wed, Feb 05, 2025 at 01:12:26PM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> This variable is not referenced in either of these two drivers driver,
> causing a warning when they are built-in and W=1 warnings are enabled
> with gcc:
> 
> drivers/staging/gpib/tnt4882/tnt4882_gpib.c:1507:35: error: 'tnt4882_pnp_table' defined but not used [-Werror=unused-const-variable=]
>  1507 | static const struct pnp_device_id tnt4882_pnp_table[] = {
>       |                                   ^~~~~~~~~~~~~~~~~
> drivers/staging/gpib/hp_82341/hp_82341.c:811:35: error: 'hp_82341_pnp_table' defined but not used [-Werror=unused-const-variable=]
>   811 | static const struct pnp_device_id hp_82341_pnp_table[] = {
> 
> The MODULE_DEVICE_TABLE() entry does have the effect of loading
> the module when the PNP device is detected, so it is still needed
> for the modular case.
> 
> Ideally the drivers should be converted to pnp_register_driver(),
> which would lead to the ID table actually being used.
> 
> As a simpler workaround, add a __maybe_unused annotation to shut
> up the warning.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/staging/gpib/hp_82341/hp_82341.c    | 2 +-
>  drivers/staging/gpib/tnt4882/tnt4882_gpib.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/gpib/hp_82341/hp_82341.c b/drivers/staging/gpib/hp_82341/hp_82341.c
> index 800f99c05566..7284311e04e2 100644
> --- a/drivers/staging/gpib/hp_82341/hp_82341.c
> +++ b/drivers/staging/gpib/hp_82341/hp_82341.c
> @@ -808,7 +808,7 @@ static void hp_82341_detach(gpib_board_t *board)
>  	hp_82341_free_private(board);
>  }
>  
> -static const struct pnp_device_id hp_82341_pnp_table[] = {
> +static __maybe_unused const struct pnp_device_id hp_82341_pnp_table[] = {
>  	{.id = "HWP1411"},
>  	{.id = ""}
>  };
> diff --git a/drivers/staging/gpib/tnt4882/tnt4882_gpib.c b/drivers/staging/gpib/tnt4882/tnt4882_gpib.c
> index 2e1c3cbebaca..cf3b2a0eb93d 100644
> --- a/drivers/staging/gpib/tnt4882/tnt4882_gpib.c
> +++ b/drivers/staging/gpib/tnt4882/tnt4882_gpib.c
> @@ -1390,7 +1390,7 @@ static struct pci_driver tnt4882_pci_driver = {
>  	.probe = &tnt4882_pci_probe
>  };
>  
> -static const struct pnp_device_id tnt4882_pnp_table[] = {
> +static __maybe_unused const struct pnp_device_id tnt4882_pnp_table[] = {

I see this happening in many different drivers right now, what is so
unique about pnp that causes this?  Shouldn't we fix up the
MODULE_DEVICE_TABLE() macro to not require stuff like this instead?

thanks,

greg k-h

  reply	other threads:[~2025-02-05 12:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-05 12:12 [PATCH] gpib: mark pnp_device_id tables as __maybe_unused Arnd Bergmann
2025-02-05 12:25 ` Greg Kroah-Hartman [this message]
2025-02-05 13:04   ` Arnd Bergmann
2025-02-05 13:28     ` Greg Kroah-Hartman

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=2025020532-roast-shortage-4086@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=arnd@arndb.de \
    --cc=arnd@kernel.org \
    --cc=dan.carpenter@linaro.org \
    --cc=dpenkler@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=niharchaithanya@gmail.com \
    --cc=roheetchavan@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox