Linux Sound subsystem development
 help / color / mirror / Atom feed
From: David Laight <david.laight.linux@gmail.com>
To: wangdich9700@163.com
Cc: tiwai@suse.de, broonie@kernel.org, wangdicheng@kylinos.cn,
	linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH 4/4] ASoC: tlv320aic32x4: Use div64_ul for division by unsigned long
Date: Fri, 17 Jul 2026 09:06:52 +0100	[thread overview]
Message-ID: <20260717090652.6fccc633@pumpkin> (raw)
In-Reply-To: <20260717070252.525545-5-wangdich9700@163.com>

On Fri, 17 Jul 2026 15:02:52 +0800
wangdich9700@163.com wrote:

> From: wangdicheng <wangdicheng@kylinos.cn>
> 
> Fix a compiler warning about do_div() truncating an unsigned long divisor:
> 
> sound/soc/codecs/tlv320aic32x4-clk.c:169:1-7: WARNING: do_div() does a 64-by-32 division, please consider using div64_ul instead.
> 
> do_div() truncates the divisor to 32 bits, but parent_rate is unsigned
> long which is 64-bit on 64-bit platforms. Use div64_ul() to correctly
> handle the unsigned long divisor across all architectures.

And the code has to process the same values on 32bit.
So the value must fit in 32bits and do_div() is fine.
Doesn't 'fix' anything.

	David

> 
> Fixes: 514b044cba66 ("ASoC: tlv320aic32x4: Model PLL in CCF")
> Cc: <stable@vger.kernel.org>
> Signed-off-by: wangdicheng <wangdicheng@kylinos.cn>
> ---
>  sound/soc/codecs/tlv320aic32x4-clk.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/sound/soc/codecs/tlv320aic32x4-clk.c b/sound/soc/codecs/tlv320aic32x4-clk.c
> index 5c0a76a4a106..9359492051ad 100644
> --- a/sound/soc/codecs/tlv320aic32x4-clk.c
> +++ b/sound/soc/codecs/tlv320aic32x4-clk.c
> @@ -166,7 +166,7 @@ static int clk_aic32x4_pll_calc_muldiv(struct clk_aic32x4_pll_muldiv *settings,
>  	 * math in the kernel.
>  	 */
>  	multiplier = (u64) rate * settings->p * 10000;
> -	do_div(multiplier, parent_rate);
> +	multiplier = div64_ul(multiplier, parent_rate);
>  
>  	/*
>  	 * J can't be over 64, so R can scale this.


      reply	other threads:[~2026-07-17  8:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-17  7:02 [PATCH 0/4] ALSA: Fix compiler warnings in sound subsystem wangdich9700
2026-07-17  7:02 ` [PATCH 1/4] ASoC: mediatek: mt8189: Remove redundant else-if branch with identical body wangdich9700
2026-07-17  7:02 ` [PATCH 2/4] ALSA: sparc/dbri: Fix "possible condition with no effect" warning wangdich9700
2026-07-17  7:02 ` [PATCH 3/4] ASoC: fsl_easrc: Use div64_u64 for 64-by-64 division wangdich9700
2026-07-17  8:04   ` David Laight
2026-07-17  7:02 ` [PATCH 4/4] ASoC: tlv320aic32x4: Use div64_ul for division by unsigned long wangdich9700
2026-07-17  8:06   ` David Laight [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=20260717090652.6fccc633@pumpkin \
    --to=david.laight.linux@gmail.com \
    --cc=broonie@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=tiwai@suse.de \
    --cc=wangdich9700@163.com \
    --cc=wangdicheng@kylinos.cn \
    /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