aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/message/fusion/mptspi.c
diff options
context:
space:
mode:
authorEric Moore <eric.moore@lsi.com>2007-09-29 12:15:59 -0400
committerJames Bottomley <jejb@mulgrave.localdomain>2007-10-12 14:52:08 -0400
commite7eae9f6e94cd49261c2997b0b4f768c1351bc02 (patch)
treed82cd39d6d997fc650a0fae933ecaf7514e4e7de /drivers/message/fusion/mptspi.c
parentcce99c6925b8d6a59cf584411277c1c20c330334 (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>
Diffstat (limited to 'drivers/message/fusion/mptspi.c')
-rw-r--r--drivers/message/fusion/mptspi.c23
1 files changed, 11 insertions, 12 deletions
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)
397static int mptspi_target_alloc(struct scsi_target *starget) 397static 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
703static int mptspi_slave_alloc(struct scsi_device *sdev) 703static 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
736static int mptspi_slave_configure(struct scsi_device *sdev) 736static 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)
764static int 763static int
765mptspi_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) 764mptspi_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
1137mptspi_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply) 1136mptspi_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)
1267static int 1266static int
1268mptspi_ioc_reset(MPT_ADAPTER *ioc, int reset_phase) 1267mptspi_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
1286mptspi_resume(struct pci_dev *pdev) 1285mptspi_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!