diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/scsi/dpt_i2o.c | 102 | ||||
-rw-r--r-- | drivers/scsi/dpti.h | 6 |
2 files changed, 51 insertions, 57 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 | ||
125 | static 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 | ||
872 | static 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 | |||
885 | static int adpt_install_hba(struct scsi_host_template* sht, struct pci_dev* pDev) | 853 | static 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 | |||
1084 | static 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 | |||
1095 | static struct adpt_device* adpt_find_device(adpt_hba* pHba, u32 chan, u32 id, u32 lun) | 1051 | static 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 | ||
2180 | static s32 adpt_scsi_register(adpt_hba* pHba,struct scsi_host_template * sht) | 2136 | static 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 | ||
3325 | static struct scsi_host_template driver_template = { | 3281 | static 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 | |
3300 | static 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; | ||
3320 | fail: | ||
3321 | for (pHba = hba_chain; pHba; pHba = next) { | ||
3322 | next = pHba->next; | ||
3323 | scsi_remove_host(pHba->host); | ||
3324 | } | ||
3325 | return error; | ||
3326 | } | ||
3327 | |||
3328 | static 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 | |||
3340 | module_init(adpt_init); | ||
3341 | module_exit(adpt_exit); | ||
3342 | |||
3345 | MODULE_LICENSE("GPL"); | 3343 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/scsi/dpti.h b/drivers/scsi/dpti.h index fd79068c5869..acc692915b4c 100644 --- a/drivers/scsi/dpti.h +++ b/drivers/scsi/dpti.h | |||
@@ -84,7 +84,6 @@ static int adpt_device_reset(struct scsi_cmnd* cmd); | |||
84 | #define PCI_DPT_DEVICE_ID (0xA501) // DPT PCI I2O Device ID | 84 | #define PCI_DPT_DEVICE_ID (0xA501) // DPT PCI I2O Device ID |
85 | #define PCI_DPT_RAPTOR_DEVICE_ID (0xA511) | 85 | #define PCI_DPT_RAPTOR_DEVICE_ID (0xA511) |
86 | 86 | ||
87 | //#define REBOOT_NOTIFIER 1 | ||
88 | /* Debugging macro from Linux Device Drivers - Rubini */ | 87 | /* Debugging macro from Linux Device Drivers - Rubini */ |
89 | #undef PDEBUG | 88 | #undef PDEBUG |
90 | #ifdef DEBUG | 89 | #ifdef DEBUG |
@@ -264,9 +263,6 @@ static void adpt_i2o_sys_shutdown(void); | |||
264 | static int adpt_init(void); | 263 | static int adpt_init(void); |
265 | static int adpt_i2o_build_sys_table(void); | 264 | static int adpt_i2o_build_sys_table(void); |
266 | static irqreturn_t adpt_isr(int irq, void *dev_id); | 265 | static irqreturn_t adpt_isr(int irq, void *dev_id); |
267 | #ifdef REBOOT_NOTIFIER | ||
268 | static int adpt_reboot_event(struct notifier_block *n, ulong code, void *p); | ||
269 | #endif | ||
270 | 266 | ||
271 | static void adpt_i2o_report_hba_unit(adpt_hba* pHba, struct i2o_device *d); | 267 | static void adpt_i2o_report_hba_unit(adpt_hba* pHba, struct i2o_device *d); |
272 | static int adpt_i2o_query_scalar(adpt_hba* pHba, int tid, | 268 | static int adpt_i2o_query_scalar(adpt_hba* pHba, int tid, |
@@ -289,7 +285,7 @@ static s32 adpt_i2o_init_outbound_q(adpt_hba* pHba); | |||
289 | static s32 adpt_i2o_hrt_get(adpt_hba* pHba); | 285 | static s32 adpt_i2o_hrt_get(adpt_hba* pHba); |
290 | static s32 adpt_scsi_to_i2o(adpt_hba* pHba, struct scsi_cmnd* cmd, struct adpt_device* dptdevice); | 286 | static s32 adpt_scsi_to_i2o(adpt_hba* pHba, struct scsi_cmnd* cmd, struct adpt_device* dptdevice); |
291 | static s32 adpt_i2o_to_scsi(void __iomem *reply, struct scsi_cmnd* cmd); | 287 | static s32 adpt_i2o_to_scsi(void __iomem *reply, struct scsi_cmnd* cmd); |
292 | static s32 adpt_scsi_register(adpt_hba* pHba,struct scsi_host_template * sht); | 288 | static s32 adpt_scsi_host_alloc(adpt_hba* pHba,struct scsi_host_template * sht); |
293 | static s32 adpt_hba_reset(adpt_hba* pHba); | 289 | static s32 adpt_hba_reset(adpt_hba* pHba); |
294 | static s32 adpt_i2o_reset_hba(adpt_hba* pHba); | 290 | static s32 adpt_i2o_reset_hba(adpt_hba* pHba); |
295 | static s32 adpt_rescan(adpt_hba* pHba); | 291 | static s32 adpt_rescan(adpt_hba* pHba); |