From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Dolev Raviv" Subject: Re: [PATCH V3 09/16] scsi: ufs: introduce well known logical unit in ufs Date: Mon, 15 Sep 2014 10:39:40 -0000 Message-ID: References: <1410350063-23267-1-git-send-email-draviv@codeaurora.org> <1410350063-23267-10-git-send-email-draviv@codeaurora.org> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7BIT Return-path: Received: from smtp.codeaurora.org ([198.145.11.231]:33963 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753675AbaIOKlq (ORCPT ); Mon, 15 Sep 2014 06:41:46 -0400 In-Reply-To: Sender: linux-arm-msm-owner@vger.kernel.org List-Id: linux-arm-msm@vger.kernel.org To: Akinobu Mita Cc: Dolev Raviv , Jej B , Christoph Hellwig , linux-scsi@vger.kernel.org, linux-scsi-owner@vger.kernel.org, linux-arm-msm@vger.kernel.org, Santosh Y , Subhash Jadavani , Sujit Reddy Thumma > 2014-09-10 20:54 GMT+09:00 Dolev Raviv : >> +static void ufshcd_set_queue_depth(struct scsi_device *sdev) >> +{ >> + int ret = 0; >> + u8 lun_qdepth; >> + struct ufs_hba *hba; >> + >> + hba = shost_priv(sdev->host); >> + >> + lun_qdepth = hba->nutrs; >> + ret = ufshcd_read_unit_desc_param(hba, >> + >> ufshcd_scsi_to_upiu_lun(sdev->lun), >> + UNIT_DESC_PARAM_LU_Q_DEPTH, >> + &lun_qdepth, >> + sizeof(lun_qdepth)); >> + >> + /* Some WLUN doesn't support unit descriptor */ >> + if (ret == -EOPNOTSUPP) >> + lun_qdepth = 1; >> + else if (!lun_qdepth) >> + /* eventually, we can figure out the real queue depth */ >> + lun_qdepth = hba->nutrs; >> + else >> + lun_qdepth = min_t(int, lun_qdepth, hba->nutrs); > > If ufshcd_read_unit_desc_param() failed and its error code was not > -EOPNOTSUPP, lun_qdepth is undefined. In such cases lun_qdepth > should be 1? I'm not sure I follow your concern. If this lun does not support command queuing (ret == -EOPNOTSUPP) obviously, lun_qdepth should be 1. If there was an error and lun_qdepth, was returned as 0, hba->nutrs will be our default choice. last, even if the query succeed we want to make sure we don't exceed the hba->nutrs. Thanks, Dolev > -- > To unsubscribe from this list: send the line "unsubscribe linux-scsi" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > -- QUALCOMM ISRAEL, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation