Re: [PATCH v5 2/7] scsi: libsas: Define NCQ Priority sysfs attributes for SATA devices

From: John Garry
Date: Tue Mar 05 2024 - 06:32:19 EST


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 = {

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.

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