mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrey Panin <pazke@orbita1.ru>
To: Martin Dalecki <dalecki@evision-ventures.com>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] Serverworks IDE driver: minor cleanups
Date: Tue, 28 May 2002 10:11:11 +0400	[thread overview]
Message-ID: <20020528061111.GB2111@pazke.ipt> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 612 bytes --]


Hi,

this patch contains some minor cleanups for Serverworks IDE driver:
	- udma_modes[] array in svwks_tune_chipset() function is 
	  meaningless (lists  0,1,2,3,4,5). Removed;
	- same function, variable drive_pci2 == drive_pci + 4, no
	  need to assign it in the switch statement;
	- removed some unneeded initializations of local vars;
	- svwks_proc variable moved into #ifdef DISPLAY_SVWKS_TIMING
	  where it must live.

Compiles, but untested. Please consider applyiing.

-- 
Andrey Panin            | Embedded systems software engineer
pazke@orbita1.ru        | PGP key: wwwkeys.eu.pgp.net

[-- Attachment #1.2: patch-serverworks --]
[-- Type: text/plain, Size: 2752 bytes --]

diff -urN -X /usr/share/dontdiff linux.vanilla/drivers/ide/serverworks.c linux/drivers/ide/serverworks.c
--- linux.vanilla/drivers/ide/serverworks.c	Tue May 28 03:45:52 2002
+++ linux/drivers/ide/serverworks.c	Tue May 28 03:49:03 2002
@@ -98,7 +98,7 @@
 #undef DISPLAY_SVWKS_TIMINGS
 #undef SVWKS_DEBUG_DRIVE_INFO
 
-static u8 svwks_revision = 0;
+static u8 svwks_revision;
 
 #if defined(DISPLAY_SVWKS_TIMINGS) && defined(CONFIG_PROC_FS)
 #include <linux/stat.h>
@@ -230,12 +230,13 @@
 				((reg40&0x005D0000)==0x005D0000)?"0":"?");
 	return p-buffer;	 /* => must be less than 4k! */
 }
+
+static byte svwks_proc;
+
 #endif  /* defined(DISPLAY_SVWKS_TIMINGS) && defined(CONFIG_PROC_FS) */
 
 #define SVWKS_CSB5_REVISION_NEW	0x92 /* min PCI_REVISION_ID for UDMA5 (A2.0) */
 
-byte svwks_proc = 0;
-
 extern char *ide_xfer_verbose (byte xfer_rate);
 
 static struct pci_dev *isa_dev;
@@ -262,7 +263,6 @@
 
 static int svwks_tune_chipset(struct ata_device *drive, byte speed)
 {
-	static u8 udma_modes[]	= { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05 };
 	static u8 dma_modes[]	= { 0x77, 0x21, 0x20 };
 	static u8 pio_modes[]	= { 0x5d, 0x47, 0x34, 0x22, 0x20 };
 
@@ -271,26 +271,23 @@
 	byte unit		= (drive->select.b.unit & 0x01);
 	byte csb5		= (dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5IDE) ? 1 : 0;
 
-	byte drive_pci		= 0x00;
-	byte drive_pci2		= 0x00;
-	byte drive_pci3		= hwif->unit ? 0x57 : 0x56;
-
-	byte ultra_enable	= 0x00;
-	byte ultra_timing	= 0x00;
-	byte dma_timing		= 0x00;
-	byte pio_timing		= 0x00;
-	unsigned short csb5_pio	= 0x00;
+	byte drive_pci, drive_pci2;
+	byte drive_pci3	= hwif->unit ? 0x57 : 0x56;
+
+	byte ultra_enable, ultra_timing, dma_timing, pio_timing;
+	unsigned short csb5_pio;
 
 	byte pio = ata_timing_mode(drive, XFER_PIO | XFER_EPIO) - XFER_PIO_0;
 
         switch (drive->dn) {
-		case 0: drive_pci = 0x41; drive_pci2 = 0x45; break;
-		case 1: drive_pci = 0x40; drive_pci2 = 0x44; break;
-		case 2: drive_pci = 0x43; drive_pci2 = 0x47; break;
-		case 3: drive_pci = 0x42; drive_pci2 = 0x46; break;
+		case 0: drive_pci = 0x41; break;
+		case 1: drive_pci = 0x40; break;
+		case 2: drive_pci = 0x43; break;
+		case 3: drive_pci = 0x42; break;
 		default:
 			return -1;
 	}
+	drive_pci2 = drive_pci + 4;
 
 	pci_read_config_byte(dev, drive_pci, &pio_timing);
 	pci_read_config_byte(dev, drive_pci2, &dma_timing);
@@ -337,7 +334,7 @@
 			pio_timing   |= pio_modes[pio];
 			csb5_pio     |= (pio << (4*drive->dn));
 			dma_timing   |= dma_modes[2];
-			ultra_timing |= ((udma_modes[speed - XFER_UDMA_0]) << (4*unit));
+			ultra_timing |= ((speed - XFER_UDMA_0) << (4*unit));
 			ultra_enable |= (0x01 << drive->dn);
 #endif
 		default:

[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]

                 reply	other threads:[~2002-05-28  6:06 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20020528061111.GB2111@pazke.ipt \
    --to=pazke@orbita1.ru \
    --cc=dalecki@evision-ventures.com \
    --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

all inboxes | Powered by JetHome®