Commit 93e50e5e authored by David Jeffery's avatar David Jeffery Committed by Linus Torvalds

[PATCH] ips: use scsi_add_host

This converts the driver to use the new scsi_add_host() interface to add
scsi controllers.
parent 6e761a42
...@@ -195,7 +195,7 @@ ...@@ -195,7 +195,7 @@
* DRIVER_VER * DRIVER_VER
*/ */
#define IPS_VERSION_HIGH "5.99" #define IPS_VERSION_HIGH "5.99"
#define IPS_VERSION_LOW ".00-BETA" #define IPS_VERSION_LOW ".01-BETA"
#if !defined(__i386__) && !defined(__ia64__) #if !defined(__i386__) && !defined(__ia64__)
...@@ -241,6 +241,7 @@ static ips_ha_t *ips_ha[IPS_MAX_ADAPTERS]; /* Array of HA structures * ...@@ -241,6 +241,7 @@ static ips_ha_t *ips_ha[IPS_MAX_ADAPTERS]; /* Array of HA structures *
static unsigned int ips_next_controller = 0; static unsigned int ips_next_controller = 0;
static unsigned int ips_num_controllers = 0; static unsigned int ips_num_controllers = 0;
static unsigned int ips_released_controllers = 0; static unsigned int ips_released_controllers = 0;
static int ips_hotplug;
static int ips_cmd_timeout = 60; static int ips_cmd_timeout = 60;
static int ips_reset_timeout = 60 * 5; static int ips_reset_timeout = 60 * 5;
static int ips_force_memio = 1; /* Always use Memory Mapped I/O */ static int ips_force_memio = 1; /* Always use Memory Mapped I/O */
...@@ -572,7 +573,7 @@ ips_detect(Scsi_Host_Template *SHT) { ...@@ -572,7 +573,7 @@ ips_detect(Scsi_Host_Template *SHT) {
ips_free(ips_ha[i]); ips_free(ips_ha[i]);
ips_released_controllers++; ips_released_controllers++;
} }
ips_hotplug = 1;
return (ips_num_controllers); return (ips_num_controllers);
} }
...@@ -702,6 +703,7 @@ ips_release(struct Scsi_Host *sh) { ...@@ -702,6 +703,7 @@ ips_release(struct Scsi_Host *sh) {
/* free IRQ */ /* free IRQ */
free_irq(ha->irq, ha); free_irq(ha->irq, ha);
IPS_REMOVE_HOST(sh);
scsi_unregister(sh); scsi_unregister(sh);
ips_released_controllers++; ips_released_controllers++;
...@@ -6764,6 +6766,7 @@ ips_register_scsi( int index){ ...@@ -6764,6 +6766,7 @@ ips_register_scsi( int index){
sh->max_channel = ha->nbus - 1; sh->max_channel = ha->nbus - 1;
sh->can_queue = ha->max_cmds-1; sh->can_queue = ha->max_cmds-1;
IPS_ADD_HOST(sh, NULL);
return 0; return 0;
} }
...@@ -6804,7 +6807,7 @@ ips_module_init(void){ ...@@ -6804,7 +6807,7 @@ ips_module_init(void){
return -ENODEV; return -ENODEV;
ips_driver_template.module = THIS_MODULE; ips_driver_template.module = THIS_MODULE;
ips_order_controllers(); ips_order_controllers();
if( scsi_register_host(&ips_driver_template) ){ if( IPS_REGISTER_HOSTS(&ips_driver_template) ){
pci_unregister_driver(&ips_pci_driver); pci_unregister_driver(&ips_pci_driver);
return -ENODEV; return -ENODEV;
} }
...@@ -6821,7 +6824,7 @@ ips_module_init(void){ ...@@ -6821,7 +6824,7 @@ ips_module_init(void){
/****************************************************************************/ /****************************************************************************/
static void __exit static void __exit
ips_module_exit(void){ ips_module_exit(void){
scsi_unregister_host(&ips_driver_template); IPS_UNREGISTER_HOSTS(&ips_driver_template);
pci_unregister_driver(&ips_pci_driver); pci_unregister_driver(&ips_pci_driver);
unregister_reboot_notifier(&ips_notifier); unregister_reboot_notifier(&ips_notifier);
} }
...@@ -6851,6 +6854,12 @@ static int __devinit ips_insert_device(struct pci_dev *pci_dev, const struct pci ...@@ -6851,6 +6854,12 @@ static int __devinit ips_insert_device(struct pci_dev *pci_dev, const struct pci
if (rc == SUCCESS) if (rc == SUCCESS)
rc = ips_init_phase2(index); rc = ips_init_phase2(index);
if(ips_hotplug)
if(ips_register_scsi(index)){
ips_free(ips_ha[index]);
rc = -1;
}
if (rc == SUCCESS) if (rc == SUCCESS)
ips_num_controllers++; ips_num_controllers++;
......
...@@ -99,8 +99,15 @@ ...@@ -99,8 +99,15 @@
#endif #endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
#define scsi_register_host(x) scsi_register_module(MODULE_SCSI_HA,x) #define IPS_REGISTER_HOSTS(SHT) scsi_register_module(MODULE_SCSI_HA,SHT)
#define scsi_unregister_host(x) scsi_unregister_module(MODULE_SCSI_HA,x) #define IPS_UNREGISTER_HOSTS(SHT) scsi_unregister_module(MODULE_SCSI_HA,SHT)
#define IPS_ADD_HOST(shost,device)
#define IPS_REMOVE_HOST(shost)
#else
#define IPS_REGISTER_HOSTS(SHT) (!ips_detect(SHT))
#define IPS_UNREGISTER_HOSTS(SHT)
#define IPS_ADD_HOST(shost,device) scsi_add_host(shost,device)
#define IPS_REMOVE_HOST(shost) scsi_remove_host(shost)
#endif #endif
#ifndef MDELAY #ifndef MDELAY
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment