[PATCH 02/11] ata: ahci: Ensure initialised fields are not overwritten in AHCI_SHT()

From: Lee Jones
Date: Fri May 28 2021 - 05:05:29 EST


Fixes the following W=1 kernel build warning(s):

In file included from drivers/ata/ahci_platform.c:21:
drivers/ata/ahci.h:388:16: warning: initialized field overwritten [-Woverride-init]
drivers/ata/ahci_platform.c:40:2: note: in expansion of macro ‘AHCI_SHT’
drivers/ata/ahci.h:388:16: note: (near initialization for ‘ahci_platform_sht.can_queue’)
drivers/ata/ahci_platform.c:40:2: note: in expansion of macro ‘AHCI_SHT’
drivers/ata/ahci.h:392:17: warning: initialized field overwritten [-Woverride-init]
drivers/ata/ahci_platform.c:40:2: note: in expansion of macro ‘AHCI_SHT’
drivers/ata/ahci.h:392:17: note: (near initialization for ‘ahci_platform_sht.sdev_attrs’)
drivers/ata/ahci_platform.c:40:2: note: in expansion of macro ‘AHCI_SHT’
In file included from drivers/ata/ahci_mtk.c:18:
drivers/ata/ahci.h:388:16: warning: initialized field overwritten [-Woverride-init]
drivers/ata/ahci_mtk.c:41:2: note: in expansion of macro ‘AHCI_SHT’
drivers/ata/ahci.h:388:16: note: (near initialization for ‘ahci_platform_sht.can_queue’)
drivers/ata/ahci_mtk.c:41:2: note: in expansion of macro ‘AHCI_SHT’
drivers/ata/ahci.h:392:17: warning: initialized field overwritten [-Woverride-init]
drivers/ata/ahci_mtk.c:41:2: note: in expansion of macro ‘AHCI_SHT’
drivers/ata/ahci.h:392:17: note: (near initialization for ‘ahci_platform_sht.sdev_attrs’)
drivers/ata/ahci_mtk.c:41:2: note: in expansion of macro ‘AHCI_SHT’
In file included from drivers/ata/ahci_dm816.c:16:
drivers/ata/ahci.h:388:16: warning: initialized field overwritten [-Woverride-init]
drivers/ata/ahci_dm816.c:138:2: note: in expansion of macro ‘AHCI_SHT’
drivers/ata/ahci.h:388:16: note: (near initialization for ‘ahci_dm816_platform_sht.can_queue’)
drivers/ata/ahci_dm816.c:138:2: note: in expansion of macro ‘AHCI_SHT’
drivers/ata/ahci.h:392:17: warning: initialized field overwritten [-Woverride-init]
drivers/ata/ahci_dm816.c:138:2: note: in expansion of macro ‘AHCI_SHT’
drivers/ata/ahci.h:392:17: note: (near initialization for ‘ahci_dm816_platform_sht.sdev_attrs’)
drivers/ata/ahci_dm816.c:138:2: note: in expansion of macro ‘AHCI_SHT’

NB: Snipped 150 lines of this for brevity!

Cc: Jens Axboe <axboe@xxxxxxxxx>
Cc: Philipp Zabel <p.zabel@xxxxxxxxxxxxxx>
Cc: Tejun Heo <tj@xxxxxxxxxx>
Cc: ALWAYS copy <linux-ide@xxxxxxxxxxxxxxx>
Cc: linux-ide@xxxxxxxxxxxxxxx
Signed-off-by: Lee Jones <lee.jones@xxxxxxxxxx>
---
drivers/ata/ahci.h | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/ata/ahci.h b/drivers/ata/ahci.h
index d1f284f0c83d9..2e89499bd9c3d 100644
--- a/drivers/ata/ahci.h
+++ b/drivers/ata/ahci.h
@@ -384,12 +384,15 @@ extern struct device_attribute *ahci_sdev_attrs[];
* 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, \
+ .tag_alloc_policy = BLK_TAG_ALLOC_RR, \
+ .slave_configure = ata_scsi_slave_config

extern struct ata_port_operations ahci_ops;
extern struct ata_port_operations ahci_platform_ops;
--
2.31.1