Commit 5e2053a4 authored by Bart Van Assche's avatar Bart Van Assche Committed by Martin K. Petersen

scsi: ufs: mcq: Inline ufshcd_mcq_vops_get_hba_mac()

Make ufshcd_mcq_decide_queue_depth() easier to read by inlining
ufshcd_mcq_vops_get_hba_mac().
Reviewed-by: default avatarPeter Wang <peter.wang@mediatek.com>
Signed-off-by: default avatarBart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20240708211716.2827751-10-bvanassche@acm.orgReviewed-by: default avatarManivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 7e2c268d
...@@ -144,14 +144,14 @@ EXPORT_SYMBOL_GPL(ufshcd_mcq_queue_cfg_addr); ...@@ -144,14 +144,14 @@ EXPORT_SYMBOL_GPL(ufshcd_mcq_queue_cfg_addr);
*/ */
int ufshcd_mcq_decide_queue_depth(struct ufs_hba *hba) int ufshcd_mcq_decide_queue_depth(struct ufs_hba *hba)
{ {
int mac; int mac = -EOPNOTSUPP;
/* Mandatory to implement get_hba_mac() */ if (!hba->vops || !hba->vops->get_hba_mac)
mac = ufshcd_mcq_vops_get_hba_mac(hba); goto err;
if (mac < 0) {
dev_err(hba->dev, "Failed to get mac, err=%d\n", mac); mac = hba->vops->get_hba_mac(hba);
return mac; if (mac < 0)
} goto err;
WARN_ON_ONCE(!hba->dev_info.bqueuedepth); WARN_ON_ONCE(!hba->dev_info.bqueuedepth);
/* /*
...@@ -160,6 +160,10 @@ int ufshcd_mcq_decide_queue_depth(struct ufs_hba *hba) ...@@ -160,6 +160,10 @@ int ufshcd_mcq_decide_queue_depth(struct ufs_hba *hba)
* shared queuing architecture is enabled. * shared queuing architecture is enabled.
*/ */
return min_t(int, mac, hba->dev_info.bqueuedepth); return min_t(int, mac, hba->dev_info.bqueuedepth);
err:
dev_err(hba->dev, "Failed to get mac, err=%d\n", mac);
return mac;
} }
static int ufshcd_mcq_config_nr_queues(struct ufs_hba *hba) static int ufshcd_mcq_config_nr_queues(struct ufs_hba *hba)
......
...@@ -249,14 +249,6 @@ static inline int ufshcd_vops_mcq_config_resource(struct ufs_hba *hba) ...@@ -249,14 +249,6 @@ static inline int ufshcd_vops_mcq_config_resource(struct ufs_hba *hba)
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
static inline int ufshcd_mcq_vops_get_hba_mac(struct ufs_hba *hba)
{
if (hba->vops && hba->vops->get_hba_mac)
return hba->vops->get_hba_mac(hba);
return -EOPNOTSUPP;
}
static inline int ufshcd_mcq_vops_op_runtime_config(struct ufs_hba *hba) static inline int ufshcd_mcq_vops_op_runtime_config(struct ufs_hba *hba)
{ {
if (hba->vops && hba->vops->op_runtime_config) if (hba->vops && hba->vops->op_runtime_config)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment