Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1abaede7 authored by Johannes Thumshirn's avatar Johannes Thumshirn Committed by Martin K. Petersen
Browse files

scsi: fc: Export fc_bsg_jobdone and use it in FC drivers



Export fc_bsg_jobdone so drivers can use it directly instead of doing
the round-trip via struct fc_bsg_job::job_done() and use it in the
LLDDs.  That way we can also unify the interfaces of fc_bsg_jobdone and
bsg_job_done.

As we've converted all LLDDs over to use fc_bsg_jobdone() directly, we
can remove the function pointer from struct fc_bsg_job as well.

Signed-off-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: default avatarHannes Reinecke <hare@suse.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Acked-by: default avatarTyrel Datwyler <tyreld@linux.vnet.ibm.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 01e0e15c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -892,7 +892,7 @@ static void zfcp_fc_ct_els_job_handler(void *data)
	jr->reply_payload_rcv_len = job->reply_payload.payload_len;
	jr->reply_data.ctels_reply.status = FC_CTELS_STATUS_OK;
	jr->result = zfcp_ct_els->status ? -EIO : 0;
	job->job_done(job);
	fc_bsg_jobdone(job, jr->result, jr->reply_payload_rcv_len);
}

static struct zfcp_fc_wka_port *zfcp_fc_job_wka_port(struct fc_bsg_job *job)
+4 −2
Original line number Diff line number Diff line
@@ -3180,7 +3180,8 @@ bfad_im_bsg_vendor_request(struct fc_bsg_job *job)
	bsg_reply->reply_payload_rcv_len = job->reply_payload.payload_len;
	bsg_reply->result = rc;

	job->job_done(job);
	fc_bsg_jobdone(job, bsg_reply->result,
		       bsg_reply->reply_payload_rcv_len);
	return rc;
error:
	/* free the command buffer */
@@ -3556,7 +3557,8 @@ bfad_im_bsg_els_ct_request(struct fc_bsg_job *job)
	bsg_reply->result = rc;

	if (rc == BFA_STATUS_OK)
		job->job_done(job);
		fc_bsg_jobdone(job, bsg_reply->result,
			       bsg_reply->reply_payload_rcv_len);

	return rc;
}
+2 −1
Original line number Diff line number Diff line
@@ -1945,7 +1945,8 @@ static int ibmvfc_bsg_request(struct fc_bsg_job *job)
	ibmvfc_free_event(evt);
	spin_unlock_irqrestore(vhost->host->host_lock, flags);
	bsg_reply->result = rc;
	job->job_done(job);
	fc_bsg_jobdone(job, bsg_reply->result,
		       bsg_reply->reply_payload_rcv_len);
	rc = 0;
out:
	dma_unmap_sg(vhost->dev, job->request_payload.sg_list,
+4 −2
Original line number Diff line number Diff line
@@ -1913,7 +1913,8 @@ static void fc_lport_bsg_resp(struct fc_seq *sp, struct fc_frame *fp,
			-ECONNABORTED : -ETIMEDOUT;
		job->reply_len = sizeof(uint32_t);
		job->state_flags |= FC_RQST_STATE_DONE;
		job->job_done(job);
		fc_bsg_jobdone(job, bsg_reply->result,
			       bsg_reply->reply_payload_rcv_len);
		kfree(info);
		return;
	}
@@ -1948,7 +1949,8 @@ static void fc_lport_bsg_resp(struct fc_seq *sp, struct fc_frame *fp,
				job->reply_payload.payload_len;
		bsg_reply->result = 0;
		job->state_flags |= FC_RQST_STATE_DONE;
		job->job_done(job);
		fc_bsg_jobdone(job, bsg_reply->result,
			       bsg_reply->reply_payload_rcv_len);
		kfree(info);
	}
	fc_frame_free(fp);
+48 −23
Original line number Diff line number Diff line
@@ -371,7 +371,8 @@ lpfc_bsg_send_mgmt_cmd_cmp(struct lpfc_hba *phba,

	if (job) {
		bsg_reply->result = rc;
		job->job_done(job);
		fc_bsg_jobdone(job, bsg_reply->result,
			       bsg_reply->reply_payload_rcv_len);
	}
	return;
}
@@ -644,7 +645,8 @@ lpfc_bsg_rport_els_cmp(struct lpfc_hba *phba,

	if (job) {
		bsg_reply->result = rc;
		job->job_done(job);
		fc_bsg_jobdone(job, bsg_reply->result,
			       bsg_reply->reply_payload_rcv_len);
	}
	return;
}
@@ -1136,7 +1138,8 @@ lpfc_bsg_ct_unsol_event(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
			job->dd_data = NULL;
			/* complete the job back to userspace */
			spin_unlock_irqrestore(&phba->ct_ev_lock, flags);
			job->job_done(job);
			fc_bsg_jobdone(job, bsg_reply->result,
				       bsg_reply->reply_payload_rcv_len);
			spin_lock_irqsave(&phba->ct_ev_lock, flags);
		}
	}
