The patch titled libata: fix ata_acpi_gtm_xfermask() has been removed from the -mm tree. Its filename was libata-fix-ata_acpi_gtm_xfermask.patch This patch was dropped because it was merged into mainline or a subsystem tree ------------------------------------------------------ Subject: libata: fix ata_acpi_gtm_xfermask() From: Tejun Heo <htejun@xxxxxxxxx> ata_acpi_gtm_xfermask() as separated out from pacpi_discover_modes() has various bugs. Fix them. * The wrong comparison operator is used when finding for matching cycle resulting totally bogus result. * With the comparion operator fixed, boundary condtion handling is clumsy. * Setting of any DMA mask bit set all bits in PIO mask. * MWDMA and UDMA blocks are swapped. Signed-off-by: Tejun Heo <htejun@xxxxxxxxx> Cc: Alan Cox <alan@xxxxxxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- drivers/ata/libata-acpi.c | 42 ++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 21 deletions(-) diff -puN drivers/ata/libata-acpi.c~libata-fix-ata_acpi_gtm_xfermask drivers/ata/libata-acpi.c --- a/drivers/ata/libata-acpi.c~libata-fix-ata_acpi_gtm_xfermask +++ a/drivers/ata/libata-acpi.c @@ -453,49 +453,49 @@ EXPORT_SYMBOL_GPL(ata_acpi_udma_cycle); unsigned int ata_acpi_gtm_xfermask(struct ata_device *dev, const struct ata_acpi_gtm *gtm) { + unsigned int pio_mask = 0, mwdma_mask = 0, udma_mask = 0; int unit, i; u32 t; - unsigned long mask = (0x7f << ATA_SHIFT_UDMA) | (0x7 << ATA_SHIFT_MWDMA) | (0x1F << ATA_SHIFT_PIO); /* we always use the 0 slot for crap hardware */ unit = dev->devno; if (!(gtm->flags & 0x10)) unit = 0; + /* Values larger than the longest cycle results in 0 mask + * while values equal to smaller than the shortest cycle + * results in mask which includes all supported modes. + * Disabled transfer method has the value of 0xffffffff which + * will always result in 0 mask. + */ + /* start by scanning for PIO modes */ - for (i = 0; i < 7; i++) { - t = gtm->drive[unit].pio; - if (t <= ata_acpi_pio_cycle[i]) { - mask |= (2 << (ATA_SHIFT_PIO + i)) - 1; + t = gtm->drive[unit].pio; + for (i = 0; i < ARRAY_SIZE(ata_acpi_pio_cycle); i++) + if (t > ata_acpi_pio_cycle[i]) break; - } - } + pio_mask = (1 << i) - 1; /* See if we have MWDMA or UDMA data. We don't bother with * MWDMA if UDMA is available as this means the BIOS set UDMA * and our error changedown if it works is UDMA to PIO anyway. */ - if (gtm->flags & (1 << (2 * unit))) { + t = gtm->drive[unit].dma; + if (!(gtm->flags & (1 << (2 * unit)))) { /* MWDMA */ - for (i = 0; i < 5; i++) { - t = gtm->drive[unit].dma; - if (t <= ata_acpi_mwdma_cycle[i]) { - mask |= (2 << (ATA_SHIFT_MWDMA + i)) - 1; + for (i = 0; i < ARRAY_SIZE(ata_acpi_mwdma_cycle); i++) + if (t > ata_acpi_mwdma_cycle[i]) break; - } - } + mwdma_mask = (1 << i) - 1; } else { /* UDMA */ - for (i = 0; i < 7; i++) { - t = gtm->drive[unit].dma; - if (t <= ata_acpi_udma_cycle[i]) { - mask |= (2 << (ATA_SHIFT_UDMA + i)) - 1; + for (i = 0; i < ARRAY_SIZE(ata_acpi_udma_cycle); i++) + if (t > ata_acpi_udma_cycle[i]) break; - } - } + udma_mask = (1 << i) - 1; } - return mask; + return ata_pack_xfermask(pio_mask, mwdma_mask, udma_mask); } EXPORT_SYMBOL_GPL(ata_acpi_gtm_xfermask); _ Patches currently in -mm which might be from htejun@xxxxxxxxx are git-libata-all.patch libata-xfer_mask-is-unsigned-int-not-unsigned-long.patch libata-add-toshiba-mk1637gsx-to-spurious-command-completion-list.patch sata_nv-dont-use-legacy-dma-in-adma-mode-v3.patch libata-set-proper-ata-udma-mode-for-bf548-according-to-system-clock-checkpatch-fixes.patch ata-ahci-enclosure-management-via-led.patch libata-fix-early-use-of-port-printk-checkpatch-fixes.patch pata_amd-pata_via-de-couple-programming-of-pio-mwdma-and-udma-timings.patch scsi-early-detection-of-medium-not-present-updated.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html