From a50de1c422207d617a063da7c89d25593c362705 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Sat, 31 Jan 2004 20:50:52 -0800 Subject: [PATCH] [PATCH] fix issues with loading PCI IDE drivers as modules From: Davin McCall Set hwif->chipset to ide_forced if it was forced by kernel parameters. Set hwif->chipset to ide_generic for hwifs controlled by generic IDE code, so they wont be taken by setup_pci.c:ide_match_hwif(). Patch also fixes /proc/ide/ideX/model to report "generic" instead of "(none)" for default hwifs. This has been in -mm since 2.6.1-mm1. --- drivers/ide/ide-probe.c | 2 ++ drivers/ide/ide-proc.c | 4 +++- drivers/ide/ide.c | 2 +- drivers/ide/pci/cmd640.c | 2 +- drivers/ide/setup-pci.c | 2 +- include/linux/ide.h | 2 +- 6 files changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index ef80249cda495..59d3da8c6e48e 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c @@ -1343,6 +1343,8 @@ int ideprobe_init (void) int unit; if (!hwif->present) continue; + if (hwif->chipset == ide_unknown || hwif->chipset == ide_forced) + hwif->chipset = ide_generic; for (unit = 0; unit < MAX_DRIVES; ++unit) if (hwif->drives[unit].present) ata_attach(&hwif->drives[unit]); diff --git a/drivers/ide/ide-proc.c b/drivers/ide/ide-proc.c index 49b754b86efa1..323eeb79f0eb5 100644 --- a/drivers/ide/ide-proc.c +++ b/drivers/ide/ide-proc.c @@ -348,8 +348,10 @@ static int proc_ide_read_imodel int len; const char *name; + /* + * Neither ide_unknown nor ide_forced should be set at this point. + */ switch (hwif->chipset) { - case ide_unknown: name = "(none)"; break; case ide_generic: name = "generic"; break; case ide_pci: name = "pci"; break; case ide_cmd640: name = "cmd640"; break; diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c index bf2282aa9c7a4..01134b2e1bb08 100644 --- a/drivers/ide/ide.c +++ b/drivers/ide/ide.c @@ -2179,7 +2179,7 @@ int __init ide_setup (char *s) memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->io_ports)); hwif->irq = vals[2]; hwif->noprobe = 0; - hwif->chipset = ide_generic; + hwif->chipset = ide_forced; goto done; case 0: goto bad_option; diff --git a/drivers/ide/pci/cmd640.c b/drivers/ide/pci/cmd640.c index 08a74cdb6605b..0eac8ee64d2ec 100644 --- a/drivers/ide/pci/cmd640.c +++ b/drivers/ide/pci/cmd640.c @@ -419,7 +419,7 @@ static void __init setup_device_ptrs (void) cmd_hwif1 = &ide_hwifs[1]; /* default, if not found below */ for (i = 0; i < MAX_HWIFS; i++) { ide_hwif_t *hwif = &ide_hwifs[i]; - if (hwif->chipset == ide_unknown || hwif->chipset == ide_generic) { + if (hwif->chipset == ide_unknown || hwif->chipset == ide_forced) { if (hwif->io_ports[IDE_DATA_OFFSET] == 0x1f0) cmd_hwif0 = hwif; else if (hwif->io_ports[IDE_DATA_OFFSET] == 0x170) diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c index e0ed9c0493f9f..a2ff75859e454 100644 --- a/drivers/ide/setup-pci.c +++ b/drivers/ide/setup-pci.c @@ -59,7 +59,7 @@ static ide_hwif_t *ide_match_hwif(unsigned long io_base, u8 bootable, const char for (h = 0; h < MAX_HWIFS; ++h) { hwif = &ide_hwifs[h]; if (hwif->io_ports[IDE_DATA_OFFSET] == io_base) { - if (hwif->chipset == ide_generic) + if (hwif->chipset == ide_forced) return hwif; /* a perfect match */ } } diff --git a/include/linux/ide.h b/include/linux/ide.h index a9c107b8716d4..ea10e916d9eb1 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -279,7 +279,7 @@ typedef enum { ide_unknown, ide_generic, ide_pci, ide_pdc4030, ide_rz1000, ide_trm290, ide_cmd646, ide_cy82c693, ide_4drives, ide_pmac, ide_etrax100, ide_acorn, - ide_pc9800 + ide_pc9800, ide_forced } hwif_chipset_t; /* -- 2.53.0