[PATCH] ata: sata_nv: use enum values as array indeces

From: Sascha Hauer
Date: Fri May 08 2020 - 01:55:04 EST


Positions of the entries in nv_port_info[] must be consistent to enum
nv_host_type. Ensure this by using the enum as array index directly.

Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
---
drivers/ata/sata_nv.c | 18 ++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c
index 20190f66ced9..25c53fa17b33 100644
--- a/drivers/ata/sata_nv.c
+++ b/drivers/ata/sata_nv.c
@@ -520,8 +520,7 @@ struct nv_pi_priv {
&(struct nv_pi_priv){ .irq_handler = _irq_handler, .sht = _sht }

static const struct ata_port_info nv_port_info[] = {
- /* generic */
- {
+ [GENERIC] = {
.flags = ATA_FLAG_SATA,
.pio_mask = NV_PIO_MASK,
.mwdma_mask = NV_MWDMA_MASK,
@@ -529,8 +528,7 @@ static const struct ata_port_info nv_port_info[] = {
.port_ops = &nv_generic_ops,
.private_data = NV_PI_PRIV(nv_generic_interrupt, &nv_sht),
},
- /* nforce2/3 */
- {
+ [NFORCE2] = {
.flags = ATA_FLAG_SATA,
.pio_mask = NV_PIO_MASK,
.mwdma_mask = NV_MWDMA_MASK,
@@ -538,8 +536,7 @@ static const struct ata_port_info nv_port_info[] = {
.port_ops = &nv_nf2_ops,
.private_data = NV_PI_PRIV(nv_nf2_interrupt, &nv_sht),
},
- /* ck804 */
- {
+ [CK804] = {
.flags = ATA_FLAG_SATA,
.pio_mask = NV_PIO_MASK,
.mwdma_mask = NV_MWDMA_MASK,
@@ -547,8 +544,7 @@ static const struct ata_port_info nv_port_info[] = {
.port_ops = &nv_ck804_ops,
.private_data = NV_PI_PRIV(nv_ck804_interrupt, &nv_sht),
},
- /* ADMA */
- {
+ [ADMA] = {
.flags = ATA_FLAG_SATA | ATA_FLAG_NCQ,
.pio_mask = NV_PIO_MASK,
.mwdma_mask = NV_MWDMA_MASK,
@@ -556,8 +552,7 @@ static const struct ata_port_info nv_port_info[] = {
.port_ops = &nv_adma_ops,
.private_data = NV_PI_PRIV(nv_adma_interrupt, &nv_adma_sht),
},
- /* MCP5x */
- {
+ [MCP5x] = {
.flags = ATA_FLAG_SATA,
.pio_mask = NV_PIO_MASK,
.mwdma_mask = NV_MWDMA_MASK,
@@ -565,8 +560,7 @@ static const struct ata_port_info nv_port_info[] = {
.port_ops = &nv_generic_ops,
.private_data = NV_PI_PRIV(nv_generic_interrupt, &nv_sht),
},
- /* SWNCQ */
- {
+ [SWNCQ] = {
.flags = ATA_FLAG_SATA | ATA_FLAG_NCQ,
.pio_mask = NV_PIO_MASK,
.mwdma_mask = NV_MWDMA_MASK,
--
2.26.2