Skip to content

Commit e5b48ee

Browse files
author
Damien Le Moal
committed
ata: sata_fsl: fix scsi host initialization
When compiling with W=1, the sata_fsl driver compilation throws the warning: drivers/ata/sata_fsl.c:1385:22: error: initialized field overwritten [-Werror=override-init] 1385 | .can_queue = SATA_FSL_QUEUE_DEPTH, This is due to the driver scsi host template initialization overwriting the can_queue field that is already set using the ATA_NCQ_SHT() initializer macro, resulting in the same field being initialized twice in the host template declaration. To remove this warning, introduce the ATA_SUBBASE_SHT_QD() and ATA_NCQ_SHT_QD() initialization macros to allow specifying a queue depth different from the default ATA_DEF_QUEUE using an additional argument to the macro. Signed-off-by: Damien Le Moal <[email protected]> Reviewed-by: Hannes Reinecke <[email protected]>
1 parent a3d11c2 commit e5b48ee

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

drivers/ata/sata_fsl.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1380,8 +1380,7 @@ static void sata_fsl_host_stop(struct ata_host *host)
13801380
* scsi mid-layer and libata interface structures
13811381
*/
13821382
static struct scsi_host_template sata_fsl_sht = {
1383-
ATA_NCQ_SHT("sata_fsl"),
1384-
.can_queue = SATA_FSL_QUEUE_DEPTH,
1383+
ATA_NCQ_SHT_QD("sata_fsl", SATA_FSL_QUEUE_DEPTH),
13851384
.sg_tablesize = SATA_FSL_MAX_PRD_USABLE,
13861385
.dma_boundary = ATA_DMA_BOUNDARY,
13871386
};

include/linux/libata.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1385,6 +1385,12 @@ extern const struct attribute_group *ata_common_sdev_groups[];
13851385
.tag_alloc_policy = BLK_TAG_ALLOC_RR, \
13861386
.slave_configure = ata_scsi_slave_config
13871387

1388+
#define ATA_SUBBASE_SHT_QD(drv_name, drv_qd) \
1389+
__ATA_BASE_SHT(drv_name), \
1390+
.can_queue = drv_qd, \
1391+
.tag_alloc_policy = BLK_TAG_ALLOC_RR, \
1392+
.slave_configure = ata_scsi_slave_config
1393+
13881394
#define ATA_BASE_SHT(drv_name) \
13891395
ATA_SUBBASE_SHT(drv_name), \
13901396
.sdev_groups = ata_common_sdev_groups
@@ -1396,6 +1402,11 @@ extern const struct attribute_group *ata_ncq_sdev_groups[];
13961402
ATA_SUBBASE_SHT(drv_name), \
13971403
.sdev_groups = ata_ncq_sdev_groups, \
13981404
.change_queue_depth = ata_scsi_change_queue_depth
1405+
1406+
#define ATA_NCQ_SHT_QD(drv_name, drv_qd) \
1407+
ATA_SUBBASE_SHT_QD(drv_name, drv_qd), \
1408+
.sdev_groups = ata_ncq_sdev_groups, \
1409+
.change_queue_depth = ata_scsi_change_queue_depth
13991410
#endif
14001411

14011412
/*

0 commit comments

Comments
 (0)