public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Bean Huo <beanhuo@iokpp.de>,
	avri.altman@wdc.com, alim.akhtar@samsung.com, jejb@linux.ibm.com,
	martin.petersen@oracle.com, stanley.chu@mediatek.com,
	mani@kernel.org, quic_cang@quicinc.com,
	quic_asutoshd@quicinc.com, beanhuo@micron.com
Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
	mikebi@micron.com, lporzio@micron.com
Subject: Re: [PATCH v1 1/2] scsi: ufs: core: Add UFS RTC support
Date: Thu, 9 Nov 2023 10:06:02 -0800	[thread overview]
Message-ID: <e1ac57a7-920f-44c4-92d3-960811edede9@acm.org> (raw)
In-Reply-To: <20231109125217.185462-2-beanhuo@iokpp.de>

On 11/9/23 04:52, Bean Huo wrote:
> The objective of this patch is to incorporate Real Time Clock (RTC) support in Universal
> Flash Storage (UFS) device. This enhancement is crucial for the internal maintenance
> operations of the UFS device.

That sounds vague. Please explain why a UFS device should know the real
time since other storage devices don't need to know the real time.

> +		dev_info->rtc_time_baseline = mktime64(2010, 1, 1, 0, 0, 0) -
> +								mktime64(1970, 1, 1, 0, 0, 0);

The formatting of the above code is not compliant with the kernel coding
style. Please consider reformatting this patch with e.g.
git clang-format HEAD^.

> +	schedule_delayed_work(&hba->ufs_rtc_delayed_work,
> +							msecs_to_jiffies(UFS_RTC_UPDATE_EVERY_MS));

The formatting of the above code is not compliant with the style guide
either.

> @@ -9746,6 +9834,8 @@ static int __ufshcd_wl_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
>   	ret = ufshcd_vops_suspend(hba, pm_op, POST_CHANGE);
>   	if (ret)
>   		goto set_link_active;
> +
> +	cancel_delayed_work(&hba->ufs_rtc_delayed_work);

Why cancel_delayed_work() instead of cancel_delayed_work_sync()?

> @@ -9840,6 +9930,8 @@ static int __ufshcd_wl_resume(struct ufs_hba *hba, enum ufs_pm_op pm_op)
>   		if (ret)
>   			goto set_old_link_state;
>   		ufshcd_set_timestamp_attr(hba);
> +		schedule_delayed_work(&hba->ufs_rtc_delayed_work,
> +							msecs_to_jiffies(UFS_RTC_UPDATE_EVERY_MS));

The name of the constant "UFS_RTC_UPDATE_EVERY_MS" suggests that the
real-time clock is updated 1000 times per second while the comment above
the UFS_RTC_UPDATE_EVERY_MS constant says that it is updated once every
ten seconds. Please choose a better name for UFS_RTC_UPDATE_EVERY_MS,
e.g. UFS_RTC_UPDATE_INTERVAL_MS.

> diff --git a/include/ufs/ufs.h b/include/ufs/ufs.h
> index e77ab1786856..18b39c6b3a97 100644
> --- a/include/ufs/ufs.h
> +++ b/include/ufs/ufs.h
> @@ -14,6 +14,7 @@
>   #include <linux/bitops.h>
>   #include <linux/types.h>
>   #include <uapi/scsi/scsi_bsg_ufs.h>
> +#include <linux/rtc.h>

The include/ufs/ufs.h header file does not depend on anything declared
in <linux/rtc.h> so please move the above include directive into a .c
file.

> +	struct delayed_work ufs_rtc_delayed_work;

Please change the name of this structure member into
ufs_rtc_update_work.

Thanks,

Bart.


  parent reply	other threads:[~2023-11-09 18:06 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-09 12:52 [PATCH v1 0/2] Add UFS RTC support Bean Huo
2023-11-09 12:52 ` [PATCH v1 1/2] scsi: ufs: core: " Bean Huo
2023-11-09 14:05   ` Thomas Weißschuh
2023-11-14 18:27     ` Bean Huo
2023-11-14 18:53       ` Thomas Weißschuh
2023-11-09 15:09   ` Avri Altman
2023-11-14 18:42     ` Bean Huo
2023-11-09 18:06   ` Bart Van Assche [this message]
2023-11-09 12:52 ` [PATCH v1 2/2] scsi: ufs: core: Add sysfs node for UFS RTC update Bean Huo
2023-11-09 14:05   ` Thomas Weißschuh
2023-11-14 18:39     ` Bean Huo
2023-11-14 18:48       ` Thomas Weißschuh
2023-11-09 15:10   ` Avri Altman
2023-11-09 18:07   ` Bart Van Assche
2023-11-14 18:46     ` Bean Huo
2023-11-12  2:02   ` kernel test robot
2023-11-09 15:10 ` [PATCH v1 0/2] Add UFS RTC support Avri Altman
2023-11-09 18:07 ` 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=e1ac57a7-920f-44c4-92d3-960811edede9@acm.org \
    --to=bvanassche@acm.org \
    --cc=alim.akhtar@samsung.com \
    --cc=avri.altman@wdc.com \
    --cc=beanhuo@iokpp.de \
    --cc=beanhuo@micron.com \
    --cc=jejb@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=lporzio@micron.com \
    --cc=mani@kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=mikebi@micron.com \
    --cc=quic_asutoshd@quicinc.com \
    --cc=quic_cang@quicinc.com \
    --cc=stanley.chu@mediatek.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