@@ -1361,7 +1364,8 @@ lpfc_bsg_hba_get_event(struct fc_bsg_job *job)
	spin_unlock_irqrestore(&phba->ct_ev_lock, flags);
	job->dd_data = NULL;
	bsg_reply->result = 0;
	job->job_done(job);
	fc_bsg_jobdone(job, bsg_reply->result,
		       bsg_reply->reply_payload_rcv_len);
	return 0;

job_error:
@@ -1458,7 +1462,8 @@ lpfc_issue_ct_rsp_cmp(struct lpfc_hba *phba,

	if (job) {
		bsg_reply->result = rc;
		job->job_done(job);
		fc_bsg_jobdone(job, bsg_reply->result,
			       bsg_reply->reply_payload_rcv_len);
	}
	return;
}
@@ -1886,7 +1891,8 @@ lpfc_sli3_bsg_diag_loopback_mode(struct lpfc_hba *phba, struct fc_bsg_job *job)
	bsg_reply->result = rc;
	/* complete the job back to userspace if no error */
	if (rc == 0)
		job->job_done(job);
		fc_bsg_jobdone(job, bsg_reply->result,
			       bsg_reply->reply_payload_rcv_len);
	return rc;
}

@@ -2175,7 +2181,8 @@ lpfc_sli4_bsg_diag_loopback_mode(struct lpfc_hba *phba, struct fc_bsg_job *job)
	bsg_reply->result = rc;
	/* complete the job back to userspace if no error */
	if (rc == 0)
		job->job_done(job);
		fc_bsg_jobdone(job, bsg_reply->result,
			       bsg_reply->reply_payload_rcv_len);
	return rc;
}

@@ -2289,7 +2296,8 @@ lpfc_sli4_bsg_diag_mode_end(struct fc_bsg_job *job)
	bsg_reply->result = rc;
	/* complete the job back to userspace if no error */
	if (rc == 0)
		job->job_done(job);
		fc_bsg_jobdone(job, bsg_reply->result,
			       bsg_reply->reply_payload_rcv_len);
	return rc;
}

@@ -2441,7 +2449,8 @@ lpfc_sli4_bsg_link_diag_test(struct fc_bsg_job *job)
	bsg_reply->result = rc;
	/* complete the job back to userspace if no error */
	if (rc == 0)
		job->job_done(job);
		fc_bsg_jobdone(job, bsg_reply->result,
			       bsg_reply->reply_payload_rcv_len);
	return rc;
}

@@ -3301,7 +3310,8 @@ lpfc_bsg_diag_loopback_run(struct fc_bsg_job *job)
	job->dd_data = NULL;
	/* complete the job back to userspace if no error */
	if (rc == IOCB_SUCCESS)
		job->job_done(job);
		fc_bsg_jobdone(job, bsg_reply->result,
			       bsg_reply->reply_payload_rcv_len);
	return rc;
}

@@ -3344,7 +3354,8 @@ lpfc_bsg_get_dfc_rev(struct fc_bsg_job *job)
job_error:
	bsg_reply->result = rc;
	if (rc == 0)
		job->job_done(job);
		fc_bsg_jobdone(job, bsg_reply->result,
			       bsg_reply->reply_payload_rcv_len);
	return rc;
}

