aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/dpt_i2o.c
diff options
context:
space:
mode:
authorMiquel van Smoorenburg <miquels@cistron.nl>2008-05-01 19:05:33 -0400
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-05-02 14:13:23 -0400
commitc864cb145dc2218cfad9fe53d323b54b48dbab6c (patch)
tree4f75dabae6c4de4b1d938e2fc6baa4de107e95bf /drivers/scsi/dpt_i2o.c
parent33139b21013aba815924b421159fab35e5175483 (diff)
[SCSI] dpt_i2o: use standard __init / __exit code
Update dpt_i2o.c to use the standard __init / __exit code instead of the legacy '#include "scsi_module.c"' code. This is needed in preparation of 64-bit support. scsi_module.c calls scsi_add_host() with the device pointer set to NULL, and that crashes code like arch/x64/kernel/pci-gart_64.c::need_iommu(). The reboot_notifier code is deleted because it wasn't compiled in ever anyway, and it would be useless to duplicate it in the new code. Signed-off-by: Miquel van Smoorenburg <miquels@cistron.nl> Acked-by: Mark Salyzyn <Mark_Salyzyn@adaptec.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/dpt_i2o.c')
-rw-r--r--drivers/scsi/dpt_i2o.c102
1 files changed, 50 insertions, 52 deletions
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
index c9dd8392aab2..30c741a12a62 100644
--- a/drivers/scsi/dpt_i2o.c
+++ b/drivers/scsi/dpt_i2o.c
@@ -121,15 +121,6 @@ static const struct file_operations adpt_fops = {
121 .release = adpt_close 121 .release = adpt_close
122}; 122};
123 123
124#ifdef REBOOT_NOTIFIER
125static struct notifier_block adpt_reboot_notifier =
126{
127 adpt_reboot_event,
128 NULL,
129 0
130};
131#endif
132
133/* Structures and definitions for synchronous message posting. 124/* Structures and definitions for synchronous message posting.
134 * See adpt_i2o_post_wait() for description 125 * See adpt_i2o_post_wait() for description
135 * */ 126 * */
@@ -178,8 +169,6 @@ static int adpt_detect(struct scsi_host_template* sht)
178 struct pci_dev *pDev = NULL; 169 struct pci_dev *pDev = NULL;
179 adpt_hba* pHba; 170 adpt_hba* pHba;
180 171
181 adpt_init();
182
183 PINFO("Detecting Adaptec I2O RAID controllers...\n"); 172 PINFO("Detecting Adaptec I2O RAID controllers...\n");
184 173
185 /* search for all Adatpec I2O RAID cards */ 174 /* search for all Adatpec I2O RAID cards */
@@ -248,7 +237,7 @@ rebuild_sys_tab:
248 } 237 }
249 238
250 for (pHba = hba_chain; pHba; pHba = pHba->next) { 239 for (pHba = hba_chain; pHba; pHba = pHba->next) {
251 if( adpt_scsi_register(pHba,sht) < 0){ 240 if (adpt_scsi_host_alloc(pHba, sht) < 0){
252 adpt_i2o_delete_hba(pHba); 241 adpt_i2o_delete_hba(pHba);
253 continue; 242 continue;
254 } 243 }
@@ -861,27 +850,6 @@ static void adpt_i2o_sys_shutdown(void)
861 printk(KERN_INFO "Adaptec I2O controllers down.\n"); 850 printk(KERN_INFO "Adaptec I2O controllers down.\n");
862} 851}
863 852
864/*
865 * reboot/shutdown notification.
866 *
867 * - Quiesce each IOP in the system
868 *
869 */
870
871#ifdef REBOOT_NOTIFIER
872static int adpt_reboot_event(struct notifier_block *n, ulong code, void *p)
873{
874
875 if(code != SYS_RESTART && code != SYS_HALT && code != SYS_POWER_OFF)
876 return NOTIFY_DONE;
877
878 adpt_i2o_sys_shutdown();
879
880 return NOTIFY_DONE;
881}
882#endif
883
884
885static int adpt_install_hba(struct scsi_host_template* sht, struct pci_dev* pDev) 853static int adpt_install_hba(struct scsi_host_template* sht, struct pci_dev* pDev)
886{ 854{
887 855
@@ -1080,18 +1048,6 @@ static void adpt_i2o_delete_hba(adpt_hba* pHba)
1080 } 1048 }
1081} 1049}
1082 1050
1083
1084static int adpt_init(void)
1085{
1086 printk("Loading Adaptec I2O RAID: Version " DPT_I2O_VERSION "\n");
1087#ifdef REBOOT_NOTIFIER
1088 register_reboot_notifier(&adpt_reboot_notifier);
1089#endif
1090
1091 return 0;
1092}
1093
1094
1095static struct adpt_device* adpt_find_device(adpt_hba* pHba, u32 chan, u32 id, u32 lun) 1051static struct adpt_device* adpt_find_device(adpt_hba* pHba, u32 chan, u32 id, u32 lun)
1096{ 1052{
1097 struct adpt_device* d; 1053 struct adpt_device* d;
@@ -2177,13 +2133,13 @@ static s32 adpt_scsi_to_i2o(adpt_hba* pHba, struct scsi_cmnd* cmd, struct adpt_d
2177} 2133}
2178 2134
2179 2135
2180static s32 adpt_scsi_register(adpt_hba* pHba,struct scsi_host_template * sht) 2136static s32 adpt_scsi_host_alloc(adpt_hba* pHba, struct scsi_host_template *sht)
2181{ 2137{
2182 struct Scsi_Host *host = NULL; 2138 struct Scsi_Host *host;
2183 2139
2184 host = scsi_register(sht, sizeof(adpt_hba*)); 2140 host = scsi_host_alloc(sht, sizeof(adpt_hba*));
2185 if (host == NULL) { 2141 if (host == NULL) {
2186 printk ("%s: scsi_register returned NULL\n",pHba->name); 2142 printk("%s: scsi_host_alloc returned NULL\n", pHba->name);
2187 return -1; 2143 return -1;
2188 } 2144 }
2189 host->hostdata[0] = (unsigned long)pHba; 2145 host->hostdata[0] = (unsigned long)pHba;
@@ -3323,11 +3279,10 @@ static static void adpt_delay(int millisec)
3323#endif 3279#endif
3324 3280
3325static struct scsi_host_template driver_template = { 3281static struct scsi_host_template driver_template = {
3282 .module = THIS_MODULE,
3326 .name = "dpt_i2o", 3283 .name = "dpt_i2o",
3327 .proc_name = "dpt_i2o", 3284 .proc_name = "dpt_i2o",
3328 .proc_info = adpt_proc_info, 3285 .proc_info = adpt_proc_info,
3329 .detect = adpt_detect,
3330 .release = adpt_release,
3331 .info = adpt_info, 3286 .info = adpt_info,
3332 .queuecommand = adpt_queue, 3287 .queuecommand = adpt_queue,
3333 .eh_abort_handler = adpt_abort, 3288 .eh_abort_handler = adpt_abort,
@@ -3341,5 +3296,48 @@ static struct scsi_host_template driver_template = {
3341 .cmd_per_lun = 1, 3296 .cmd_per_lun = 1,
3342 .use_clustering = ENABLE_CLUSTERING, 3297 .use_clustering = ENABLE_CLUSTERING,
3343}; 3298};
3344#include "scsi_module.c" 3299
3300static int __init adpt_init(void)
3301{
3302 int error;
3303 adpt_hba *pHba, *next;
3304
3305 printk("Loading Adaptec I2O RAID: Version " DPT_I2O_VERSION "\n");
3306
3307 error = adpt_detect(&driver_template);
3308 if (error < 0)
3309 return error;
3310 if (hba_chain == NULL)
3311 return -ENODEV;
3312
3313 for (pHba = hba_chain; pHba; pHba = pHba->next) {
3314 error = scsi_add_host(pHba->host, &pHba->pDev->dev);
3315 if (error)
3316 goto fail;
3317 scsi_scan_host(pHba->host);
3318 }
3319 return 0;
3320fail:
3321 for (pHba = hba_chain; pHba; pHba = next) {
3322 next = pHba->next;
3323 scsi_remove_host(pHba->host);
3324 }
3325 return error;
3326}
3327
3328static void __exit adpt_exit(void)
3329{
3330 adpt_hba *pHba, *next;
3331
3332 for (pHba = hba_chain; pHba; pHba = pHba->next)
3333 scsi_remove_host(pHba->host);
3334 for (pHba = hba_chain; pHba; pHba = next) {
3335 next = pHba->next;
3336 adpt_release(pHba->host);
3337 }
3338}
3339
3340module_init(adpt_init);
3341module_exit(adpt_exit);
3342
3345MODULE_LICENSE("GPL"); 3343MODULE_LICENSE("GPL");