diff options
author | Tejun Heo <htejun@gmail.com> | 2007-11-27 05:43:41 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2008-01-23 05:24:11 -0500 |
commit | 9d3501ab962b1506d93974faf8509251b4a85fbc (patch) | |
tree | a4785ca835e1b0ca5551167cf0ecf484eed8b71b /drivers | |
parent | 70cd071e4ecc06c985189665af75c108601fd5a3 (diff) |
libata: kill ata_id_to_dma_mode()
ata_id_to_dma_mode() isn't quite generic. The function is basically
privately implemented ata_id_xfermask() combined with hardcoded mode
printing and configuration which are specific to ata_generic.
Kill the function and open code it in generic_set_mode() using generic
xfermode handling functions.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/ata/ata_generic.c | 17 | ||||
-rw-r--r-- | drivers/ata/libata-core.c | 43 |
2 files changed, 16 insertions, 44 deletions
diff --git a/drivers/ata/ata_generic.c b/drivers/ata/ata_generic.c index fb5434c8ae6e..d11a4f1fe86a 100644 --- a/drivers/ata/ata_generic.c +++ b/drivers/ata/ata_generic.c | |||
@@ -63,7 +63,22 @@ static int generic_set_mode(struct ata_link *link, struct ata_device **unused) | |||
63 | /* We do need the right mode information for DMA or PIO | 63 | /* We do need the right mode information for DMA or PIO |
64 | and this comes from the current configuration flags */ | 64 | and this comes from the current configuration flags */ |
65 | if (dma_enabled & (1 << (5 + dev->devno))) { | 65 | if (dma_enabled & (1 << (5 + dev->devno))) { |
66 | ata_id_to_dma_mode(dev, XFER_MW_DMA_0); | 66 | unsigned int xfer_mask = ata_id_xfermask(dev->id); |
67 | const char *name; | ||
68 | |||
69 | if (xfer_mask & (ATA_MASK_MWDMA | ATA_MASK_UDMA)) | ||
70 | name = ata_mode_string(xfer_mask); | ||
71 | else { | ||
72 | /* SWDMA perhaps? */ | ||
73 | name = "DMA"; | ||
74 | xfer_mask |= ata_xfer_mode2mask(XFER_MW_DMA_0); | ||
75 | } | ||
76 | |||
77 | ata_dev_printk(dev, KERN_INFO, "configured for %s\n", | ||
78 | name); | ||
79 | |||
80 | dev->xfer_mode = ata_xfer_mask2mode(xfer_mask); | ||
81 | dev->xfer_shift = ata_xfer_mode2shift(dev->xfer_mode); | ||
67 | dev->flags &= ~ATA_DFLAG_PIO; | 82 | dev->flags &= ~ATA_DFLAG_PIO; |
68 | } else { | 83 | } else { |
69 | ata_dev_printk(dev, KERN_INFO, "configured for PIO\n"); | 84 | ata_dev_printk(dev, KERN_INFO, "configured for PIO\n"); |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index a70ed7b3bc55..ab84772235c9 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -1288,48 +1288,6 @@ static int ata_hpa_resize(struct ata_device *dev) | |||
1288 | } | 1288 | } |
1289 | 1289 | ||
1290 | /** | 1290 | /** |
1291 | * ata_id_to_dma_mode - Identify DMA mode from id block | ||
1292 | * @dev: device to identify | ||
1293 | * @unknown: mode to assume if we cannot tell | ||
1294 | * | ||
1295 | * Set up the timing values for the device based upon the identify | ||
1296 | * reported values for the DMA mode. This function is used by drivers | ||
1297 | * which rely upon firmware configured modes, but wish to report the | ||
1298 | * mode correctly when possible. | ||
1299 | * | ||
1300 | * In addition we emit similarly formatted messages to the default | ||
1301 | * ata_dev_set_mode handler, in order to provide consistency of | ||
1302 | * presentation. | ||
1303 | */ | ||
1304 | |||
1305 | void ata_id_to_dma_mode(struct ata_device *dev, u8 unknown) | ||
1306 | { | ||
1307 | unsigned int mask; | ||
1308 | u8 mode; | ||
1309 | |||
1310 | /* Pack the DMA modes */ | ||
1311 | mask = ((dev->id[63] >> 8) << ATA_SHIFT_MWDMA) & ATA_MASK_MWDMA; | ||
1312 | if (dev->id[53] & 0x04) | ||
1313 | mask |= ((dev->id[88] >> 8) << ATA_SHIFT_UDMA) & ATA_MASK_UDMA; | ||
1314 | |||
1315 | /* Select the mode in use */ | ||
1316 | mode = ata_xfer_mask2mode(mask); | ||
1317 | |||
1318 | if (mode != 0xff) { | ||
1319 | ata_dev_printk(dev, KERN_INFO, "configured for %s\n", | ||
1320 | ata_mode_string(mask)); | ||
1321 | } else { | ||
1322 | /* SWDMA perhaps ? */ | ||
1323 | mode = unknown; | ||
1324 | ata_dev_printk(dev, KERN_INFO, "configured for DMA\n"); | ||
1325 | } | ||
1326 | |||
1327 | /* Configure the device reporting */ | ||
1328 | dev->xfer_mode = mode; | ||
1329 | dev->xfer_shift = ata_xfer_mode2shift(mode); | ||
1330 | } | ||
1331 | |||
1332 | /** | ||
1333 | * ata_noop_dev_select - Select device 0/1 on ATA bus | 1291 | * ata_noop_dev_select - Select device 0/1 on ATA bus |
1334 | * @ap: ATA channel to manipulate | 1292 | * @ap: ATA channel to manipulate |
1335 | * @device: ATA device (numbered from zero) to select | 1293 | * @device: ATA device (numbered from zero) to select |
@@ -7653,7 +7611,6 @@ EXPORT_SYMBOL_GPL(ata_host_resume); | |||
7653 | #endif /* CONFIG_PM */ | 7611 | #endif /* CONFIG_PM */ |
7654 | EXPORT_SYMBOL_GPL(ata_id_string); | 7612 | EXPORT_SYMBOL_GPL(ata_id_string); |
7655 | EXPORT_SYMBOL_GPL(ata_id_c_string); | 7613 | EXPORT_SYMBOL_GPL(ata_id_c_string); |
7656 | EXPORT_SYMBOL_GPL(ata_id_to_dma_mode); | ||
7657 | EXPORT_SYMBOL_GPL(ata_scsi_simulate); | 7614 | EXPORT_SYMBOL_GPL(ata_scsi_simulate); |
7658 | 7615 | ||
7659 | EXPORT_SYMBOL_GPL(ata_pio_need_iordy); | 7616 | EXPORT_SYMBOL_GPL(ata_pio_need_iordy); |