Patchwork libata: fix ata_dma_enabled

login
register
mail settings
Submitter Aaron Lu
Date Dec. 3, 2012, 1:04 a.m.
Message ID <50BBFA94.2070105@intel.com>
Download mbox | patch
Permalink /patch/203256/
State Not Applicable
Delegated to: David Miller
Headers show

Comments

Aaron Lu - Dec. 3, 2012, 1:04 a.m.
ata_dma_enabled should check if device is either using multi word DMA
or ultra DMA instead of checking 0xff, as dma_mode 0 is not a valid dma
mode either.

This patch fixes the following bug:
https://bugzilla.kernel.org/show_bug.cgi?id=49151

Reported-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Aaron Lu <aaron.lu@intel.com>
Tested-by: Dutra Julio <dutra.julio@gmail.com>
Tested-by: Szymon Janc <szymon@janc.net.pl>
Tested-by: Bernd Buschinski <b.buschinski@googlemail.com>
Cc: <stable@kernel.org>
---
 include/linux/libata.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Alan Cox - Dec. 3, 2012, 1:22 a.m.
On Mon, 03 Dec 2012 09:04:20 +0800
Aaron Lu <aaron.lu@intel.com> wrote:

> 
> ata_dma_enabled should check if device is either using multi word DMA
> or ultra DMA instead of checking 0xff, as dma_mode 0 is not a valid dma
> mode either.
> 
> This patch fixes the following bug:
> https://bugzilla.kernel.org/show_bug.cgi?id=49151

NAK

dma_mode should *NEVER* be zero. If it's getting set to zero you have
another bug and that needs fixing instead

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

Patch

diff --git a/include/linux/libata.h b/include/linux/libata.h
index 77eeeda..2444695 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -1617,7 +1617,7 @@  static inline int ata_using_udma(struct ata_device *adev)
 
 static inline int ata_dma_enabled(struct ata_device *adev)
 {
-	return (adev->dma_mode == 0xFF ? 0 : 1);
+	return ata_using_mwdma(adev) || ata_using_udma(adev);
 }
 
 /**************************************************************************