scsi: mpt3sas: Introduce mpt3sas_get_st_from_smid()
Abstract accesses to the scsi_lookup array by introducing mpt3sas_get_st_from_smid(). Signed-off-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Suganath Prabu S <suganath-prabu.subramani@broadcom.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:

committed by
Martin K. Petersen

parent
02a386df36
commit
12e7c6782b
@@ -888,6 +888,15 @@ _base_async_event(struct MPT3SAS_ADAPTER *ioc, u8 msix_index, u32 reply)
|
||||
return 1;
|
||||
}
|
||||
|
||||
struct scsiio_tracker *
|
||||
mpt3sas_get_st_from_smid(struct MPT3SAS_ADAPTER *ioc, u16 smid)
|
||||
{
|
||||
if (WARN_ON(!smid) ||
|
||||
WARN_ON(smid >= ioc->hi_priority_smid))
|
||||
return NULL;
|
||||
return &ioc->scsi_lookup[smid - 1];
|
||||
}
|
||||
|
||||
/**
|
||||
* _base_get_cb_idx - obtain the callback index
|
||||
* @ioc: per adapter object
|
||||
@@ -902,8 +911,11 @@ _base_get_cb_idx(struct MPT3SAS_ADAPTER *ioc, u16 smid)
|
||||
u8 cb_idx = 0xFF;
|
||||
|
||||
if (smid < ioc->hi_priority_smid) {
|
||||
i = smid - 1;
|
||||
cb_idx = ioc->scsi_lookup[i].cb_idx;
|
||||
struct scsiio_tracker *st;
|
||||
|
||||
st = mpt3sas_get_st_from_smid(ioc, smid);
|
||||
if (st)
|
||||
cb_idx = st->cb_idx;
|
||||
} else if (smid < ioc->internal_smid) {
|
||||
i = smid - ioc->hi_priority_smid;
|
||||
cb_idx = ioc->hpr_lookup[i].cb_idx;
|
||||
@@ -1294,6 +1306,7 @@ static struct chain_tracker *
|
||||
_base_get_chain_buffer_tracker(struct MPT3SAS_ADAPTER *ioc, u16 smid)
|
||||
{
|
||||
struct chain_tracker *chain_req;
|
||||
struct scsiio_tracker *st;
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&ioc->scsi_lookup_lock, flags);
|
||||
@@ -1306,8 +1319,9 @@ _base_get_chain_buffer_tracker(struct MPT3SAS_ADAPTER *ioc, u16 smid)
|
||||
chain_req = list_entry(ioc->free_chain_list.next,
|
||||
struct chain_tracker, tracker_list);
|
||||
list_del_init(&chain_req->tracker_list);
|
||||
list_add_tail(&chain_req->tracker_list,
|
||||
&ioc->scsi_lookup[smid - 1].chain_list);
|
||||
st = mpt3sas_get_st_from_smid(ioc, smid);
|
||||
if (st)
|
||||
list_add_tail(&chain_req->tracker_list, &st->chain_list);
|
||||
spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags);
|
||||
return chain_req;
|
||||
}
|
||||
|
Reference in New Issue
Block a user