Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Linux: Kernel

[PATCH] ide: fix ioctl to pass requested transfer mode to ide_find_dma_mode instead of UDMA6

 

 

Linux kernel RSS feed   Index | Next | Previous | View Threaded


hemantp at ti

Nov 23, 2009, 8:16 PM

Post #1 of 4 (157 views)
Permalink
[PATCH] ide: fix ioctl to pass requested transfer mode to ide_find_dma_mode instead of UDMA6

Currently, ide_cmd_ioctl when invoked for setting DMA transfer mode calls
ide_find_dma_mode with requested mode as XFER_UDMA_6. This prevents setting DMA
mode to any other value than the default (maximum) supported by the device (or
UDMA6, if supported) irrespective of the actual requested transfer mode and
returns error.

For example, setting mode to UDMA2 using hdparm, where UDMA4 is the default
transfer mode gives following error:
# ./hdparm -d1 -Xudma2 /dev/hda
/dev/hda:hda: UDMA/66 mode selected
setting using_dma to 1 (on)
hda: UDMA/66 mode selected
setting xfermode to 66 (UltraDMA mode2)
HDIO_DRIVE_CMD(setxfermode) failed: Invalid argument
using_dma = 1 (on)

This patch fixes the issue.

Signed-off-by: Hemant Pedanekar <hemantp [at] ti>
Acked-by: Bartlomiej Zolnierkiewicz <bzolnier [at] gmail>
---
drivers/ide/ide-ioctls.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/ide/ide-ioctls.c b/drivers/ide/ide-ioctls.c
index d3440b5..6e7ae2b 100644
--- a/drivers/ide/ide-ioctls.c
+++ b/drivers/ide/ide-ioctls.c
@@ -162,7 +162,7 @@ static int ide_cmd_ioctl(ide_drive_t *drive, unsigned long arg)
if (tf->command == ATA_CMD_SET_FEATURES &&
tf->feature == SETFEATURES_XFER &&
tf->nsect >= XFER_SW_DMA_0) {
- xfer_rate = ide_find_dma_mode(drive, XFER_UDMA_6);
+ xfer_rate = ide_find_dma_mode(drive, tf->nsect);
if (xfer_rate != tf->nsect) {
err = -EINVAL;
goto abort;
--
1.6.2.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


sshtylyov at ru

Nov 24, 2009, 3:12 AM

Post #2 of 4 (155 views)
Permalink
Re: [PATCH] ide: fix ioctl to pass requested transfer mode to ide_find_dma_mode instead of UDMA6 [In reply to]

Hello.

Hemant Pedanekar wrote:
> Currently, ide_cmd_ioctl when invoked for setting DMA transfer mode calls
> ide_find_dma_mode with requested mode as XFER_UDMA_6. This prevents setting DMA
> mode to any other value than the default (maximum) supported by the device (or
> UDMA6, if supported) irrespective of the actual requested transfer mode and
> returns error.
>
> For example, setting mode to UDMA2 using hdparm, where UDMA4 is the default
> transfer mode gives following error:
> # ./hdparm -d1 -Xudma2 /dev/hda
> /dev/hda:hda: UDMA/66 mode selected
> setting using_dma to 1 (on)
> hda: UDMA/66 mode selected
> setting xfermode to 66 (UltraDMA mode2)
> HDIO_DRIVE_CMD(setxfermode) failed: Invalid argument
> using_dma = 1 (on)
>
> This patch fixes the issue.
>
> Signed-off-by: Hemant Pedanekar <hemantp [at] ti>
> Acked-by: Bartlomiej Zolnierkiewicz <bzolnier [at] gmail>

Acked-by: Sergei Shtylyov <sshtylyov [at] ru>

MBR, Sergei


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


hemantp at ti

Nov 24, 2009, 3:50 AM

Post #3 of 4 (150 views)
Permalink
[PATCH] ide: fix ioctl to pass requested transfer mode to ide_find_dma_mode instead of UDMA6 [In reply to]

Currently, ide_cmd_ioctl when invoked for setting DMA transfer mode calls
ide_find_dma_mode with requested mode as XFER_UDMA_6. This prevents setting DMA
mode to any other value than the default (maximum) supported by the device (or
UDMA6, if supported) irrespective of the actual requested transfer mode and
returns error.

For example, setting mode to UDMA2 using hdparm, where UDMA4 is the default
transfer mode gives following error:
# ./hdparm -d1 -Xudma2 /dev/hda
/dev/hda:hda: UDMA/66 mode selected
setting using_dma to 1 (on)
hda: UDMA/66 mode selected
setting xfermode to 66 (UltraDMA mode2)
HDIO_DRIVE_CMD(setxfermode) failed: Invalid argument
using_dma = 1 (on)

This patch fixes the issue.

Signed-off-by: Hemant Pedanekar <hemantp [at] ti>
Acked-by: Bartlomiej Zolnierkiewicz <bzolnier [at] gmail>
Acked-by: Sergei Shtylyov <sshtylyov [at] ru>
---
drivers/ide/ide-ioctls.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/ide/ide-ioctls.c b/drivers/ide/ide-ioctls.c
index d3440b5..6e7ae2b 100644
--- a/drivers/ide/ide-ioctls.c
+++ b/drivers/ide/ide-ioctls.c
@@ -162,7 +162,7 @@ static int ide_cmd_ioctl(ide_drive_t *drive, unsigned long arg)
if (tf->command == ATA_CMD_SET_FEATURES &&
tf->feature == SETFEATURES_XFER &&
tf->nsect >= XFER_SW_DMA_0) {
- xfer_rate = ide_find_dma_mode(drive, XFER_UDMA_6);
+ xfer_rate = ide_find_dma_mode(drive, tf->nsect);
if (xfer_rate != tf->nsect) {
err = -EINVAL;
goto abort;
--
1.6.2.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


davem at davemloft

Nov 25, 2009, 3:05 PM

Post #4 of 4 (140 views)
Permalink
Re: [PATCH] ide: fix ioctl to pass requested transfer mode to ide_find_dma_mode instead of UDMA6 [In reply to]

From: Hemant Pedanekar <hemantp [at] ti>
Date: Tue, 24 Nov 2009 17:20:50 +0530

> Currently, ide_cmd_ioctl when invoked for setting DMA transfer mode calls
> ide_find_dma_mode with requested mode as XFER_UDMA_6. This prevents setting DMA
> mode to any other value than the default (maximum) supported by the device (or
> UDMA6, if supported) irrespective of the actual requested transfer mode and
> returns error.
>
> For example, setting mode to UDMA2 using hdparm, where UDMA4 is the default
> transfer mode gives following error:
> # ./hdparm -d1 -Xudma2 /dev/hda
> /dev/hda:hda: UDMA/66 mode selected
> setting using_dma to 1 (on)
> hda: UDMA/66 mode selected
> setting xfermode to 66 (UltraDMA mode2)
> HDIO_DRIVE_CMD(setxfermode) failed: Invalid argument
> using_dma = 1 (on)
>
> This patch fixes the issue.
>
> Signed-off-by: Hemant Pedanekar <hemantp [at] ti>
> Acked-by: Bartlomiej Zolnierkiewicz <bzolnier [at] gmail>
> Acked-by: Sergei Shtylyov <sshtylyov [at] ru>

Applied and queued up for -stable, thanks!
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Linux kernel RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.