linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/16] ide: various fixes/cleanups
@ 2008-01-21 23:30 Bartlomiej Zolnierkiewicz
  2008-01-21 23:30 ` [PATCH 01/16] ide-tape: use ide_execute_command() Bartlomiej Zolnierkiewicz
                   ` (15 more replies)
  0 siblings, 16 replies; 30+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-01-21 23:30 UTC (permalink / raw)
  To: linux-ide; +Cc: Bartlomiej Zolnierkiewicz, linux-kernel


Easy stuff done as relax from more hard-core changes...

diffstat:

 drivers/ide/cris/ide-cris.c |    6 -
 drivers/ide/ide-dma.c       |   20 ++++++
 drivers/ide/ide-iops.c      |  145 ++++++++++----------------------------------
 drivers/ide/ide-probe.c     |   35 ++++++----
 drivers/ide/ide-tape.c      |    4 -
 drivers/ide/ide-taskfile.c  |   11 ++-
 drivers/ide/ide.c           |    5 -
 drivers/ide/pci/siimage.c   |   25 ++++---
 drivers/ide/pci/trm290.c    |    5 -
 drivers/scsi/ide-scsi.c     |    7 --
 include/linux/hdreg.h       |    4 -
 include/linux/ide.h         |   15 ----
 12 files changed, 113 insertions(+), 169 deletions(-)

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 01/16] ide-tape: use ide_execute_command()
  2008-01-21 23:30 [PATCH 00/16] ide: various fixes/cleanups Bartlomiej Zolnierkiewicz
@ 2008-01-21 23:30 ` Bartlomiej Zolnierkiewicz
  2008-01-22 14:32   ` Sergei Shtylyov
  2008-01-21 23:30 ` [PATCH 02/16] ide-scsi: " Bartlomiej Zolnierkiewicz
                   ` (14 subsequent siblings)
  15 siblings, 1 reply; 30+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-01-21 23:30 UTC (permalink / raw)
  To: linux-ide; +Cc: Bartlomiej Zolnierkiewicz, linux-kernel


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

Index: b/drivers/ide/ide-tape.c
===================================================================
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -2181,8 +2181,8 @@ static ide_startstop_t idetape_issue_pac
 	if (dma_ok)			/* Will begin DMA later */
 		set_bit(PC_DMA_IN_PROGRESS, &pc->flags);
 	if (test_bit(IDETAPE_DRQ_INTERRUPT, &tape->flags)) {
-		ide_set_handler(drive, &idetape_transfer_pc, IDETAPE_WAIT_CMD, NULL);
-		hwif->OUTB(WIN_PACKETCMD, IDE_COMMAND_REG);
+		ide_execute_command(drive, WIN_PACKETCMD, &idetape_transfer_pc,
+				    IDETAPE_WAIT_CMD, NULL);
 		return ide_started;
 	} else {
 		hwif->OUTB(WIN_PACKETCMD, IDE_COMMAND_REG);

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 02/16] ide-scsi: use ide_execute_command()
  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-21 23:30 ` Bartlomiej Zolnierkiewicz
  2008-01-22 14:32   ` Sergei Shtylyov
  2008-01-21 23:30 ` [PATCH 03/16] trm290: " Bartlomiej Zolnierkiewicz
                   ` (13 subsequent siblings)
  15 siblings, 1 reply; 30+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-01-21 23:30 UTC (permalink / raw)
  To: linux-ide; +Cc: Bartlomiej Zolnierkiewicz, linux-kernel


Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/scsi/ide-scsi.c |    7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

Index: b/drivers/scsi/ide-scsi.c
===================================================================
--- a/drivers/scsi/ide-scsi.c
+++ b/drivers/scsi/ide-scsi.c
@@ -596,11 +596,8 @@ static ide_startstop_t idescsi_issue_pc 
 		set_bit(PC_DMA_OK, &pc->flags);
 
 	if (test_bit(IDESCSI_DRQ_INTERRUPT, &scsi->flags)) {
-		BUG_ON(HWGROUP(drive)->handler != NULL);
-		ide_set_handler(drive, &idescsi_transfer_pc,
-				get_timeout(pc), idescsi_expiry);
-		/* Issue the packet command */
-		HWIF(drive)->OUTB(WIN_PACKETCMD, IDE_COMMAND_REG);
+		ide_execute_command(drive, WIN_PACKETCMD, &idescsi_transfer_pc,
+				    get_timeout(pc), idescsi_expiry);
 		return ide_started;
 	} else {
 		/* Issue the packet command */

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 03/16] trm290: use ide_execute_command()
  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-21 23:30 ` [PATCH 02/16] ide-scsi: " Bartlomiej Zolnierkiewicz
@ 2008-01-21 23:30 ` Bartlomiej Zolnierkiewicz
  2008-01-22 14:32   ` Sergei Shtylyov
  2008-01-21 23:31 ` [PATCH 04/16] ide-cris: " Bartlomiej Zolnierkiewicz
                   ` (12 subsequent siblings)
  15 siblings, 1 reply; 30+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-01-21 23:30 UTC (permalink / raw)
  To: linux-ide; +Cc: Bartlomiej Zolnierkiewicz, linux-kernel


Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/ide/pci/trm290.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Index: b/drivers/ide/pci/trm290.c
===================================================================
--- a/drivers/ide/pci/trm290.c
+++ b/drivers/ide/pci/trm290.c
@@ -177,10 +177,7 @@ static void trm290_selectproc (ide_drive
 
 static void trm290_dma_exec_cmd(ide_drive_t *drive, u8 command)
 {
-	BUG_ON(HWGROUP(drive)->handler != NULL);	/* paranoia check */
-	ide_set_handler(drive, &ide_dma_intr, WAIT_CMD, NULL);
-	/* issue cmd to drive */
-	outb(command, IDE_COMMAND_REG);
+	ide_execute_command(drive, command, &ide_dma_intr, WAIT_CMD, NULL);
 }
 
 static int trm290_dma_setup(ide_drive_t *drive)

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 04/16] ide-cris: use ide_execute_command()
  2008-01-21 23:30 [PATCH 00/16] ide: various fixes/cleanups Bartlomiej Zolnierkiewicz
                   ` (2 preceding siblings ...)
  2008-01-21 23:30 ` [PATCH 03/16] trm290: " Bartlomiej Zolnierkiewicz
@ 2008-01-21 23:31 ` 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
                   ` (11 subsequent siblings)
  15 siblings, 1 reply; 30+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-01-21 23:31 UTC (permalink / raw)
  To: linux-ide; +Cc: Bartlomiej Zolnierkiewicz, linux-kernel


Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/ide/cris/ide-cris.c |    6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

Index: b/drivers/ide/cris/ide-cris.c
===================================================================
--- a/drivers/ide/cris/ide-cris.c
+++ b/drivers/ide/cris/ide-cris.c
@@ -1034,11 +1034,7 @@ static int cris_dma_setup(ide_drive_t *d
 
 static void cris_dma_exec_cmd(ide_drive_t *drive, u8 command)
 {
-	/* set the irq handler which will finish the request when DMA is done */
-	ide_set_handler(drive, &cris_dma_intr, WAIT_CMD, NULL);
-
-	/* issue cmd to drive */
-	cris_ide_outb(command, IDE_COMMAND_REG);
+	ide_execute_command(drive, command, &cris_dma_intr, WAIT_CMD, NULL);
 }
 
 static void cris_dma_start(ide_drive_t *drive)

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 05/16] ide-probe: remove needless Status register reads
  2008-01-21 23:30 [PATCH 00/16] ide: various fixes/cleanups Bartlomiej Zolnierkiewicz
                   ` (3 preceding siblings ...)
  2008-01-21 23:31 ` [PATCH 04/16] ide-cris: " Bartlomiej Zolnierkiewicz
@ 2008-01-21 23:31 ` Bartlomiej Zolnierkiewicz
  2008-01-21 23:31 ` [PATCH 06/16] ide: remove unused ->auto_poll field from ide_hwif_t Bartlomiej Zolnierkiewicz
                   ` (10 subsequent siblings)
  15 siblings, 0 replies; 30+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-01-21 23:31 UTC (permalink / raw)
  To: linux-ide; +Cc: Bartlomiej Zolnierkiewicz, linux-kernel


