[PATCH 09/16] ide: remove SATA_*_REG macros

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <linux-ide@...>
Cc: Bartlomiej Zolnierkiewicz <bzolnier@...>, <linux-kernel@...>
Date: Monday, January 21, 2008 - 7:31 pm

* 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
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 00/16] ide: various fixes/cleanups, Bartlomiej Zolnierkiewicz..., (Mon Jan 21, 7:30 pm)
[PATCH 16/16] ide: move check_dma_crc() to ide-dma.c, Bartlomiej Zolnierkiewicz..., (Mon Jan 21, 7:32 pm)
[PATCH 15/16] ide: remove ide_auto_reduce_xfer(), Bartlomiej Zolnierkiewicz..., (Mon Jan 21, 7:32 pm)
Re: [PATCH 15/16] ide: remove ide_auto_reduce_xfer(), Sergei Shtylyov, (Tue Jan 22, 12:39 pm)
[PATCH 14/16] ide: move drive-&gt;crc_count check out from c..., Bartlomiej Zolnierkiewicz..., (Mon Jan 21, 7:32 pm)
[PATCH 13/16] ide: remove ide_ata66_check(), Bartlomiej Zolnierkiewicz..., (Mon Jan 21, 7:32 pm)
Re: [PATCH 13/16] ide: remove ide_ata66_check(), Sergei Shtylyov, (Tue Jan 22, 12:31 pm)
[PATCH 12/16] ide: remove set_transfer(), Bartlomiej Zolnierkiewicz..., (Mon Jan 21, 7:31 pm)
Re: [PATCH 12/16] ide: remove set_transfer(), Sergei Shtylyov, (Tue Jan 22, 10:24 am)
[PATCH 11/16] ide: unexport SELECT_DRIVE(), Bartlomiej Zolnierkiewicz..., (Mon Jan 21, 7:31 pm)
Re: [PATCH 11/16] ide: unexport SELECT_DRIVE(), Sergei Shtylyov, (Tue Jan 22, 12:28 pm)
[PATCH 10/16] ide: use __ide_set_handler() in ide_execute_co..., Bartlomiej Zolnierkiewicz..., (Mon Jan 21, 7:31 pm)
[PATCH 09/16] ide: remove SATA_*_REG macros, Bartlomiej Zolnierkiewicz..., (Mon Jan 21, 7:31 pm)
[PATCH 08/16] ide: remove -&gt;nice0 and -&gt;nice2 fields f..., Bartlomiej Zolnierkiewicz..., (Mon Jan 21, 7:31 pm)
[PATCH 07/16] ide: convert -&gt;straight8 field in ide_hwif_..., Bartlomiej Zolnierkiewicz..., (Mon Jan 21, 7:31 pm)
[PATCH 06/16] ide: remove unused -&gt;auto_poll field from i..., Bartlomiej Zolnierkiewicz..., (Mon Jan 21, 7:31 pm)
[PATCH 05/16] ide-probe: remove needless Status register reads, Bartlomiej Zolnierkiewicz..., (Mon Jan 21, 7:31 pm)
[PATCH 04/16] ide-cris: use ide_execute_command(), Bartlomiej Zolnierkiewicz..., (Mon Jan 21, 7:31 pm)
Re: [PATCH 04/16] ide-cris: use ide_execute_command(), Sergei Shtylyov, (Tue Jan 22, 10:34 am)
[PATCH 03/16] trm290: use ide_execute_command(), Bartlomiej Zolnierkiewicz..., (Mon Jan 21, 7:30 pm)
Re: [PATCH 03/16] trm290: use ide_execute_command(), Sergei Shtylyov, (Tue Jan 22, 10:32 am)
[PATCH 02/16] ide-scsi: use ide_execute_command(), Bartlomiej Zolnierkiewicz..., (Mon Jan 21, 7:30 pm)
Re: [PATCH 02/16] ide-scsi: use ide_execute_command(), Sergei Shtylyov, (Tue Jan 22, 10:32 am)
[PATCH 01/16] ide-tape: use ide_execute_command(), Bartlomiej Zolnierkiewicz..., (Mon Jan 21, 7:30 pm)
Re: [PATCH 01/16] ide-tape: use ide_execute_command(), Sergei Shtylyov, (Tue Jan 22, 10:32 am)