aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/gdth.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/gdth.c')
-rw-r--r--drivers/scsi/gdth.c51
1 files changed, 34 insertions, 17 deletions
diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c
index 8e2e964af668..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{
@@ -3724,6 +3723,8 @@ static void gdth_log_event(gdth_evt_data *dvr, char *buffer)
3724} 3723}
3725 3724
3726#ifdef GDTH_STATISTICS 3725#ifdef GDTH_STATISTICS
3726static unchar gdth_timer_running;
3727
3727static void gdth_timeout(ulong data) 3728static void gdth_timeout(ulong data)
3728{ 3729{
3729 ulong32 i; 3730 ulong32 i;
@@ -3731,7 +3732,10 @@ static void gdth_timeout(ulong data)
3731 gdth_ha_str *ha; 3732 gdth_ha_str *ha;
3732 ulong flags; 3733 ulong flags;
3733 3734
3734 BUG_ON(list_empty(&gdth_instances)); 3735 if(unlikely(list_empty(&gdth_instances))) {
3736 gdth_timer_running = 0;
3737 return;
3738 }
3735 3739
3736 ha = list_first_entry(&gdth_instances, gdth_ha_str, list); 3740 ha = list_first_entry(&gdth_instances, gdth_ha_str, list);
3737 spin_lock_irqsave(&ha->smp_lock, flags); 3741 spin_lock_irqsave(&ha->smp_lock, flags);
@@ -3751,6 +3755,22 @@ static void gdth_timeout(ulong data)
3751 add_timer(&gdth_timer); 3755 add_timer(&gdth_timer);
3752 spin_unlock_irqrestore(&ha->smp_lock, flags); 3756 spin_unlock_irqrestore(&ha->smp_lock, flags);
3753} 3757}
3758
3759static void gdth_timer_init(void)
3760{
3761 if (gdth_timer_running)
3762 return;
3763 gdth_timer_running = 1;
3764 TRACE2(("gdth_detect(): Initializing timer !\n"));
3765 gdth_timer.expires = jiffies + HZ;
3766 gdth_timer.data = 0L;
3767 gdth_timer.function = gdth_timeout;
3768 add_timer(&gdth_timer);
3769}
3770#else
3771static inline void gdth_timer_init(void)
3772{
3773}
3754#endif 3774#endif
3755 3775
3756static void __init internal_setup(char *str,int *ints) 3776static void __init internal_setup(char *str,int *ints)
@@ -4735,6 +4755,7 @@ static int __init gdth_isa_probe_one(ulong32 isa_bios)
4735 if (error) 4755 if (error)
4736 goto out_free_coal_stat; 4756 goto out_free_coal_stat;
4737 list_add_tail(&ha->list, &gdth_instances); 4757 list_add_tail(&ha->list, &gdth_instances);
4758 gdth_timer_init();
4738 4759
4739 scsi_scan_host(shp); 4760 scsi_scan_host(shp);
4740 4761
@@ -4865,6 +4886,7 @@ static int __init gdth_eisa_probe_one(ushort eisa_slot)
4865 if (error) 4886 if (error)
4866 goto out_free_coal_stat; 4887 goto out_free_coal_stat;
4867 list_add_tail(&ha->list, &gdth_instances); 4888 list_add_tail(&ha->list, &gdth_instances);
4889 gdth_timer_init();
4868 4890
4869 scsi_scan_host(shp); 4891 scsi_scan_host(shp);
4870 4892
@@ -5011,6 +5033,7 @@ static int gdth_pci_probe_one(gdth_pci_str *pcistr,
5011 list_add_tail(&ha->list, &gdth_instances); 5033 list_add_tail(&ha->list, &gdth_instances);
5012 5034
5013 pci_set_drvdata(ha->pdev, ha); 5035 pci_set_drvdata(ha->pdev, ha);
5036 gdth_timer_init();
5014 5037
5015 scsi_scan_host(shp); 5038 scsi_scan_host(shp);
5016 5039
@@ -5110,6 +5133,7 @@ static int __init gdth_init(void)
5110 /* initializations */ 5133 /* initializations */
5111 gdth_polling = TRUE; 5134 gdth_polling = TRUE;
5112 gdth_clear_events(); 5135 gdth_clear_events();
5136 init_timer(&gdth_timer);
5113 5137
5114 /* As default we do not probe for EISA or ISA controllers */ 5138 /* As default we do not probe for EISA or ISA controllers */
5115 if (probe_eisa_isa) { 5139 if (probe_eisa_isa) {
@@ -5132,23 +5156,17 @@ static int __init gdth_init(void)
5132 5156
5133#ifdef CONFIG_PCI 5157#ifdef CONFIG_PCI
5134 /* scanning for PCI controllers */ 5158 /* scanning for PCI controllers */
5135 if (pci_register_driver(&gdth_pci_driver) == 0) 5159 if (pci_register_driver(&gdth_pci_driver)) {
5136 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 }
5137#endif /* CONFIG_PCI */ 5166#endif /* CONFIG_PCI */
5138 5167
5139 TRACE2(("gdth_detect() %d controller detected\n", gdth_ctr_count)); 5168 TRACE2(("gdth_detect() %d controller detected\n", gdth_ctr_count));
5140 5169
5141 if (list_empty(&gdth_instances))
5142 return -ENODEV;
5143
5144#ifdef GDTH_STATISTICS
5145 TRACE2(("gdth_detect(): Initializing timer !\n"));
5146 init_timer(&gdth_timer);
5147 gdth_timer.expires = jiffies + HZ;
5148 gdth_timer.data = 0L;
5149 gdth_timer.function = gdth_timeout;
5150 add_timer(&gdth_timer);
5151#endif
5152 major = register_chrdev(0,"gdth", &gdth_fops); 5170 major = register_chrdev(0,"gdth", &gdth_fops);
5153 register_reboot_notifier(&gdth_notifier); 5171 register_reboot_notifier(&gdth_notifier);
5154 gdth_polling = FALSE; 5172 gdth_polling = FALSE;
@@ -5167,8 +5185,7 @@ static void __exit gdth_exit(void)
5167#endif 5185#endif
5168 5186
5169#ifdef CONFIG_PCI 5187#ifdef CONFIG_PCI
5170 if (gdth_pci_registered) 5188 pci_unregister_driver(&gdth_pci_driver);
5171 pci_unregister_driver(&gdth_pci_driver);
5172#endif 5189#endif
5173 5190
5174 list_for_each_entry(ha, &gdth_instances, list) 5191 list_for_each_entry(ha, &gdth_instances, list)