Re: [PATCH V4] scsi: ufs: add support for query requests

From: Santosh Y
Date: Thu May 02 2013 - 04:24:57 EST


> +
> +/**
> + * ufshcd_compose_upiu - form UFS Protocol Information Unit(UPIU)
> + * @hba - UFS hba
> + * @lrb - pointer to local reference block
> + */
> +static int ufshcd_compose_upiu(struct ufs_hba *hba, struct ufshcd_lrb *lrbp)
> +{
> + u32 upiu_flags;
> + int ret = 0;
> +
> + switch (lrbp->command_type) {
> + case UTP_CMD_TYPE_SCSI:
> case UTP_CMD_TYPE_DEV_MANAGE:
> - /* For query function implementation */
> + ufshcd_prepare_req_desc(lrbp, &upiu_flags);
> + if (lrbp->cmd && lrbp->command_type == UTP_CMD_TYPE_SCSI)

Sorry, probably missed it in the initial review. Here no need to check
for 'lrbp->cmd'.

> + ufshcd_prepare_utp_scsi_cmd_upiu(lrbp, upiu_flags);
> + else if (lrbp->cmd)

no need to check here also

> + ufshcd_prepare_utp_query_req_upiu(hba, lrbp,
> + upiu_flags);
> + else {
> + dev_err(hba->dev, "%s: Invalid UPIU request\n",
> + __func__);
> + ret = -EINVAL;
> + }

remove this else part, this condition will never be true.

> break;
> case UTP_CMD_TYPE_UFS:
> /* For UFS native command implementation */
> + dev_err(hba->dev, "%s: UFS native command are not supported\n",
> + __func__);
> + ret = -ENOTSUPP;
> + break;
> + default:
> + ret = -ENOTSUPP;
> + dev_err(hba->dev, "%s: unknown command type: 0x%x\n",
> + __func__, lrbp->command_type);
> break;
> } /* end of switch */
> +
> + return ret;
> }
>


--
~Santosh
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/