* [PATCH] Serverworks IDE driver: minor cleanups
@ 2002-05-28 6:11 Andrey Panin
0 siblings, 0 replies; only message in thread
From: Andrey Panin @ 2002-05-28 6:11 UTC (permalink / raw)
To: Martin Dalecki; +Cc: linux-kernel
[-- 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 --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2002-05-28 6:06 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-28 6:11 [PATCH] Serverworks IDE driver: minor cleanups Andrey Panin
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®