aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/message
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/message')
-rw-r--r--drivers/message/fusion/lsi/mpi_log_sas.h2
-rw-r--r--drivers/message/fusion/mptbase.c94
-rw-r--r--drivers/message/fusion/mptbase.h2
-rw-r--r--drivers/message/fusion/mptctl.c8
-rw-r--r--drivers/message/fusion/mptsas.c2
-rw-r--r--drivers/message/fusion/mptscsih.c4
-rw-r--r--drivers/message/i2o/i2o_block.c20
-rw-r--r--drivers/message/i2o/i2o_scsi.c2
-rw-r--r--drivers/message/i2o/iop.c2
9 files changed, 72 insertions, 64 deletions
diff --git a/drivers/message/fusion/lsi/mpi_log_sas.h b/drivers/message/fusion/lsi/mpi_log_sas.h
index 6be1f6b65777..af9da03e95e5 100644
--- a/drivers/message/fusion/lsi/mpi_log_sas.h
+++ b/drivers/message/fusion/lsi/mpi_log_sas.h
@@ -162,7 +162,7 @@
162#define PL_LOGINFO_SUB_CODE_FRAME_XFER_ERROR (0x00000400) /* Bits 0-3 encode Transport Status Register (offset 0x08) */ 162#define PL_LOGINFO_SUB_CODE_FRAME_XFER_ERROR (0x00000400) /* Bits 0-3 encode Transport Status Register (offset 0x08) */
163 /* Bit 0 is Status Bit 0: FrameXferErr */ 163 /* Bit 0 is Status Bit 0: FrameXferErr */
164 /* Bit 1 & 2 are Status Bits 16 and 17: FrameXmitErrStatus */ 164 /* Bit 1 & 2 are Status Bits 16 and 17: FrameXmitErrStatus */
165 /* Bit 3 is Status Bit 18 WriteDataLenghtGTDataLengthErr */ 165 /* Bit 3 is Status Bit 18 WriteDataLengthGTDataLengthErr */
166 166
167#define PL_LOGINFO_SUB_CODE_TX_FM_CONNECTED_LOW (0x00000500) 167#define PL_LOGINFO_SUB_CODE_TX_FM_CONNECTED_LOW (0x00000500)
168#define PL_LOGINFO_SUB_CODE_SATA_NON_NCQ_RW_ERR_BIT_SET (0x00000600) 168#define PL_LOGINFO_SUB_CODE_SATA_NON_NCQ_RW_ERR_BIT_SET (0x00000600)
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
index 52fb216dfe74..425f60c21fdd 100644
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
@@ -2056,7 +2056,7 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag)
2056 ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT 2056 ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT
2057 "mpt_upload: alt_%s has cached_fw=%p \n", 2057 "mpt_upload: alt_%s has cached_fw=%p \n",
2058 ioc->name, ioc->alt_ioc->name, ioc->alt_ioc->cached_fw)); 2058 ioc->name, ioc->alt_ioc->name, ioc->alt_ioc->cached_fw));
2059 ioc->alt_ioc->cached_fw = NULL; 2059 ioc->cached_fw = NULL;
2060 } 2060 }
2061 } else { 2061 } else {
2062 printk(MYIOC_s_WARN_FMT 2062 printk(MYIOC_s_WARN_FMT
@@ -2262,10 +2262,12 @@ mpt_adapter_disable(MPT_ADAPTER *ioc)
2262 int ret; 2262 int ret;
2263 2263
2264 if (ioc->cached_fw != NULL) { 2264 if (ioc->cached_fw != NULL) {
2265 ddlprintk(ioc, printk(MYIOC_s_INFO_FMT 2265 ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s: Pushing FW onto "
2266 "mpt_adapter_disable: Pushing FW onto adapter\n", ioc->name)); 2266 "adapter\n", __FUNCTION__, ioc->name));
2267 if ((ret = mpt_downloadboot(ioc, (MpiFwHeader_t *)ioc->cached_fw, NO_SLEEP)) < 0) { 2267 if ((ret = mpt_downloadboot(ioc, (MpiFwHeader_t *)
2268 printk(MYIOC_s_WARN_FMT "firmware downloadboot failure (%d)!\n", 2268 ioc->cached_fw, CAN_SLEEP)) < 0) {
2269 printk(MYIOC_s_WARN_FMT
2270 ": firmware downloadboot failure (%d)!\n",
2269 ioc->name, ret); 2271 ioc->name, ret);
2270 } 2272 }
2271 } 2273 }
@@ -2303,13 +2305,7 @@ mpt_adapter_disable(MPT_ADAPTER *ioc)
2303 ioc->alloc_total -= sz; 2305 ioc->alloc_total -= sz;
2304 } 2306 }
2305 2307
2306 if (ioc->cached_fw != NULL) { 2308 mpt_free_fw_memory(ioc);
2307 sz = ioc->facts.FWImageSize;
2308 pci_free_consistent(ioc->pcidev, sz,
2309 ioc->cached_fw, ioc->cached_fw_dma);
2310 ioc->cached_fw = NULL;
2311 ioc->alloc_total -= sz;
2312 }
2313 2309
2314 kfree(ioc->spi_data.nvram); 2310 kfree(ioc->spi_data.nvram);
2315 mpt_inactive_raid_list_free(ioc); 2311 mpt_inactive_raid_list_free(ioc);
@@ -3047,44 +3043,62 @@ SendPortEnable(MPT_ADAPTER *ioc, int portnum, int sleepFlag)
3047 * 3043 *
3048 * If memory has already been allocated, the same (cached) value 3044 * If memory has already been allocated, the same (cached) value
3049 * is returned. 3045 * is returned.
3050 */ 3046 *
3051void 3047 * Return 0 if successfull, or non-zero for failure
3048 **/
3049int
3052mpt_alloc_fw_memory(MPT_ADAPTER *ioc, int size) 3050mpt_alloc_fw_memory(MPT_ADAPTER *ioc, int size)
3053{ 3051{
3054 if (ioc->cached_fw) 3052 int rc;
3055 return; /* use already allocated memory */ 3053
3056 if (ioc->alt_ioc && ioc->alt_ioc->cached_fw) { 3054 if (ioc->cached_fw) {
3055 rc = 0; /* use already allocated memory */
3056 goto out;
3057 }
3058 else if (ioc->alt_ioc && ioc->alt_ioc->cached_fw) {
3057 ioc->cached_fw = ioc->alt_ioc->cached_fw; /* use alt_ioc's memory */ 3059 ioc->cached_fw = ioc->alt_ioc->cached_fw; /* use alt_ioc's memory */
3058 ioc->cached_fw_dma = ioc->alt_ioc->cached_fw_dma; 3060 ioc->cached_fw_dma = ioc->alt_ioc->cached_fw_dma;
3059 ioc->alloc_total += size; 3061 rc = 0;
3060 ioc->alt_ioc->alloc_total -= size; 3062 goto out;
3063 }
3064 ioc->cached_fw = pci_alloc_consistent(ioc->pcidev, size, &ioc->cached_fw_dma);
3065 if (!ioc->cached_fw) {
3066 printk(MYIOC_s_ERR_FMT "Unable to allocate memory for the cached firmware image!\n",
3067 ioc->name);
3068 rc = -1;
3061 } else { 3069 } else {
3062 if ( (ioc->cached_fw = pci_alloc_consistent(ioc->pcidev, size, &ioc->cached_fw_dma) ) ) 3070 dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "FW Image @ %p[%p], sz=%d[%x] bytes\n",
3063 ioc->alloc_total += size; 3071 ioc->name, ioc->cached_fw, (void *)(ulong)ioc->cached_fw_dma, size, size));
3072 ioc->alloc_total += size;
3073 rc = 0;
3064 } 3074 }
3075 out:
3076 return rc;
3065} 3077}
3078
3066/** 3079/**
3067 * mpt_free_fw_memory - free firmware memory 3080 * mpt_free_fw_memory - free firmware memory
3068 * @ioc: Pointer to MPT_ADAPTER structure 3081 * @ioc: Pointer to MPT_ADAPTER structure
3069 * 3082 *
3070 * If alt_img is NULL, delete from ioc structure. 3083 * If alt_img is NULL, delete from ioc structure.
3071 * Else, delete a secondary image in same format. 3084 * Else, delete a secondary image in same format.
3072 */ 3085 **/
3073void 3086void
3074mpt_free_fw_memory(MPT_ADAPTER *ioc) 3087mpt_free_fw_memory(MPT_ADAPTER *ioc)
3075{ 3088{
3076 int sz; 3089 int sz;
3077 3090
3091 if (!ioc->cached_fw)
3092 return;
3093
3078 sz = ioc->facts.FWImageSize; 3094 sz = ioc->facts.FWImageSize;
3079 dinitprintk(ioc, printk(MYIOC_s_INFO_FMT "free_fw_memory: FW Image @ %p[%p], sz=%d[%x] bytes\n", 3095 dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "free_fw_memory: FW Image @ %p[%p], sz=%d[%x] bytes\n",
3080 ioc->name, ioc->cached_fw, (void *)(ulong)ioc->cached_fw_dma, sz, sz)); 3096 ioc->name, ioc->cached_fw, (void *)(ulong)ioc->cached_fw_dma, sz, sz));
3081 pci_free_consistent(ioc->pcidev, sz, ioc->cached_fw, ioc->cached_fw_dma); 3097 pci_free_consistent(ioc->pcidev, sz, ioc->cached_fw, ioc->cached_fw_dma);
3098 ioc->alloc_total -= sz;
3082 ioc->cached_fw = NULL; 3099 ioc->cached_fw = NULL;
3083
3084 return;
3085} 3100}
3086 3101
3087
3088/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 3102/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
3089/** 3103/**
3090 * mpt_do_upload - Construct and Send FWUpload request to MPT adapter port. 3104 * mpt_do_upload - Construct and Send FWUpload request to MPT adapter port.
@@ -3116,17 +3130,12 @@ mpt_do_upload(MPT_ADAPTER *ioc, int sleepFlag)
3116 if ((sz = ioc->facts.FWImageSize) == 0) 3130 if ((sz = ioc->facts.FWImageSize) == 0)
3117 return 0; 3131 return 0;
3118 3132
3119 mpt_alloc_fw_memory(ioc, sz); 3133 if (mpt_alloc_fw_memory(ioc, ioc->facts.FWImageSize) != 0)
3134 return -ENOMEM;
3120 3135
3121 dinitprintk(ioc, printk(MYIOC_s_INFO_FMT ": FW Image @ %p[%p], sz=%d[%x] bytes\n", 3136 dinitprintk(ioc, printk(MYIOC_s_INFO_FMT ": FW Image @ %p[%p], sz=%d[%x] bytes\n",
3122 ioc->name, ioc->cached_fw, (void *)(ulong)ioc->cached_fw_dma, sz, sz)); 3137 ioc->name, ioc->cached_fw, (void *)(ulong)ioc->cached_fw_dma, sz, sz));
3123 3138
3124 if (ioc->cached_fw == NULL) {
3125 /* Major Failure.
3126 */
3127 return -ENOMEM;
3128 }
3129
3130 prequest = (sleepFlag == NO_SLEEP) ? kzalloc(ioc->req_sz, GFP_ATOMIC) : 3139 prequest = (sleepFlag == NO_SLEEP) ? kzalloc(ioc->req_sz, GFP_ATOMIC) :
3131 kzalloc(ioc->req_sz, GFP_KERNEL); 3140 kzalloc(ioc->req_sz, GFP_KERNEL);
3132 if (!prequest) { 3141 if (!prequest) {
@@ -3498,12 +3507,12 @@ KickStart(MPT_ADAPTER *ioc, int force, int sleepFlag)
3498static int 3507static int
3499mpt_diag_reset(MPT_ADAPTER *ioc, int ignore, int sleepFlag) 3508mpt_diag_reset(MPT_ADAPTER *ioc, int ignore, int sleepFlag)
3500{ 3509{
3501 MPT_ADAPTER *iocp=NULL;
3502 u32 diag0val; 3510 u32 diag0val;
3503 u32 doorbell; 3511 u32 doorbell;
3504 int hard_reset_done = 0; 3512 int hard_reset_done = 0;
3505 int count = 0; 3513 int count = 0;
3506 u32 diag1val = 0; 3514 u32 diag1val = 0;
3515 MpiFwHeader_t *cached_fw; /* Pointer to FW */
3507 3516
3508 /* Clear any existing interrupts */ 3517 /* Clear any existing interrupts */
3509 CHIPREG_WRITE32(&ioc->chip->IntStatus, 0); 3518 CHIPREG_WRITE32(&ioc->chip->IntStatus, 0);
@@ -3635,22 +3644,24 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ignore, int sleepFlag)
3635 } 3644 }
3636 3645
3637 if (ioc->cached_fw) 3646 if (ioc->cached_fw)
3638 iocp = ioc; 3647 cached_fw = (MpiFwHeader_t *)ioc->cached_fw;
3639 else if (ioc->alt_ioc && ioc->alt_ioc->cached_fw) 3648 else if (ioc->alt_ioc && ioc->alt_ioc->cached_fw)
3640 iocp = ioc->alt_ioc; 3649 cached_fw = (MpiFwHeader_t *)ioc->alt_ioc->cached_fw;
3641 if (iocp) { 3650 else
3651 cached_fw = NULL;
3652 if (cached_fw) {
3642 /* If the DownloadBoot operation fails, the 3653 /* If the DownloadBoot operation fails, the
3643 * IOC will be left unusable. This is a fatal error 3654 * IOC will be left unusable. This is a fatal error
3644 * case. _diag_reset will return < 0 3655 * case. _diag_reset will return < 0
3645 */ 3656 */
3646 for (count = 0; count < 30; count ++) { 3657 for (count = 0; count < 30; count ++) {
3647 diag0val = CHIPREG_READ32(&iocp->chip->Diagnostic); 3658 diag0val = CHIPREG_READ32(&ioc->chip->Diagnostic);
3648 if (!(diag0val & MPI_DIAG_RESET_ADAPTER)) { 3659 if (!(diag0val & MPI_DIAG_RESET_ADAPTER)) {
3649 break; 3660 break;
3650 } 3661 }
3651 3662
3652 dprintk(ioc, printk(MYIOC_s_DEBUG_FMT "cached_fw: diag0val=%x count=%d\n", 3663 dprintk(ioc, printk(MYIOC_s_DEBUG_FMT "cached_fw: diag0val=%x count=%d\n",
3653 iocp->name, diag0val, count)); 3664 ioc->name, diag0val, count));
3654 /* wait 1 sec */ 3665 /* wait 1 sec */
3655 if (sleepFlag == CAN_SLEEP) { 3666 if (sleepFlag == CAN_SLEEP) {
3656 msleep (1000); 3667 msleep (1000);
@@ -3658,8 +3669,7 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ignore, int sleepFlag)
3658 mdelay (1000); 3669 mdelay (1000);
3659 } 3670 }
3660 } 3671 }
3661 if ((count = mpt_downloadboot(ioc, 3672 if ((count = mpt_downloadboot(ioc, cached_fw, sleepFlag)) < 0) {
3662 (MpiFwHeader_t *)iocp->cached_fw, sleepFlag)) < 0) {
3663 printk(MYIOC_s_WARN_FMT 3673 printk(MYIOC_s_WARN_FMT
3664 "firmware downloadboot failure (%d)!\n", ioc->name, count); 3674 "firmware downloadboot failure (%d)!\n", ioc->name, count);
3665 } 3675 }
diff --git a/drivers/message/fusion/mptbase.h b/drivers/message/fusion/mptbase.h
index d7682e083f59..b49b706c0020 100644
--- a/drivers/message/fusion/mptbase.h
+++ b/drivers/message/fusion/mptbase.h
@@ -907,7 +907,7 @@ extern u32 mpt_GetIocState(MPT_ADAPTER *ioc, int cooked);
907extern void mpt_print_ioc_summary(MPT_ADAPTER *ioc, char *buf, int *size, int len, int showlan); 907extern void mpt_print_ioc_summary(MPT_ADAPTER *ioc, char *buf, int *size, int len, int showlan);
908extern int mpt_HardResetHandler(MPT_ADAPTER *ioc, int sleepFlag); 908extern int mpt_HardResetHandler(MPT_ADAPTER *ioc, int sleepFlag);
909extern int mpt_config(MPT_ADAPTER *ioc, CONFIGPARMS *cfg); 909extern int mpt_config(MPT_ADAPTER *ioc, CONFIGPARMS *cfg);
910extern void mpt_alloc_fw_memory(MPT_ADAPTER *ioc, int size); 910extern int mpt_alloc_fw_memory(MPT_ADAPTER *ioc, int size);
911extern void mpt_free_fw_memory(MPT_ADAPTER *ioc); 911extern void mpt_free_fw_memory(MPT_ADAPTER *ioc);
912extern int mpt_findImVolumes(MPT_ADAPTER *ioc); 912extern int mpt_findImVolumes(MPT_ADAPTER *ioc);
913extern int mptbase_sas_persist_operation(MPT_ADAPTER *ioc, u8 persist_opcode); 913extern int mptbase_sas_persist_operation(MPT_ADAPTER *ioc, u8 persist_opcode);
diff --git a/drivers/message/fusion/mptctl.c b/drivers/message/fusion/mptctl.c
index 6029509702d3..e630b50966ec 100644
--- a/drivers/message/fusion/mptctl.c
+++ b/drivers/message/fusion/mptctl.c
@@ -1708,7 +1708,7 @@ mptctl_replace_fw (unsigned long arg)
1708 * 1708 *
1709 * Outputs: None. 1709 * Outputs: None.
1710 * Return: 0 if successful 1710 * Return: 0 if successful
1711 * -EBUSY if previous command timout and IOC reset is not complete. 1711 * -EBUSY if previous command timeout and IOC reset is not complete.
1712 * -EFAULT if data unavailable 1712 * -EFAULT if data unavailable
1713 * -ENODEV if no such device/adapter 1713 * -ENODEV if no such device/adapter
1714 * -ETIME if timer expires 1714 * -ETIME if timer expires
@@ -1748,7 +1748,7 @@ mptctl_mpt_command (unsigned long arg)
1748 * 1748 *
1749 * Outputs: None. 1749 * Outputs: None.
1750 * Return: 0 if successful 1750 * Return: 0 if successful
1751 * -EBUSY if previous command timout and IOC reset is not complete. 1751 * -EBUSY if previous command timeout and IOC reset is not complete.
1752 * -EFAULT if data unavailable 1752 * -EFAULT if data unavailable
1753 * -ENODEV if no such device/adapter 1753 * -ENODEV if no such device/adapter
1754 * -ETIME if timer expires 1754 * -ETIME if timer expires
@@ -2316,7 +2316,7 @@ done_free_mem:
2316 * Outputs: None. 2316 * Outputs: None.
2317 * Return: 0 if successful 2317 * Return: 0 if successful
2318 * -EFAULT if data unavailable 2318 * -EFAULT if data unavailable
2319 * -EBUSY if previous command timout and IOC reset is not complete. 2319 * -EBUSY if previous command timeout and IOC reset is not complete.
2320 * -ENODEV if no such device/adapter 2320 * -ENODEV if no such device/adapter
2321 * -ETIME if timer expires 2321 * -ETIME if timer expires
2322 * -ENOMEM if memory allocation error 2322 * -ENOMEM if memory allocation error
@@ -2553,7 +2553,7 @@ mptctl_hp_hostinfo(unsigned long arg, unsigned int data_size)
2553 * Outputs: None. 2553 * Outputs: None.
2554 * Return: 0 if successful 2554 * Return: 0 if successful
2555 * -EFAULT if data unavailable 2555 * -EFAULT if data unavailable
2556 * -EBUSY if previous command timout and IOC reset is not complete. 2556 * -EBUSY if previous command timeout and IOC reset is not complete.
2557 * -ENODEV if no such device/adapter 2557 * -ENODEV if no such device/adapter
2558 * -ETIME if timer expires 2558 * -ETIME if timer expires
2559 * -ENOMEM if memory allocation error 2559 * -ENOMEM if memory allocation error
diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c
index e4c94f93de16..f77b329f6923 100644
--- a/drivers/message/fusion/mptsas.c
+++ b/drivers/message/fusion/mptsas.c
@@ -1343,6 +1343,8 @@ static int mptsas_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy,
1343 smprep = (SmpPassthroughReply_t *)ioc->sas_mgmt.reply; 1343 smprep = (SmpPassthroughReply_t *)ioc->sas_mgmt.reply;
1344 memcpy(req->sense, smprep, sizeof(*smprep)); 1344 memcpy(req->sense, smprep, sizeof(*smprep));
1345 req->sense_len = sizeof(*smprep); 1345 req->sense_len = sizeof(*smprep);
1346 req->data_len = 0;
1347 rsp->data_len -= smprep->ResponseDataLength;
1346 } else { 1348 } else {
1347 printk(MYIOC_s_ERR_FMT "%s: smp passthru reply failed to be returned\n", 1349 printk(MYIOC_s_ERR_FMT "%s: smp passthru reply failed to be returned\n",
1348 ioc->name, __FUNCTION__); 1350 ioc->name, __FUNCTION__);
diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c
index 626bb3c9af2b..af1de0ccee2f 100644
--- a/drivers/message/fusion/mptscsih.c
+++ b/drivers/message/fusion/mptscsih.c
@@ -111,7 +111,7 @@ int mptscsih_suspend(struct pci_dev *pdev, pm_message_t state);
111int mptscsih_resume(struct pci_dev *pdev); 111int mptscsih_resume(struct pci_dev *pdev);
112#endif 112#endif
113 113
114#define SNS_LEN(scp) sizeof((scp)->sense_buffer) 114#define SNS_LEN(scp) SCSI_SENSE_BUFFERSIZE
115 115
116/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 116/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
117/** 117/**
@@ -1736,7 +1736,7 @@ mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 id, int lun, i
1736 fail_out: 1736 fail_out:
1737 1737
1738 /* 1738 /*
1739 * Free task managment mf, and corresponding tm flags 1739 * Free task management mf, and corresponding tm flags
1740 */ 1740 */
1741 mpt_free_msg_frame(ioc, mf); 1741 mpt_free_msg_frame(ioc, mf);
1742 hd->tmPending = 0; 1742 hd->tmPending = 0;
diff --git a/drivers/message/i2o/i2o_block.c b/drivers/message/i2o/i2o_block.c
index e4ad7a1c4fbd..a95314897402 100644
--- a/drivers/message/i2o/i2o_block.c
+++ b/drivers/message/i2o/i2o_block.c
@@ -412,13 +412,13 @@ static void i2o_block_delayed_request_fn(struct work_struct *work)
412/** 412/**
413 * i2o_block_end_request - Post-processing of completed commands 413 * i2o_block_end_request - Post-processing of completed commands
414 * @req: request which should be completed 414 * @req: request which should be completed
415 * @uptodate: 1 for success, 0 for I/O error, < 0 for specific error 415 * @error: 0 for success, < 0 for error
416 * @nr_bytes: number of bytes to complete 416 * @nr_bytes: number of bytes to complete
417 * 417 *
418 * Mark the request as complete. The lock must not be held when entering. 418 * Mark the request as complete. The lock must not be held when entering.
419 * 419 *
420 */ 420 */
421static void i2o_block_end_request(struct request *req, int uptodate, 421static void i2o_block_end_request(struct request *req, int error,
422 int nr_bytes) 422 int nr_bytes)
423{ 423{
424 struct i2o_block_request *ireq = req->special; 424 struct i2o_block_request *ireq = req->special;
@@ -426,22 +426,18 @@ static void i2o_block_end_request(struct request *req, int uptodate,
426 struct request_queue *q = req->q; 426 struct request_queue *q = req->q;
427 unsigned long flags; 427 unsigned long flags;
428 428
429 if (end_that_request_chunk(req, uptodate, nr_bytes)) { 429 if (blk_end_request(req, error, nr_bytes)) {
430 int leftover = (req->hard_nr_sectors << KERNEL_SECTOR_SHIFT); 430 int leftover = (req->hard_nr_sectors << KERNEL_SECTOR_SHIFT);
431 431
432 if (blk_pc_request(req)) 432 if (blk_pc_request(req))
433 leftover = req->data_len; 433 leftover = req->data_len;
434 434
435 if (end_io_error(uptodate)) 435 if (error)
436 end_that_request_chunk(req, 0, leftover); 436 blk_end_request(req, -EIO, leftover);
437 } 437 }
438 438
439 add_disk_randomness(req->rq_disk);
440
441 spin_lock_irqsave(q->queue_lock, flags); 439 spin_lock_irqsave(q->queue_lock, flags);
442 440
443 end_that_request_last(req, uptodate);
444
445 if (likely(dev)) { 441 if (likely(dev)) {
446 dev->open_queue_depth--; 442 dev->open_queue_depth--;
447 list_del(&ireq->queue); 443 list_del(&ireq->queue);
@@ -468,7 +464,7 @@ static int i2o_block_reply(struct i2o_controller *c, u32 m,
468 struct i2o_message *msg) 464 struct i2o_message *msg)
469{ 465{
470 struct request *req; 466 struct request *req;
471 int uptodate = 1; 467 int error = 0;
472 468
473 req = i2o_cntxt_list_get(c, le32_to_cpu(msg->u.s.tcntxt)); 469 req = i2o_cntxt_list_get(c, le32_to_cpu(msg->u.s.tcntxt));
474 if (unlikely(!req)) { 470 if (unlikely(!req)) {
@@ -501,10 +497,10 @@ static int i2o_block_reply(struct i2o_controller *c, u32 m,
501 497
502 req->errors++; 498 req->errors++;
503 499
504 uptodate = 0; 500 error = -EIO;
505 } 501 }
506 502
507 i2o_block_end_request(req, uptodate, le32_to_cpu(msg->body[1])); 503 i2o_block_end_request(req, error, le32_to_cpu(msg->body[1]));
508 504
509 return 1; 505 return 1;
510}; 506};
diff --git a/drivers/message/i2o/i2o_scsi.c b/drivers/message/i2o/i2o_scsi.c
index aa6fb9429d58..1bcdbbb9e7d3 100644
--- a/drivers/message/i2o/i2o_scsi.c
+++ b/drivers/message/i2o/i2o_scsi.c
@@ -370,7 +370,7 @@ static int i2o_scsi_reply(struct i2o_controller *c, u32 m,
370 */ 370 */
371 if (cmd->result) 371 if (cmd->result)
372 memcpy(cmd->sense_buffer, &msg->body[3], 372 memcpy(cmd->sense_buffer, &msg->body[3],
373 min(sizeof(cmd->sense_buffer), (size_t) 40)); 373 min(SCSI_SENSE_BUFFERSIZE, 40));
374 374
375 /* only output error code if AdapterStatus is not HBA_SUCCESS */ 375 /* only output error code if AdapterStatus is not HBA_SUCCESS */
376 if ((error >> 8) & 0xff) 376 if ((error >> 8) & 0xff)
diff --git a/drivers/message/i2o/iop.c b/drivers/message/i2o/iop.c
index 7814a06ae970..da715e11c1b2 100644
--- a/drivers/message/i2o/iop.c
+++ b/drivers/message/i2o/iop.c
@@ -916,7 +916,7 @@ static int i2o_parse_hrt(struct i2o_controller *c)
916 * status block. The status block could then be accessed through 916 * status block. The status block could then be accessed through
917 * c->status_block. 917 * c->status_block.
918 * 918 *
919 * Returns 0 on sucess or negative error code on failure. 919 * Returns 0 on success or negative error code on failure.
920 */ 920 */
921int i2o_status_get(struct i2o_controller *c) 921int i2o_status_get(struct i2o_controller *c)
922{ 922{