From: Bart Van Assche <bvanassche@acm.org>
To: Anjana Hari <quic_ahari@quicinc.com>,
agross@kernel.org, andersson@kernel.org, jejb@linux.ibm.com,
martin.petersen@oracle.com
Cc: alim.akhtar@samsung.com, avri.altman@wdc.com,
konrad.dybcio@linaro.org, linux-scsi@vger.kernel.org,
linux-kernel@vger.kernel.org, quic_narepall@quicinc.com,
quic_nitirawa@quicinc.com, quic_rampraka@quicinc.com
Subject: Re: [PATCH v3 1/1] scsi: ufs: Add hibernation callbacks
Date: Fri, 20 Jan 2023 13:27:05 -0800 [thread overview]
Message-ID: <9800d704-c436-a924-c2bb-ccdf51e86716@acm.org> (raw)
In-Reply-To: <20230120113321.30433-2-quic_ahari@quicinc.com>
On 1/20/23 03:33, Anjana Hari wrote:
> + /* Make sure that UTRL and UTMRL base address registers
> + * are updated with the latest queue addresses. Only after
> + * updating these addresses, we can queue the new commands.
> + */
Please follow the kernel coding style and start comment blocks with "/*"
on a line by its own.
> + /* Resuming from hibernate, assume that link was OFF */
> + if (hba->restore)
> + ufshcd_set_link_off(hba);
Why two successive 'if (hba->restore)' statements? Can these two
if-statements be combined into a single if-statement?
> +int ufshcd_system_freeze(struct device *dev)
> +{
> +
> + struct ufs_hba *hba = dev_get_drvdata(dev);
> + int ret = 0;
> +
> + /*
> + * Run time resume the controller to make sure
> + * the PM work queue threads do not try to resume
> + * the child (scsi host), which leads to errors as
> + * the controller is not yet resumed.
> + */
> + pm_runtime_get_sync(hba->dev);
> + ret = ufshcd_system_suspend(dev);
> + pm_runtime_put_sync(hba->dev);
> +
> + return ret;
> +}
> +EXPORT_SYMBOL_GPL(ufshcd_system_freeze);
Why does the above function use 'hba->dev' instead of 'dev'?
I do not understand the comment in the above function. My understanding
is that the power management core serializes hibernation and runtime
power management. How could runtime resume be in progress when
ufshcd_system_freeze() is called? Additionally, shouldn't
ufshcd_system_freeze() skip the UFS controller if it is already runtime
suspended instead of runtime resuming it? Some time ago I added the
following code in sd_suspend_system() (commit 9131bff6a9f1 ("scsi: core:
pm: Only runtime resume if necessary"):
if (pm_runtime_suspended(dev))
return 0;
Thanks,
Bart.
next prev parent reply other threads:[~2023-01-20 21:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-20 11:33 [PATCH v3 0/1] " Anjana Hari
2023-01-20 11:33 ` [PATCH v3 1/1] " Anjana Hari
2023-01-20 21:27 ` Bart Van Assche [this message]
2023-01-21 4:42 ` kernel test robot
2023-01-21 4:42 ` kernel test robot
2023-01-20 21:12 ` [PATCH v3 0/1] " Bart Van Assche
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=9800d704-c436-a924-c2bb-ccdf51e86716@acm.org \
--to=bvanassche@acm.org \
--cc=agross@kernel.org \
--cc=alim.akhtar@samsung.com \
--cc=andersson@kernel.org \
--cc=avri.altman@wdc.com \
--cc=jejb@linux.ibm.com \
--cc=konrad.dybcio@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=quic_ahari@quicinc.com \
--cc=quic_narepall@quicinc.com \
--cc=quic_nitirawa@quicinc.com \
--cc=quic_rampraka@quicinc.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®