All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nathan Chancellor <nathan@kernel.org>
To: Alex Deucher <alexander.deucher@amd.com>
Cc: Aric Cyr <Aric.Cyr@amd.com>, Anthony Koo <Anthony.Koo@amd.com>,
	kernel test robot <lkp@intel.com>,
	amd-gfx@lists.freedesktop.org, Angus Wang <Angus.Wang@amd.com>
Subject: Re: [PATCH] drm/amd/display: fix 64 bit divide in freesync code
Date: Thu, 7 Apr 2022 16:31:43 -0700	[thread overview]
Message-ID: <Yk90X7v8hIgmX5Q5@dev-arch.thelio-3990X> (raw)
In-Reply-To: <20220407195029.1581581-1-alexander.deucher@amd.com>

On Thu, Apr 07, 2022 at 03:50:29PM -0400, Alex Deucher wrote:
> Use do_div() rather than a a 64 bit divide.
> 
> Fixes: 3fe5739db48843 ("drm/amd/display: Add flip interval workaround")
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> Cc: Angus Wang <Angus.Wang@amd.com>
> Cc: Anthony Koo <Anthony.Koo@amd.com>
> Cc: Aric Cyr <Aric.Cyr@amd.com>
> ---
>  drivers/gpu/drm/amd/display/modules/freesync/freesync.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/display/modules/freesync/freesync.c b/drivers/gpu/drm/amd/display/modules/freesync/freesync.c
> index 0130f1879116..70f06fa8cc2b 100644
> --- a/drivers/gpu/drm/amd/display/modules/freesync/freesync.c
> +++ b/drivers/gpu/drm/amd/display/modules/freesync/freesync.c
> @@ -1230,6 +1230,7 @@ void mod_freesync_handle_v_update(struct mod_freesync *mod_freesync,
>  {
>  	struct core_freesync *core_freesync = NULL;
>  	unsigned int cur_timestamp_in_us;
> +	unsigned long long tmp;
>  
>  	if ((mod_freesync == NULL) || (stream == NULL) || (in_out_vrr == NULL))
>  		return;
> @@ -1239,7 +1240,9 @@ void mod_freesync_handle_v_update(struct mod_freesync *mod_freesync,
>  	if (in_out_vrr->supported == false)
>  		return;
>  
> -	cur_timestamp_in_us = dm_get_timestamp(core_freesync->dc->ctx)/10;
> +	tmp = dm_get_timestamp(core_freesync->dc->ctx);
> +	do_div(tmp, 10);
> +	cur_timestamp_in_us = tmp;

Any reason not to use

cur_timestamp_in_us = div_u64(dm_get_timestamp(core_freesync->dc->ctx), 10)

and save a variable?

>  	in_out_vrr->flip_interval.vsyncs_between_flip++;
>  	in_out_vrr->flip_interval.v_update_timestamp_in_us = cur_timestamp_in_us;
> -- 
> 2.35.1
> 
> 

  reply	other threads:[~2022-04-07 23:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-07 19:50 [PATCH] drm/amd/display: fix 64 bit divide in freesync code Alex Deucher
2022-04-07 23:31 ` Nathan Chancellor [this message]
2022-04-08 20:51   ` Alex Deucher
2022-04-08 21:04 Alex Deucher
2022-04-08 21:07 ` Nathan Chancellor

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=Yk90X7v8hIgmX5Q5@dev-arch.thelio-3990X \
    --to=nathan@kernel.org \
    --cc=Angus.Wang@amd.com \
    --cc=Anthony.Koo@amd.com \
    --cc=Aric.Cyr@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=lkp@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.