> +
> +/**
> + * ufshcd_eh_device_reset_handler - device reset handler registered to
> + * scsi layer.
> + * @cmd - SCSI command pointer
> + *
> + * Returns SUCCESS/FAILED
> + */
> +static int ufshcd_eh_device_reset_handler(struct scsi_cmnd *cmd)
> +{
> + struct ufs_hba *hba;
> + int err;
> + unsigned long flags;
> +
> + hba = shost_priv(cmd->device->host);
> +
> + spin_lock_irqsave(hba->host->host_lock, flags);
> + if (hba->ufshcd_state == UFSHCD_STATE_RESET) {
> + dev_warn(hba->dev, "%s: reset in progress\n", __func__);
> + err = SUCCESS;
> + spin_unlock_irqrestore(hba->host->host_lock, flags);
> + goto out;
It is better to wait here until the state changes to 'operational' or
'error' before returning success.
> + }
> +
> + hba->ufshcd_state = UFSHCD_STATE_RESET;
> + ufshcd_set_device_reset_pending(hba);
> + spin_unlock_irqrestore(hba->host->host_lock, flags);
> +
> + err = ufshcd_reset_and_restore(hba);
> +
> + spin_lock_irqsave(hba->host->host_lock, flags);
> + if (!err) {
> + err = SUCCESS;
> + hba->ufshcd_state = UFSHCD_STATE_OPERATIONAL;
> + } else {
> + err = FAILED;
> + hba->ufshcd_state = UFSHCD_STATE_ERROR;
> + }
> + spin_unlock_irqrestore(hba->host->host_lock, flags);
> +out:
> + return err;
> +}
> +
> +/**
> + * ufshcd_eh_host_reset_handler - host reset handler registered to scsi layer
> + * @cmd - SCSI command pointer
> + *
> + * Returns SUCCESS/FAILED
> + */
> +static int ufshcd_eh_host_reset_handler(struct scsi_cmnd *cmd)
> +{
> + struct ufs_hba *hba;
> + int err;
> + unsigned long flags;
> +
> + hba = shost_priv(cmd->device->host);
> +
> + spin_lock_irqsave(hba->host->host_lock, flags);
> + if (hba->ufshcd_state == UFSHCD_STATE_RESET) {
> + dev_warn(hba->dev, "%s: reset in progress\n", __func__);
> + err = SUCCESS;
> + spin_unlock_irqrestore(hba->host->host_lock, flags);
> + goto out;
same in this case also.
> + }
> +
> + hba->ufshcd_state = UFSHCD_STATE_RESET;
> + ufshcd_set_host_reset_pending(hba);
> + spin_unlock_irqrestore(hba->host->host_lock, flags);
> +
> + err = ufshcd_reset_and_restore(hba);
> +
> + spin_lock_irqsave(hba->host->host_lock, flags);
> + if (!err) {
> + err = SUCCESS;
> + hba->ufshcd_state = UFSHCD_STATE_OPERATIONAL;
> + } else {
> + err = FAILED;
> + hba->ufshcd_state = UFSHCD_STATE_ERROR;
> + }
> + spin_unlock_irqrestore(hba->host->host_lock, flags);
> +out:
> + return err;
> +}
> +
> +/**
--
~Santosh
--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html