Re: [PATCH 2/4] mpt3sas: Fix for Crusader to achieve product targets with SAS devices.
From: Bart Van Assche
Date: Thu Jan 19 2017 - 11:05:56 EST
On Thu, 2017-01-19 at 21:19 +0530, Chaitra P B wrote:
> diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
> index 5ffbfb1..b3f9f7a 100644
> --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
> +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
> @@ -1096,6 +1096,27 @@ _scsih_scsi_lookup_get_clear(struct MPT3SAS_ADAPTER *ioc, u16 smid)
> }
>
> /**
> + * _scsih_scsi_lookup_get_clear_without_lock - returns scmd entry without
> + * holding any lock.
> + * @ioc: per adapter object
> + * @smid: system request message index
> + *
> + * Returns the smid stored scmd pointer.
> + * Then will derefrence the stored scmd pointer.
> + */
> +static inline struct scsi_cmnd *
> +_scsih_scsi_lookup_get_clear_without_lock(struct MPT3SAS_ADAPTER *ioc,
> + u16 smid)
> +{
> + struct scsi_cmnd *scmd;
> +
> + scmd = ioc->scsi_lookup[smid - 1].scmd;
> + ioc->scsi_lookup[smid - 1].scmd = NULL;
> +
> + return scmd;
> +}
Please make the following changes in the above code:
* Use swap() instead of open-coding it.
* Call _scsih_scsi_lookup_get_clear_without_lock() from
_scsih_scsi_lookup_get_clear() to avoid code duplication.
* Fix the spelling of "dereference".
Thanks,
Bart.