Re: [PATCH 84/86] libata: add ata_mwdma_to_pio() inline helper

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello.

Bartlomiej Zolnierkiewicz wrote:

From: Bartlomiej Zolnierkiewicz <bzolnier@xxxxxxxxx>
Subject: [PATCH] libata: add ata_mwdma_to_pio() inline helper

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@xxxxxxxxx>

[...]

 static struct ata_port_operations rdc_pata_ops = {
Index: b/include/linux/ata.h
===================================================================
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -1012,4 +1012,15 @@ static inline int lba_48_ok(u64 block, u
 #define sata_pmp_gscr_rev(gscr)		(((gscr)[SATA_PMP_GSCR_REV] >> 8) & 0xff)
 #define sata_pmp_gscr_ports(gscr)	((gscr)[SATA_PMP_GSCR_PORT_INFO] & 0xf)
+/* returns PIO number matching given MWDMA mode */
+static inline u8 ata_mwdma_to_pio(u8 mwdma_mode)
+{
+	unsigned int mwdma = mwdma_mode - XFER_MW_DMA_0;
+	const unsigned int needed_pio[3] = {

   'u8' would have been enough.

+		XFER_PIO_0, XFER_PIO_3, XFER_PIO_4
+	};

Er, perhaps this should be 'static' array?.. Intialization *auto* class arrays produces some real code... Also, why not simply {0, 3, 4}?

+
+	return needed_pio[mwdma] - XFER_PIO_0;
+}
+
 #endif /* __LINUX_ATA_H__ */

MBR, Sergei
--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux