scsi: fc: provide fc_bsg_to_shost() helper

Provide fc_bsg_to_shost() helper that will become handy when we're
moving from struct fc_bsg_job to a plain struct bsg_job. Also use this
little helper in the LLDDs.

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>
This commit is contained in:
Johannes Thumshirn 2016-11-17 10:31:14 +01:00 committed by Martin K. Petersen
parent 1abaede715
commit cd21c605b2
8 changed files with 59 additions and 54 deletions

View File

@ -901,11 +901,13 @@ static struct zfcp_fc_wka_port *zfcp_fc_job_wka_port(struct fc_bsg_job *job)
u8 gs_type; u8 gs_type;
struct zfcp_adapter *adapter; struct zfcp_adapter *adapter;
struct fc_bsg_request *bsg_request = job->request; struct fc_bsg_request *bsg_request = job->request;
struct Scsi_Host *shost;
preamble_word1 = bsg_request->rqst_data.r_ct.preamble_word1; preamble_word1 = bsg_request->rqst_data.r_ct.preamble_word1;
gs_type = (preamble_word1 & 0xff000000) >> 24; gs_type = (preamble_word1 & 0xff000000) >> 24;
adapter = (struct zfcp_adapter *) job->shost->hostdata[0]; shost = fc_bsg_to_shost(job);
adapter = (struct zfcp_adapter *) shost->hostdata[0];
switch (gs_type) { switch (gs_type) {
case FC_FST_ALIAS: case FC_FST_ALIAS:
@ -987,7 +989,7 @@ int zfcp_fc_exec_bsg_job(struct fc_bsg_job *job)
struct zfcp_fsf_ct_els *ct_els = job->dd_data; struct zfcp_fsf_ct_els *ct_els = job->dd_data;
struct fc_bsg_request *bsg_request = job->request; struct fc_bsg_request *bsg_request = job->request;
shost = job->rport ? rport_to_shost(job->rport) : job->shost; shost = job->rport ? rport_to_shost(job->rport) : fc_bsg_to_shost(job);
adapter = (struct zfcp_adapter *)shost->hostdata[0]; adapter = (struct zfcp_adapter *)shost->hostdata[0];
if (!(atomic_read(&adapter->status) & ZFCP_STATUS_COMMON_OPEN)) if (!(atomic_read(&adapter->status) & ZFCP_STATUS_COMMON_OPEN))

View File

@ -3135,8 +3135,7 @@ bfad_im_bsg_vendor_request(struct fc_bsg_job *job)
struct fc_bsg_request *bsg_request = job->request; struct fc_bsg_request *bsg_request = job->request;
struct fc_bsg_reply *bsg_reply = job->reply; struct fc_bsg_reply *bsg_reply = job->reply;
uint32_t vendor_cmd = bsg_request->rqst_data.h_vendor.vendor_cmd[0]; uint32_t vendor_cmd = bsg_request->rqst_data.h_vendor.vendor_cmd[0];
struct bfad_im_port_s *im_port = struct bfad_im_port_s *im_port = shost_priv(fc_bsg_to_shost(job));
(struct bfad_im_port_s *) job->shost->hostdata[0];
struct bfad_s *bfad = im_port->bfad; struct bfad_s *bfad = im_port->bfad;
struct request_queue *request_q = job->req->q; struct request_queue *request_q = job->req->q;
void *payload_kbuf; void *payload_kbuf;
@ -3358,8 +3357,7 @@ int
bfad_im_bsg_els_ct_request(struct fc_bsg_job *job) bfad_im_bsg_els_ct_request(struct fc_bsg_job *job)
{ {
struct bfa_bsg_data *bsg_data; struct bfa_bsg_data *bsg_data;
struct bfad_im_port_s *im_port = struct bfad_im_port_s *im_port = shost_priv(fc_bsg_to_shost(job));
(struct bfad_im_port_s *) job->shost->hostdata[0];
struct bfad_s *bfad = im_port->bfad; struct bfad_s *bfad = im_port->bfad;
bfa_bsg_fcpt_t *bsg_fcpt; bfa_bsg_fcpt_t *bsg_fcpt;
struct bfad_fcxp *drv_fcxp; struct bfad_fcxp *drv_fcxp;

View File

@ -1708,7 +1708,7 @@ static void ibmvfc_bsg_timeout_done(struct ibmvfc_event *evt)
**/ **/
static int ibmvfc_bsg_timeout(struct fc_bsg_job *job) static int ibmvfc_bsg_timeout(struct fc_bsg_job *job)
{ {
struct ibmvfc_host *vhost = shost_priv(job->shost); struct ibmvfc_host *vhost = shost_priv(fc_bsg_to_shost(job));
unsigned long port_id = (unsigned long)job->dd_data; unsigned long port_id = (unsigned long)job->dd_data;
struct ibmvfc_event *evt; struct ibmvfc_event *evt;
struct ibmvfc_tmf *tmf; struct ibmvfc_tmf *tmf;
@ -1821,7 +1821,7 @@ static int ibmvfc_bsg_plogi(struct ibmvfc_host *vhost, unsigned int port_id)
**/ **/
static int ibmvfc_bsg_request(struct fc_bsg_job *job) static int ibmvfc_bsg_request(struct fc_bsg_job *job)
{ {
struct ibmvfc_host *vhost = shost_priv(job->shost); struct ibmvfc_host *vhost = shost_priv(fc_bsg_to_shost(job));
struct fc_rport *rport = job->rport; struct fc_rport *rport = job->rport;
struct ibmvfc_passthru_mad *mad; struct ibmvfc_passthru_mad *mad;
struct ibmvfc_event *evt; struct ibmvfc_event *evt;

View File

@ -2088,7 +2088,7 @@ int fc_lport_bsg_request(struct fc_bsg_job *job)
struct fc_bsg_request *bsg_request = job->request; struct fc_bsg_request *bsg_request = job->request;
struct fc_bsg_reply *bsg_reply = job->reply; struct fc_bsg_reply *bsg_reply = job->reply;
struct request *rsp = job->req->next_rq; struct request *rsp = job->req->next_rq;
struct Scsi_Host *shost = job->shost; struct Scsi_Host *shost = fc_bsg_to_shost(job);
struct fc_lport *lport = shost_priv(shost); struct fc_lport *lport = shost_priv(shost);
struct fc_rport *rport; struct fc_rport *rport;
struct fc_rport_priv *rdata; struct fc_rport_priv *rdata;

View File

@ -384,7 +384,7 @@ lpfc_bsg_send_mgmt_cmd_cmp(struct lpfc_hba *phba,
static int static int
lpfc_bsg_send_mgmt_cmd(struct fc_bsg_job *job) lpfc_bsg_send_mgmt_cmd(struct fc_bsg_job *job)
{ {
struct lpfc_vport *vport = (struct lpfc_vport *)job->shost->hostdata; struct lpfc_vport *vport = shost_priv(fc_bsg_to_shost(job));
struct lpfc_hba *phba = vport->phba; struct lpfc_hba *phba = vport->phba;
struct lpfc_rport_data *rdata = job->rport->dd_data; struct lpfc_rport_data *rdata = job->rport->dd_data;
struct lpfc_nodelist *ndlp = rdata->pnode; struct lpfc_nodelist *ndlp = rdata->pnode;
@ -658,7 +658,7 @@ lpfc_bsg_rport_els_cmp(struct lpfc_hba *phba,
static int static int
lpfc_bsg_rport_els(struct fc_bsg_job *job) lpfc_bsg_rport_els(struct fc_bsg_job *job)
{ {
struct lpfc_vport *vport = (struct lpfc_vport *)job->shost->hostdata; struct lpfc_vport *vport = shost_priv(fc_bsg_to_shost(job));
struct lpfc_hba *phba = vport->phba; struct lpfc_hba *phba = vport->phba;
struct lpfc_rport_data *rdata = job->rport->dd_data; struct lpfc_rport_data *rdata = job->rport->dd_data;
struct lpfc_nodelist *ndlp = rdata->pnode; struct lpfc_nodelist *ndlp = rdata->pnode;
@ -1202,7 +1202,7 @@ lpfc_bsg_ct_unsol_abort(struct lpfc_hba *phba, struct hbq_dmabuf *dmabuf)
static int static int
lpfc_bsg_hba_set_event(struct fc_bsg_job *job) lpfc_bsg_hba_set_event(struct fc_bsg_job *job)
{ {
struct lpfc_vport *vport = (struct lpfc_vport *)job->shost->hostdata; struct lpfc_vport *vport = shost_priv(fc_bsg_to_shost(job));
struct lpfc_hba *phba = vport->phba; struct lpfc_hba *phba = vport->phba;
struct fc_bsg_request *bsg_request = job->request; struct fc_bsg_request *bsg_request = job->request;
struct set_ct_event *event_req; struct set_ct_event *event_req;
@ -1287,7 +1287,7 @@ lpfc_bsg_hba_set_event(struct fc_bsg_job *job)
static int static int
lpfc_bsg_hba_get_event(struct fc_bsg_job *job) lpfc_bsg_hba_get_event(struct fc_bsg_job *job)
{ {
struct lpfc_vport *vport = (struct lpfc_vport *)job->shost->hostdata; struct lpfc_vport *vport = shost_priv(fc_bsg_to_shost(job));
struct lpfc_hba *phba = vport->phba; struct lpfc_hba *phba = vport->phba;
struct fc_bsg_request *bsg_request = job->request; struct fc_bsg_request *bsg_request = job->request;
struct fc_bsg_reply *bsg_reply = job->reply; struct fc_bsg_reply *bsg_reply = job->reply;
@ -1625,7 +1625,7 @@ lpfc_issue_ct_rsp(struct lpfc_hba *phba, struct fc_bsg_job *job, uint32_t tag,
static int static int
lpfc_bsg_send_mgmt_rsp(struct fc_bsg_job *job) lpfc_bsg_send_mgmt_rsp(struct fc_bsg_job *job)
{ {
struct lpfc_vport *vport = (struct lpfc_vport *)job->shost->hostdata; struct lpfc_vport *vport = shost_priv(fc_bsg_to_shost(job));
struct lpfc_hba *phba = vport->phba; struct lpfc_hba *phba = vport->phba;
struct fc_bsg_request *bsg_request = job->request; struct fc_bsg_request *bsg_request = job->request;
struct fc_bsg_reply *bsg_reply = job->reply; struct fc_bsg_reply *bsg_reply = job->reply;
@ -2201,10 +2201,10 @@ lpfc_bsg_diag_loopback_mode(struct fc_bsg_job *job)
struct lpfc_hba *phba; struct lpfc_hba *phba;
int rc; int rc;
shost = job->shost; shost = fc_bsg_to_shost(job);
if (!shost) if (!shost)
return -ENODEV; return -ENODEV;
vport = (struct lpfc_vport *)job->shost->hostdata; vport = shost_priv(shost);
if (!vport) if (!vport)
return -ENODEV; return -ENODEV;
phba = vport->phba; phba = vport->phba;
@ -2241,10 +2241,10 @@ lpfc_sli4_bsg_diag_mode_end(struct fc_bsg_job *job)
uint32_t timeout; uint32_t timeout;
int rc, i; int rc, i;
shost = job->shost; shost = fc_bsg_to_shost(job);
if (!shost) if (!shost)
return -ENODEV; return -ENODEV;
vport = (struct lpfc_vport *)job->shost->hostdata; vport = shost_priv(shost);
if (!vport) if (!vport)
return -ENODEV; return -ENODEV;
phba = vport->phba; phba = vport->phba;
@ -2325,12 +2325,12 @@ lpfc_sli4_bsg_link_diag_test(struct fc_bsg_job *job)
struct diag_status *diag_status_reply; struct diag_status *diag_status_reply;
int mbxstatus, rc = 0; int mbxstatus, rc = 0;
shost = job->shost; shost = fc_bsg_to_shost(job);
if (!shost) { if (!shost) {
rc = -ENODEV; rc = -ENODEV;
goto job_error; goto job_error;
} }
vport = (struct lpfc_vport *)job->shost->hostdata; vport = shost_priv(shost);
if (!vport) { if (!vport) {
rc = -ENODEV; rc = -ENODEV;
goto job_error; goto job_error;
@ -3018,7 +3018,7 @@ static int lpfcdiag_loop_post_rxbufs(struct lpfc_hba *phba, uint16_t rxxri,
static int static int
lpfc_bsg_diag_loopback_run(struct fc_bsg_job *job) lpfc_bsg_diag_loopback_run(struct fc_bsg_job *job)
{ {
struct lpfc_vport *vport = (struct lpfc_vport *)job->shost->hostdata; struct lpfc_vport *vport = shost_priv(fc_bsg_to_shost(job));
struct fc_bsg_reply *bsg_reply = job->reply; struct fc_bsg_reply *bsg_reply = job->reply;
struct lpfc_hba *phba = vport->phba; struct lpfc_hba *phba = vport->phba;
struct lpfc_bsg_event *evt; struct lpfc_bsg_event *evt;
@ -3322,7 +3322,7 @@ lpfc_bsg_diag_loopback_run(struct fc_bsg_job *job)
static int static int
lpfc_bsg_get_dfc_rev(struct fc_bsg_job *job) lpfc_bsg_get_dfc_rev(struct fc_bsg_job *job)
{ {
struct lpfc_vport *vport = (struct lpfc_vport *)job->shost->hostdata; struct lpfc_vport *vport = shost_priv(fc_bsg_to_shost(job));
struct fc_bsg_reply *bsg_reply = job->reply; struct fc_bsg_reply *bsg_reply = job->reply;
struct lpfc_hba *phba = vport->phba; struct lpfc_hba *phba = vport->phba;
struct get_mgmt_rev_reply *event_reply; struct get_mgmt_rev_reply *event_reply;
@ -4933,7 +4933,7 @@ lpfc_bsg_issue_mbox(struct lpfc_hba *phba, struct fc_bsg_job *job,
static int static int
lpfc_bsg_mbox_cmd(struct fc_bsg_job *job) lpfc_bsg_mbox_cmd(struct fc_bsg_job *job)
{ {
struct lpfc_vport *vport = (struct lpfc_vport *)job->shost->hostdata; struct lpfc_vport *vport = shost_priv(fc_bsg_to_shost(job));
struct fc_bsg_request *bsg_request = job->request; struct fc_bsg_request *bsg_request = job->request;
struct fc_bsg_reply *bsg_reply = job->reply; struct fc_bsg_reply *bsg_reply = job->reply;
struct lpfc_hba *phba = vport->phba; struct lpfc_hba *phba = vport->phba;
@ -5093,7 +5093,7 @@ lpfc_bsg_menlo_cmd_cmp(struct lpfc_hba *phba,
static int static int
lpfc_menlo_cmd(struct fc_bsg_job *job) lpfc_menlo_cmd(struct fc_bsg_job *job)
{ {
struct lpfc_vport *vport = (struct lpfc_vport *)job->shost->hostdata; struct lpfc_vport *vport = shost_priv(fc_bsg_to_shost(job));
struct fc_bsg_request *bsg_request = job->request; struct fc_bsg_request *bsg_request = job->request;
struct fc_bsg_reply *bsg_reply = job->reply; struct fc_bsg_reply *bsg_reply = job->reply;
struct lpfc_hba *phba = vport->phba; struct lpfc_hba *phba = vport->phba;
@ -5257,7 +5257,7 @@ lpfc_menlo_cmd(struct fc_bsg_job *job)
static int static int
lpfc_forced_link_speed(struct fc_bsg_job *job) lpfc_forced_link_speed(struct fc_bsg_job *job)
{ {
struct Scsi_Host *shost = job->shost; struct Scsi_Host *shost = fc_bsg_to_shost(job);
struct lpfc_vport *vport = shost_priv(shost); struct lpfc_vport *vport = shost_priv(shost);
struct lpfc_hba *phba = vport->phba; struct lpfc_hba *phba = vport->phba;
struct fc_bsg_reply *bsg_reply = job->reply; struct fc_bsg_reply *bsg_reply = job->reply;
@ -5400,7 +5400,7 @@ lpfc_bsg_request(struct fc_bsg_job *job)
int int
lpfc_bsg_timeout(struct fc_bsg_job *job) lpfc_bsg_timeout(struct fc_bsg_job *job)
{ {
struct lpfc_vport *vport = (struct lpfc_vport *)job->shost->hostdata; struct lpfc_vport *vport = shost_priv(fc_bsg_to_shost(job));
struct lpfc_hba *phba = vport->phba; struct lpfc_hba *phba = vport->phba;
struct lpfc_iocbq *cmdiocb; struct lpfc_iocbq *cmdiocb;
struct lpfc_sli_ring *pring = &phba->sli.ring[LPFC_ELS_RING]; struct lpfc_sli_ring *pring = &phba->sli.ring[LPFC_ELS_RING];

View File

@ -1,4 +1,4 @@
/* /*
* QLogic Fibre Channel HBA Driver * QLogic Fibre Channel HBA Driver
* Copyright (c) 2003-2014 QLogic Corporation * Copyright (c) 2003-2014 QLogic Corporation
* *
@ -122,7 +122,7 @@ qla24xx_fcp_prio_cfg_valid(scsi_qla_host_t *vha,
static int static int
qla24xx_proc_fcp_prio_cfg_cmd(struct fc_bsg_job *bsg_job) qla24xx_proc_fcp_prio_cfg_cmd(struct fc_bsg_job *bsg_job)
{ {
struct Scsi_Host *host = bsg_job->shost; struct Scsi_Host *host = fc_bsg_to_shost(bsg_job);
struct fc_bsg_request *bsg_request = bsg_job->request; struct fc_bsg_request *bsg_request = bsg_job->request;
struct fc_bsg_reply *bsg_reply = bsg_job->reply; struct fc_bsg_reply *bsg_reply = bsg_job->reply;
scsi_qla_host_t *vha = shost_priv(host); scsi_qla_host_t *vha = shost_priv(host);
@ -271,7 +271,7 @@ qla2x00_process_els(struct fc_bsg_job *bsg_job)
ha = vha->hw; ha = vha->hw;
type = "FC_BSG_RPT_ELS"; type = "FC_BSG_RPT_ELS";
} else { } else {
host = bsg_job->shost; host = fc_bsg_to_shost(bsg_job);
vha = shost_priv(host); vha = shost_priv(host);
ha = vha->hw; ha = vha->hw;
type = "FC_BSG_HST_ELS_NOLOGIN"; type = "FC_BSG_HST_ELS_NOLOGIN";
@ -432,7 +432,7 @@ qla2x00_process_ct(struct fc_bsg_job *bsg_job)
{ {
srb_t *sp; srb_t *sp;
struct fc_bsg_request *bsg_request = bsg_job->request; struct fc_bsg_request *bsg_request = bsg_job->request;
struct Scsi_Host *host = bsg_job->shost; struct Scsi_Host *host = fc_bsg_to_shost(bsg_job);
scsi_qla_host_t *vha = shost_priv(host); scsi_qla_host_t *vha = shost_priv(host);
struct qla_hw_data *ha = vha->hw; struct qla_hw_data *ha = vha->hw;
int rval = (DRIVER_ERROR << 16); int rval = (DRIVER_ERROR << 16);
@ -710,7 +710,7 @@ qla2x00_process_loopback(struct fc_bsg_job *bsg_job)
{ {
struct fc_bsg_request *bsg_request = bsg_job->request; struct fc_bsg_request *bsg_request = bsg_job->request;
struct fc_bsg_reply *bsg_reply = bsg_job->reply; struct fc_bsg_reply *bsg_reply = bsg_job->reply;
struct Scsi_Host *host = bsg_job->shost; struct Scsi_Host *host = fc_bsg_to_shost(bsg_job);
scsi_qla_host_t *vha = shost_priv(host); scsi_qla_host_t *vha = shost_priv(host);
struct qla_hw_data *ha = vha->hw; struct qla_hw_data *ha = vha->hw;
int rval; int rval;
@ -950,7 +950,7 @@ static int
qla84xx_reset(struct fc_bsg_job *bsg_job) qla84xx_reset(struct fc_bsg_job *bsg_job)
{ {
struct fc_bsg_request *bsg_request = bsg_job->request; struct fc_bsg_request *bsg_request = bsg_job->request;
struct Scsi_Host *host = bsg_job->shost; struct Scsi_Host *host = fc_bsg_to_shost(bsg_job);
struct fc_bsg_reply *bsg_reply = bsg_job->reply; struct fc_bsg_reply *bsg_reply = bsg_job->reply;
scsi_qla_host_t *vha = shost_priv(host); scsi_qla_host_t *vha = shost_priv(host);
struct qla_hw_data *ha = vha->hw; struct qla_hw_data *ha = vha->hw;
@ -987,7 +987,7 @@ qla84xx_updatefw(struct fc_bsg_job *bsg_job)
{ {
struct fc_bsg_request *bsg_request = bsg_job->request; struct fc_bsg_request *bsg_request = bsg_job->request;
struct fc_bsg_reply *bsg_reply = bsg_job->reply; struct fc_bsg_reply *bsg_reply = bsg_job->reply;
struct Scsi_Host *host = bsg_job->shost; struct Scsi_Host *host = fc_bsg_to_shost(bsg_job);
scsi_qla_host_t *vha = shost_priv(host); scsi_qla_host_t *vha = shost_priv(host);
struct qla_hw_data *ha = vha->hw; struct qla_hw_data *ha = vha->hw;
struct verify_chip_entry_84xx *mn = NULL; struct verify_chip_entry_84xx *mn = NULL;
@ -1099,7 +1099,7 @@ qla84xx_mgmt_cmd(struct fc_bsg_job *bsg_job)
{ {
struct fc_bsg_request *bsg_request = bsg_job->request; struct fc_bsg_request *bsg_request = bsg_job->request;
struct fc_bsg_reply *bsg_reply = bsg_job->reply; struct fc_bsg_reply *bsg_reply = bsg_job->reply;
struct Scsi_Host *host = bsg_job->shost; struct Scsi_Host *host = fc_bsg_to_shost(bsg_job);
scsi_qla_host_t *vha = shost_priv(host); scsi_qla_host_t *vha = shost_priv(host);
struct qla_hw_data *ha = vha->hw; struct qla_hw_data *ha = vha->hw;
struct access_chip_84xx *mn = NULL; struct access_chip_84xx *mn = NULL;
@ -1297,7 +1297,7 @@ qla24xx_iidma(struct fc_bsg_job *bsg_job)
{ {
struct fc_bsg_request *bsg_request = bsg_job->request; struct fc_bsg_request *bsg_request = bsg_job->request;
struct fc_bsg_reply *bsg_reply = bsg_job->reply; struct fc_bsg_reply *bsg_reply = bsg_job->reply;
struct Scsi_Host *host = bsg_job->shost; struct Scsi_Host *host = fc_bsg_to_shost(bsg_job);
scsi_qla_host_t *vha = shost_priv(host); scsi_qla_host_t *vha = shost_priv(host);
int rval = 0; int rval = 0;
struct qla_port_param *port_param = NULL; struct qla_port_param *port_param = NULL;
@ -1455,7 +1455,7 @@ static int
qla2x00_read_optrom(struct fc_bsg_job *bsg_job) qla2x00_read_optrom(struct fc_bsg_job *bsg_job)
{ {
struct fc_bsg_reply *bsg_reply = bsg_job->reply; struct fc_bsg_reply *bsg_reply = bsg_job->reply;
struct Scsi_Host *host = bsg_job->shost; struct Scsi_Host *host = fc_bsg_to_shost(bsg_job);
scsi_qla_host_t *vha = shost_priv(host); scsi_qla_host_t *vha = shost_priv(host);
struct qla_hw_data *ha = vha->hw; struct qla_hw_data *ha = vha->hw;
int rval = 0; int rval = 0;
@ -1492,7 +1492,7 @@ static int
qla2x00_update_optrom(struct fc_bsg_job *bsg_job) qla2x00_update_optrom(struct fc_bsg_job *bsg_job)
{ {
struct fc_bsg_reply *bsg_reply = bsg_job->reply; struct fc_bsg_reply *bsg_reply = bsg_job->reply;
struct Scsi_Host *host = bsg_job->shost; struct Scsi_Host *host = fc_bsg_to_shost(bsg_job);
scsi_qla_host_t *vha = shost_priv(host); scsi_qla_host_t *vha = shost_priv(host);
struct qla_hw_data *ha = vha->hw; struct qla_hw_data *ha = vha->hw;
int rval = 0; int rval = 0;
@ -1528,7 +1528,7 @@ static int
qla2x00_update_fru_versions(struct fc_bsg_job *bsg_job) qla2x00_update_fru_versions(struct fc_bsg_job *bsg_job)
{ {
struct fc_bsg_reply *bsg_reply = bsg_job->reply; struct fc_bsg_reply *bsg_reply = bsg_job->reply;
struct Scsi_Host *host = bsg_job->shost; struct Scsi_Host *host = fc_bsg_to_shost(bsg_job);
scsi_qla_host_t *vha = shost_priv(host); scsi_qla_host_t *vha = shost_priv(host);
struct qla_hw_data *ha = vha->hw; struct qla_hw_data *ha = vha->hw;
int rval = 0; int rval = 0;
@ -1580,7 +1580,7 @@ static int
qla2x00_read_fru_status(struct fc_bsg_job *bsg_job) qla2x00_read_fru_status(struct fc_bsg_job *bsg_job)
{ {
struct fc_bsg_reply *bsg_reply = bsg_job->reply; struct fc_bsg_reply *bsg_reply = bsg_job->reply;
struct Scsi_Host *host = bsg_job->shost; struct Scsi_Host *host = fc_bsg_to_shost(bsg_job);
scsi_qla_host_t *vha = shost_priv(host); scsi_qla_host_t *vha = shost_priv(host);
struct qla_hw_data *ha = vha->hw; struct qla_hw_data *ha = vha->hw;
int rval = 0; int rval = 0;
@ -1630,7 +1630,7 @@ static int
qla2x00_write_fru_status(struct fc_bsg_job *bsg_job) qla2x00_write_fru_status(struct fc_bsg_job *bsg_job)
{ {
struct fc_bsg_reply *bsg_reply = bsg_job->reply; struct fc_bsg_reply *bsg_reply = bsg_job->reply;
struct Scsi_Host *host = bsg_job->shost; struct Scsi_Host *host = fc_bsg_to_shost(bsg_job);
scsi_qla_host_t *vha = shost_priv(host); scsi_qla_host_t *vha = shost_priv(host);
struct qla_hw_data *ha = vha->hw; struct qla_hw_data *ha = vha->hw;
int rval = 0; int rval = 0;
@ -1676,7 +1676,7 @@ static int
qla2x00_write_i2c(struct fc_bsg_job *bsg_job) qla2x00_write_i2c(struct fc_bsg_job *bsg_job)
{ {
struct fc_bsg_reply *bsg_reply = bsg_job->reply; struct fc_bsg_reply *bsg_reply = bsg_job->reply;
struct Scsi_Host *host = bsg_job->shost; struct Scsi_Host *host = fc_bsg_to_shost(bsg_job);
scsi_qla_host_t *vha = shost_priv(host); scsi_qla_host_t *vha = shost_priv(host);
struct qla_hw_data *ha = vha->hw; struct qla_hw_data *ha = vha->hw;
int rval = 0; int rval = 0;
@ -1721,7 +1721,7 @@ static int
qla2x00_read_i2c(struct fc_bsg_job *bsg_job) qla2x00_read_i2c(struct fc_bsg_job *bsg_job)
{ {
struct fc_bsg_reply *bsg_reply = bsg_job->reply; struct fc_bsg_reply *bsg_reply = bsg_job->reply;
struct Scsi_Host *host = bsg_job->shost; struct Scsi_Host *host = fc_bsg_to_shost(bsg_job);
scsi_qla_host_t *vha = shost_priv(host); scsi_qla_host_t *vha = shost_priv(host);
struct qla_hw_data *ha = vha->hw; struct qla_hw_data *ha = vha->hw;
int rval = 0; int rval = 0;
@ -1770,7 +1770,7 @@ static int
qla24xx_process_bidir_cmd(struct fc_bsg_job *bsg_job) qla24xx_process_bidir_cmd(struct fc_bsg_job *bsg_job)
{ {
struct fc_bsg_reply *bsg_reply = bsg_job->reply; struct fc_bsg_reply *bsg_reply = bsg_job->reply;
struct Scsi_Host *host = bsg_job->shost; struct Scsi_Host *host = fc_bsg_to_shost(bsg_job);
scsi_qla_host_t *vha = shost_priv(host); scsi_qla_host_t *vha = shost_priv(host);
struct qla_hw_data *ha = vha->hw; struct qla_hw_data *ha = vha->hw;
uint32_t rval = EXT_STATUS_OK; uint32_t rval = EXT_STATUS_OK;
@ -1949,7 +1949,7 @@ static int
qlafx00_mgmt_cmd(struct fc_bsg_job *bsg_job) qlafx00_mgmt_cmd(struct fc_bsg_job *bsg_job)
{ {
struct fc_bsg_request *bsg_request = bsg_job->request; struct fc_bsg_request *bsg_request = bsg_job->request;
struct Scsi_Host *host = bsg_job->shost; struct Scsi_Host *host = fc_bsg_to_shost(bsg_job);
scsi_qla_host_t *vha = shost_priv(host); scsi_qla_host_t *vha = shost_priv(host);
struct qla_hw_data *ha = vha->hw; struct qla_hw_data *ha = vha->hw;
int rval = (DRIVER_ERROR << 16); int rval = (DRIVER_ERROR << 16);
@ -2072,7 +2072,7 @@ static int
qla26xx_serdes_op(struct fc_bsg_job *bsg_job) qla26xx_serdes_op(struct fc_bsg_job *bsg_job)
{ {
struct fc_bsg_reply *bsg_reply = bsg_job->reply; struct fc_bsg_reply *bsg_reply = bsg_job->reply;
struct Scsi_Host *host = bsg_job->shost; struct Scsi_Host *host = fc_bsg_to_shost(bsg_job);
scsi_qla_host_t *vha = shost_priv(host); scsi_qla_host_t *vha = shost_priv(host);
int rval = 0; int rval = 0;
struct qla_serdes_reg sr; struct qla_serdes_reg sr;
@ -2114,7 +2114,7 @@ static int
qla8044_serdes_op(struct fc_bsg_job *bsg_job) qla8044_serdes_op(struct fc_bsg_job *bsg_job)
{ {
struct fc_bsg_reply *bsg_reply = bsg_job->reply; struct fc_bsg_reply *bsg_reply = bsg_job->reply;
struct Scsi_Host *host = bsg_job->shost; struct Scsi_Host *host = fc_bsg_to_shost(bsg_job);
scsi_qla_host_t *vha = shost_priv(host); scsi_qla_host_t *vha = shost_priv(host);
int rval = 0; int rval = 0;
struct qla_serdes_reg_ex sr; struct qla_serdes_reg_ex sr;
@ -2156,7 +2156,7 @@ static int
qla27xx_get_flash_upd_cap(struct fc_bsg_job *bsg_job) qla27xx_get_flash_upd_cap(struct fc_bsg_job *bsg_job)
{ {
struct fc_bsg_reply *bsg_reply = bsg_job->reply; struct fc_bsg_reply *bsg_reply = bsg_job->reply;
struct Scsi_Host *host = bsg_job->shost; struct Scsi_Host *host = fc_bsg_to_shost(bsg_job);
scsi_qla_host_t *vha = shost_priv(host); scsi_qla_host_t *vha = shost_priv(host);
struct qla_hw_data *ha = vha->hw; struct qla_hw_data *ha = vha->hw;
struct qla_flash_update_caps cap; struct qla_flash_update_caps cap;
@ -2188,7 +2188,7 @@ static int
qla27xx_set_flash_upd_cap(struct fc_bsg_job *bsg_job) qla27xx_set_flash_upd_cap(struct fc_bsg_job *bsg_job)
{ {
struct fc_bsg_reply *bsg_reply = bsg_job->reply; struct fc_bsg_reply *bsg_reply = bsg_job->reply;
struct Scsi_Host *host = bsg_job->shost; struct Scsi_Host *host = fc_bsg_to_shost(bsg_job);
scsi_qla_host_t *vha = shost_priv(host); scsi_qla_host_t *vha = shost_priv(host);
struct qla_hw_data *ha = vha->hw; struct qla_hw_data *ha = vha->hw;
uint64_t online_fw_attr = 0; uint64_t online_fw_attr = 0;
@ -2234,7 +2234,7 @@ static int
qla27xx_get_bbcr_data(struct fc_bsg_job *bsg_job) qla27xx_get_bbcr_data(struct fc_bsg_job *bsg_job)
{ {
struct fc_bsg_reply *bsg_reply = bsg_job->reply; struct fc_bsg_reply *bsg_reply = bsg_job->reply;
struct Scsi_Host *host = bsg_job->shost; struct Scsi_Host *host = fc_bsg_to_shost(bsg_job);
scsi_qla_host_t *vha = shost_priv(host); scsi_qla_host_t *vha = shost_priv(host);
struct qla_hw_data *ha = vha->hw; struct qla_hw_data *ha = vha->hw;
struct qla_bbcr_data bbcr; struct qla_bbcr_data bbcr;
@ -2294,7 +2294,7 @@ qla2x00_get_priv_stats(struct fc_bsg_job *bsg_job)
{ {
struct fc_bsg_request *bsg_request = bsg_job->request; struct fc_bsg_request *bsg_request = bsg_job->request;
struct fc_bsg_reply *bsg_reply = bsg_job->reply; struct fc_bsg_reply *bsg_reply = bsg_job->reply;
struct Scsi_Host *host = bsg_job->shost; struct Scsi_Host *host = fc_bsg_to_shost(bsg_job);
scsi_qla_host_t *vha = shost_priv(host); scsi_qla_host_t *vha = shost_priv(host);
struct qla_hw_data *ha = vha->hw; struct qla_hw_data *ha = vha->hw;
struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev);
@ -2354,7 +2354,7 @@ static int
qla2x00_do_dport_diagnostics(struct fc_bsg_job *bsg_job) qla2x00_do_dport_diagnostics(struct fc_bsg_job *bsg_job)
{ {
struct fc_bsg_reply *bsg_reply = bsg_job->reply; struct fc_bsg_reply *bsg_reply = bsg_job->reply;
struct Scsi_Host *host = bsg_job->shost; struct Scsi_Host *host = fc_bsg_to_shost(bsg_job);
scsi_qla_host_t *vha = shost_priv(host); scsi_qla_host_t *vha = shost_priv(host);
int rval; int rval;
struct qla_dport_diag *dd; struct qla_dport_diag *dd;
@ -2489,7 +2489,7 @@ qla24xx_bsg_request(struct fc_bsg_job *bsg_job)
host = rport_to_shost(rport); host = rport_to_shost(rport);
vha = shost_priv(host); vha = shost_priv(host);
} else { } else {
host = bsg_job->shost; host = fc_bsg_to_shost(bsg_job);
vha = shost_priv(host); vha = shost_priv(host);
} }
@ -2528,7 +2528,7 @@ int
qla24xx_bsg_timeout(struct fc_bsg_job *bsg_job) qla24xx_bsg_timeout(struct fc_bsg_job *bsg_job)
{ {
struct fc_bsg_reply *bsg_reply = bsg_job->reply; struct fc_bsg_reply *bsg_reply = bsg_job->reply;
scsi_qla_host_t *vha = shost_priv(bsg_job->shost); scsi_qla_host_t *vha = shost_priv(fc_bsg_to_shost(bsg_job));
struct qla_hw_data *ha = vha->hw; struct qla_hw_data *ha = vha->hw;
srb_t *sp; srb_t *sp;
int cnt, que; int cnt, que;

View File

@ -3639,7 +3639,7 @@ static enum blk_eh_timer_return
fc_bsg_job_timeout(struct request *req) fc_bsg_job_timeout(struct request *req)
{ {
struct fc_bsg_job *job = (void *) req->special; struct fc_bsg_job *job = (void *) req->special;
struct Scsi_Host *shost = job->shost; struct Scsi_Host *shost = fc_bsg_to_shost(job);
struct fc_internal *i = to_fc_internal(shost->transportt); struct fc_internal *i = to_fc_internal(shost->transportt);
unsigned long flags; unsigned long flags;
int err = 0, done = 0; int err = 0, done = 0;

View File

@ -819,6 +819,11 @@ fc_vport_set_state(struct fc_vport *vport, enum fc_vport_state new_state)
vport->vport_state = new_state; vport->vport_state = new_state;
} }
static inline struct Scsi_Host *fc_bsg_to_shost(struct fc_bsg_job *job)
{
return job->shost;
}
struct scsi_transport_template *fc_attach_transport( struct scsi_transport_template *fc_attach_transport(
struct fc_function_template *); struct fc_function_template *);
void fc_release_transport(struct scsi_transport_template *); void fc_release_transport(struct scsi_transport_template *);