diff options
author | Eric Moore <eric.moore@lsi.com> | 2007-09-29 12:15:59 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.localdomain> | 2007-10-12 14:52:08 -0400 |
commit | e7eae9f6e94cd49261c2997b0b4f768c1351bc02 (patch) | |
tree | d82cd39d6d997fc650a0fae933ecaf7514e4e7de | |
parent | cce99c6925b8d6a59cf584411277c1c20c330334 (diff) |
[SCSI] mpt fusion: add use of shost_priv and remove all the typecasting
The driver is currently typecasting to obtain the shost hostdata. The
driver is updated to use the shost_priv macro.
Signed-off-by: Eric Moore <Eric.Moore@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
-rw-r--r-- | drivers/message/fusion/mptctl.c | 10 | ||||
-rw-r--r-- | drivers/message/fusion/mptfc.c | 17 | ||||
-rw-r--r-- | drivers/message/fusion/mptsas.c | 14 | ||||
-rw-r--r-- | drivers/message/fusion/mptscsih.c | 74 | ||||
-rw-r--r-- | drivers/message/fusion/mptspi.c | 23 |
5 files changed, 62 insertions, 76 deletions
diff --git a/drivers/message/fusion/mptctl.c b/drivers/message/fusion/mptctl.c index b7d1159916c2..70178a8940b2 100644 --- a/drivers/message/fusion/mptctl.c +++ b/drivers/message/fusion/mptctl.c | |||
@@ -348,7 +348,7 @@ static int mptctl_bus_reset(MPT_IOCTL *ioctl) | |||
348 | if (ioctl->ioc->sh == NULL) | 348 | if (ioctl->ioc->sh == NULL) |
349 | return -EPERM; | 349 | return -EPERM; |
350 | 350 | ||
351 | hd = (MPT_SCSI_HOST *) ioctl->ioc->sh->hostdata; | 351 | hd = shost_priv(ioctl->ioc->sh); |
352 | if (hd == NULL) | 352 | if (hd == NULL) |
353 | return -EPERM; | 353 | return -EPERM; |
354 | 354 | ||
@@ -449,7 +449,7 @@ mptctl_free_tm_flags(MPT_ADAPTER *ioc) | |||
449 | MPT_SCSI_HOST * hd; | 449 | MPT_SCSI_HOST * hd; |
450 | unsigned long flags; | 450 | unsigned long flags; |
451 | 451 | ||
452 | hd = (MPT_SCSI_HOST *) ioc->sh->hostdata; | 452 | hd = shost_priv(ioc->sh); |
453 | if (hd == NULL) | 453 | if (hd == NULL) |
454 | return; | 454 | return; |
455 | 455 | ||
@@ -2026,7 +2026,7 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr) | |||
2026 | case MPI_FUNCTION_SCSI_TASK_MGMT: | 2026 | case MPI_FUNCTION_SCSI_TASK_MGMT: |
2027 | { | 2027 | { |
2028 | MPT_SCSI_HOST *hd = NULL; | 2028 | MPT_SCSI_HOST *hd = NULL; |
2029 | if ((ioc->sh == NULL) || ((hd = (MPT_SCSI_HOST *)ioc->sh->hostdata) == NULL)) { | 2029 | if ((ioc->sh == NULL) || ((hd = shost_priv(ioc->sh)) == NULL)) { |
2030 | printk(MYIOC_s_ERR_FMT "%s@%d::mptctl_do_mpt_command - " | 2030 | printk(MYIOC_s_ERR_FMT "%s@%d::mptctl_do_mpt_command - " |
2031 | "SCSI driver not loaded or SCSI host not found. \n", | 2031 | "SCSI driver not loaded or SCSI host not found. \n", |
2032 | ioc->name, __FILE__, __LINE__); | 2032 | ioc->name, __FILE__, __LINE__); |
@@ -2466,7 +2466,7 @@ mptctl_hp_hostinfo(unsigned long arg, unsigned int data_size) | |||
2466 | karg.soft_resets = 0; | 2466 | karg.soft_resets = 0; |
2467 | karg.timeouts = 0; | 2467 | karg.timeouts = 0; |
2468 | if (ioc->sh != NULL) { | 2468 | if (ioc->sh != NULL) { |
2469 | MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)ioc->sh->hostdata; | 2469 | MPT_SCSI_HOST *hd = shost_priv(ioc->sh); |
2470 | 2470 | ||
2471 | if (hd && (cim_rev == 1)) { | 2471 | if (hd && (cim_rev == 1)) { |
2472 | karg.hard_resets = hd->hard_resets; | 2472 | karg.hard_resets = hd->hard_resets; |
@@ -2683,7 +2683,7 @@ mptctl_hp_targetinfo(unsigned long arg) | |||
2683 | pci_free_consistent(ioc->pcidev, data_sz, (u8 *) pg3_alloc, page_dma); | 2683 | pci_free_consistent(ioc->pcidev, data_sz, (u8 *) pg3_alloc, page_dma); |
2684 | } | 2684 | } |
2685 | } | 2685 | } |
2686 | hd = (MPT_SCSI_HOST *) ioc->sh->hostdata; | 2686 | hd = shost_priv(ioc->sh); |
2687 | if (hd != NULL) | 2687 | if (hd != NULL) |
2688 | karg.select_timeouts = hd->sel_timeout[karg.hdr.id]; | 2688 | karg.select_timeouts = hd->sel_timeout[karg.hdr.id]; |
2689 | 2689 | ||
diff --git a/drivers/message/fusion/mptfc.c b/drivers/message/fusion/mptfc.c index 19438ecc47a6..df1e6faebf19 100644 --- a/drivers/message/fusion/mptfc.c +++ b/drivers/message/fusion/mptfc.c | |||
@@ -196,7 +196,7 @@ mptfc_block_error_handler(struct scsi_cmnd *SCpnt, | |||
196 | int ready; | 196 | int ready; |
197 | MPT_ADAPTER *ioc; | 197 | MPT_ADAPTER *ioc; |
198 | 198 | ||
199 | hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata; | 199 | hd = shost_priv(SCpnt->device->host); |
200 | ioc = hd->ioc; | 200 | ioc = hd->ioc; |
201 | spin_lock_irqsave(shost->host_lock, flags); | 201 | spin_lock_irqsave(shost->host_lock, flags); |
202 | while ((ready = fc_remote_port_chkready(rport) >> 16) == DID_IMM_RETRY) { | 202 | while ((ready = fc_remote_port_chkready(rport) >> 16) == DID_IMM_RETRY) { |
@@ -204,8 +204,7 @@ mptfc_block_error_handler(struct scsi_cmnd *SCpnt, | |||
204 | dfcprintk (ioc, printk(MYIOC_s_DEBUG_FMT | 204 | dfcprintk (ioc, printk(MYIOC_s_DEBUG_FMT |
205 | "mptfc_block_error_handler.%d: %d:%d, port status is " | 205 | "mptfc_block_error_handler.%d: %d:%d, port status is " |
206 | "DID_IMM_RETRY, deferring %s recovery.\n", | 206 | "DID_IMM_RETRY, deferring %s recovery.\n", |
207 | ((MPT_SCSI_HOST *) shost->hostdata)->ioc->name, | 207 | ioc->name, ioc->sh->host_no, |
208 | ((MPT_SCSI_HOST *) shost->hostdata)->ioc->sh->host_no, | ||
209 | SCpnt->device->id, SCpnt->device->lun, caller)); | 208 | SCpnt->device->id, SCpnt->device->lun, caller)); |
210 | msleep(1000); | 209 | msleep(1000); |
211 | spin_lock_irqsave(shost->host_lock, flags); | 210 | spin_lock_irqsave(shost->host_lock, flags); |
@@ -216,16 +215,14 @@ mptfc_block_error_handler(struct scsi_cmnd *SCpnt, | |||
216 | dfcprintk (ioc, printk(MYIOC_s_DEBUG_FMT | 215 | dfcprintk (ioc, printk(MYIOC_s_DEBUG_FMT |
217 | "%s.%d: %d:%d, failing recovery, " | 216 | "%s.%d: %d:%d, failing recovery, " |
218 | "port state %d, vdevice %p.\n", caller, | 217 | "port state %d, vdevice %p.\n", caller, |
219 | ((MPT_SCSI_HOST *) shost->hostdata)->ioc->name, | 218 | ioc->name, ioc->sh->host_no, |
220 | ((MPT_SCSI_HOST *) shost->hostdata)->ioc->sh->host_no, | ||
221 | SCpnt->device->id, SCpnt->device->lun, ready, | 219 | SCpnt->device->id, SCpnt->device->lun, ready, |
222 | SCpnt->device->hostdata)); | 220 | SCpnt->device->hostdata)); |
223 | return FAILED; | 221 | return FAILED; |
224 | } | 222 | } |
225 | dfcprintk (ioc, printk(MYIOC_s_DEBUG_FMT | 223 | dfcprintk (ioc, printk(MYIOC_s_DEBUG_FMT |
226 | "%s.%d: %d:%d, executing recovery.\n", caller, | 224 | "%s.%d: %d:%d, executing recovery.\n", caller, |
227 | ((MPT_SCSI_HOST *) shost->hostdata)->ioc->name, | 225 | ioc->name, ioc->sh->host_no, |
228 | ((MPT_SCSI_HOST *) shost->hostdata)->ioc->sh->host_no, | ||
229 | SCpnt->device->id, SCpnt->device->lun)); | 226 | SCpnt->device->id, SCpnt->device->lun)); |
230 | return (*func)(SCpnt); | 227 | return (*func)(SCpnt); |
231 | } | 228 | } |
@@ -615,7 +612,7 @@ mptfc_slave_alloc(struct scsi_device *sdev) | |||
615 | if (!rport || fc_remote_port_chkready(rport)) | 612 | if (!rport || fc_remote_port_chkready(rport)) |
616 | return -ENXIO; | 613 | return -ENXIO; |
617 | 614 | ||
618 | hd = (MPT_SCSI_HOST *)sdev->host->hostdata; | 615 | hd = shost_priv(sdev->host); |
619 | ioc = hd->ioc; | 616 | ioc = hd->ioc; |
620 | 617 | ||
621 | vdevice = kzalloc(sizeof(VirtDevice), GFP_KERNEL); | 618 | vdevice = kzalloc(sizeof(VirtDevice), GFP_KERNEL); |
@@ -1279,7 +1276,7 @@ mptfc_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1279 | 1276 | ||
1280 | spin_unlock_irqrestore(&ioc->FreeQlock, flags); | 1277 | spin_unlock_irqrestore(&ioc->FreeQlock, flags); |
1281 | 1278 | ||
1282 | hd = (MPT_SCSI_HOST *) sh->hostdata; | 1279 | hd = shost_priv(sh); |
1283 | hd->ioc = ioc; | 1280 | hd->ioc = ioc; |
1284 | 1281 | ||
1285 | /* SCSI needs scsi_cmnd lookup table! | 1282 | /* SCSI needs scsi_cmnd lookup table! |
@@ -1386,7 +1383,7 @@ mptfc_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply) | |||
1386 | ioc->name, event)); | 1383 | ioc->name, event)); |
1387 | 1384 | ||
1388 | if (ioc->sh == NULL || | 1385 | if (ioc->sh == NULL || |
1389 | ((hd = (MPT_SCSI_HOST *)ioc->sh->hostdata) == NULL)) | 1386 | ((hd = shost_priv(ioc->sh)) == NULL)) |
1390 | return 1; | 1387 | return 1; |
1391 | 1388 | ||
1392 | switch (event) { | 1389 | switch (event) { |
diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c index d2f1b8ea93b2..adbdbd45e0c9 100644 --- a/drivers/message/fusion/mptsas.c +++ b/drivers/message/fusion/mptsas.c | |||
@@ -575,7 +575,7 @@ static void | |||
575 | mptsas_target_reset_queue(MPT_ADAPTER *ioc, | 575 | mptsas_target_reset_queue(MPT_ADAPTER *ioc, |
576 | EVENT_DATA_SAS_DEVICE_STATUS_CHANGE *sas_event_data) | 576 | EVENT_DATA_SAS_DEVICE_STATUS_CHANGE *sas_event_data) |
577 | { | 577 | { |
578 | MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)ioc->sh->hostdata; | 578 | MPT_SCSI_HOST *hd = shost_priv(ioc->sh); |
579 | VirtTarget *vtarget = NULL; | 579 | VirtTarget *vtarget = NULL; |
580 | struct mptsas_target_reset_event *target_reset_list; | 580 | struct mptsas_target_reset_event *target_reset_list; |
581 | u8 id, channel; | 581 | u8 id, channel; |
@@ -622,7 +622,7 @@ mptsas_target_reset_queue(MPT_ADAPTER *ioc, | |||
622 | static void | 622 | static void |
623 | mptsas_dev_reset_complete(MPT_ADAPTER *ioc) | 623 | mptsas_dev_reset_complete(MPT_ADAPTER *ioc) |
624 | { | 624 | { |
625 | MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)ioc->sh->hostdata; | 625 | MPT_SCSI_HOST *hd = shost_priv(ioc->sh); |
626 | struct list_head *head = &hd->target_reset_list; | 626 | struct list_head *head = &hd->target_reset_list; |
627 | struct mptsas_target_reset_event *target_reset_list; | 627 | struct mptsas_target_reset_event *target_reset_list; |
628 | struct mptsas_hotplug_event *ev; | 628 | struct mptsas_hotplug_event *ev; |
@@ -739,7 +739,7 @@ mptsas_ioc_reset(MPT_ADAPTER *ioc, int reset_phase) | |||
739 | 739 | ||
740 | if (!ioc->sh || !ioc->sh->hostdata) | 740 | if (!ioc->sh || !ioc->sh->hostdata) |
741 | goto out; | 741 | goto out; |
742 | hd = (MPT_SCSI_HOST *)ioc->sh->hostdata; | 742 | hd = shost_priv(ioc->sh); |
743 | if (!hd->ioc) | 743 | if (!hd->ioc) |
744 | goto out; | 744 | goto out; |
745 | 745 | ||
@@ -839,7 +839,7 @@ static int | |||
839 | mptsas_target_alloc(struct scsi_target *starget) | 839 | mptsas_target_alloc(struct scsi_target *starget) |
840 | { | 840 | { |
841 | struct Scsi_Host *host = dev_to_shost(&starget->dev); | 841 | struct Scsi_Host *host = dev_to_shost(&starget->dev); |
842 | MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)host->hostdata; | 842 | MPT_SCSI_HOST *hd = shost_priv(host); |
843 | VirtTarget *vtarget; | 843 | VirtTarget *vtarget; |
844 | u8 id, channel; | 844 | u8 id, channel; |
845 | struct sas_rphy *rphy; | 845 | struct sas_rphy *rphy; |
@@ -908,7 +908,7 @@ static void | |||
908 | mptsas_target_destroy(struct scsi_target *starget) | 908 | mptsas_target_destroy(struct scsi_target *starget) |
909 | { | 909 | { |
910 | struct Scsi_Host *host = dev_to_shost(&starget->dev); | 910 | struct Scsi_Host *host = dev_to_shost(&starget->dev); |
911 | MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)host->hostdata; | 911 | MPT_SCSI_HOST *hd = shost_priv(host); |
912 | struct sas_rphy *rphy; | 912 | struct sas_rphy *rphy; |
913 | struct mptsas_portinfo *p; | 913 | struct mptsas_portinfo *p; |
914 | int i; | 914 | int i; |
@@ -941,7 +941,7 @@ static int | |||
941 | mptsas_slave_alloc(struct scsi_device *sdev) | 941 | mptsas_slave_alloc(struct scsi_device *sdev) |
942 | { | 942 | { |
943 | struct Scsi_Host *host = sdev->host; | 943 | struct Scsi_Host *host = sdev->host; |
944 | MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)host->hostdata; | 944 | MPT_SCSI_HOST *hd = shost_priv(host); |
945 | struct sas_rphy *rphy; | 945 | struct sas_rphy *rphy; |
946 | struct mptsas_portinfo *p; | 946 | struct mptsas_portinfo *p; |
947 | VirtDevice *vdevice; | 947 | VirtDevice *vdevice; |
@@ -3215,7 +3215,7 @@ mptsas_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
3215 | sh->sg_tablesize = numSGE; | 3215 | sh->sg_tablesize = numSGE; |
3216 | } | 3216 | } |
3217 | 3217 | ||
3218 | hd = (MPT_SCSI_HOST *) sh->hostdata; | 3218 | hd = shost_priv(sh); |
3219 | hd->ioc = ioc; | 3219 | hd->ioc = ioc; |
3220 | 3220 | ||
3221 | /* SCSI needs scsi_cmnd lookup table! | 3221 | /* SCSI needs scsi_cmnd lookup table! |
diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c index 17369f8ba88b..b1f68caf9a1d 100644 --- a/drivers/message/fusion/mptscsih.c +++ b/drivers/message/fusion/mptscsih.c | |||
@@ -647,8 +647,7 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr) | |||
647 | VirtDevice *vdevice; | 647 | VirtDevice *vdevice; |
648 | VirtTarget *vtarget; | 648 | VirtTarget *vtarget; |
649 | 649 | ||
650 | hd = (MPT_SCSI_HOST *) ioc->sh->hostdata; | 650 | hd = shost_priv(ioc->sh); |
651 | |||
652 | req_idx = le16_to_cpu(mf->u.frame.hwhdr.msgctxu.fld.req_idx); | 651 | req_idx = le16_to_cpu(mf->u.frame.hwhdr.msgctxu.fld.req_idx); |
653 | req_idx_MR = (mr != NULL) ? | 652 | req_idx_MR = (mr != NULL) ? |
654 | le16_to_cpu(mr->u.frame.hwhdr.msgctxu.fld.req_idx) : req_idx; | 653 | le16_to_cpu(mr->u.frame.hwhdr.msgctxu.fld.req_idx) : req_idx; |
@@ -1105,7 +1104,7 @@ mptscsih_report_queue_full(struct scsi_cmnd *sc, SCSIIOReply_t *pScsiReply, SCSI | |||
1105 | return; | 1104 | return; |
1106 | if (sc->device->host == NULL) | 1105 | if (sc->device->host == NULL) |
1107 | return; | 1106 | return; |
1108 | if ((hd = (MPT_SCSI_HOST *)sc->device->host->hostdata) == NULL) | 1107 | if ((hd = shost_priv(sc->device->host)) == NULL) |
1109 | return; | 1108 | return; |
1110 | ioc = hd->ioc; | 1109 | ioc = hd->ioc; |
1111 | if (time - hd->last_queue_full > 10 * HZ) { | 1110 | if (time - hd->last_queue_full > 10 * HZ) { |
@@ -1137,7 +1136,7 @@ mptscsih_remove(struct pci_dev *pdev) | |||
1137 | 1136 | ||
1138 | scsi_remove_host(host); | 1137 | scsi_remove_host(host); |
1139 | 1138 | ||
1140 | if((hd = (MPT_SCSI_HOST *)host->hostdata) == NULL) | 1139 | if((hd = shost_priv(host)) == NULL) |
1141 | return; | 1140 | return; |
1142 | 1141 | ||
1143 | mptscsih_shutdown(pdev); | 1142 | mptscsih_shutdown(pdev); |
@@ -1174,15 +1173,6 @@ mptscsih_remove(struct pci_dev *pdev) | |||
1174 | void | 1173 | void |
1175 | mptscsih_shutdown(struct pci_dev *pdev) | 1174 | mptscsih_shutdown(struct pci_dev *pdev) |
1176 | { | 1175 | { |
1177 | MPT_ADAPTER *ioc = pci_get_drvdata(pdev); | ||
1178 | struct Scsi_Host *host = ioc->sh; | ||
1179 | MPT_SCSI_HOST *hd; | ||
1180 | |||
1181 | if(!host) | ||
1182 | return; | ||
1183 | |||
1184 | hd = (MPT_SCSI_HOST *)host->hostdata; | ||
1185 | |||
1186 | } | 1176 | } |
1187 | 1177 | ||
1188 | #ifdef CONFIG_PM | 1178 | #ifdef CONFIG_PM |
@@ -1228,7 +1218,7 @@ mptscsih_info(struct Scsi_Host *SChost) | |||
1228 | MPT_SCSI_HOST *h; | 1218 | MPT_SCSI_HOST *h; |
1229 | int size = 0; | 1219 | int size = 0; |
1230 | 1220 | ||
1231 | h = (MPT_SCSI_HOST *)SChost->hostdata; | 1221 | h = shost_priv(SChost); |
1232 | 1222 | ||
1233 | if (h) { | 1223 | if (h) { |
1234 | if (h->info_kbuf == NULL) | 1224 | if (h->info_kbuf == NULL) |
@@ -1322,7 +1312,7 @@ int | |||
1322 | mptscsih_proc_info(struct Scsi_Host *host, char *buffer, char **start, off_t offset, | 1312 | mptscsih_proc_info(struct Scsi_Host *host, char *buffer, char **start, off_t offset, |
1323 | int length, int func) | 1313 | int length, int func) |
1324 | { | 1314 | { |
1325 | MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)host->hostdata; | 1315 | MPT_SCSI_HOST *hd = shost_priv(host); |
1326 | MPT_ADAPTER *ioc = hd->ioc; | 1316 | MPT_ADAPTER *ioc = hd->ioc; |
1327 | int size = 0; | 1317 | int size = 0; |
1328 | 1318 | ||
@@ -1371,7 +1361,7 @@ mptscsih_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) | |||
1371 | int ii; | 1361 | int ii; |
1372 | MPT_ADAPTER *ioc; | 1362 | MPT_ADAPTER *ioc; |
1373 | 1363 | ||
1374 | hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata; | 1364 | hd = shost_priv(SCpnt->device->host); |
1375 | ioc = hd->ioc; | 1365 | ioc = hd->ioc; |
1376 | lun = SCpnt->device->lun; | 1366 | lun = SCpnt->device->lun; |
1377 | SCpnt->scsi_done = done; | 1367 | SCpnt->scsi_done = done; |
@@ -1807,7 +1797,7 @@ mptscsih_abort(struct scsi_cmnd * SCpnt) | |||
1807 | 1797 | ||
1808 | /* If we can't locate our host adapter structure, return FAILED status. | 1798 | /* If we can't locate our host adapter structure, return FAILED status. |
1809 | */ | 1799 | */ |
1810 | if ((hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata) == NULL) { | 1800 | if ((hd = shost_priv(SCpnt->device->host)) == NULL) { |
1811 | SCpnt->result = DID_RESET << 16; | 1801 | SCpnt->result = DID_RESET << 16; |
1812 | SCpnt->scsi_done(SCpnt); | 1802 | SCpnt->scsi_done(SCpnt); |
1813 | printk(KERN_ERR MYNAM ": task abort: " | 1803 | printk(KERN_ERR MYNAM ": task abort: " |
@@ -1913,7 +1903,7 @@ mptscsih_dev_reset(struct scsi_cmnd * SCpnt) | |||
1913 | 1903 | ||
1914 | /* If we can't locate our host adapter structure, return FAILED status. | 1904 | /* If we can't locate our host adapter structure, return FAILED status. |
1915 | */ | 1905 | */ |
1916 | if ((hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata) == NULL){ | 1906 | if ((hd = shost_priv(SCpnt->device->host)) == NULL){ |
1917 | printk(KERN_ERR MYNAM ": target reset: " | 1907 | printk(KERN_ERR MYNAM ": target reset: " |
1918 | "Can't locate host! (sc=%p)\n", SCpnt); | 1908 | "Can't locate host! (sc=%p)\n", SCpnt); |
1919 | return FAILED; | 1909 | return FAILED; |
@@ -1976,7 +1966,7 @@ mptscsih_bus_reset(struct scsi_cmnd * SCpnt) | |||
1976 | 1966 | ||
1977 | /* If we can't locate our host adapter structure, return FAILED status. | 1967 | /* If we can't locate our host adapter structure, return FAILED status. |
1978 | */ | 1968 | */ |
1979 | if ((hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata) == NULL){ | 1969 | if ((hd = shost_priv(SCpnt->device->host)) == NULL){ |
1980 | printk(KERN_ERR MYNAM ": bus reset: " | 1970 | printk(KERN_ERR MYNAM ": bus reset: " |
1981 | "Can't locate host! (sc=%p)\n", SCpnt); | 1971 | "Can't locate host! (sc=%p)\n", SCpnt); |
1982 | return FAILED; | 1972 | return FAILED; |
@@ -2020,7 +2010,7 @@ mptscsih_host_reset(struct scsi_cmnd *SCpnt) | |||
2020 | MPT_ADAPTER *ioc; | 2010 | MPT_ADAPTER *ioc; |
2021 | 2011 | ||
2022 | /* If we can't locate the host to reset, then we failed. */ | 2012 | /* If we can't locate the host to reset, then we failed. */ |
2023 | if ((hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata) == NULL){ | 2013 | if ((hd = shost_priv(SCpnt->device->host)) == NULL){ |
2024 | printk(KERN_ERR MYNAM ": host reset: " | 2014 | printk(KERN_ERR MYNAM ": host reset: " |
2025 | "Can't locate host! (sc=%p)\n", SCpnt); | 2015 | "Can't locate host! (sc=%p)\n", SCpnt); |
2026 | return FAILED; | 2016 | return FAILED; |
@@ -2186,7 +2176,7 @@ mptscsih_taskmgmt_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *m | |||
2186 | return 1; | 2176 | return 1; |
2187 | } | 2177 | } |
2188 | 2178 | ||
2189 | hd = (MPT_SCSI_HOST *)ioc->sh->hostdata; | 2179 | hd = shost_priv(ioc->sh); |
2190 | pScsiTmReply = (SCSITaskMgmtReply_t*)mr; | 2180 | pScsiTmReply = (SCSITaskMgmtReply_t*)mr; |
2191 | pScsiTmReq = (SCSITaskMgmt_t*)mf; | 2181 | pScsiTmReq = (SCSITaskMgmt_t*)mf; |
2192 | tmType = pScsiTmReq->TaskType; | 2182 | tmType = pScsiTmReq->TaskType; |
@@ -2380,7 +2370,7 @@ void | |||
2380 | mptscsih_slave_destroy(struct scsi_device *sdev) | 2370 | mptscsih_slave_destroy(struct scsi_device *sdev) |
2381 | { | 2371 | { |
2382 | struct Scsi_Host *host = sdev->host; | 2372 | struct Scsi_Host *host = sdev->host; |
2383 | MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)host->hostdata; | 2373 | MPT_SCSI_HOST *hd = shost_priv(host); |
2384 | VirtTarget *vtarget; | 2374 | VirtTarget *vtarget; |
2385 | VirtDevice *vdevice; | 2375 | VirtDevice *vdevice; |
2386 | struct scsi_target *starget; | 2376 | struct scsi_target *starget; |
@@ -2407,7 +2397,7 @@ mptscsih_slave_destroy(struct scsi_device *sdev) | |||
2407 | int | 2397 | int |
2408 | mptscsih_change_queue_depth(struct scsi_device *sdev, int qdepth) | 2398 | mptscsih_change_queue_depth(struct scsi_device *sdev, int qdepth) |
2409 | { | 2399 | { |
2410 | MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)sdev->host->hostdata; | 2400 | MPT_SCSI_HOST *hd = shost_priv(sdev->host); |
2411 | VirtTarget *vtarget; | 2401 | VirtTarget *vtarget; |
2412 | struct scsi_target *starget; | 2402 | struct scsi_target *starget; |
2413 | int max_depth; | 2403 | int max_depth; |
@@ -2452,7 +2442,7 @@ mptscsih_slave_configure(struct scsi_device *sdev) | |||
2452 | VirtTarget *vtarget; | 2442 | VirtTarget *vtarget; |
2453 | VirtDevice *vdevice; | 2443 | VirtDevice *vdevice; |
2454 | struct scsi_target *starget; | 2444 | struct scsi_target *starget; |
2455 | MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)sh->hostdata; | 2445 | MPT_SCSI_HOST *hd = shost_priv(sh); |
2456 | MPT_ADAPTER *ioc = hd->ioc; | 2446 | MPT_ADAPTER *ioc = hd->ioc; |
2457 | 2447 | ||
2458 | starget = scsi_target(sdev); | 2448 | starget = scsi_target(sdev); |
@@ -2567,7 +2557,7 @@ SCPNT_TO_LOOKUP_IDX(struct scsi_cmnd *sc) | |||
2567 | MPT_SCSI_HOST *hd; | 2557 | MPT_SCSI_HOST *hd; |
2568 | int i; | 2558 | int i; |
2569 | 2559 | ||
2570 | hd = (MPT_SCSI_HOST *) sc->device->host->hostdata; | 2560 | hd = shost_priv(sc->device->host); |
2571 | 2561 | ||
2572 | for (i = 0; i < hd->ioc->req_depth; i++) { | 2562 | for (i = 0; i < hd->ioc->req_depth; i++) { |
2573 | if (hd->ScsiLookup[i] == sc) { | 2563 | if (hd->ScsiLookup[i] == sc) { |
@@ -2595,10 +2585,10 @@ mptscsih_ioc_reset(MPT_ADAPTER *ioc, int reset_phase) | |||
2595 | * before all scsi hosts have been attached, then an alt_ioc | 2585 | * before all scsi hosts have been attached, then an alt_ioc |
2596 | * may have a NULL sh pointer. | 2586 | * may have a NULL sh pointer. |
2597 | */ | 2587 | */ |
2598 | if ((ioc->sh == NULL) || (ioc->sh->hostdata == NULL)) | 2588 | if (ioc->sh == NULL || shost_priv(ioc->sh) == NULL) |
2599 | return 0; | 2589 | return 0; |
2600 | else | 2590 | else |
2601 | hd = (MPT_SCSI_HOST *) ioc->sh->hostdata; | 2591 | hd = shost_priv(ioc->sh); |
2602 | 2592 | ||
2603 | if (reset_phase == MPT_IOC_SETUP_RESET) { | 2593 | if (reset_phase == MPT_IOC_SETUP_RESET) { |
2604 | dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Setup-Diag Reset\n", ioc->name)); | 2594 | dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Setup-Diag Reset\n", ioc->name)); |
@@ -2691,7 +2681,7 @@ mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply) | |||
2691 | ioc->name, event)); | 2681 | ioc->name, event)); |
2692 | 2682 | ||
2693 | if (ioc->sh == NULL || | 2683 | if (ioc->sh == NULL || |
2694 | ((hd = (MPT_SCSI_HOST *)ioc->sh->hostdata) == NULL)) | 2684 | ((hd = shost_priv(ioc->sh)) == NULL)) |
2695 | return 1; | 2685 | return 1; |
2696 | 2686 | ||
2697 | switch (event) { | 2687 | switch (event) { |
@@ -2770,7 +2760,7 @@ mptscsih_scandv_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr) | |||
2770 | int completionCode; | 2760 | int completionCode; |
2771 | u16 req_idx; | 2761 | u16 req_idx; |
2772 | 2762 | ||
2773 | hd = (MPT_SCSI_HOST *) ioc->sh->hostdata; | 2763 | hd = shost_priv(ioc->sh); |
2774 | 2764 | ||
2775 | if ((mf == NULL) || | 2765 | if ((mf == NULL) || |
2776 | (mf >= MPT_INDEX_2_MFPTR(ioc, ioc->req_depth))) { | 2766 | (mf >= MPT_INDEX_2_MFPTR(ioc, ioc->req_depth))) { |
@@ -3254,7 +3244,7 @@ static ssize_t | |||
3254 | mptscsih_version_fw_show(struct class_device *cdev, char *buf) | 3244 | mptscsih_version_fw_show(struct class_device *cdev, char *buf) |
3255 | { | 3245 | { |
3256 | struct Scsi_Host *host = class_to_shost(cdev); | 3246 | struct Scsi_Host *host = class_to_shost(cdev); |
3257 | MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)host->hostdata; | 3247 | MPT_SCSI_HOST *hd = shost_priv(host); |
3258 | MPT_ADAPTER *ioc = hd->ioc; | 3248 | MPT_ADAPTER *ioc = hd->ioc; |
3259 | 3249 | ||
3260 | return snprintf(buf, PAGE_SIZE, "%02d.%02d.%02d.%02d\n", | 3250 | return snprintf(buf, PAGE_SIZE, "%02d.%02d.%02d.%02d\n", |
@@ -3269,7 +3259,7 @@ static ssize_t | |||
3269 | mptscsih_version_bios_show(struct class_device *cdev, char *buf) | 3259 | mptscsih_version_bios_show(struct class_device *cdev, char *buf) |
3270 | { | 3260 | { |
3271 | struct Scsi_Host *host = class_to_shost(cdev); | 3261 | struct Scsi_Host *host = class_to_shost(cdev); |
3272 | MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)host->hostdata; | 3262 | MPT_SCSI_HOST *hd = shost_priv(host); |
3273 | MPT_ADAPTER *ioc = hd->ioc; | 3263 | MPT_ADAPTER *ioc = hd->ioc; |
3274 | 3264 | ||
3275 | return snprintf(buf, PAGE_SIZE, "%02x.%02x.%02x.%02x\n", | 3265 | return snprintf(buf, PAGE_SIZE, "%02x.%02x.%02x.%02x\n", |
@@ -3284,7 +3274,7 @@ static ssize_t | |||
3284 | mptscsih_version_mpi_show(struct class_device *cdev, char *buf) | 3274 | mptscsih_version_mpi_show(struct class_device *cdev, char *buf) |
3285 | { | 3275 | { |
3286 | struct Scsi_Host *host = class_to_shost(cdev); | 3276 | struct Scsi_Host *host = class_to_shost(cdev); |
3287 | MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)host->hostdata; | 3277 | MPT_SCSI_HOST *hd = shost_priv(host); |
3288 | MPT_ADAPTER *ioc = hd->ioc; | 3278 | MPT_ADAPTER *ioc = hd->ioc; |
3289 | 3279 | ||
3290 | return snprintf(buf, PAGE_SIZE, "%03x\n", ioc->facts.MsgVersion); | 3280 | return snprintf(buf, PAGE_SIZE, "%03x\n", ioc->facts.MsgVersion); |
@@ -3295,7 +3285,7 @@ static ssize_t | |||
3295 | mptscsih_version_product_show(struct class_device *cdev, char *buf) | 3285 | mptscsih_version_product_show(struct class_device *cdev, char *buf) |
3296 | { | 3286 | { |
3297 | struct Scsi_Host *host = class_to_shost(cdev); | 3287 | struct Scsi_Host *host = class_to_shost(cdev); |
3298 | MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)host->hostdata; | 3288 | MPT_SCSI_HOST *hd = shost_priv(host); |
3299 | MPT_ADAPTER *ioc = hd->ioc; | 3289 | MPT_ADAPTER *ioc = hd->ioc; |
3300 | 3290 | ||
3301 | return snprintf(buf, PAGE_SIZE, "%s\n", ioc->prod_name); | 3291 | return snprintf(buf, PAGE_SIZE, "%s\n", ioc->prod_name); |
@@ -3307,7 +3297,7 @@ static ssize_t | |||
3307 | mptscsih_version_nvdata_persistent_show(struct class_device *cdev, char *buf) | 3297 | mptscsih_version_nvdata_persistent_show(struct class_device *cdev, char *buf) |
3308 | { | 3298 | { |
3309 | struct Scsi_Host *host = class_to_shost(cdev); | 3299 | struct Scsi_Host *host = class_to_shost(cdev); |
3310 | MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)host->hostdata; | 3300 | MPT_SCSI_HOST *hd = shost_priv(host); |
3311 | MPT_ADAPTER *ioc = hd->ioc; | 3301 | MPT_ADAPTER *ioc = hd->ioc; |
3312 | 3302 | ||
3313 | return snprintf(buf, PAGE_SIZE, "%02xh\n", | 3303 | return snprintf(buf, PAGE_SIZE, "%02xh\n", |
@@ -3320,7 +3310,7 @@ static ssize_t | |||
3320 | mptscsih_version_nvdata_default_show(struct class_device *cdev, char *buf) | 3310 | mptscsih_version_nvdata_default_show(struct class_device *cdev, char *buf) |
3321 | { | 3311 | { |
3322 | struct Scsi_Host *host = class_to_shost(cdev); | 3312 | struct Scsi_Host *host = class_to_shost(cdev); |
3323 | MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)host->hostdata; | 3313 | MPT_SCSI_HOST *hd = shost_priv(host); |
3324 | MPT_ADAPTER *ioc = hd->ioc; | 3314 | MPT_ADAPTER *ioc = hd->ioc; |
3325 | 3315 | ||
3326 | return snprintf(buf, PAGE_SIZE, "%02xh\n",ioc->nvdata_version_default); | 3316 | return snprintf(buf, PAGE_SIZE, "%02xh\n",ioc->nvdata_version_default); |
@@ -3332,7 +3322,7 @@ static ssize_t | |||
3332 | mptscsih_board_name_show(struct class_device *cdev, char *buf) | 3322 | mptscsih_board_name_show(struct class_device *cdev, char *buf) |
3333 | { | 3323 | { |
3334 | struct Scsi_Host *host = class_to_shost(cdev); | 3324 | struct Scsi_Host *host = class_to_shost(cdev); |
3335 | MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)host->hostdata; | 3325 | MPT_SCSI_HOST *hd = shost_priv(host); |
3336 | MPT_ADAPTER *ioc = hd->ioc; | 3326 | MPT_ADAPTER *ioc = hd->ioc; |
3337 | 3327 | ||
3338 | return snprintf(buf, PAGE_SIZE, "%s\n", ioc->board_name); | 3328 | return snprintf(buf, PAGE_SIZE, "%s\n", ioc->board_name); |
@@ -3343,7 +3333,7 @@ static ssize_t | |||
3343 | mptscsih_board_assembly_show(struct class_device *cdev, char *buf) | 3333 | mptscsih_board_assembly_show(struct class_device *cdev, char *buf) |
3344 | { | 3334 | { |
3345 | struct Scsi_Host *host = class_to_shost(cdev); | 3335 | struct Scsi_Host *host = class_to_shost(cdev); |
3346 | MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)host->hostdata; | 3336 | MPT_SCSI_HOST *hd = shost_priv(host); |
3347 | MPT_ADAPTER *ioc = hd->ioc; | 3337 | MPT_ADAPTER *ioc = hd->ioc; |
3348 | 3338 | ||
3349 | return snprintf(buf, PAGE_SIZE, "%s\n", ioc->board_assembly); | 3339 | return snprintf(buf, PAGE_SIZE, "%s\n", ioc->board_assembly); |
@@ -3355,7 +3345,7 @@ static ssize_t | |||
3355 | mptscsih_board_tracer_show(struct class_device *cdev, char *buf) | 3345 | mptscsih_board_tracer_show(struct class_device *cdev, char *buf) |
3356 | { | 3346 | { |
3357 | struct Scsi_Host *host = class_to_shost(cdev); | 3347 | struct Scsi_Host *host = class_to_shost(cdev); |
3358 | MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)host->hostdata; | 3348 | MPT_SCSI_HOST *hd = shost_priv(host); |
3359 | MPT_ADAPTER *ioc = hd->ioc; | 3349 | MPT_ADAPTER *ioc = hd->ioc; |
3360 | 3350 | ||
3361 | return snprintf(buf, PAGE_SIZE, "%s\n", ioc->board_tracer); | 3351 | return snprintf(buf, PAGE_SIZE, "%s\n", ioc->board_tracer); |
@@ -3367,7 +3357,7 @@ static ssize_t | |||
3367 | mptscsih_io_delay_show(struct class_device *cdev, char *buf) | 3357 | mptscsih_io_delay_show(struct class_device *cdev, char *buf) |
3368 | { | 3358 | { |
3369 | struct Scsi_Host *host = class_to_shost(cdev); | 3359 | struct Scsi_Host *host = class_to_shost(cdev); |
3370 | MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)host->hostdata; | 3360 | MPT_SCSI_HOST *hd = shost_priv(host); |
3371 | MPT_ADAPTER *ioc = hd->ioc; | 3361 | MPT_ADAPTER *ioc = hd->ioc; |
3372 | 3362 | ||
3373 | return snprintf(buf, PAGE_SIZE, "%02d\n", ioc->io_missing_delay); | 3363 | return snprintf(buf, PAGE_SIZE, "%02d\n", ioc->io_missing_delay); |
@@ -3379,7 +3369,7 @@ static ssize_t | |||
3379 | mptscsih_device_delay_show(struct class_device *cdev, char *buf) | 3369 | mptscsih_device_delay_show(struct class_device *cdev, char *buf) |
3380 | { | 3370 | { |
3381 | struct Scsi_Host *host = class_to_shost(cdev); | 3371 | struct Scsi_Host *host = class_to_shost(cdev); |
3382 | MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)host->hostdata; | 3372 | MPT_SCSI_HOST *hd = shost_priv(host); |
3383 | MPT_ADAPTER *ioc = hd->ioc; | 3373 | MPT_ADAPTER *ioc = hd->ioc; |
3384 | 3374 | ||
3385 | return snprintf(buf, PAGE_SIZE, "%02d\n", ioc->device_missing_delay); | 3375 | return snprintf(buf, PAGE_SIZE, "%02d\n", ioc->device_missing_delay); |
@@ -3391,7 +3381,7 @@ static ssize_t | |||
3391 | mptscsih_debug_level_show(struct class_device *cdev, char *buf) | 3381 | mptscsih_debug_level_show(struct class_device *cdev, char *buf) |
3392 | { | 3382 | { |
3393 | struct Scsi_Host *host = class_to_shost(cdev); | 3383 | struct Scsi_Host *host = class_to_shost(cdev); |
3394 | MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)host->hostdata; | 3384 | MPT_SCSI_HOST *hd = shost_priv(host); |
3395 | MPT_ADAPTER *ioc = hd->ioc; | 3385 | MPT_ADAPTER *ioc = hd->ioc; |
3396 | 3386 | ||
3397 | return snprintf(buf, PAGE_SIZE, "%08xh\n", ioc->debug_level); | 3387 | return snprintf(buf, PAGE_SIZE, "%08xh\n", ioc->debug_level); |
@@ -3401,7 +3391,7 @@ mptscsih_debug_level_store(struct class_device *cdev, const char *buf, | |||
3401 | size_t count) | 3391 | size_t count) |
3402 | { | 3392 | { |
3403 | struct Scsi_Host *host = class_to_shost(cdev); | 3393 | struct Scsi_Host *host = class_to_shost(cdev); |
3404 | MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)host->hostdata; | 3394 | MPT_SCSI_HOST *hd = shost_priv(host); |
3405 | MPT_ADAPTER *ioc = hd->ioc; | 3395 | MPT_ADAPTER *ioc = hd->ioc; |
3406 | int val = 0; | 3396 | int val = 0; |
3407 | 3397 | ||
diff --git a/drivers/message/fusion/mptspi.c b/drivers/message/fusion/mptspi.c index 02062f198be3..3c24928e3cec 100644 --- a/drivers/message/fusion/mptspi.c +++ b/drivers/message/fusion/mptspi.c | |||
@@ -397,7 +397,7 @@ mptspi_is_raid(struct _MPT_SCSI_HOST *hd, u32 id) | |||
397 | static int mptspi_target_alloc(struct scsi_target *starget) | 397 | static int mptspi_target_alloc(struct scsi_target *starget) |
398 | { | 398 | { |
399 | struct Scsi_Host *shost = dev_to_shost(&starget->dev); | 399 | struct Scsi_Host *shost = dev_to_shost(&starget->dev); |
400 | struct _MPT_SCSI_HOST *hd = (struct _MPT_SCSI_HOST *)shost->hostdata; | 400 | struct _MPT_SCSI_HOST *hd = shost_priv(shost); |
401 | VirtTarget *vtarget; | 401 | VirtTarget *vtarget; |
402 | MPT_ADAPTER *ioc; | 402 | MPT_ADAPTER *ioc; |
403 | 403 | ||
@@ -514,7 +514,7 @@ static int mptspi_read_spi_device_pg0(struct scsi_target *starget, | |||
514 | struct _CONFIG_PAGE_SCSI_DEVICE_0 *pass_pg0) | 514 | struct _CONFIG_PAGE_SCSI_DEVICE_0 *pass_pg0) |
515 | { | 515 | { |
516 | struct Scsi_Host *shost = dev_to_shost(&starget->dev); | 516 | struct Scsi_Host *shost = dev_to_shost(&starget->dev); |
517 | struct _MPT_SCSI_HOST *hd = (struct _MPT_SCSI_HOST *)shost->hostdata; | 517 | struct _MPT_SCSI_HOST *hd = shost_priv(shost); |
518 | struct _MPT_ADAPTER *ioc = hd->ioc; | 518 | struct _MPT_ADAPTER *ioc = hd->ioc; |
519 | struct _CONFIG_PAGE_SCSI_DEVICE_0 *pg0; | 519 | struct _CONFIG_PAGE_SCSI_DEVICE_0 *pg0; |
520 | dma_addr_t pg0_dma; | 520 | dma_addr_t pg0_dma; |
@@ -702,7 +702,7 @@ static void mptspi_dv_device(struct _MPT_SCSI_HOST *hd, | |||
702 | 702 | ||
703 | static int mptspi_slave_alloc(struct scsi_device *sdev) | 703 | static int mptspi_slave_alloc(struct scsi_device *sdev) |
704 | { | 704 | { |
705 | MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)sdev->host->hostdata; | 705 | MPT_SCSI_HOST *hd = shost_priv(sdev->host); |
706 | VirtTarget *vtarget; | 706 | VirtTarget *vtarget; |
707 | VirtDevice *vdevice; | 707 | VirtDevice *vdevice; |
708 | struct scsi_target *starget; | 708 | struct scsi_target *starget; |
@@ -735,8 +735,7 @@ static int mptspi_slave_alloc(struct scsi_device *sdev) | |||
735 | 735 | ||
736 | static int mptspi_slave_configure(struct scsi_device *sdev) | 736 | static int mptspi_slave_configure(struct scsi_device *sdev) |
737 | { | 737 | { |
738 | struct _MPT_SCSI_HOST *hd = | 738 | struct _MPT_SCSI_HOST *hd = shost_priv(sdev->host); |
739 | (struct _MPT_SCSI_HOST *)sdev->host->hostdata; | ||
740 | VirtTarget *vtarget = scsi_target(sdev)->hostdata; | 739 | VirtTarget *vtarget = scsi_target(sdev)->hostdata; |
741 | int ret; | 740 | int ret; |
742 | 741 | ||
@@ -764,7 +763,7 @@ static int mptspi_slave_configure(struct scsi_device *sdev) | |||
764 | static int | 763 | static int |
765 | mptspi_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) | 764 | mptspi_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) |
766 | { | 765 | { |
767 | struct _MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata; | 766 | struct _MPT_SCSI_HOST *hd = shost_priv(SCpnt->device->host); |
768 | VirtDevice *vdevice = SCpnt->device->hostdata; | 767 | VirtDevice *vdevice = SCpnt->device->hostdata; |
769 | MPT_ADAPTER *ioc = hd->ioc; | 768 | MPT_ADAPTER *ioc = hd->ioc; |
770 | 769 | ||
@@ -839,7 +838,7 @@ static int mptspi_write_spi_device_pg1(struct scsi_target *starget, | |||
839 | struct _CONFIG_PAGE_SCSI_DEVICE_1 *pass_pg1) | 838 | struct _CONFIG_PAGE_SCSI_DEVICE_1 *pass_pg1) |
840 | { | 839 | { |
841 | struct Scsi_Host *shost = dev_to_shost(&starget->dev); | 840 | struct Scsi_Host *shost = dev_to_shost(&starget->dev); |
842 | struct _MPT_SCSI_HOST *hd = (struct _MPT_SCSI_HOST *)shost->hostdata; | 841 | struct _MPT_SCSI_HOST *hd = shost_priv(shost); |
843 | struct _MPT_ADAPTER *ioc = hd->ioc; | 842 | struct _MPT_ADAPTER *ioc = hd->ioc; |
844 | struct _CONFIG_PAGE_SCSI_DEVICE_1 *pg1; | 843 | struct _CONFIG_PAGE_SCSI_DEVICE_1 *pg1; |
845 | dma_addr_t pg1_dma; | 844 | dma_addr_t pg1_dma; |
@@ -1027,7 +1026,7 @@ static void mptspi_write_qas(struct scsi_target *starget, int qas) | |||
1027 | { | 1026 | { |
1028 | struct _CONFIG_PAGE_SCSI_DEVICE_1 pg1; | 1027 | struct _CONFIG_PAGE_SCSI_DEVICE_1 pg1; |
1029 | struct Scsi_Host *shost = dev_to_shost(&starget->dev); | 1028 | struct Scsi_Host *shost = dev_to_shost(&starget->dev); |
1030 | struct _MPT_SCSI_HOST *hd = (struct _MPT_SCSI_HOST *)shost->hostdata; | 1029 | struct _MPT_SCSI_HOST *hd = shost_priv(shost); |
1031 | VirtTarget *vtarget = starget->hostdata; | 1030 | VirtTarget *vtarget = starget->hostdata; |
1032 | u32 nego; | 1031 | u32 nego; |
1033 | 1032 | ||
@@ -1137,7 +1136,7 @@ static int | |||
1137 | mptspi_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply) | 1136 | mptspi_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply) |
1138 | { | 1137 | { |
1139 | u8 event = le32_to_cpu(pEvReply->Event) & 0xFF; | 1138 | u8 event = le32_to_cpu(pEvReply->Event) & 0xFF; |
1140 | struct _MPT_SCSI_HOST *hd = (struct _MPT_SCSI_HOST *)ioc->sh->hostdata; | 1139 | struct _MPT_SCSI_HOST *hd = shost_priv(ioc->sh); |
1141 | 1140 | ||
1142 | if (hd && event == MPI_EVENT_INTEGRATED_RAID) { | 1141 | if (hd && event == MPI_EVENT_INTEGRATED_RAID) { |
1143 | int reason | 1142 | int reason |
@@ -1267,7 +1266,7 @@ mptspi_dv_renegotiate(struct _MPT_SCSI_HOST *hd) | |||
1267 | static int | 1266 | static int |
1268 | mptspi_ioc_reset(MPT_ADAPTER *ioc, int reset_phase) | 1267 | mptspi_ioc_reset(MPT_ADAPTER *ioc, int reset_phase) |
1269 | { | 1268 | { |
1270 | struct _MPT_SCSI_HOST *hd = (struct _MPT_SCSI_HOST *)ioc->sh->hostdata; | 1269 | struct _MPT_SCSI_HOST *hd = shost_priv(ioc->sh); |
1271 | int rc; | 1270 | int rc; |
1272 | 1271 | ||
1273 | rc = mptscsih_ioc_reset(ioc, reset_phase); | 1272 | rc = mptscsih_ioc_reset(ioc, reset_phase); |
@@ -1286,7 +1285,7 @@ static int | |||
1286 | mptspi_resume(struct pci_dev *pdev) | 1285 | mptspi_resume(struct pci_dev *pdev) |
1287 | { | 1286 | { |
1288 | MPT_ADAPTER *ioc = pci_get_drvdata(pdev); | 1287 | MPT_ADAPTER *ioc = pci_get_drvdata(pdev); |
1289 | struct _MPT_SCSI_HOST *hd = (struct _MPT_SCSI_HOST *)ioc->sh->hostdata; | 1288 | struct _MPT_SCSI_HOST *hd = shost_priv(ioc->sh); |
1290 | int rc; | 1289 | int rc; |
1291 | 1290 | ||
1292 | rc = mptscsih_resume(pdev); | 1291 | rc = mptscsih_resume(pdev); |
@@ -1441,7 +1440,7 @@ mptspi_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1441 | 1440 | ||
1442 | spin_unlock_irqrestore(&ioc->FreeQlock, flags); | 1441 | spin_unlock_irqrestore(&ioc->FreeQlock, flags); |
1443 | 1442 | ||
1444 | hd = (MPT_SCSI_HOST *) sh->hostdata; | 1443 | hd = shost_priv(sh); |
1445 | hd->ioc = ioc; | 1444 | hd->ioc = ioc; |
1446 | 1445 | ||
1447 | /* SCSI needs scsi_cmnd lookup table! | 1446 | /* SCSI needs scsi_cmnd lookup table! |