From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
To: Vamshi Gajjela <vamshigajjela@google.com>
Cc: Alim Akhtar <alim.akhtar@samsung.com>,
Avri Altman <avri.altman@wdc.com>,
Bart Van Assche <bvanassche@acm.org>,
linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH] scsi: ufs: core: Fix link_startup_again on success
Date: Tue, 26 Nov 2024 10:22:06 +0530 [thread overview]
Message-ID: <20241126045206.v64iypeiyt22lcei@thinkpad> (raw)
In-Reply-To: <20241125125338.905146-1-vamshigajjela@google.com>
On Mon, Nov 25, 2024 at 06:23:37PM +0530, Vamshi Gajjela wrote:
> Set link_startup_again to false after a successful
> ufshcd_dme_link_startup operation and confirmation of device presence.
> Prevents unnecessary link startup attempts when the previous operation
> has succeeded.
>
> Signed-off-by: Vamshi Gajjela <vamshigajjela@google.com>
> Fixes: 7caf489b99a4 ("scsi: ufs: issue link starup 2 times if device isn't active")
> Cc: stable@vger.kernel.org
> ---
> drivers/ufs/core/ufshcd.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> index abbe7135a977..cc1d15002ab5 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -4994,6 +4994,10 @@ static int ufshcd_link_startup(struct ufs_hba *hba)
> goto out;
> }
>
> + /* link_startup success and device is present */
> + if (!ret && ufshcd_is_device_present(hba))
> + link_startup_again = false;
> +
Using 'link_startup_again' flag looks messy. Can't we just check the device
state after first link startup and if it is still not active, then try link
startup one more time? (Assuming that the device state won't be active after
first link startup).
Also, we should move the link startup and its associated check to a helper
function and call them instead of (ab)using the goto label.
Like,
ret = __ufshcd_link_startup()
if (ret)
goto fail
/* try link startup one more time if the device is not active */
if (!ufshcd_is_ufs_dev_active()) {
ret = __ufshcd_link_startup()
if (ret)
goto fail
}
- Mani
> /*
> * DME link lost indication is only received when link is up,
> * but we can't be sure if the link is up until link startup
> --
> 2.47.0.371.ga323438b13-goog
>
--
மணிவண்ணன் சதாசிவம்
prev parent reply other threads:[~2024-11-26 4:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-25 12:53 Vamshi Gajjela
2024-11-25 17:10 ` Bart Van Assche
2024-11-26 4:52 ` Manivannan Sadhasivam [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241126045206.v64iypeiyt22lcei@thinkpad \
--to=manivannan.sadhasivam@linaro.org \
--cc=alim.akhtar@samsung.com \
--cc=avri.altman@wdc.com \
--cc=bvanassche@acm.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=vamshigajjela@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®