LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
To: linux-ide@vger.kernel.org
Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH 15/16] ide: remove ide_auto_reduce_xfer()
Date: Tue, 22 Jan 2008 00:32:19 +0100	[thread overview]
Message-ID: <20080121233219.30311.13119.sendpatchset@localhost.localdomain> (raw)
In-Reply-To: <20080121233036.30311.76015.sendpatchset@localhost.localdomain>


While at it:

* Remove needless '!drive->crc_count' check.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/ide/ide-iops.c |   41 +++++++++++++----------------------------
 1 file changed, 13 insertions(+), 28 deletions(-)

Index: b/drivers/ide/ide-iops.c
===================================================================
--- a/drivers/ide/ide-iops.c
+++ b/drivers/ide/ide-iops.c
@@ -612,33 +612,6 @@ no_80w:
 	return 0;
 }
 
-#ifdef CONFIG_BLK_DEV_IDEDMA
-static u8 ide_auto_reduce_xfer (ide_drive_t *drive)
-{
-	if (!drive->crc_count)
-		return drive->current_speed;
-	drive->crc_count = 0;
-
-	switch(drive->current_speed) {
-		case XFER_UDMA_7:	return XFER_UDMA_6;
-		case XFER_UDMA_6:	return XFER_UDMA_5;
-		case XFER_UDMA_5:	return XFER_UDMA_4;
-		case XFER_UDMA_4:	return XFER_UDMA_3;
-		case XFER_UDMA_3:	return XFER_UDMA_2;
-		case XFER_UDMA_2:	return XFER_UDMA_1;
-		case XFER_UDMA_1:	return XFER_UDMA_0;
-			/*
-			 * OOPS we do not goto non Ultra DMA modes
-			 * without iCRC's available we force
-			 * the system to PIO and make the user
-			 * invoke the ATA-1 ATA-2 DMA modes.
-			 */
-		case XFER_UDMA_0:
-		default:		return XFER_PIO_4;
-	}
-}
-#endif /* CONFIG_BLK_DEV_IDEDMA */
-
 int ide_driveid_update(ide_drive_t *drive)
 {
 	ide_hwif_t *hwif = drive->hwif;
@@ -968,8 +941,20 @@ static ide_startstop_t reset_pollfunc (i
 static void check_dma_crc(ide_drive_t *drive)
 {
 #ifdef CONFIG_BLK_DEV_IDEDMA
+	u8 mode;
+
 	ide_dma_off_quietly(drive);
-	ide_set_xfer_rate(drive, ide_auto_reduce_xfer(drive));
+	drive->crc_count = 0;
+	mode = drive->current_speed;
+	/*
+	 * Don't try non Ultra-DMA modes without iCRC's.  Force the
+	 * device to PIO and make the user enable SWDMA/MWDMA modes.
+	 */
+	if (mode > XFER_UDMA_0 && mode <= XFER_UDMA_7)
+		mode--;
+	else
+		mode = XFER_PIO_4;
+	ide_set_xfer_rate(drive, mode);
 	if (drive->current_speed >= XFER_SW_DMA_0)
 		ide_dma_on(drive);
 #endif

  parent reply	other threads:[~2008-01-21 23:23 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-21 23:30 [PATCH 00/16] ide: various fixes/cleanups Bartlomiej Zolnierkiewicz
2008-01-21 23:30 ` [PATCH 01/16] ide-tape: use ide_execute_command() Bartlomiej Zolnierkiewicz
2008-01-22 14:32   ` Sergei Shtylyov
2008-01-21 23:30 ` [PATCH 02/16] ide-scsi: " Bartlomiej Zolnierkiewicz
2008-01-22 14:32   ` Sergei Shtylyov
2008-01-21 23:30 ` [PATCH 03/16] trm290: " Bartlomiej Zolnierkiewicz
2008-01-22 14:32   ` Sergei Shtylyov
2008-01-21 23:31 ` [PATCH 04/16] ide-cris: " Bartlomiej Zolnierkiewicz
2008-01-22 14:34   ` Sergei Shtylyov
2008-01-21 23:31 ` [PATCH 05/16] ide-probe: remove needless Status register reads Bartlomiej Zolnierkiewicz
2008-01-21 23:31 ` [PATCH 06/16] ide: remove unused ->auto_poll field from ide_hwif_t Bartlomiej Zolnierkiewicz
2008-01-22 14:04   ` Sergei Shtylyov
2008-01-21 23:31 ` [PATCH 07/16] ide: convert ->straight8 field in ide_hwif_t to bit flag Bartlomiej Zolnierkiewicz
2008-01-22 14:11   ` Sergei Shtylyov
2008-01-21 23:31 ` [PATCH 08/16] ide: remove ->nice0 and ->nice2 fields from ide_drive_t Bartlomiej Zolnierkiewicz
2008-01-22 14:10   ` Sergei Shtylyov
2008-01-21 23:31 ` [PATCH 09/16] ide: remove SATA_*_REG macros Bartlomiej Zolnierkiewicz
2008-01-21 23:31 ` [PATCH 10/16] ide: use __ide_set_handler() in ide_execute_command() Bartlomiej Zolnierkiewicz
2008-01-22 14:16   ` Sergei Shtylyov
2008-01-21 23:31 ` [PATCH 11/16] ide: unexport SELECT_DRIVE() Bartlomiej Zolnierkiewicz
2008-01-22 16:28   ` Sergei Shtylyov
2008-01-21 23:31 ` [PATCH 12/16] ide: remove set_transfer() Bartlomiej Zolnierkiewicz
2008-01-22 14:24   ` Sergei Shtylyov
2008-01-21 23:32 ` [PATCH 13/16] ide: remove ide_ata66_check() Bartlomiej Zolnierkiewicz
2008-01-22 16:31   ` Sergei Shtylyov
2008-01-21 23:32 ` [PATCH 14/16] ide: move drive->crc_count check out from check_dma_crc() Bartlomiej Zolnierkiewicz
2008-01-22 16:38   ` Sergei Shtylyov
2008-01-21 23:32 ` Bartlomiej Zolnierkiewicz [this message]
2008-01-22 16:39   ` [PATCH 15/16] ide: remove ide_auto_reduce_xfer() Sergei Shtylyov
2008-01-21 23:32 ` [PATCH 16/16] ide: move check_dma_crc() to ide-dma.c Bartlomiej Zolnierkiewicz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080121233219.30311.13119.sendpatchset@localhost.localdomain \
    --to=bzolnier@gmail.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).