[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZeexuDYlmaDoDmtv@google.com>
Date: Tue, 5 Mar 2024 15:58:48 -0800
From: Igor Pylypiv <ipylypiv@...gle.com>
To: John Garry <john.g.garry@...cle.com>
Cc: Damien Le Moal <dlemoal@...nel.org>, Niklas Cassel <cassel@...nel.org>,
Jason Yan <yanaijie@...wei.com>,
"James E.J. Bottomley" <jejb@...ux.ibm.com>,
"Martin K. Petersen" <martin.petersen@...cle.com>,
Jack Wang <jinpu.wang@...ud.ionos.com>,
Hannes Reinecke <hare@...e.de>,
Xiang Chen <chenxiang66@...ilicon.com>,
Artur Paszkiewicz <artur.paszkiewicz@...el.com>,
Bart Van Assche <bvanassche@....org>,
TJ Adams <tadamsjr@...gle.com>, linux-ide@...r.kernel.org,
linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v5 2/7] scsi: libsas: Define NCQ Priority sysfs
attributes for SATA devices
On Tue, Mar 05, 2024 at 11:29:11AM +0000, John Garry wrote:
> On 05/03/2024 00:50, Igor Pylypiv wrote:
> > static inline void sas_ata_disabled_notice(void)
> > @@ -123,6 +125,10 @@ static inline int sas_ata_add_dev(struct domain_device *parent, struct ex_phy *p
> > sas_ata_disabled_notice();
> > return -ENODEV;
> > }
> > +
> > +static const struct attribute_group sas_ata_sdev_attr_group = {
> > + .attrs = NULL,
> > +};
>
> I just noticed a build issue.
>
> With CONFIG_SCSI_SAS_ATA not set, I get this for W=1 build:
>
> In file included from drivers/scsi/hisi_sas/hisi_sas.h:29,
> from drivers/scsi/hisi_sas/hisi_sas_v1_hw.c:7:
> ./include/scsi/sas_ata.h:129:37: error: ‘sas_ata_sdev_attr_group’
> defined but not used [-Werror=unused-const-variable=]
> 129 | static const struct attribute_group sas_ata_sdev_attr_group = {
Thanks for catching this, John!
For some reason I only get this warning with gcc but not with clang.
>
> I suppose that marking sas_ata_sdev_attr_group as __maybe_unused is ok, but
> less than ideal. The linker should strip it out of files when unused.
Looks like adding the __maybe_unused attribute is a prefferred way since
it is mentioned in the Linux kernel coding style:
https://www.kernel.org/doc/html/v6.7/process/coding-style.html#conditional-compilation
Added the __maybe_unused attribute in v6. Thank you!
>
> I think that this is also ok:
>
> #define sas_ata_sdev_attr_group (struct attribute_group) {}
>
> The compiler here will create a empty structure and have
> &sas_ata_sdev_attr_group point at it.
>
> Thanks,
> John
Powered by blists - more mailing lists