diff options
author | Denis Orlov <denorl2009@gmail.com> | 2022-05-04 12:25:41 +0300 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2022-05-05 09:47:04 +0200 |
commit | 9f63aea0ac6a00b49bc5e1badc86fc6fd196306d (patch) | |
tree | c982319da534f5572ecf672d44e4e38b37dbe129 /drivers/ata | |
parent | aca06614ce9a11cfdd60e2ac7bb4664167a7607f (diff) | |
download | barebox-9f63aea0ac6a00b49bc5e1badc86fc6fd196306d.tar.gz barebox-9f63aea0ac6a00b49bc5e1badc86fc6fd196306d.tar.xz |
ata: ahci: simplify fis structure creation
Signed-off-by: Denis Orlov <denorl2009@gmail.com>
Link: https://lore.barebox.org/20220504092553.27961-4-denorl2009@gmail.com
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/ata')
-rw-r--r-- | drivers/ata/ahci.c | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index 5aab81fcef..026f83046c 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c @@ -192,14 +192,12 @@ static int ahci_io(struct ahci_port *ahci_port, u8 *fis, int fis_len, void *rbuf static int ahci_read_id(struct ata_port *ata, void *buf) { struct ahci_port *ahci = container_of(ata, struct ahci_port, ata); - u8 fis[20]; - - memset(fis, 0, sizeof(fis)); - /* Construct the FIS */ - fis[0] = 0x27; /* Host to device FIS. */ - fis[1] = 1 << 7; /* Command FIS. */ - fis[2] = ATA_CMD_ID_ATA; /* Command byte. */ + u8 fis[20] = { + 0x27, /* Host to device FIS. */ + 1 << 7, /* Command FIS. */ + ATA_CMD_ID_ATA /* Command byte. */ + }; return ahci_io(ahci, fis, sizeof(fis), buf, NULL, SECTOR_SIZE); } @@ -208,16 +206,13 @@ static int ahci_rw(struct ata_port *ata, void *rbuf, const void *wbuf, sector_t block, blkcnt_t num_blocks) { struct ahci_port *ahci = container_of(ata, struct ahci_port, ata); - u8 fis[20]; + u8 fis[20] = { + 0x27, /* Host to device FIS. */ + 1 << 7 /* Command FIS. */ + }; int ret; int lba48 = ata_id_has_lba48(ata->id); - memset(fis, 0, sizeof(fis)); - - /* Construct the FIS */ - fis[0] = 0x27; /* Host to device FIS. */ - fis[1] = 1 << 7; /* Command FIS. */ - /* Command byte. */ if (lba48) fis[2] = wbuf ? ATA_CMD_WRITE_EXT : ATA_CMD_READ_EXT; |