Re: [PATCH v1 07/12] nfc: Drop __maybe_unused from of_device_id tables
From: Uwe Kleine-König (The Capable Hub)
Date: Wed Jul 08 2026 - 01:06:04 EST
On Tue, Jul 07, 2026 at 07:28:57PM +0200, Krzysztof Kozlowski wrote:
> On 03/07/2026 17:46, Uwe Kleine-König (The Capable Hub) wrote:
> > Referencing these arrays in MODULE_DEVICE_TABLE() is enough to convince
> > the compiler that they are used even if the drivers are built-in (since
> > 5ab23c7923a1 ("modpost: Create modalias for builtin modules"). So the
> > __maybe_unused marking can be removed without introducing a compiler
> > warning.
> >
> > Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@xxxxxxxxxxxx>
> > ---
> > drivers/nfc/nfcmrvl/i2c.c | 2 +-
> > drivers/nfc/nfcmrvl/spi.c | 2 +-
> > drivers/nfc/pn533/i2c.c | 2 +-
> > drivers/nfc/pn544/i2c.c | 2 +-
> > drivers/nfc/s3fwrn5/i2c.c | 2 +-
> > drivers/nfc/st-nci/i2c.c | 2 +-
> > drivers/nfc/st-nci/spi.c | 2 +-
> > drivers/nfc/st21nfca/i2c.c | 2 +-
> > drivers/nfc/st95hf/core.c | 2 +-
> > drivers/nfc/trf7970a.c | 2 +-
> > 10 files changed, 10 insertions(+), 10 deletions(-)
> >
> > diff --git a/drivers/nfc/nfcmrvl/i2c.c b/drivers/nfc/nfcmrvl/i2c.c
> > index 66877a7d03f2..687d2979b881 100644
> > --- a/drivers/nfc/nfcmrvl/i2c.c
> > +++ b/drivers/nfc/nfcmrvl/i2c.c
> > @@ -245,7 +245,7 @@ static void nfcmrvl_i2c_remove(struct i2c_client *client)
> > }
> >
> >
> > -static const struct of_device_id of_nfcmrvl_i2c_match[] __maybe_unused = {
> > +static const struct of_device_id of_nfcmrvl_i2c_match[] = {
> > { .compatible = "marvell,nfc-i2c", },
> > {},
>
> This (and probably others) should re-introduce warnings on !MODULE and
> !OF builds (and other cases).
With an x86_64 allnoconfig and just the things enabled to make this
driver build (i.e. I2C and a few NFC related switches, but neither OF
nor MODULES) the driver builds fine even with W=1. If I drop
MODULE_DEVICE_TABLE() the warning appears. So unless proven otherwise I
claim the commit log and the patch are correct.
Best regards
Uwe
Attachment:
signature.asc
Description: PGP signature