[PATCH] ata: fix AHCI_SHT() macro definition

From: Bartlomiej Zolnierkiewicz
Date: Fri Jun 12 2020 - 08:09:38 EST


Fix AHCI_SHT() macro definition to not reinitialize .can_queue and
.sdev_attrs fields.

This removes gcc warnings from W=1 builds such as:

CC drivers/ata/ahci_platform.o
In file included from drivers/ata/ahci_platform.c:21:0:
drivers/ata/ahci.h:384:16: warning: initialized field overwritten [-Woverride-init]
.can_queue = AHCI_MAX_CMDS, \
^
drivers/ata/ahci_platform.c:40:2: note: in expansion of macro âAHCI_SHTâ
AHCI_SHT(DRV_NAME),
^
drivers/ata/ahci.h:384:16: note: (near initialization for âahci_platform_sht.can_queueâ)
.can_queue = AHCI_MAX_CMDS, \
^
drivers/ata/ahci_platform.c:40:2: note: in expansion of macro âAHCI_SHTâ
AHCI_SHT(DRV_NAME),
^
drivers/ata/ahci.h:388:17: warning: initialized field overwritten [-Woverride-init]
.sdev_attrs = ahci_sdev_attrs
^
drivers/ata/ahci_platform.c:40:2: note: in expansion of macro âAHCI_SHTâ
AHCI_SHT(DRV_NAME),
^
drivers/ata/ahci.h:388:17: note: (near initialization for âahci_platform_sht.sdev_attrsâ)
.sdev_attrs = ahci_sdev_attrs
^
drivers/ata/ahci_platform.c:40:2: note: in expansion of macro âAHCI_SHTâ
AHCI_SHT(DRV_NAME),
^

Reported-by: kernel test robot <lkp@xxxxxxxxx>
Cc: Christoph Hellwig <hch@xxxxxx>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@xxxxxxxxxxx>
---
drivers/ata/ahci.h | 7 ++++---
include/linux/libata.h | 3 ++-
2 files changed, 6 insertions(+), 4 deletions(-)

Index: b/drivers/ata/ahci.h
===================================================================
--- a/drivers/ata/ahci.h
+++ b/drivers/ata/ahci.h
@@ -378,15 +378,16 @@ extern struct device_attribute *ahci_sde

/*
* This must be instantiated by the edge drivers. Read the comments
- * for ATA_BASE_SHT
+ * for __ATA_BASE_SHT
*/
#define AHCI_SHT(drv_name) \
- ATA_NCQ_SHT(drv_name), \
+ __ATA_BASE_SHT(drv_name), \
.can_queue = AHCI_MAX_CMDS, \
.sg_tablesize = AHCI_MAX_SG, \
.dma_boundary = AHCI_DMA_BOUNDARY, \
.shost_attrs = ahci_shost_attrs, \
- .sdev_attrs = ahci_sdev_attrs
+ .sdev_attrs = ahci_sdev_attrs, \
+ .change_queue_depth = ata_scsi_change_queue_depth

extern struct ata_port_operations ahci_ops;
extern struct ata_port_operations ahci_platform_ops;
Index: b/include/linux/libata.h
===================================================================
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -1389,7 +1389,6 @@ extern struct device_attribute *ata_comm
ATA_SCSI_COMPAT_IOCTL \
.queuecommand = ata_scsi_queuecmd, \
.dma_need_drain = ata_scsi_dma_need_drain, \
- .can_queue = ATA_DEF_QUEUE, \
.tag_alloc_policy = BLK_TAG_ALLOC_RR, \
.this_id = ATA_SHT_THIS_ID, \
.emulated = ATA_SHT_EMULATED, \
@@ -1401,6 +1400,7 @@ extern struct device_attribute *ata_comm

#define ATA_BASE_SHT(drv_name) \
__ATA_BASE_SHT(drv_name), \
+ .can_queue = ATA_DEF_QUEUE, \
.sdev_attrs = ata_common_sdev_attrs

#ifdef CONFIG_SATA_HOST
@@ -1408,6 +1408,7 @@ extern struct device_attribute *ata_ncq_

#define ATA_NCQ_SHT(drv_name) \
__ATA_BASE_SHT(drv_name), \
+ .can_queue = ATA_DEF_QUEUE, \
.sdev_attrs = ata_ncq_sdev_attrs, \
.change_queue_depth = ata_scsi_change_queue_depth
#endif