Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

scsi: fc: use bsg_job_done

fc_bsg_jobdone() and bsg_job_done() are 1:1 copies now so use the
bsg-lib one instead of the FC private implementation.

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Acked-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Johannes Thumshirn and committed by
Martin K. Petersen
06548160 6aa858cd

+51 -88
+1 -1
drivers/s390/scsi/zfcp_fc.c
··· 893 893 jr->reply_payload_rcv_len = job->reply_payload.payload_len; 894 894 jr->reply_data.ctels_reply.status = FC_CTELS_STATUS_OK; 895 895 jr->result = zfcp_ct_els->status ? -EIO : 0; 896 - fc_bsg_jobdone(job, jr->result, jr->reply_payload_rcv_len); 896 + bsg_job_done(job, jr->result, jr->reply_payload_rcv_len); 897 897 } 898 898 899 899 static struct zfcp_fc_wka_port *zfcp_fc_job_wka_port(struct bsg_job *job)
+2 -2
drivers/scsi/bfa/bfad_bsg.c
··· 3179 3179 bsg_reply->reply_payload_rcv_len = job->reply_payload.payload_len; 3180 3180 bsg_reply->result = rc; 3181 3181 3182 - fc_bsg_jobdone(job, bsg_reply->result, 3182 + bsg_job_done(job, bsg_reply->result, 3183 3183 bsg_reply->reply_payload_rcv_len); 3184 3184 return rc; 3185 3185 error: ··· 3555 3555 bsg_reply->result = rc; 3556 3556 3557 3557 if (rc == BFA_STATUS_OK) 3558 - fc_bsg_jobdone(job, bsg_reply->result, 3558 + bsg_job_done(job, bsg_reply->result, 3559 3559 bsg_reply->reply_payload_rcv_len); 3560 3560 3561 3561 return rc;
+1 -1
drivers/scsi/ibmvscsi/ibmvfc.c
··· 1946 1946 ibmvfc_free_event(evt); 1947 1947 spin_unlock_irqrestore(vhost->host->host_lock, flags); 1948 1948 bsg_reply->result = rc; 1949 - fc_bsg_jobdone(job, bsg_reply->result, 1949 + bsg_job_done(job, bsg_reply->result, 1950 1950 bsg_reply->reply_payload_rcv_len); 1951 1951 rc = 0; 1952 1952 out:
+2 -2
drivers/scsi/libfc/fc_lport.c
··· 1912 1912 bsg_reply->result = (PTR_ERR(fp) == -FC_EX_CLOSED) ? 1913 1913 -ECONNABORTED : -ETIMEDOUT; 1914 1914 job->reply_len = sizeof(uint32_t); 1915 - fc_bsg_jobdone(job, bsg_reply->result, 1915 + bsg_job_done(job, bsg_reply->result, 1916 1916 bsg_reply->reply_payload_rcv_len); 1917 1917 kfree(info); 1918 1918 return; ··· 1947 1947 bsg_reply->reply_payload_rcv_len = 1948 1948 job->reply_payload.payload_len; 1949 1949 bsg_reply->result = 0; 1950 - fc_bsg_jobdone(job, bsg_reply->result, 1950 + bsg_job_done(job, bsg_reply->result, 1951 1951 bsg_reply->reply_payload_rcv_len); 1952 1952 kfree(info); 1953 1953 }
+20 -20
drivers/scsi/lpfc/lpfc_bsg.c
··· 371 371 372 372 if (job) { 373 373 bsg_reply->result = rc; 374 - fc_bsg_jobdone(job, bsg_reply->result, 374 + bsg_job_done(job, bsg_reply->result, 375 375 bsg_reply->reply_payload_rcv_len); 376 376 } 377 377 return; ··· 645 645 646 646 if (job) { 647 647 bsg_reply->result = rc; 648 - fc_bsg_jobdone(job, bsg_reply->result, 648 + bsg_job_done(job, bsg_reply->result, 649 649 bsg_reply->reply_payload_rcv_len); 650 650 } 651 651 return; ··· 1138 1138 job->dd_data = NULL; 1139 1139 /* complete the job back to userspace */ 1140 1140 spin_unlock_irqrestore(&phba->ct_ev_lock, flags); 1141 - fc_bsg_jobdone(job, bsg_reply->result, 1141 + bsg_job_done(job, bsg_reply->result, 1142 1142 bsg_reply->reply_payload_rcv_len); 1143 1143 spin_lock_irqsave(&phba->ct_ev_lock, flags); 1144 1144 } ··· 1364 1364 spin_unlock_irqrestore(&phba->ct_ev_lock, flags); 1365 1365 job->dd_data = NULL; 1366 1366 bsg_reply->result = 0; 1367 - fc_bsg_jobdone(job, bsg_reply->result, 1367 + bsg_job_done(job, bsg_reply->result, 1368 1368 bsg_reply->reply_payload_rcv_len); 1369 1369 return 0; 1370 1370 ··· 1462 1462 1463 1463 if (job) { 1464 1464 bsg_reply->result = rc; 1465 - fc_bsg_jobdone(job, bsg_reply->result, 1465 + bsg_job_done(job, bsg_reply->result, 1466 1466 bsg_reply->reply_payload_rcv_len); 1467 1467 } 1468 1468 return; ··· 1891 1891 bsg_reply->result = rc; 1892 1892 /* complete the job back to userspace if no error */ 1893 1893 if (rc == 0) 1894 - fc_bsg_jobdone(job, bsg_reply->result, 1894 + bsg_job_done(job, bsg_reply->result, 1895 1895 bsg_reply->reply_payload_rcv_len); 1896 1896 return rc; 1897 1897 } ··· 2181 2181 bsg_reply->result = rc; 2182 2182 /* complete the job back to userspace if no error */ 2183 2183 if (rc == 0) 2184 - fc_bsg_jobdone(job, bsg_reply->result, 2184 + bsg_job_done(job, bsg_reply->result, 2185 2185 bsg_reply->reply_payload_rcv_len); 2186 2186 return rc; 2187 2187 } ··· 2296 2296 bsg_reply->result = rc; 2297 2297 /* complete the job back to userspace if no error */ 2298 2298 if (rc == 0) 2299 - fc_bsg_jobdone(job, bsg_reply->result, 2299 + bsg_job_done(job, bsg_reply->result, 2300 2300 bsg_reply->reply_payload_rcv_len); 2301 2301 return rc; 2302 2302 } ··· 2449 2449 bsg_reply->result = rc; 2450 2450 /* complete the job back to userspace if no error */ 2451 2451 if (rc == 0) 2452 - fc_bsg_jobdone(job, bsg_reply->result, 2452 + bsg_job_done(job, bsg_reply->result, 2453 2453 bsg_reply->reply_payload_rcv_len); 2454 2454 return rc; 2455 2455 } ··· 3310 3310 job->dd_data = NULL; 3311 3311 /* complete the job back to userspace if no error */ 3312 3312 if (rc == IOCB_SUCCESS) 3313 - fc_bsg_jobdone(job, bsg_reply->result, 3313 + bsg_job_done(job, bsg_reply->result, 3314 3314 bsg_reply->reply_payload_rcv_len); 3315 3315 return rc; 3316 3316 } ··· 3354 3354 job_error: 3355 3355 bsg_reply->result = rc; 3356 3356 if (rc == 0) 3357 - fc_bsg_jobdone(job, bsg_reply->result, 3357 + bsg_job_done(job, bsg_reply->result, 3358 3358 bsg_reply->reply_payload_rcv_len); 3359 3359 return rc; 3360 3360 } ··· 3420 3420 3421 3421 if (job) { 3422 3422 bsg_reply->result = 0; 3423 - fc_bsg_jobdone(job, bsg_reply->result, 3423 + bsg_job_done(job, bsg_reply->result, 3424 3424 bsg_reply->reply_payload_rcv_len); 3425 3425 } 3426 3426 return; ··· 3669 3669 /* if the job is still active, call job done */ 3670 3670 if (job) { 3671 3671 bsg_reply = job->reply; 3672 - fc_bsg_jobdone(job, bsg_reply->result, 3672 + bsg_job_done(job, bsg_reply->result, 3673 3673 bsg_reply->reply_payload_rcv_len); 3674 3674 } 3675 3675 return; ··· 3707 3707 /* if the job is still active, call job done */ 3708 3708 if (job) { 3709 3709 bsg_reply = job->reply; 3710 - fc_bsg_jobdone(job, bsg_reply->result, 3710 + bsg_job_done(job, bsg_reply->result, 3711 3711 bsg_reply->reply_payload_rcv_len); 3712 3712 } 3713 3713 ··· 4150 4150 /* wait for additoinal external buffers */ 4151 4151 4152 4152 bsg_reply->result = 0; 4153 - fc_bsg_jobdone(job, bsg_reply->result, 4153 + bsg_job_done(job, bsg_reply->result, 4154 4154 bsg_reply->reply_payload_rcv_len); 4155 4155 return SLI_CONFIG_HANDLED; 4156 4156 ··· 4377 4377 } 4378 4378 4379 4379 bsg_reply->result = 0; 4380 - fc_bsg_jobdone(job, bsg_reply->result, 4380 + bsg_job_done(job, bsg_reply->result, 4381 4381 bsg_reply->reply_payload_rcv_len); 4382 4382 4383 4383 return SLI_CONFIG_HANDLED; ··· 4494 4494 4495 4495 /* wait for additoinal external buffers */ 4496 4496 bsg_reply->result = 0; 4497 - fc_bsg_jobdone(job, bsg_reply->result, 4497 + bsg_job_done(job, bsg_reply->result, 4498 4498 bsg_reply->reply_payload_rcv_len); 4499 4499 return SLI_CONFIG_HANDLED; 4500 4500 ··· 4963 4963 /* job done */ 4964 4964 bsg_reply->result = 0; 4965 4965 job->dd_data = NULL; 4966 - fc_bsg_jobdone(job, bsg_reply->result, 4966 + bsg_job_done(job, bsg_reply->result, 4967 4967 bsg_reply->reply_payload_rcv_len); 4968 4968 } else if (rc == 1) 4969 4969 /* job submitted, will complete later*/ ··· 5074 5074 5075 5075 if (job) { 5076 5076 bsg_reply->result = rc; 5077 - fc_bsg_jobdone(job, bsg_reply->result, 5077 + bsg_job_done(job, bsg_reply->result, 5078 5078 bsg_reply->reply_payload_rcv_len); 5079 5079 } 5080 5080 ··· 5293 5293 job_error: 5294 5294 bsg_reply->result = rc; 5295 5295 if (rc == 0) 5296 - fc_bsg_jobdone(job, bsg_reply->result, 5296 + bsg_job_done(job, bsg_reply->result, 5297 5297 bsg_reply->reply_payload_rcv_len); 5298 5298 return rc; 5299 5299 }
+22 -22
drivers/scsi/qla2xxx/qla_bsg.c
··· 21 21 struct fc_bsg_reply *bsg_reply = bsg_job->reply; 22 22 23 23 bsg_reply->result = res; 24 - fc_bsg_jobdone(bsg_job, bsg_reply->result, 24 + bsg_job_done(bsg_job, bsg_reply->result, 25 25 bsg_reply->reply_payload_rcv_len); 26 26 sp->free(vha, sp); 27 27 } ··· 244 244 } 245 245 exit_fcp_prio_cfg: 246 246 if (!ret) 247 - fc_bsg_jobdone(bsg_job, bsg_reply->result, 247 + bsg_job_done(bsg_job, bsg_reply->result, 248 248 bsg_reply->reply_payload_rcv_len); 249 249 return ret; 250 250 } ··· 942 942 bsg_job->request_payload.sg_list, 943 943 bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE); 944 944 if (!rval) 945 - fc_bsg_jobdone(bsg_job, bsg_reply->result, 945 + bsg_job_done(bsg_job, bsg_reply->result, 946 946 bsg_reply->reply_payload_rcv_len); 947 947 return rval; 948 948 } ··· 976 976 ql_dbg(ql_dbg_user, vha, 0x7031, 977 977 "Vendor request 84xx reset completed.\n"); 978 978 bsg_reply->result = DID_OK; 979 - fc_bsg_jobdone(bsg_job, bsg_reply->result, 979 + bsg_job_done(bsg_job, bsg_reply->result, 980 980 bsg_reply->reply_payload_rcv_len); 981 981 } 982 982 ··· 1090 1090 bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE); 1091 1091 1092 1092 if (!rval) 1093 - fc_bsg_jobdone(bsg_job, bsg_reply->result, 1093 + bsg_job_done(bsg_job, bsg_reply->result, 1094 1094 bsg_reply->reply_payload_rcv_len); 1095 1095 return rval; 1096 1096 } ··· 1288 1288 dma_pool_free(ha->s_dma_pool, mn, mn_dma); 1289 1289 1290 1290 if (!rval) 1291 - fc_bsg_jobdone(bsg_job, bsg_reply->result, 1291 + bsg_job_done(bsg_job, bsg_reply->result, 1292 1292 bsg_reply->reply_payload_rcv_len); 1293 1293 return rval; 1294 1294 } ··· 1375 1375 } 1376 1376 1377 1377 bsg_reply->result = DID_OK; 1378 - fc_bsg_jobdone(bsg_job, bsg_reply->result, 1378 + bsg_job_done(bsg_job, bsg_reply->result, 1379 1379 bsg_reply->reply_payload_rcv_len); 1380 1380 } 1381 1381 ··· 1484 1484 ha->optrom_buffer = NULL; 1485 1485 ha->optrom_state = QLA_SWAITING; 1486 1486 mutex_unlock(&ha->optrom_mutex); 1487 - fc_bsg_jobdone(bsg_job, bsg_reply->result, 1487 + bsg_job_done(bsg_job, bsg_reply->result, 1488 1488 bsg_reply->reply_payload_rcv_len); 1489 1489 return rval; 1490 1490 } ··· 1520 1520 ha->optrom_buffer = NULL; 1521 1521 ha->optrom_state = QLA_SWAITING; 1522 1522 mutex_unlock(&ha->optrom_mutex); 1523 - fc_bsg_jobdone(bsg_job, bsg_reply->result, 1523 + bsg_job_done(bsg_job, bsg_reply->result, 1524 1524 bsg_reply->reply_payload_rcv_len); 1525 1525 return rval; 1526 1526 } ··· 1571 1571 done: 1572 1572 bsg_job->reply_len = sizeof(struct fc_bsg_reply); 1573 1573 bsg_reply->result = DID_OK << 16; 1574 - fc_bsg_jobdone(bsg_job, bsg_reply->result, 1574 + bsg_job_done(bsg_job, bsg_reply->result, 1575 1575 bsg_reply->reply_payload_rcv_len); 1576 1576 1577 1577 return 0; ··· 1621 1621 bsg_job->reply_len = sizeof(struct fc_bsg_reply); 1622 1622 bsg_reply->reply_payload_rcv_len = sizeof(*sr); 1623 1623 bsg_reply->result = DID_OK << 16; 1624 - fc_bsg_jobdone(bsg_job, bsg_reply->result, 1624 + bsg_job_done(bsg_job, bsg_reply->result, 1625 1625 bsg_reply->reply_payload_rcv_len); 1626 1626 1627 1627 return 0; ··· 1667 1667 done: 1668 1668 bsg_job->reply_len = sizeof(struct fc_bsg_reply); 1669 1669 bsg_reply->result = DID_OK << 16; 1670 - fc_bsg_jobdone(bsg_job, bsg_reply->result, 1670 + bsg_job_done(bsg_job, bsg_reply->result, 1671 1671 bsg_reply->reply_payload_rcv_len); 1672 1672 1673 1673 return 0; ··· 1712 1712 done: 1713 1713 bsg_job->reply_len = sizeof(struct fc_bsg_reply); 1714 1714 bsg_reply->result = DID_OK << 16; 1715 - fc_bsg_jobdone(bsg_job, bsg_reply->result, 1715 + bsg_job_done(bsg_job, bsg_reply->result, 1716 1716 bsg_reply->reply_payload_rcv_len); 1717 1717 1718 1718 return 0; ··· 1761 1761 bsg_job->reply_len = sizeof(struct fc_bsg_reply); 1762 1762 bsg_reply->reply_payload_rcv_len = sizeof(*i2c); 1763 1763 bsg_reply->result = DID_OK << 16; 1764 - fc_bsg_jobdone(bsg_job, bsg_reply->result, 1764 + bsg_job_done(bsg_job, bsg_reply->result, 1765 1765 bsg_reply->reply_payload_rcv_len); 1766 1766 1767 1767 return 0; ··· 1940 1940 bsg_job->reply_len = sizeof(struct fc_bsg_reply); 1941 1941 bsg_reply->reply_payload_rcv_len = 0; 1942 1942 bsg_reply->result = (DID_OK) << 16; 1943 - fc_bsg_jobdone(bsg_job, bsg_reply->result, 1943 + bsg_job_done(bsg_job, bsg_reply->result, 1944 1944 bsg_reply->reply_payload_rcv_len); 1945 1945 /* Always return success, vendor rsp carries correct status */ 1946 1946 return 0; ··· 2106 2106 2107 2107 bsg_job->reply_len = sizeof(struct fc_bsg_reply); 2108 2108 bsg_reply->result = DID_OK << 16; 2109 - fc_bsg_jobdone(bsg_job, bsg_reply->result, 2109 + bsg_job_done(bsg_job, bsg_reply->result, 2110 2110 bsg_reply->reply_payload_rcv_len); 2111 2111 return 0; 2112 2112 } ··· 2148 2148 2149 2149 bsg_job->reply_len = sizeof(struct fc_bsg_reply); 2150 2150 bsg_reply->result = DID_OK << 16; 2151 - fc_bsg_jobdone(bsg_job, bsg_reply->result, 2151 + bsg_job_done(bsg_job, bsg_reply->result, 2152 2152 bsg_reply->reply_payload_rcv_len); 2153 2153 return 0; 2154 2154 } ··· 2180 2180 2181 2181 bsg_job->reply_len = sizeof(struct fc_bsg_reply); 2182 2182 bsg_reply->result = DID_OK << 16; 2183 - fc_bsg_jobdone(bsg_job, bsg_reply->result, 2183 + bsg_job_done(bsg_job, bsg_reply->result, 2184 2184 bsg_reply->reply_payload_rcv_len); 2185 2185 return 0; 2186 2186 } ··· 2226 2226 2227 2227 bsg_job->reply_len = sizeof(struct fc_bsg_reply); 2228 2228 bsg_reply->result = DID_OK << 16; 2229 - fc_bsg_jobdone(bsg_job, bsg_reply->result, 2229 + bsg_job_done(bsg_job, bsg_reply->result, 2230 2230 bsg_reply->reply_payload_rcv_len); 2231 2231 return 0; 2232 2232 } ··· 2285 2285 2286 2286 bsg_job->reply_len = sizeof(struct fc_bsg_reply); 2287 2287 bsg_reply->result = DID_OK << 16; 2288 - fc_bsg_jobdone(bsg_job, bsg_reply->result, 2288 + bsg_job_done(bsg_job, bsg_reply->result, 2289 2289 bsg_reply->reply_payload_rcv_len); 2290 2290 return 0; 2291 2291 } ··· 2342 2342 2343 2343 bsg_job->reply_len = sizeof(*bsg_reply); 2344 2344 bsg_reply->result = DID_OK << 16; 2345 - fc_bsg_jobdone(bsg_job, bsg_reply->result, 2345 + bsg_job_done(bsg_job, bsg_reply->result, 2346 2346 bsg_reply->reply_payload_rcv_len); 2347 2347 2348 2348 dma_free_coherent(&ha->pdev->dev, sizeof(*stats), ··· 2386 2386 2387 2387 bsg_job->reply_len = sizeof(*bsg_reply); 2388 2388 bsg_reply->result = DID_OK << 16; 2389 - fc_bsg_jobdone(bsg_job, bsg_reply->result, 2389 + bsg_job_done(bsg_job, bsg_reply->result, 2390 2390 bsg_reply->reply_payload_rcv_len); 2391 2391 2392 2392 kfree(dd);
+3 -38
drivers/scsi/scsi_transport_fc.c
··· 3556 3556 */ 3557 3557 3558 3558 /** 3559 - * fc_bsg_jobdone - completion routine for bsg requests that the LLD has 3560 - * completed 3561 - * @job: fc_bsg_job that is complete 3562 - * @result: job reply result 3563 - * @reply_payload_rcv_len: length of payload received 3564 - */ 3565 - void fc_bsg_jobdone(struct bsg_job *job, int result, 3566 - unsigned int reply_payload_rcv_len) 3567 - { 3568 - struct request *req = job->req; 3569 - struct request *rsp = req->next_rq; 3570 - int err; 3571 - 3572 - err = job->req->errors = result; 3573 - 3574 - if (err < 0) 3575 - /* we're only returning the result field in the reply */ 3576 - job->req->sense_len = sizeof(uint32_t); 3577 - else 3578 - job->req->sense_len = job->reply_len; 3579 - 3580 - /* we assume all request payload was transferred, residual == 0 */ 3581 - req->resid_len = 0; 3582 - 3583 - if (rsp) { 3584 - WARN_ON(reply_payload_rcv_len > rsp->resid_len); 3585 - 3586 - /* set reply (bidi) residual */ 3587 - rsp->resid_len -= min(reply_payload_rcv_len, rsp->resid_len); 3588 - } 3589 - blk_complete_request(req); 3590 - } 3591 - EXPORT_SYMBOL_GPL(fc_bsg_jobdone); 3592 - 3593 - /** 3594 3559 * fc_bsg_job_timeout - handler for when a bsg request timesout 3595 3560 * @req: request that timed out 3596 3561 */ ··· 3762 3797 bsg_reply->reply_payload_rcv_len = 0; 3763 3798 bsg_reply->result = ret; 3764 3799 job->reply_len = sizeof(uint32_t); 3765 - fc_bsg_jobdone(job, bsg_reply->result, 3800 + bsg_job_done(job, bsg_reply->result, 3766 3801 bsg_reply->reply_payload_rcv_len); 3767 3802 return FC_DISPATCH_UNLOCKED; 3768 3803 } ··· 3840 3875 bsg_reply->reply_payload_rcv_len = 0; 3841 3876 bsg_reply->result = ret; 3842 3877 job->reply_len = sizeof(uint32_t); 3843 - fc_bsg_jobdone(job, bsg_reply->result, 3878 + bsg_job_done(job, bsg_reply->result, 3844 3879 bsg_reply->reply_payload_rcv_len); 3845 3880 return FC_DISPATCH_UNLOCKED; 3846 3881 } ··· 3901 3936 bsg_reply->reply_payload_rcv_len = 0; 3902 3937 bsg_reply->result = -ENOMSG; 3903 3938 job->reply_len = sizeof(uint32_t); 3904 - fc_bsg_jobdone(job, bsg_reply->result, 3939 + bsg_job_done(job, bsg_reply->result, 3905 3940 bsg_reply->reply_payload_rcv_len); 3906 3941 spin_lock_irq(q->queue_lock); 3907 3942 continue;
-2
include/scsi/scsi_transport_fc.h
··· 808 808 struct fc_vport_identifiers *); 809 809 int fc_vport_terminate(struct fc_vport *vport); 810 810 int fc_block_scsi_eh(struct scsi_cmnd *cmnd); 811 - void fc_bsg_jobdone(struct bsg_job *job, int result, 812 - unsigned int reply_payload_rcv_len); 813 811 814 812 static inline struct Scsi_Host *fc_bsg_to_shost(struct bsg_job *job) 815 813 {