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