Commit f201f5046ddaeeccb036bdf6848549bf5cb51bb1

Authored by Alan Cox
Committed by Linus Torvalds
1 parent da574af755

[PATCH] ide: housekeeping on IDE drivers

Move auto arrays to static (const).  Clean up using PCI_DEVICE in places,
remove unreachable junk and dead code.

Fix the serverworks cable detect logic (if ordering is wrong).  Backport
from libata.  Plenty of scope for more cleanup left.

Signed-off-by: Alan Cox <alan@redhat.com>
Cc: Bartlomiej Zolnierkiewicz <B.Zolnierkiewicz@elka.pw.edu.pl>
Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

Showing 5 changed files with 28 additions and 71 deletions Side-by-side Diff

drivers/ide/pci/aec62xx.c
... ... @@ -22,7 +22,7 @@
22 22 u8 ultra_settings;
23 23 };
24 24  
25   -static struct chipset_bus_clock_list_entry aec6xxx_33_base [] = {
  25 +static const struct chipset_bus_clock_list_entry aec6xxx_33_base [] = {
26 26 { XFER_UDMA_6, 0x31, 0x07 },
27 27 { XFER_UDMA_5, 0x31, 0x06 },
28 28 { XFER_UDMA_4, 0x31, 0x05 },
... ... @@ -42,7 +42,7 @@
42 42 { 0, 0x00, 0x00 }
43 43 };
44 44  
45   -static struct chipset_bus_clock_list_entry aec6xxx_34_base [] = {
  45 +static const struct chipset_bus_clock_list_entry aec6xxx_34_base [] = {
46 46 { XFER_UDMA_6, 0x41, 0x06 },
47 47 { XFER_UDMA_5, 0x41, 0x05 },
48 48 { XFER_UDMA_4, 0x41, 0x04 },
... ... @@ -425,12 +425,12 @@
425 425 return d->init_setup(dev, d);
426 426 }
427 427  
428   -static struct pci_device_id aec62xx_pci_tbl[] = {
429   - { PCI_VENDOR_ID_ARTOP, PCI_DEVICE_ID_ARTOP_ATP850UF, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
430   - { PCI_VENDOR_ID_ARTOP, PCI_DEVICE_ID_ARTOP_ATP860, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1 },
431   - { PCI_VENDOR_ID_ARTOP, PCI_DEVICE_ID_ARTOP_ATP860R, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 2 },
432   - { PCI_VENDOR_ID_ARTOP, PCI_DEVICE_ID_ARTOP_ATP865, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 3 },
433   - { PCI_VENDOR_ID_ARTOP, PCI_DEVICE_ID_ARTOP_ATP865R, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 4 },
  428 +static const struct pci_device_id aec62xx_pci_tbl[] = {
  429 + { PCI_DEVICE(PCI_VENDOR_ID_ARTOP, PCI_DEVICE_ID_ARTOP_ATP850UF), 0 },
  430 + { PCI_DEVICE(PCI_VENDOR_ID_ARTOP, PCI_DEVICE_ID_ARTOP_ATP860), 1 },
  431 + { PCI_DEVICE(PCI_VENDOR_ID_ARTOP, PCI_DEVICE_ID_ARTOP_ATP860R), 2 },
  432 + { PCI_DEVICE(PCI_VENDOR_ID_ARTOP, PCI_DEVICE_ID_ARTOP_ATP865), 3 },
  433 + { PCI_DEVICE(PCI_VENDOR_ID_ARTOP, PCI_DEVICE_ID_ARTOP_ATP865R), 4 },
434 434 { 0, },
435 435 };
436 436 MODULE_DEVICE_TABLE(pci, aec62xx_pci_tbl);
drivers/ide/pci/cmd64x.c
... ... @@ -190,14 +190,6 @@
190 190 #endif /* defined(DISPLAY_CMD64X_TIMINGS) && defined(CONFIG_PROC_FS) */
191 191  
192 192 /*
193   - * Registers and masks for easy access by drive index:
194   - */
195   -#if 0
196   -static u8 prefetch_regs[4] = {CNTRL, CNTRL, ARTTIM23, ARTTIM23};
197   -static u8 prefetch_masks[4] = {CNTRL_DIS_RA0, CNTRL_DIS_RA1, ARTTIM23_DIS_RA2, ARTTIM23_DIS_RA3};
198   -#endif
199   -
200   -/*
201 193 * This routine writes the prepared setup/active/recovery counts
202 194 * for a drive into the cmd646 chipset registers to active them.
203 195 */
... ... @@ -605,13 +597,6 @@
605 597  
606 598 pci_read_config_dword(dev, PCI_CLASS_REVISION, &class_rev);
607 599 class_rev &= 0xff;
608   -
609   -#ifdef __i386__
610   - if (dev->resource[PCI_ROM_RESOURCE].start) {
611   - pci_write_config_dword(dev, PCI_ROM_ADDRESS, dev->resource[PCI_ROM_RESOURCE].start | PCI_ROM_ADDRESS_ENABLE);
612   - printk(KERN_INFO "%s: ROM enabled at 0x%08lx\n", name, dev->resource[PCI_ROM_RESOURCE].start);
613   - }
614   -#endif
615 600  
616 601 switch(dev->device) {
617 602 case PCI_DEVICE_ID_CMD_643:
drivers/ide/pci/serverworks.c
... ... @@ -123,11 +123,11 @@
123 123 }
124 124 static int svwks_tune_chipset (ide_drive_t *drive, u8 xferspeed)
125 125 {
126   - u8 udma_modes[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05 };
127   - u8 dma_modes[] = { 0x77, 0x21, 0x20 };
128   - u8 pio_modes[] = { 0x5d, 0x47, 0x34, 0x22, 0x20 };
129   - u8 drive_pci[] = { 0x41, 0x40, 0x43, 0x42 };
130   - u8 drive_pci2[] = { 0x45, 0x44, 0x47, 0x46 };
  126 + static const u8 udma_modes[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05 };
  127 + static const u8 dma_modes[] = { 0x77, 0x21, 0x20 };
  128 + static const u8 pio_modes[] = { 0x5d, 0x47, 0x34, 0x22, 0x20 };
  129 + static const u8 drive_pci[] = { 0x41, 0x40, 0x43, 0x42 };
  130 + static const u8 drive_pci2[] = { 0x45, 0x44, 0x47, 0x46 };
131 131  
132 132 ide_hwif_t *hwif = HWIF(drive);
133 133 struct pci_dev *dev = hwif->pci_dev;
... ... @@ -392,16 +392,6 @@
392 392 }
393 393 outb_p(0x06, 0x0c00);
394 394 dev->irq = inb_p(0x0c01);
395   -#if 0
396   - printk("%s: device class (0x%04x)\n",
397   - name, dev->class);
398   - if ((dev->class >> 8) != PCI_CLASS_STORAGE_IDE) {
399   - dev->class &= ~0x000F0F00;
400   - // dev->class |= ~0x00000400;
401   - dev->class |= ~0x00010100;
402   - /**/
403   - }
404   -#endif
405 395 } else {
406 396 struct pci_dev * findev = NULL;
407 397 u8 reg41 = 0;
... ... @@ -452,7 +442,7 @@
452 442 pci_write_config_byte(dev, 0x5A, btr);
453 443 }
454 444  
455   - return (dev->irq) ? dev->irq : 0;
  445 + return dev->irq;
456 446 }
457 447  
458 448 static unsigned int __devinit ata66_svwks_svwks (ide_hwif_t *hwif)
... ... @@ -500,11 +490,6 @@
500 490 {
501 491 struct pci_dev *dev = hwif->pci_dev;
502 492  
503   - /* Per Specified Design by OEM, and ASIC Architect */
504   - if ((dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE) ||
505   - (dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2))
506   - return 1;
507   -
508 493 /* Server Works */
509 494 if (dev->subsystem_vendor == PCI_VENDOR_ID_SERVERWORKS)
510 495 return ata66_svwks_svwks (hwif);
511 496  
... ... @@ -517,10 +502,14 @@
517 502 if (dev->subsystem_vendor == PCI_VENDOR_ID_SUN)
518 503 return ata66_svwks_cobalt (hwif);
519 504  
  505 + /* Per Specified Design by OEM, and ASIC Architect */
  506 + if ((dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE) ||
  507 + (dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2))
  508 + return 1;
  509 +
520 510 return 0;
521 511 }
522 512  
523   -#undef CAN_SW_DMA
524 513 static void __devinit init_hwif_svwks (ide_hwif_t *hwif)
525 514 {
526 515 u8 dma_stat = 0;
... ... @@ -537,9 +526,6 @@
537 526 hwif->ultra_mask = 0x3f;
538 527  
539 528 hwif->mwdma_mask = 0x07;
540   -#ifdef CAN_SW_DMA
541   - hwif->swdma_mask = 0x07;
542   -#endif /* CAN_SW_DMA */
543 529  
544 530 hwif->autodma = 0;
545 531  
... ... @@ -562,8 +548,6 @@
562 548 hwif->drives[1].autodma = (dma_stat & 0x40);
563 549 hwif->drives[0].autotune = (!(dma_stat & 0x20));
564 550 hwif->drives[1].autotune = (!(dma_stat & 0x40));
565   -// hwif->drives[0].autodma = hwif->autodma;
566   -// hwif->drives[1].autodma = hwif->autodma;
567 551 }
568 552  
569 553 /*
... ... @@ -593,11 +577,6 @@
593 577 if (dev->resource[0].start == 0x01f1)
594 578 d->bootable = ON_BOARD;
595 579 }
596   -#if 0
597   - if ((IDE_PCI_DEVID_EQ(d->devid, DEVID_CSB6) &&
598   - (!(PCI_FUNC(dev->devfn) & 1)))
599   - d->autodma = AUTODMA;
600   -#endif
601 580  
602 581 d->channels = ((dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE ||
603 582 dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2) &&
... ... @@ -671,11 +650,11 @@
671 650 }
672 651  
673 652 static struct pci_device_id svwks_pci_tbl[] = {
674   - { PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_OSB4IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
675   - { PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB5IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1},
676   - { PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB6IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 2},
677   - { PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 3},
678   - { PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_HT1000IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 4},
  653 + { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_OSB4IDE), 0},
  654 + { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB5IDE), 1},
  655 + { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB6IDE), 2},
  656 + { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2), 3},
  657 + { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_HT1000IDE), 4},
679 658 { 0, },
680 659 };
681 660 MODULE_DEVICE_TABLE(pci, svwks_pci_tbl);
drivers/ide/pci/sl82c105.c
... ... @@ -447,7 +447,6 @@
447 447 printk(" %s: Winbond 553 bridge revision %d, BM-DMA disabled\n",
448 448 hwif->name, rev);
449 449 } else {
450   -#ifdef CONFIG_BLK_DEV_IDEDMA
451 450 dma_state |= 0x60;
452 451  
453 452 hwif->atapi_dma = 1;
... ... @@ -468,7 +467,6 @@
468 467  
469 468 if (hwif->mate)
470 469 hwif->serialized = hwif->mate->serialized = 1;
471   -#endif /* CONFIG_BLK_DEV_IDEDMA */
472 470 }
473 471 hwif->OUTB(dma_state, hwif->dma_base + 2);
474 472 }
... ... @@ -489,7 +487,7 @@
489 487 }
490 488  
491 489 static struct pci_device_id sl82c105_pci_tbl[] = {
492   - { PCI_VENDOR_ID_WINBOND, PCI_DEVICE_ID_WINBOND_82C105, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
  490 + { PCI_DEVICE(PCI_VENDOR_ID_WINBOND, PCI_DEVICE_ID_WINBOND_82C105), 0},
493 491 { 0, },
494 492 };
495 493 MODULE_DEVICE_TABLE(pci, sl82c105_pci_tbl);
drivers/ide/pci/slc90e66.c
... ... @@ -72,8 +72,9 @@
72 72 u16 master_data;
73 73 u8 slave_data;
74 74 /* ISP RTC */
75   - u8 timings[][2] = { { 0, 0 },
  75 + static const u8 timings[][2]= {
76 76 { 0, 0 },
  77 + { 0, 0 },
77 78 { 1, 0 },
78 79 { 2, 1 },
79 80 { 2, 3 }, };
... ... @@ -119,7 +120,6 @@
119 120 pci_read_config_word(dev, 0x4a, &reg4a);
120 121  
121 122 switch(speed) {
122   -#ifdef CONFIG_BLK_DEV_IDEDMA
123 123 case XFER_UDMA_4: u_speed = 4 << (drive->dn * 4); break;
124 124 case XFER_UDMA_3: u_speed = 3 << (drive->dn * 4); break;
125 125 case XFER_UDMA_2: u_speed = 2 << (drive->dn * 4); break;
... ... @@ -128,7 +128,6 @@
128 128 case XFER_MW_DMA_2:
129 129 case XFER_MW_DMA_1:
130 130 case XFER_SW_DMA_2: break;
131   -#endif /* CONFIG_BLK_DEV_IDEDMA */
132 131 case XFER_PIO_4:
133 132 case XFER_PIO_3:
134 133 case XFER_PIO_2:
... ... @@ -156,7 +155,6 @@
156 155 return (ide_config_drive_speed(drive, speed));
157 156 }
158 157  
159   -#ifdef CONFIG_BLK_DEV_IDEDMA
160 158 static int slc90e66_config_drive_for_dma (ide_drive_t *drive)
161 159 {
162 160 u8 speed = ide_dma_speed(drive, slc90e66_ratemask(drive));
... ... @@ -194,7 +192,6 @@
194 192 /* IORDY not supported */
195 193 return 0;
196 194 }
197   -#endif /* CONFIG_BLK_DEV_IDEDMA */
198 195  
199 196 static void __devinit init_hwif_slc90e66 (ide_hwif_t *hwif)
200 197 {
... ... @@ -222,7 +219,6 @@
222 219 hwif->mwdma_mask = 0x07;
223 220 hwif->swdma_mask = 0x07;
224 221  
225   -#ifdef CONFIG_BLK_DEV_IDEDMA
226 222 if (!(hwif->udma_four))
227 223 /* bit[0(1)]: 0:80, 1:40 */
228 224 hwif->udma_four = (reg47 & mask) ? 0 : 1;
... ... @@ -232,7 +228,6 @@
232 228 hwif->autodma = 1;
233 229 hwif->drives[0].autodma = hwif->autodma;
234 230 hwif->drives[1].autodma = hwif->autodma;
235   -#endif /* !CONFIG_BLK_DEV_IDEDMA */
236 231 }
237 232  
238 233 static ide_pci_device_t slc90e66_chipset __devinitdata = {
... ... @@ -250,7 +245,7 @@
250 245 }
251 246  
252 247 static struct pci_device_id slc90e66_pci_tbl[] = {
253   - { PCI_VENDOR_ID_EFAR, PCI_DEVICE_ID_EFAR_SLC90E66_1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
  248 + { PCI_DEVICE(PCI_VENDOR_ID_EFAR, PCI_DEVICE_ID_EFAR_SLC90E66_1), 0},
254 249 { 0, },
255 250 };
256 251 MODULE_DEVICE_TABLE(pci, slc90e66_pci_tbl);