summaryrefslogtreecommitdiff
path: root/drivers/block/ahci.c
diff options
context:
space:
mode:
authorTaylor Hutt <thutt@chromium.org>2012-10-29 05:23:55 +0000
committerTom Rini <trini@ti.com>2012-11-02 15:20:42 -0700
commitc8731115656132b4b449f4e32a867ec48e47c84b (patch)
treef81598407ddfbb3ce64937477ea4cf2dc0746144 /drivers/block/ahci.c
parent19d1d41e844ea8525f527fd5301aba9eb3006241 (diff)
downloadu-boot-imx-c8731115656132b4b449f4e32a867ec48e47c84b.zip
u-boot-imx-c8731115656132b4b449f4e32a867ec48e47c84b.tar.gz
u-boot-imx-c8731115656132b4b449f4e32a867ec48e47c84b.tar.bz2
ahci: Use sizeof(fis) instead of hardcoding '20'
This cleanup replaces the hardcoded use of '20', which represents the number of bytes in the FIS, with sizeof(fis). Signed-off-by: Taylor Hutt <thutt@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/block/ahci.c')
-rw-r--r--drivers/block/ahci.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/block/ahci.c b/drivers/block/ahci.c
index c16e8ba..10fae88 100644
--- a/drivers/block/ahci.c
+++ b/drivers/block/ahci.c
@@ -383,14 +383,14 @@ static void ahci_set_feature(u8 port)
u8 fis[20];
/* set feature */
- memset(fis, 0, 20);
+ memset(fis, 0, sizeof(fis));
fis[0] = 0x27;
fis[1] = 1 << 7;
fis[2] = ATA_CMD_SETF;
fis[3] = SETFEATURES_XFER;
fis[12] = __ilog2(probe_ent->udma_mask + 1) + 0x40 - 0x01;
- memcpy((unsigned char *)pp->cmd_tbl, fis, 20);
+ memcpy((unsigned char *)pp->cmd_tbl, fis, sizeof(fis));
ahci_fill_cmd_slot(pp, cmd_fis_len);
writel(1, port_mmio + PORT_CMD_ISSUE);
readl(port_mmio + PORT_CMD_ISSUE);
@@ -559,7 +559,7 @@ static int ata_scsiop_inquiry(ccb *pccb)
if (pccb->datalen <= 35)
return 0;
- memset(fis, 0, 20);
+ memset(fis, 0, sizeof(fis));
/* Construct the FIS */
fis[0] = 0x27; /* Host to device FIS. */
fis[1] = 1 << 7; /* Command FIS. */
@@ -570,7 +570,7 @@ static int ata_scsiop_inquiry(ccb *pccb)
if (!(tmpid = malloc(sizeof(hd_driveid_t))))
return -ENOMEM;
- if (ahci_device_data_io(port, (u8 *) &fis, 20, tmpid,
+ if (ahci_device_data_io(port, (u8 *) &fis, sizeof(fis), tmpid,
sizeof(hd_driveid_t), 0)) {
debug("scsi_ahci: SCSI inquiry command failure.\n");
return -EIO;
@@ -620,7 +620,7 @@ static int ata_scsiop_read_write(ccb *pccb, u8 is_write)
is_write ? "write" : "read", (unsigned)lba, blocks);
/* Preset the FIS */
- memset(fis, 0, 20);
+ memset(fis, 0, sizeof(fis));
fis[0] = 0x27; /* Host to device FIS. */
fis[1] = 1 << 7; /* Command FIS. */
/* Command byte (read/write). */