Skip to content

Commit 1afca6b

Browse files
Dupuis, Chadmartinkpetersen
authored andcommitted
scsi: qedf: fixup compilation warning about atomic_t usage
Based on an original patch by Hannes Reinecke. The driver didn't follow the atomic_t vs refcount_t change, and anyway one should be using kref_read() instead of accessing the counter inside an kref. Fixes: 61d8658 ("scsi: qedf: Add QLogic FastLinQ offload FCoE driver framework.) Cc: Hannes Reinecke <[email protected]> Cc: Nilesh Javali <[email protected]> Signed-off-by: Dupuis, Chad <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent fcbfffe commit 1afca6b

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

drivers/scsi/qedf/qedf_els.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ static void qedf_rrq_compl(struct qedf_els_cb_arg *cb_arg)
183183
rrq_req->event != QEDF_IOREQ_EV_ELS_ERR_DETECT)
184184
cancel_delayed_work_sync(&orig_io_req->timeout_work);
185185

186-
refcount = atomic_read(&orig_io_req->refcount.refcount);
186+
refcount = kref_read(&orig_io_req->refcount);
187187
QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_ELS, "rrq_compl: orig io = %p,"
188188
" orig xid = 0x%x, rrq_xid = 0x%x, refcount=%d\n",
189189
orig_io_req, orig_io_req->xid, rrq_req->xid, refcount);
@@ -474,7 +474,7 @@ static void qedf_srr_compl(struct qedf_els_cb_arg *cb_arg)
474474
srr_req->event != QEDF_IOREQ_EV_ELS_ERR_DETECT)
475475
cancel_delayed_work_sync(&orig_io_req->timeout_work);
476476

477-
refcount = atomic_read(&orig_io_req->refcount.refcount);
477+
refcount = kref_read(&orig_io_req->refcount);
478478
QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_ELS, "Entered: orig_io=%p,"
479479
" orig_io_xid=0x%x, rec_xid=0x%x, refcount=%d\n",
480480
orig_io_req, orig_io_req->xid, srr_req->xid, refcount);
@@ -758,7 +758,7 @@ static void qedf_rec_compl(struct qedf_els_cb_arg *cb_arg)
758758
rec_req->event != QEDF_IOREQ_EV_ELS_ERR_DETECT)
759759
cancel_delayed_work_sync(&orig_io_req->timeout_work);
760760

761-
refcount = atomic_read(&orig_io_req->refcount.refcount);
761+
refcount = kref_read(&orig_io_req->refcount);
762762
QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_ELS, "Entered: orig_io=%p,"
763763
" orig_io_xid=0x%x, rec_xid=0x%x, refcount=%d\n",
764764
orig_io_req, orig_io_req->xid, rec_req->xid, refcount);

drivers/scsi/qedf/qedf_io.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -998,7 +998,7 @@ static void qedf_trace_io(struct qedf_rport *fcport, struct qedf_ioreq *io_req,
998998
io_log->sg_count = scsi_sg_count(sc_cmd);
999999
io_log->result = sc_cmd->result;
10001000
io_log->jiffies = jiffies;
1001-
io_log->refcount = atomic_read(&io_req->refcount.refcount);
1001+
io_log->refcount = kref_read(&io_req->refcount);
10021002

10031003
if (direction == QEDF_IO_TRACE_REQ) {
10041004
/* For requests we only care abot the submission CPU */
@@ -1340,7 +1340,7 @@ void qedf_scsi_completion(struct qedf_ctx *qedf, struct fcoe_cqe *cqe,
13401340
/* Good I/O completion */
13411341
sc_cmd->result = DID_OK << 16;
13421342
} else {
1343-
refcount = atomic_read(&io_req->refcount.refcount);
1343+
refcount = kref_read(&io_req->refcount);
13441344
QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_IO,
13451345
"%d:0:%d:%d xid=0x%0x op=0x%02x "
13461346
"lba=%02x%02x%02x%02x cdb_status=%d "
@@ -1425,7 +1425,7 @@ void qedf_scsi_done(struct qedf_ctx *qedf, struct qedf_ioreq *io_req,
14251425
qedf_unmap_sg_list(qedf, io_req);
14261426

14271427
sc_cmd->result = result << 16;
1428-
refcount = atomic_read(&io_req->refcount.refcount);
1428+
refcount = kref_read(&io_req->refcount);
14291429
QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_IO, "%d:0:%d:%d: Completing "
14301430
"sc_cmd=%p result=0x%08x op=0x%02x lba=0x%02x%02x%02x%02x, "
14311431
"allowed=%d retries=%d refcount=%d.\n",
@@ -1556,7 +1556,7 @@ static void qedf_flush_els_req(struct qedf_ctx *qedf,
15561556
{
15571557
QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_IO,
15581558
"Flushing ELS request xid=0x%x refcount=%d.\n", els_req->xid,
1559-
atomic_read(&els_req->refcount.refcount));
1559+
kref_read(&els_req->refcount));
15601560

15611561
/*
15621562
* Need to distinguish this from a timeout when calling the

0 commit comments

Comments
 (0)