aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Bottomley <James.Bottomley@HansenPartnership.com>2008-05-04 23:35:58 -0400
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-05-08 11:01:53 -0400
commita85591fd0baf4ed3f03ee1aaac6a985e400cf089 (patch)
tree8634cb2134c8632ea969c9e11eac26cd56251e12
parent2d6f0d0cd94f9b8b24102300d8dd9cbbd1688826 (diff)
[SCSI] gdth: fix Error: Driver 'gdth' is already registered, aborting...
This message appears on modprobe/rmmod/modprobe of the driver. It's caused because if the driver has no instances, it returns an error from gdth_init, which causes the module to fail to load. Unfortunately, the module's pci driver is still registered at this point. Fix this by making gdth behave like a modern driver and insert even if it doesn't find any instances (in case of hot plug or software driven binding). Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
-rw-r--r--drivers/scsi/gdth.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c
index 16785a2ad035..46771d4c81bd 100644
--- a/drivers/scsi/gdth.c
+++ b/drivers/scsi/gdth.c
@@ -550,7 +550,6 @@ static int __init gdth_search_isa(ulong32 bios_adr)
550#endif /* CONFIG_ISA */ 550#endif /* CONFIG_ISA */
551 551
552#ifdef CONFIG_PCI 552#ifdef CONFIG_PCI
553static bool gdth_pci_registered;
554 553
555static bool gdth_search_vortex(ushort device) 554static bool gdth_search_vortex(ushort device)
556{ 555{
@@ -5157,8 +5156,13 @@ static int __init gdth_init(void)
5157 5156
5158#ifdef CONFIG_PCI 5157#ifdef CONFIG_PCI
5159 /* scanning for PCI controllers */ 5158 /* scanning for PCI controllers */
5160 if (pci_register_driver(&gdth_pci_driver) == 0) 5159 if (pci_register_driver(&gdth_pci_driver)) {
5161 gdth_pci_registered = true; 5160 gdth_ha_str *ha;
5161
5162 list_for_each_entry(ha, &gdth_instances, list)
5163 gdth_remove_one(ha);
5164 return -ENODEV;
5165 }
5162#endif /* CONFIG_PCI */ 5166#endif /* CONFIG_PCI */
5163 5167
5164 TRACE2(("gdth_detect() %d controller detected\n", gdth_ctr_count)); 5168 TRACE2(("gdth_detect() %d controller detected\n", gdth_ctr_count));
@@ -5181,8 +5185,7 @@ static void __exit gdth_exit(void)
5181#endif 5185#endif
5182 5186
5183#ifdef CONFIG_PCI 5187#ifdef CONFIG_PCI
5184 if (gdth_pci_registered) 5188 pci_unregister_driver(&gdth_pci_driver);
5185 pci_unregister_driver(&gdth_pci_driver);
5186#endif 5189#endif
5187 5190
5188 list_for_each_entry(ha, &gdth_instances, list) 5191 list_for_each_entry(ha, &gdth_instances, list)