* Cache value read from the Status register in 'stat' variable in do_probe()
  and enable_nest(), then remove remove needless Status register reads.

While at it:

* Add proper KERN_* levels to printk() calls.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/ide/ide-probe.c |   35 +++++++++++++++++++++--------------
 1 file changed, 21 insertions(+), 14 deletions(-)

Index: b/drivers/ide/ide-probe.c
===================================================================
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -423,8 +423,9 @@ static int ide_busy_sleep(ide_hwif_t *hw
 
 static int do_probe (ide_drive_t *drive, u8 cmd)
 {
-	int rc;
 	ide_hwif_t *hwif = HWIF(drive);
+	int rc;
+	u8 stat;
 
 	if (drive->present) {
 		/* avoid waiting for inappropriate probes */
@@ -461,15 +462,17 @@ static int do_probe (ide_drive_t *drive,
 			/* failed: try again */
 			rc = try_to_identify(drive,cmd);
 		}
-		if (hwif->INB(IDE_STATUS_REG) == (BUSY_STAT|READY_STAT))
+
+		stat = hwif->INB(IDE_STATUS_REG);
+
+		if (stat == (BUSY_STAT | READY_STAT))
 			return 4;
 
 		if ((rc == 1 && cmd == WIN_PIDENTIFY) &&
 			((drive->autotune == IDE_TUNE_DEFAULT) ||
 			(drive->autotune == IDE_TUNE_AUTO))) {
-			printk("%s: no response (status = 0x%02x), "
-				"resetting drive\n", drive->name,
-				hwif->INB(IDE_STATUS_REG));
+			printk(KERN_ERR "%s: no response (status = 0x%02x), "
+					"resetting drive\n", drive->name, stat);
 			msleep(50);
 			hwif->OUTB(drive->select.all, IDE_SELECT_REG);
 			msleep(50);
@@ -477,11 +480,13 @@ static int do_probe (ide_drive_t *drive,
 			(void)ide_busy_sleep(hwif);
 			rc = try_to_identify(drive, cmd);
 		}
+
+		/* ensure drive IRQ is clear */
+		stat = hwif->INB(IDE_STATUS_REG);
+
 		if (rc == 1)
-			printk("%s: no response (status = 0x%02x)\n",
-				drive->name, hwif->INB(IDE_STATUS_REG));
-		/* ensure drive irq is clear */
-		(void) hwif->INB(IDE_STATUS_REG);
+			printk(KERN_ERR "%s: no response (status = 0x%02x)\n",
+					drive->name, stat);
 	} else {
 		/* not present or maybe ATAPI */
 		rc = 3;
@@ -502,6 +507,7 @@ static int do_probe (ide_drive_t *drive,
 static void enable_nest (ide_drive_t *drive)
 {
 	ide_hwif_t *hwif = HWIF(drive);
+	u8 stat;
 
 	printk("%s: enabling %s -- ", hwif->name, drive->id->model);
 	SELECT_DRIVE(drive);
@@ -515,11 +521,12 @@ static void enable_nest (ide_drive_t *dr
 
 	msleep(50);
 
-	if (!OK_STAT((hwif->INB(IDE_STATUS_REG)), 0, BAD_STAT)) {
-		printk("failed (status = 0x%02x)\n", hwif->INB(IDE_STATUS_REG));
-	} else {
-		printk("success\n");
-	}
+	stat = hwif->INB(IDE_STATUS_REG);
+
+	if (!OK_STAT(stat, 0, BAD_STAT))
+		printk(KERN_CONT "failed (status = 0x%02x)\n", stat);
+	else
+		printk(KERN_CONT "success\n");
 
 	/* if !(success||timed-out) */
 	if (do_probe(drive, WIN_IDENTIFY) >= 2) {

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 06/16] ide: remove unused ->auto_poll field from ide_hwif_t
  2008-01-21 23:30 [PATCH 00/16] ide: various fixes/cleanups Bartlomiej Zolnierkiewicz
                   ` (4 preceding siblings ...)
  2008-01-21 23:31 ` [PATCH 05/16] ide-probe: remove needless Status register reads Bartlomiej Zolnierkiewicz
@ 2008-01-21 23:31 ` 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
                   ` (9 subsequent siblings)
  15 siblings, 1 reply; 30+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-01-21 23:31 UTC (permalink / raw)
  To: linux-ide; +Cc: Bartlomiej Zolnierkiewicz, linux-kernel


Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 include/linux/ide.h |    1 -
 1 file changed, 1 deletion(-)

Index: b/include/linux/ide.h
===================================================================
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -607,7 +607,6 @@ typedef struct hwif_s {
 	unsigned	serialized : 1;	/* serialized all channel operation */
 	unsigned	sharing_irq: 1;	/* 1 = sharing irq with another hwif */
 	unsigned	reset      : 1;	/* reset after probe */
-	unsigned	auto_poll  : 1; /* supports nop auto-poll */
 	unsigned	sg_mapped  : 1;	/* sg_table and sg_nents are ready */
 	unsigned	mmio       : 1; /* host uses MMIO */
 

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 07/16] ide: convert ->straight8 field in ide_hwif_t to bit flag
  2008-01-21 23:30 [PATCH 00/16] ide: various fixes/cleanups Bartlomiej Zolnierkiewicz
                   ` (5 preceding siblings ...)
  2008-01-21 23:31 ` [PATCH 06/16] ide: remove unused ->auto_poll field from ide_hwif_t Bartlomiej Zolnierkiewicz
@ 2008-01-21 23:31 ` 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
                   ` (8 subsequent siblings)
  15 siblings, 1 reply; 30+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-01-21 23:31 UTC (permalink / raw)
  To: linux-ide; +Cc: Bartlomiej Zolnierkiewicz, linux-kernel


Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 include/linux/ide.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: b/include/linux/ide.h
===================================================================
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -488,7 +488,6 @@ typedef struct hwif_s {
 	u8 major;	/* our major number */
 	u8 index;	/* 0 for ide0; 1 for ide1; ... */
 	u8 channel;	/* for dual-port chips: 0=primary, 1=secondary */
-	u8 straight8;	/* Alan's straight 8 check */
 	u8 bus_state;	/* power state of the IDE bus */
 
 	u32 host_flags;
@@ -609,6 +608,7 @@ typedef struct hwif_s {
 	unsigned	reset      : 1;	/* reset after probe */
 	unsigned	sg_mapped  : 1;	/* sg_table and sg_nents are ready */
 	unsigned	mmio       : 1; /* host uses MMIO */
+	unsigned	straight8  : 1;	/* Alan's straight 8 check */
 
 	struct device	gendev;
 	struct completion gendev_rel_comp; /* To deal with device release() */

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 08/16] ide: remove ->nice0 and ->nice2 fields from ide_drive_t
  2008-01-21 23:30 [PATCH 00/16] ide: various fixes/cleanups Bartlomiej Zolnierkiewicz
                   ` (6 preceding siblings ...)
  2008-01-21 23:31 ` [PATCH 07/16] ide: convert ->straight8 field in ide_hwif_t to bit flag Bartlomiej Zolnierkiewicz
@ 2008-01-21 23:31 ` Bartlomiej Zolnierkiewicz
  2008-01-22 14:10   ` Sergei Shtylyov
  2008-01-21 23:31 ` [PATCH 09/16] ide: remove SATA_*_REG macros Bartlomiej Zolnierkiewicz
                   ` (7 subsequent siblings)
  15 siblings, 1 reply; 30+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-01-21 23:31 UTC (permalink / raw)
  To: linux-ide; +Cc: Bartlomiej Zolnierkiewicz, linux-kernel


* ->nice0 and ->nice2 ide_drive_t fields are always zero so remove them.

* IDE_NICE_0 and IDE_NICE_2 defines from <linux/hdreg.h> are no longer
  used by any kernel code so cover them with #ifndef/#endif __KERNEL__.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/ide/ide.c     |    5 +----
 include/linux/hdreg.h |    4 +++-
 include/linux/ide.h   |    2 --
 3 files changed, 4 insertions(+), 7 deletions(-)

Index: b/drivers/ide/ide.c
===================================================================
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -1035,11 +1035,8 @@ int generic_ide_ioctl(ide_drive_t *drive
 		case HDIO_GET_NICE:
 			return put_user(drive->dsc_overlap	<<	IDE_NICE_DSC_OVERLAP	|
 					drive->atapi_overlap	<<	IDE_NICE_ATAPI_OVERLAP	|
-					drive->nice0		<< 	IDE_NICE_0		|
-					drive->nice1		<<	IDE_NICE_1		|
-					drive->nice2		<<	IDE_NICE_2,
+					drive->nice1 << IDE_NICE_1,
 					(long __user *) arg);
-
 #ifdef CONFIG_IDE_TASK_IOCTL
 		case HDIO_DRIVE_TASKFILE:
 		        if (!capable(CAP_SYS_ADMIN) || !capable(CAP_SYS_RAWIO))
Index: b/include/linux/hdreg.h
===================================================================
--- a/include/linux/hdreg.h
+++ b/include/linux/hdreg.h
@@ -706,8 +706,10 @@ struct hd_driveid {
  */
 #define IDE_NICE_DSC_OVERLAP	(0)	/* per the DSC overlap protocol */
 #define IDE_NICE_ATAPI_OVERLAP	(1)	/* not supported yet */
-#define IDE_NICE_0		(2)	/* when sure that it won't affect us */
 #define IDE_NICE_1		(3)	/* when probably won't affect us much */
+#ifndef __KERNEL__
+#define IDE_NICE_0		(2)	/* when sure that it won't affect us */
 #define IDE_NICE_2		(4)	/* when we know it's on our expense */
+#endif
 
 #endif	/* _LINUX_HDREG_H */
Index: b/include/linux/ide.h
===================================================================
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -407,8 +407,6 @@ typedef struct ide_drive_s {
 	unsigned no_unmask	: 1;	/* disallow setting unmask bit */
 	unsigned no_io_32bit	: 1;	/* disallow enabling 32bit I/O */
 	unsigned atapi_overlap	: 1;	/* ATAPI overlap (not supported) */
-	unsigned nice0		: 1;	/* give obvious excess bandwidth */
-	unsigned nice2		: 1;	/* give a share in our own bandwidth */
 	unsigned doorlocking	: 1;	/* for removable only: door lock/unlock works */
 	unsigned nodma		: 1;	/* disallow DMA */
 	unsigned autotune	: 2;	/* 0=default, 1=autotune, 2=noautotune */

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 09/16] ide: remove SATA_*_REG macros
  2008-01-21 23:30 [PATCH 00/16] ide: various fixes/cleanups Bartlomiej Zolnierkiewicz
                   ` (7 preceding siblings ...)
  2008-01-21 23:31 ` [PATCH 08/16] ide: remove ->nice0 and ->nice2 fields from ide_drive_t Bartlomiej Zolnierkiewicz
@ 2008-01-21 23:31 ` Bartlomiej Zolnierkiewicz
  2008-01-21 23:31 ` [PATCH 10/16] ide: use __ide_set_handler() in ide_execute_command() Bartlomiej Zolnierkiewicz
                   ` (6 subsequent siblings)
  15 siblings, 0 replies; 30+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-01-21 23:31 UTC (permalink / raw)
  To: linux-ide; +Cc: Bartlomiej Zolnierkiewicz, linux-kernel


* siimage.c: use hwif->sata_scr[SATA_{ERROR,STATUS}_OFFSET] instead of
  SATA_{ERROR,STATUS}_REG macros.

* Remove no longer needed SATA_*_REG macros.

While at it:

* Remove needless SATA Status register read from sil_sata_reset_poll().

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/ide/pci/siimage.c |   25 ++++++++++++++++---------
 include/linux/ide.h       |    6 ------
 2 files changed, 16 insertions(+), 15 deletions(-)

Index: b/drivers/ide/pci/siimage.c
===================================================================
--- a/drivers/ide/pci/siimage.c
+++ b/drivers/ide/pci/siimage.c
@@ -331,15 +331,18 @@ static int siimage_mmio_ide_dma_test_irq
 {
 	ide_hwif_t *hwif	= HWIF(drive);
 	unsigned long addr	= siimage_selreg(hwif, 0x1);
+	void __iomem *sata_error_addr
+		= (void __iomem *)hwif->sata_scr[SATA_ERROR_OFFSET];
 
-	if (SATA_ERROR_REG) {
+	if (sata_error_addr) {
 		unsigned long base = (unsigned long)hwif->hwif_data;
-
 		u32 ext_stat = readl((void __iomem *)(base + 0x10));
 		u8 watchdog = 0;
+
 		if (ext_stat & ((hwif->channel) ? 0x40 : 0x10)) {
-			u32 sata_error = readl((void __iomem *)SATA_ERROR_REG);
-			writel(sata_error, (void __iomem *)SATA_ERROR_REG);
+			u32 sata_error = readl(sata_error_addr);
+
+			writel(sata_error, sata_error_addr);
 			watchdog = (sata_error & 0x00680000) ? 1 : 0;
 			printk(KERN_WARNING "%s: sata_error = 0x%08x, "
 				"watchdog = %d, %s\n",
@@ -418,13 +421,17 @@ static int sil_sata_busproc(ide_drive_t 
 
 static int sil_sata_reset_poll(ide_drive_t *drive)
 {
-	if (SATA_STATUS_REG) {
-		ide_hwif_t *hwif	= HWIF(drive);
+	ide_hwif_t *hwif = drive->hwif;
+	void __iomem *sata_status_addr
+		= (void __iomem *)hwif->sata_scr[SATA_STATUS_OFFSET];
+
+	if (sata_status_addr) {
+		/* SATA Status is available only when in MMIO mode */
+		u32 sata_stat = readl(sata_status_addr);
 
-		/* SATA_STATUS_REG is valid only when in MMIO mode */
-		if ((readl((void __iomem *)SATA_STATUS_REG) & 0x03) != 0x03) {
+		if ((sata_stat & 0x03) != 0x03) {
 			printk(KERN_WARNING "%s: reset phy dead, status=0x%08x\n",
-				hwif->name, readl((void __iomem *)SATA_STATUS_REG));
+					    hwif->name, sata_stat);
 			HWGROUP(drive)->polling = 0;
 			return ide_started;
 		}
Index: b/include/linux/ide.h
===================================================================
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -112,18 +112,12 @@ typedef unsigned char	byte;	/* used ever
 #define SATA_NR_PORTS		(3)	/* 16 possible ?? */
 
 #define SATA_STATUS_OFFSET	(0)
-#define SATA_STATUS_REG		(HWIF(drive)->sata_scr[SATA_STATUS_OFFSET])
 #define SATA_ERROR_OFFSET	(1)
-#define SATA_ERROR_REG		(HWIF(drive)->sata_scr[SATA_ERROR_OFFSET])
 #define SATA_CONTROL_OFFSET	(2)
-#define SATA_CONTROL_REG	(HWIF(drive)->sata_scr[SATA_CONTROL_OFFSET])
 
 #define SATA_MISC_OFFSET	(0)
-#define SATA_MISC_REG		(HWIF(drive)->sata_misc[SATA_MISC_OFFSET])
 #define SATA_PHY_OFFSET		(1)
-#define SATA_PHY_REG		(HWIF(drive)->sata_misc[SATA_PHY_OFFSET])
 #define SATA_IEN_OFFSET		(2)
-#define SATA_IEN_REG		(HWIF(drive)->sata_misc[SATA_IEN_OFFSET])
 
 /*
  * Our Physical Region Descriptor (PRD) table should be large enough

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 10/16] ide: use __ide_set_handler() in ide_execute_command()
  2008-01-21 23:30 [PATCH 00/16] ide: various fixes/cleanups Bartlomiej Zolnierkiewicz
                   ` (8 preceding siblings ...)
  2008-01-21 23:31 ` [PATCH 09/16] ide: remove SATA_*_REG macros Bartlomiej Zolnierkiewicz
@ 2008-01-21 23:31 ` Bartlomiej Zolnierkiewicz
  2008-01-22 14:16   ` Sergei Shtylyov
  2008-01-21 23:31 ` [PATCH 11/16] ide: unexport SELECT_DRIVE() Bartlomiej Zolnierkiewicz
                   ` (5 subsequent siblings)
  15 siblings, 1 reply; 30+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-01-21 23:31 UTC (permalink / raw)
  To: linux-ide; +Cc: Bartlomiej Zolnierkiewicz, linux-kernel


* Use __ide_set_handler() in ide_execute_command().

While at it:

* Fix whitespace damage in ide_execute_command().

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

Index: b/drivers/ide/ide-iops.c
===================================================================
--- a/drivers/ide/ide-iops.c
+++ b/drivers/ide/ide-iops.c
@@ -882,22 +882,17 @@ void ide_execute_command(ide_drive_t *dr
 	unsigned long flags;
 	ide_hwgroup_t *hwgroup = HWGROUP(drive);
 	ide_hwif_t *hwif = HWIF(drive);
-	
+
 	spin_lock_irqsave(&ide_lock, flags);
-	
 	BUG_ON(hwgroup->handler);
-	hwgroup->handler	= handler;
-	hwgroup->expiry		= expiry;
-	hwgroup->timer.expires	= jiffies + timeout;
-	hwgroup->req_gen_timer = hwgroup->req_gen;
-	add_timer(&hwgroup->timer);
+	__ide_set_handler(drive, handler, timeout, expiry);
 	hwif->OUTBSYNC(drive, cmd, IDE_COMMAND_REG);
-	/* Drive takes 400nS to respond, we must avoid the IRQ being
-	   serviced before that. 
-	   
-	   FIXME: we could skip this delay with care on non shared
-	   devices 
-	*/
+	/*
+	 * Drive takes 400nS to respond, we must avoid the IRQ being
+	 * serviced before that.
+	 *
+	 * FIXME: we could skip this delay with care on non shared devices
+	 */
 	ndelay(400);
 	spin_unlock_irqrestore(&ide_lock, flags);
 }

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 11/16] ide: unexport SELECT_DRIVE()
  2008-01-21 23:30 [PATCH 00/16] ide: various fixes/cleanups Bartlomiej Zolnierkiewicz
                   ` (9 preceding siblings ...)
  2008-01-21 23:31 ` [PATCH 10/16] ide: use __ide_set_handler() in ide_execute_command() Bartlomiej Zolnierkiewicz
@ 2008-01-21 23:31 ` Bartlomiej Zolnierkiewicz
  2008-01-22 16:28   ` Sergei Shtylyov
  2008-01-21 23:31 ` [PATCH 12/16] ide: remove set_transfer() Bartlomiej Zolnierkiewicz
                   ` (4 subsequent siblings)
  15 siblings, 1 reply; 30+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-01-21 23:31 UTC (permalink / raw)
  To: linux-ide; +Cc: Bartlomiej Zolnierkiewicz, linux-kernel


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

Index: b/drivers/ide/ide-iops.c
===================================================================
--- a/drivers/ide/ide-iops.c
+++ b/drivers/ide/ide-iops.c
@@ -163,8 +163,6 @@ void SELECT_DRIVE (ide_drive_t *drive)
 	HWIF(drive)->OUTB(drive->select.all, IDE_SELECT_REG);
 }
 
-EXPORT_SYMBOL(SELECT_DRIVE);
-
 void SELECT_MASK (ide_drive_t *drive, int mask)
 {
 	if (HWIF(drive)->maskproc)

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 12/16] ide: remove set_transfer()
  2008-01-21 23:30 [PATCH 00/16] ide: various fixes/cleanups Bartlomiej Zolnierkiewicz
                   ` (10 preceding siblings ...)
  2008-01-21 23:31 ` [PATCH 11/16] ide: unexport SELECT_DRIVE() Bartlomiej Zolnierkiewicz
@ 2008-01-21 23:31 ` Bartlomiej Zolnierkiewicz
  2008-01-22 14:24   ` Sergei Shtylyov
  2008-01-21 23:32 ` [PATCH 13/16] ide: remove ide_ata66_check() Bartlomiej Zolnierkiewicz
                   ` (3 subsequent siblings)
  15 siblings, 1 reply; 30+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-01-21 23:31 UTC (permalink / raw)
  To: linux-ide; +Cc: Bartlomiej Zolnierkiewicz, linux-kernel


Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/ide/ide-iops.c     |   18 ------------------
 drivers/ide/ide-taskfile.c |    6 +++++-
 include/linux/ide.h        |    1 -
 3 files changed, 5 insertions(+), 20 deletions(-)

Index: b/drivers/ide/ide-iops.c
===================================================================
--- a/drivers/ide/ide-iops.c
+++ b/drivers/ide/ide-iops.c
@@ -627,24 +627,6 @@ int ide_ata66_check (ide_drive_t *drive,
 	return 0;
 }
 
-/*
- * Backside of HDIO_DRIVE_CMD call of SETFEATURES_XFER.
- * 1 : Safe to update drive->id DMA registers.
- * 0 : OOPs not allowed.
- */
-int set_transfer (ide_drive_t *drive, ide_task_t *args)
-{
-	if (args->tf.command == WIN_SETFEATURES &&
-	    args->tf.nsect >= XFER_SW_DMA_0 &&
-	    args->tf.feature == SETFEATURES_XFER &&
-	    (drive->id->dma_ultra ||
-	     drive->id->dma_mword ||
-	     drive->id->dma_1word))
-		return 1;
-
-	return 0;
-}
-
 #ifdef CONFIG_BLK_DEV_IDEDMA
 static u8 ide_auto_reduce_xfer (ide_drive_t *drive)
 {
Index: b/drivers/ide/ide-taskfile.c
===================================================================
--- a/drivers/ide/ide-taskfile.c
+++ b/drivers/ide/ide-taskfile.c
@@ -755,6 +755,7 @@ int ide_cmd_ioctl (ide_drive_t *drive, u
 	u8 args[4], xfer_rate = 0;
 	ide_task_t tfargs;
 	struct ide_taskfile *tf = &tfargs.tf;
+	struct hd_driveid *id = drive->id;
 
 	if (NULL == (void *) arg) {
 		struct request rq;
@@ -792,7 +793,10 @@ int ide_cmd_ioctl (ide_drive_t *drive, u
 			return -ENOMEM;
 	}
 
-	if (set_transfer(drive, &tfargs)) {
+	if (tf->command == WIN_SETFEATURES &&
+	    tf->feature == SETFEATURES_XFER &&
+	    tf->nsect >= XFER_SW_DMA_0 &&
+	    (id->dma_ultra || id->dma_mword || id->dma_1word)) {
 		xfer_rate = args[1];
 		if (ide_ata66_check(drive, &tfargs))
 			goto abort;
Index: b/include/linux/ide.h
===================================================================
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -993,7 +993,6 @@ extern int ide_driveid_update(ide_drive_
 extern int ide_ata66_check(ide_drive_t *, ide_task_t *);
 extern int ide_config_drive_speed(ide_drive_t *, u8);
 extern u8 eighty_ninty_three (ide_drive_t *);
-extern int set_transfer(ide_drive_t *, ide_task_t *);
 extern int taskfile_lib_get_identify(ide_drive_t *drive, u8 *);
 
 extern int ide_wait_not_busy(ide_hwif_t *hwif, unsigned long timeout);

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 13/16] ide: remove ide_ata66_check()
  2008-01-21 23:30 [PATCH 00/16] ide: various fixes/cleanups Bartlomiej Zolnierkiewicz
                   ` (11 preceding siblings ...)
  2008-01-21 23:31 ` [PATCH 12/16] ide: remove set_transfer() Bartlomiej Zolnierkiewicz
@ 2008-01-21 23:32 ` 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
                   ` (2 subsequent siblings)
  15 siblings, 1 reply; 30+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-01-21 23:32 UTC (permalink / raw)
  To: linux-ide; +Cc: Bartlomiej Zolnierkiewicz, linux-kernel


Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/ide/ide-iops.c     |   15 ---------------
 drivers/ide/ide-taskfile.c |    5 ++++-
 include/linux/ide.h        |    1 -
 3 files changed, 4 insertions(+), 17 deletions(-)

Index: b/drivers/ide/ide-iops.c
===================================================================
--- a/drivers/ide/ide-iops.c
+++ b/drivers/ide/ide-iops.c
@@ -612,21 +612,6 @@ no_80w:
 	return 0;
 }
 
-int ide_ata66_check (ide_drive_t *drive, ide_task_t *args)
-{
-	if (args->tf.command == WIN_SETFEATURES &&
-	    args->tf.nsect > XFER_UDMA_2 &&
-	    args->tf.feature == SETFEATURES_XFER) {
-		if (eighty_ninty_three(drive) == 0) {
-			printk(KERN_WARNING "%s: UDMA speeds >UDMA33 cannot "
-					    "be set\n", drive->name);
-			return 1;
-		}
-	}
-
-	return 0;
-}
-
 #ifdef CONFIG_BLK_DEV_IDEDMA
 static u8 ide_auto_reduce_xfer (ide_drive_t *drive)
 {
Index: b/drivers/ide/ide-taskfile.c
===================================================================
--- a/drivers/ide/ide-taskfile.c
+++ b/drivers/ide/ide-taskfile.c
@@ -798,8 +798,11 @@ int ide_cmd_ioctl (ide_drive_t *drive, u
 	    tf->nsect >= XFER_SW_DMA_0 &&
 	    (id->dma_ultra || id->dma_mword || id->dma_1word)) {
 		xfer_rate = args[1];
-		if (ide_ata66_check(drive, &tfargs))
+		if (tf->nsect > XFER_UDMA_2 && !eighty_ninty_three(drive)) {
+			printk(KERN_WARNING "%s: UDMA speeds >UDMA33 cannot "
+					    "be set\n", drive->name);
 			goto abort;
+		}
 	}
 
 	err = ide_raw_taskfile(drive, &tfargs, buf, args[3]);
Index: b/include/linux/ide.h
===================================================================
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -990,7 +990,6 @@ int ide_task_ioctl(ide_drive_t *, unsign
 extern int system_bus_clock(void);
 
 extern int ide_driveid_update(ide_drive_t *);
-extern int ide_ata66_check(ide_drive_t *, ide_task_t *);
 extern int ide_config_drive_speed(ide_drive_t *, u8);
 extern u8 eighty_ninty_three (ide_drive_t *);
 extern int taskfile_lib_get_identify(ide_drive_t *drive, u8 *);

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 14/16] ide: move drive->crc_count check out from check_dma_crc()
  2008-01-21 23:30 [PATCH 00/16] ide: various fixes/cleanups Bartlomiej Zolnierkiewicz
                   ` (12 preceding siblings ...)
  2008-01-21 23:32 ` [PATCH 13/16] ide: remove ide_ata66_check() Bartlomiej Zolnierkiewicz
@ 2008-01-21 23:32 ` Bartlomiej Zolnierkiewicz
  2008-01-22 16:38   ` Sergei Shtylyov
  2008-01-21 23:32 ` [PATCH 15/16] ide: remove ide_auto_reduce_xfer() Bartlomiej Zolnierkiewicz
  2008-01-21 23:32 ` [PATCH 16/16] ide: move check_dma_crc() to ide-dma.c Bartlomiej Zolnierkiewicz
  15 siblings, 1 reply; 30+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-01-21 23:32 UTC (permalink / raw)
  To: linux-ide; +Cc: Bartlomiej Zolnierkiewicz, linux-kernel


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

Index: b/drivers/ide/ide-iops.c
===================================================================
--- a/drivers/ide/ide-iops.c
+++ b/drivers/ide/ide-iops.c
@@ -968,13 +968,10 @@ static ide_startstop_t reset_pollfunc (i
 static void check_dma_crc(ide_drive_t *drive)
 {
 #ifdef CONFIG_BLK_DEV_IDEDMA
-	if (drive->crc_count) {
-		ide_dma_off_quietly(drive);
-		ide_set_xfer_rate(drive, ide_auto_reduce_xfer(drive));
-		if (drive->current_speed >= XFER_SW_DMA_0)
-			ide_dma_on(drive);
-	} else
-		ide_dma_off(drive);
+	ide_dma_off_quietly(drive);
+	ide_set_xfer_rate(drive, ide_auto_reduce_xfer(drive));
+	if (drive->current_speed >= XFER_SW_DMA_0)
+		ide_dma_on(drive);
 #endif
 }
 
@@ -999,17 +996,20 @@ static void pre_reset(ide_drive_t *drive
 	else
 		drive->post_reset = 1;
 
-	if (!drive->keep_settings) {
-		if (drive->using_dma) {
+	if (drive->using_dma) {
+		if (drive->crc_count)
 			check_dma_crc(drive);
-		} else {
+		else
+			ide_dma_off(drive);
+	}
+
+	if (!drive->keep_settings) {
+		if (!drive->using_dma) {
 			drive->unmask = 0;
 			drive->io_32bit = 0;
 		}
 		return;
 	}
-	if (drive->using_dma)
-		check_dma_crc(drive);
 
 	if (HWIF(drive)->pre_reset != NULL)
 		HWIF(drive)->pre_reset(drive);

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 15/16] ide: remove ide_auto_reduce_xfer()
  2008-01-21 23:30 [PATCH 00/16] ide: various fixes/cleanups Bartlomiej Zolnierkiewicz
                   ` (13 preceding siblings ...)
  2008-01-21 23:32 ` [PATCH 14/16] ide: move drive->crc_count check out from check_dma_crc() Bartlomiej Zolnierkiewicz
@ 2008-01-21 23:32 ` Bartlomiej Zolnierkiewicz
  2008-01-22 16:39   ` Sergei Shtylyov
  2008-01-21 23:32 ` [PATCH 16/16] ide: move check_dma_crc() to ide-dma.c Bartlomiej Zolnierkiewicz
  15 siblings, 1 reply; 30+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-01-21 23:32 UTC (permalink / raw)
  To: linux-ide; +Cc: Bartlomiej Zolnierkiewicz, linux-kernel


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

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 16/16] ide: move check_dma_crc() to ide-dma.c
  2008-01-21 23:30 [PATCH 00/16] ide: various fixes/cleanups Bartlomiej Zolnierkiewicz
                   ` (14 preceding siblings ...)
  2008-01-21 23:32 ` [PATCH 15/16] ide: remove ide_auto_reduce_xfer() Bartlomiej Zolnierkiewicz
@ 2008-01-21 23:32 ` Bartlomiej Zolnierkiewicz
  15 siblings, 0 replies; 30+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-01-21 23:32 UTC (permalink / raw)
  To: linux-ide; +Cc: Bartlomiej Zolnierkiewicz, linux-kernel


* Move check_dma_crc() to ide-dma.c and add inline version for
  CONFIG_BLK_DEV_IDEDMA=n case.

* Rename check_dma_crc() to ide_check_dma_crc().

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/ide/ide-dma.c  |   20 ++++++++++++++++++++
 drivers/ide/ide-iops.c |   24 +-----------------------
 include/linux/ide.h    |    2 ++
 3 files changed, 23 insertions(+), 23 deletions(-)

Index: b/drivers/ide/ide-dma.c
===================================================================
--- a/drivers/ide/ide-dma.c
+++ b/drivers/ide/ide-dma.c
@@ -821,6 +821,26 @@ int ide_set_dma(ide_drive_t *drive)
 	return 0;
 }
 
+void ide_check_dma_crc(ide_drive_t *drive)
+{
+	u8 mode;
+
+	ide_dma_off_quietly(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);
+}
+
 #ifdef CONFIG_BLK_DEV_IDEDMA_PCI
 void ide_dma_lost_irq (ide_drive_t *drive)
 {
Index: b/drivers/ide/ide-iops.c
===================================================================
--- a/drivers/ide/ide-iops.c
+++ b/drivers/ide/ide-iops.c
@@ -938,28 +938,6 @@ static ide_startstop_t reset_pollfunc (i
 	return ide_stopped;
 }
 
-static void check_dma_crc(ide_drive_t *drive)
-{
-#ifdef CONFIG_BLK_DEV_IDEDMA
-	u8 mode;
-
-	ide_dma_off_quietly(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
-}
-
 static void ide_disk_pre_reset(ide_drive_t *drive)
 {
 	int legacy = (drive->id->cfs_enable_2 & 0x0400) ? 0 : 1;
@@ -983,7 +961,7 @@ static void pre_reset(ide_drive_t *drive
 
 	if (drive->using_dma) {
 		if (drive->crc_count)
-			check_dma_crc(drive);
+			ide_check_dma_crc(drive);
 		else
 			ide_dma_off(drive);
 	}
Index: b/include/linux/ide.h
===================================================================
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -1158,6 +1158,7 @@ void ide_dma_off_quietly(ide_drive_t *);
 void ide_dma_off(ide_drive_t *);
 void ide_dma_on(ide_drive_t *);
 int ide_set_dma(ide_drive_t *);
+void ide_check_dma_crc(ide_drive_t *);
 ide_startstop_t ide_dma_intr(ide_drive_t *);
 
 int ide_build_sglist(ide_drive_t *, struct request *);
@@ -1185,6 +1186,7 @@ static inline void ide_dma_off(ide_drive
 static inline void ide_dma_on(ide_drive_t *drive) { ; }
 static inline void ide_dma_verbose(ide_drive_t *drive) { ; }
 static inline int ide_set_dma(ide_drive_t *drive) { return 1; }
+static inline void ide_check_dma_crc(ide_drive_t *drive) { ; }
 #endif /* CONFIG_BLK_DEV_IDEDMA */
 
 #ifndef CONFIG_BLK_DEV_IDEDMA_PCI

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 06/16] ide: remove unused ->auto_poll field from ide_hwif_t
  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
  0 siblings, 0 replies; 30+ messages in thread
From: Sergei Shtylyov @ 2008-01-22 14:04 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz; +Cc: linux-ide, linux-kernel

Bartlomiej Zolnierkiewicz wrote:

> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>

MBR, Sergei

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 08/16] ide: remove ->nice0 and ->nice2 fields from ide_drive_t
  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
  0 siblings, 0 replies; 30+ messages in thread
From: Sergei Shtylyov @ 2008-01-22 14:10 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz; +Cc: linux-ide, linux-kernel

Bartlomiej Zolnierkiewicz wrote:

> * ->nice0 and ->nice2 ide_drive_t fields are always zero so remove them.

> * IDE_NICE_0 and IDE_NICE_2 defines from <linux/hdreg.h> are no longer
>   used by any kernel code so cover them with #ifndef/#endif __KERNEL__.

> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>

MBR, Sergei

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 07/16] ide: convert ->straight8 field in ide_hwif_t to bit flag
  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
  0 siblings, 0 replies; 30+ messages in thread
From: Sergei Shtylyov @ 2008-01-22 14:11 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz; +Cc: linux-ide, linux-kernel

Bartlomiej Zolnierkiewicz wrote:

> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>

MBR, Sergei

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 10/16] ide: use __ide_set_handler() in ide_execute_command()
  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
  0 siblings, 0 replies; 30+ messages in thread
From: Sergei Shtylyov @ 2008-01-22 14:16 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz; +Cc: linux-ide, linux-kernel

Bartlomiej Zolnierkiewicz wrote:

> * Use __ide_set_handler() in ide_execute_command().

> While at it:

> * Fix whitespace damage in ide_execute_command().

> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>

MBR, Sergei

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 12/16] ide: remove set_transfer()
  2008-01-21 23:31 ` [PATCH 12/16] ide: remove set_transfer() Bartlomiej Zolnierkiewicz
@ 2008-01-22 14:24   ` Sergei Shtylyov
  0 siblings, 0 replies; 30+ messages in thread
From: Sergei Shtylyov @ 2008-01-22 14:24 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz; +Cc: linux-ide, linux-kernel

Bartlomiej Zolnierkiewicz wrote:

> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>

MBR, Sergei

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 01/16] ide-tape: use ide_execute_command()
  2008-01-21 23:30 ` [PATCH 01/16] ide-tape: use ide_execute_command() Bartlomiej Zolnierkiewicz
@ 2008-01-22 14:32   ` Sergei Shtylyov
  0 siblings, 0 replies; 30+ messages in thread
From: Sergei Shtylyov @ 2008-01-22 14:32 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz; +Cc: linux-ide, linux-kernel

Bartlomiej Zolnierkiewicz wrote:

> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>

MBR, Sergei


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 02/16] ide-scsi: use ide_execute_command()
  2008-01-21 23:30 ` [PATCH 02/16] ide-scsi: " Bartlomiej Zolnierkiewicz
@ 2008-01-22 14:32   ` Sergei Shtylyov
  0 siblings, 0 replies; 30+ messages in thread
From: Sergei Shtylyov @ 2008-01-22 14:32 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz; +Cc: linux-ide, linux-kernel

Bartlomiej Zolnierkiewicz wrote:

> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>

MBR, Sergei

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 03/16] trm290: use ide_execute_command()
  2008-01-21 23:30 ` [PATCH 03/16] trm290: " Bartlomiej Zolnierkiewicz
@ 2008-01-22 14:32   ` Sergei Shtylyov
  0 siblings, 0 replies; 30+ messages in thread
From: Sergei Shtylyov @ 2008-01-22 14:32 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz; +Cc: linux-ide, linux-kernel

Bartlomiej Zolnierkiewicz wrote:

> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>

MBR, Sergei

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 04/16] ide-cris: use ide_execute_command()
  2008-01-21 23:31 ` [PATCH 04/16] ide-cris: " Bartlomiej Zolnierkiewicz
@ 2008-01-22 14:34   ` Sergei Shtylyov
  0 siblings, 0 replies; 30+ messages in thread
From: Sergei Shtylyov @ 2008-01-22 14:34 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz; +Cc: linux-ide, linux-kernel

Bartlomiej Zolnierkiewicz wrote:

> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>

MBR, Sergei


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 11/16] ide: unexport SELECT_DRIVE()
  2008-01-21 23:31 ` [PATCH 11/16] ide: unexport SELECT_DRIVE() Bartlomiej Zolnierkiewicz
@ 2008-01-22 16:28   ` Sergei Shtylyov
  0 siblings, 0 replies; 30+ messages in thread
From: Sergei Shtylyov @ 2008-01-22 16:28 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz; +Cc: linux-ide, linux-kernel

Bartlomiej Zolnierkiewicz wrote:

> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>

MBR, Sergei


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 13/16] ide: remove ide_ata66_check()
  2008-01-21 23:32 ` [PATCH 13/16] ide: remove ide_ata66_check() Bartlomiej Zolnierkiewicz
@ 2008-01-22 16:31   ` Sergei Shtylyov
  0 siblings, 0 replies; 30+ messages in thread
From: Sergei Shtylyov @ 2008-01-22 16:31 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz; +Cc: linux-ide, linux-kernel

Bartlomiej Zolnierkiewicz wrote:

> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>

MBR, Sergei

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 14/16] ide: move drive->crc_count check out from check_dma_crc()
  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
  0 siblings, 0 replies; 30+ messages in thread
From: Sergei Shtylyov @ 2008-01-22 16:38 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz; +Cc: linux-ide, linux-kernel

Bartlomiej Zolnierkiewicz wrote:

> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>

MBR, Sergei

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 15/16] ide: remove ide_auto_reduce_xfer()
  2008-01-21 23:32 ` [PATCH 15/16] ide: remove ide_auto_reduce_xfer() Bartlomiej Zolnierkiewicz
@ 2008-01-22 16:39   ` Sergei Shtylyov
  0 siblings, 0 replies; 30+ messages in thread
From: Sergei Shtylyov @ 2008-01-22 16:39 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz; +Cc: linux-ide, linux-kernel

Bartlomiej Zolnierkiewicz wrote:

> While at it:

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

> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>

MBR, Sergei


^ permalink raw reply	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2008-01-22 16:39 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH 15/16] ide: remove ide_auto_reduce_xfer() Bartlomiej Zolnierkiewicz
2008-01-22 16:39   ` Sergei Shtylyov
2008-01-21 23:32 ` [PATCH 16/16] ide: move check_dma_crc() to ide-dma.c Bartlomiej Zolnierkiewicz

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).