diff options
| author | Bartlomiej Zolnierkiewicz <b.zolnierkiewicz@elka.pw.edu.pl> | 2004-02-07 04:48:53 -0800 |
|---|---|---|
| committer | Linus Torvalds <torvalds@home.osdl.org> | 2004-02-07 04:48:53 -0800 |
| commit | 2724a14b455e66ddac226b2955e15eb2ddef1721 (patch) | |
| tree | e7e8736fa581fd8cd8e448b5336cbbb748590cab | |
| parent | 7de2696dbce1dcb7ab69fc4218ce7c71b5d05bf3 (diff) | |
[PATCH] fix duplication of DMA {black,white}list in icside.c
Always compile ide-dma.c if CONFIG_BLK_DEV_IDEDMA=y, mark PCI specific code
with CONFIG_BLK_DEV_IDEDMA_PCI for now (it should migrate to ide_pcidma.c
over a time). This fixes a small bug - in_drive_list() from icside.c used
!strstr() instead of strstr() so it was missing two entries from a blacklist.
| -rw-r--r-- | drivers/ide/Makefile | 2 | ||||
| -rw-r--r-- | drivers/ide/arm/icside.c | 73 | ||||
| -rw-r--r-- | drivers/ide/ide-dma.c | 19 | ||||
| -rw-r--r-- | include/linux/ide.h | 8 |
4 files changed, 21 insertions, 81 deletions
diff --git a/drivers/ide/Makefile b/drivers/ide/Makefile index 488c784ce670..7cc48f1f4c6a 100644 --- a/drivers/ide/Makefile +++ b/drivers/ide/Makefile @@ -20,7 +20,7 @@ ide-core-$(CONFIG_BLK_DEV_CMD640) += pci/cmd640.o # Core IDE code - must come before legacy ide-core-$(CONFIG_BLK_DEV_IDEPCI) += setup-pci.o -ide-core-$(CONFIG_BLK_DEV_IDEDMA_PCI) += ide-dma.o +ide-core-$(CONFIG_BLK_DEV_IDEDMA) += ide-dma.o ide-core-$(CONFIG_BLK_DEV_IDE_TCQ) += ide-tcq.o ide-core-$(CONFIG_PROC_FS) += ide-proc.o ide-core-$(CONFIG_BLK_DEV_IDEPNP) += ide-pnp.o diff --git a/drivers/ide/arm/icside.c b/drivers/ide/arm/icside.c index 8f582564fbb2..09d3f9414e8f 100644 --- a/drivers/ide/arm/icside.c +++ b/drivers/ide/arm/icside.c @@ -330,72 +330,6 @@ static int icside_set_speed(ide_drive_t *drive, u8 xfer_mode) return on; } -/* - * The following is a sick duplication from ide-dma.c ;( - * - * This should be defined in one place only. - */ -struct drive_list_entry { - const char * id_model; - const char * id_firmware; -}; - -static const struct drive_list_entry drive_whitelist [] = { - { "Micropolis 2112A", "ALL" }, - { "CONNER CTMA 4000", "ALL" }, - { "CONNER CTT8000-A", "ALL" }, - { "ST34342A", "ALL" }, - { NULL, NULL } -}; - -static struct drive_list_entry drive_blacklist [] = { - { "WDC AC11000H", "ALL" }, - { "WDC AC22100H", "ALL" }, - { "WDC AC32500H", "ALL" }, - { "WDC AC33100H", "ALL" }, - { "WDC AC31600H", "ALL" }, - { "WDC AC32100H", "24.09P07" }, - { "WDC AC23200L", "21.10N21" }, - { "Compaq CRD-8241B", "ALL" }, - { "CRD-8400B", "ALL" }, - { "CRD-8480B", "ALL" }, - { "CRD-8480C", "ALL" }, - { "CRD-8482B", "ALL" }, - { "CRD-84", "ALL" }, - { "SanDisk SDP3B", "ALL" }, - { "SanDisk SDP3B-64", "ALL" }, - { "SANYO CD-ROM CRD", "ALL" }, - { "HITACHI CDR-8", "ALL" }, - { "HITACHI CDR-8335", "ALL" }, - { "HITACHI CDR-8435", "ALL" }, - { "Toshiba CD-ROM XM-6202B", "ALL" }, - { "CD-532E-A", "ALL" }, - { "E-IDE CD-ROM CR-840", "ALL" }, - { "CD-ROM Drive/F5A", "ALL" }, - { "RICOH CD-R/RW MP7083A", "ALL" }, - { "WPI CDD-820", "ALL" }, - { "SAMSUNG CD-ROM SC-148C", "ALL" }, - { "SAMSUNG CD-ROM SC-148F", "ALL" }, - { "SAMSUNG CD-ROM SC", "ALL" }, - { "SanDisk SDP3B-64", "ALL" }, - { "SAMSUNG CD-ROM SN-124", "ALL" }, - { "PLEXTOR CD-R PX-W8432T", "ALL" }, - { "ATAPI CD-ROM DRIVE 40X MAXIMUM", "ALL" }, - { "_NEC DV5800A", "ALL" }, - { NULL, NULL } -}; - -static int -in_drive_list(struct hd_driveid *id, const struct drive_list_entry *drive_table) -{ - for ( ; drive_table->id_model ; drive_table++) - if ((!strcmp(drive_table->id_model, id->model)) && - ((!strstr(drive_table->id_firmware, id->fw_rev)) || - (!strcmp(drive_table->id_firmware, "ALL")))) - return 1; - return 0; -} - static int icside_dma_host_off(ide_drive_t *drive) { return 0; @@ -437,11 +371,8 @@ static int icside_dma_check(ide_drive_t *drive) /* * Consult the list of known "bad" drives */ - if (in_drive_list(id, drive_blacklist)) { - printk("%s: Disabling DMA for %s (blacklisted)\n", - drive->name, id->model); + if (__ide_dma_bad_drive(drive)) goto out; - } /* * Enable DMA on any drive that has multiword DMA @@ -454,7 +385,7 @@ static int icside_dma_check(ide_drive_t *drive) /* * Consult the list of known "good" drives */ - if (in_drive_list(id, drive_whitelist)) { + if (__ide_dma_good_drive(drive)) { if (id->eide_dma_time > 150) goto out; xfer_mode = XFER_MW_DMA_1; diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c index acf29b5c430a..205c28225ad9 100644 --- a/drivers/ide/ide-dma.c +++ b/drivers/ide/ide-dma.c @@ -90,11 +90,11 @@ #include <asm/irq.h> struct drive_list_entry { - char * id_model; - char * id_firmware; + const char *id_model; + const char *id_firmware; }; -struct drive_list_entry drive_whitelist [] = { +static const struct drive_list_entry drive_whitelist [] = { { "Micropolis 2112A" , "ALL" }, { "CONNER CTMA 4000" , "ALL" }, @@ -103,7 +103,7 @@ struct drive_list_entry drive_whitelist [] = { { 0 , 0 } }; -struct drive_list_entry drive_blacklist [] = { +static const struct drive_list_entry drive_blacklist [] = { { "WDC AC11000H" , "ALL" }, { "WDC AC22100H" , "ALL" }, @@ -151,7 +151,7 @@ struct drive_list_entry drive_blacklist [] = { * Returns 1 if the drive is found in the table. */ -static int in_drive_list(struct hd_driveid *id, struct drive_list_entry * drive_table) +static int in_drive_list(struct hd_driveid *id, const struct drive_list_entry *drive_table) { for ( ; drive_table->id_model ; drive_table++) if ((!strcmp(drive_table->id_model, id->model)) && @@ -161,6 +161,7 @@ static int in_drive_list(struct hd_driveid *id, struct drive_list_entry * drive_ return 0; } +#ifdef CONFIG_BLK_DEV_IDEDMA_PCI /** * ide_dma_intr - IDE DMA interrupt handler * @drive: the drive the interrupt is for @@ -764,6 +765,7 @@ int __ide_dma_test_irq (ide_drive_t *drive) } EXPORT_SYMBOL(__ide_dma_test_irq); +#endif /* CONFIG_BLK_DEV_IDEDMA_PCI */ int __ide_dma_bad_drive (ide_drive_t *drive) { @@ -771,8 +773,9 @@ int __ide_dma_bad_drive (ide_drive_t *drive) int blacklist = in_drive_list(id, drive_blacklist); if (blacklist) { - printk(KERN_WARNING "%s: Disabling (U)DMA for %s\n", drive->name, id->model); - return(blacklist); + printk(KERN_WARNING "%s: Disabling (U)DMA for %s (blacklisted)\n", + drive->name, id->model); + return blacklist; } return 0; } @@ -787,6 +790,7 @@ int __ide_dma_good_drive (ide_drive_t *drive) EXPORT_SYMBOL(__ide_dma_good_drive); +#ifdef CONFIG_BLK_DEV_IDEDMA_PCI /* * Used for HOST FIFO counters for VDMA * PIO over DMA, effective ATA-Bridge operator. @@ -1104,3 +1108,4 @@ void ide_setup_dma (ide_hwif_t *hwif, unsigned long dma_base, unsigned int num_p } EXPORT_SYMBOL_GPL(ide_setup_dma); +#endif /* CONFIG_BLK_DEV_IDEDMA_PCI */ diff --git a/include/linux/ide.h b/include/linux/ide.h index f5ee5b62adee..d247474de882 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -1597,6 +1597,10 @@ extern void ide_setup_pci_devices(struct pci_dev *, struct pci_dev *, ide_pci_de #define BAD_DMA_DRIVE 0 #define GOOD_DMA_DRIVE 1 +#ifdef CONFIG_BLK_DEV_IDEDMA +int __ide_dma_bad_drive(ide_drive_t *); +int __ide_dma_good_drive(ide_drive_t *); + #ifdef CONFIG_BLK_DEV_IDEDMA_PCI extern int ide_build_sglist(ide_drive_t *, struct request *); extern int ide_raw_build_sglist(ide_drive_t *, struct request *); @@ -1618,8 +1622,6 @@ extern int __ide_dma_write(ide_drive_t *); extern int __ide_dma_begin(ide_drive_t *); extern int __ide_dma_end(ide_drive_t *); extern int __ide_dma_test_irq(ide_drive_t *); -extern int __ide_dma_bad_drive(ide_drive_t *); -extern int __ide_dma_good_drive(ide_drive_t *); extern int __ide_dma_count(ide_drive_t *); extern int __ide_dma_verbose(ide_drive_t *); extern int __ide_dma_lostirq(ide_drive_t *); @@ -1637,6 +1639,8 @@ extern ide_startstop_t __ide_dma_queued_start(ide_drive_t *drive); static inline void ide_release_dma(ide_hwif_t *drive) {;} #endif +#endif /* CONFIG_BLK_DEV_IDEDMA */ + extern int ide_hwif_request_regions(ide_hwif_t *hwif); extern void ide_hwif_release_regions(ide_hwif_t* hwif); extern void ide_unregister (unsigned int index); |