@@ -3409,7 +3420,8 @@ lpfc_bsg_issue_mbox_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq)

	if (job) {
		bsg_reply->result = 0;
		job->job_done(job);
		fc_bsg_jobdone(job, bsg_reply->result,
			       bsg_reply->reply_payload_rcv_len);
	}
	return;
}
@@ -3635,6 +3647,7 @@ static void
lpfc_bsg_issue_read_mbox_ext_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq)
{
	struct fc_bsg_job *job;
	struct fc_bsg_reply *bsg_reply;

	job = lpfc_bsg_issue_mbox_ext_handle_job(phba, pmboxq);

@@ -3654,9 +3667,11 @@ lpfc_bsg_issue_read_mbox_ext_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq)
	mempool_free(pmboxq, phba->mbox_mem_pool);

	/* if the job is still active, call job done */
	if (job)
		job->job_done(job);

	if (job) {
		bsg_reply = job->reply;
		fc_bsg_jobdone(job, bsg_reply->result,
			       bsg_reply->reply_payload_rcv_len);
	}
	return;
}

@@ -3672,6 +3687,7 @@ static void
lpfc_bsg_issue_write_mbox_ext_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq)
{
	struct fc_bsg_job *job;
	struct fc_bsg_reply *bsg_reply;

	job = lpfc_bsg_issue_mbox_ext_handle_job(phba, pmboxq);

@@ -3689,8 +3705,11 @@ lpfc_bsg_issue_write_mbox_ext_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq)
	lpfc_bsg_mbox_ext_session_reset(phba);

	/* if the job is still active, call job done */
	if (job)
		job->job_done(job);
	if (job) {
		bsg_reply = job->reply;
		fc_bsg_jobdone(job, bsg_reply->result,
			       bsg_reply->reply_payload_rcv_len);
	}

	return;
}
@@ -4131,7 +4150,8 @@ lpfc_bsg_sli_cfg_write_cmd_ext(struct lpfc_hba *phba, struct fc_bsg_job *job,
	/* wait for additoinal external buffers */

	bsg_reply->result = 0;
	job->job_done(job);
	fc_bsg_jobdone(job, bsg_reply->result,
		       bsg_reply->reply_payload_rcv_len);
	return SLI_CONFIG_HANDLED;

job_error:
@@ -4357,7 +4377,8 @@ lpfc_bsg_read_ebuf_get(struct lpfc_hba *phba, struct fc_bsg_job *job)
	}

	bsg_reply->result = 0;
	job->job_done(job);
	fc_bsg_jobdone(job, bsg_reply->result,
		       bsg_reply->reply_payload_rcv_len);

	return SLI_CONFIG_HANDLED;
}
@@ -4473,7 +4494,8 @@ lpfc_bsg_write_ebuf_set(struct lpfc_hba *phba, struct fc_bsg_job *job,

	/* wait for additoinal external buffers */
	bsg_reply->result = 0;
	job->job_done(job);
	fc_bsg_jobdone(job, bsg_reply->result,
		       bsg_reply->reply_payload_rcv_len);
	return SLI_CONFIG_HANDLED;

job_error:
@@ -4941,7 +4963,8 @@ lpfc_bsg_mbox_cmd(struct fc_bsg_job *job)
		/* job done */
		bsg_reply->result = 0;
		job->dd_data = NULL;
		job->job_done(job);
		fc_bsg_jobdone(job, bsg_reply->result,
			       bsg_reply->reply_payload_rcv_len);
	} else if (rc == 1)
		/* job submitted, will complete later*/
		rc = 0; /* return zero, no error */
@@ -5051,7 +5074,8 @@ lpfc_bsg_menlo_cmd_cmp(struct lpfc_hba *phba,

	if (job) {
		bsg_reply->result = rc;
		job->job_done(job);
		fc_bsg_jobdone(job, bsg_reply->result,
			       bsg_reply->reply_payload_rcv_len);
	}

	return;
@@ -5269,7 +5293,8 @@ lpfc_forced_link_speed(struct fc_bsg_job *job)
job_error:
	bsg_reply->result = rc;
	if (rc == 0)
		job->job_done(job);
		fc_bsg_jobdone(job, bsg_reply->result,
			       bsg_reply->reply_payload_rcv_len);
	return rc;
}

Loading