Skip to content

Commit 5e2053a

Browse files
bvanasschemartinkpetersen
authored andcommitted
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: Peter Wang <peter.wang@mediatek.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Link: https://lore.kernel.org/r/20240708211716.2827751-10-bvanassche@acm.org Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 7e2c268 commit 5e2053a

File tree

2 files changed

+11
-15
lines changed

2 files changed

+11
-15
lines changed

drivers/ufs/core/ufs-mcq.c

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -144,14 +144,14 @@ EXPORT_SYMBOL_GPL(ufshcd_mcq_queue_cfg_addr);
144144
*/
145145
int ufshcd_mcq_decide_queue_depth(struct ufs_hba *hba)
146146
{
147-
int mac;
147+
int mac = -EOPNOTSUPP;
148148

149-
/* Mandatory to implement get_hba_mac() */
150-
mac = ufshcd_mcq_vops_get_hba_mac(hba);
151-
if (mac < 0) {
152-
dev_err(hba->dev, "Failed to get mac, err=%d\n", mac);
153-
return mac;
154-
}
149+
if (!hba->vops || !hba->vops->get_hba_mac)
150+
goto err;
151+
152+
mac = hba->vops->get_hba_mac(hba);
153+
if (mac < 0)
154+
goto err;
155155

156156
WARN_ON_ONCE(!hba->dev_info.bqueuedepth);
157157
/*
@@ -160,6 +160,10 @@ int ufshcd_mcq_decide_queue_depth(struct ufs_hba *hba)
160160
* shared queuing architecture is enabled.
161161
*/
162162
return min_t(int, mac, hba->dev_info.bqueuedepth);
163+
164+
err:
165+
dev_err(hba->dev, "Failed to get mac, err=%d\n", mac);
166+
return mac;
163167
}
164168

165169
static int ufshcd_mcq_config_nr_queues(struct ufs_hba *hba)

drivers/ufs/core/ufshcd-priv.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -249,14 +249,6 @@ static inline int ufshcd_vops_mcq_config_resource(struct ufs_hba *hba)
249249
return -EOPNOTSUPP;
250250
}
251251

252-
static inline int ufshcd_mcq_vops_get_hba_mac(struct ufs_hba *hba)
253-
{
254-
if (hba->vops && hba->vops->get_hba_mac)
255-
return hba->vops->get_hba_mac(hba);
256-
257-
return -EOPNOTSUPP;
258-
}
259-
260252
static inline int ufshcd_mcq_vops_op_runtime_config(struct ufs_hba *hba)
261253
{
262254
if (hba->vops && hba->vops->op_runtime_config)

0 commit comments

Comments
 (0)