public inbox for linux-staging@lists.linux.dev
 help / color / mirror / Atom feed
From: David Laight <David.Laight@ACULAB.COM>
To: 'Kang Minchul' <tegongkang@gmail.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Paulo Miguel Almeida <paulo.miguel.almeida.rodenas@gmail.com>
Cc: Dan Carpenter <error27@gmail.com>,
	Sidong Yang <realwakka@gmail.com>,
	"linux-staging@lists.linux.dev" <linux-staging@lists.linux.dev>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH] staging: pi433: Use div64_u64 instead of do_div
Date: Wed, 19 Oct 2022 10:31:17 +0000	[thread overview]
Message-ID: <e2ec77060cc84a33b49d5fd11d7867f6@AcuMS.aculab.com> (raw)
In-Reply-To: <20221019094015.832398-1-tegongkang@gmail.com>

From: Kang Minchul
> Sent: 19 October 2022 10:40
> 
> This commit removes warning generated by cocci as follows:
> 
> do_div() does a 64-by-32 division, please consider using div64_u64 instead.
> 
> Using div64_u64 instead of do_div can avoid potential truncation.

Cocci is lying to you.

do_div() exists because a 64 by 32 bit divide is significantly
faster than a 64 by 64 divide.
This is particularly true on 32bit cpu, but is also true on
Intel x86_64 bit cpu.

So unless the result might actually be larger than 32 bits
(which requires code analysis) then do_div() is correct.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


  reply	other threads:[~2022-10-19 10:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-19  9:40 [PATCH] staging: pi433: Use div64_u64 instead of do_div Kang Minchul
2022-10-19 10:31 ` David Laight [this message]
2022-10-19 14:20   ` Kang Minchul

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=e2ec77060cc84a33b49d5fd11d7867f6@AcuMS.aculab.com \
    --to=david.laight@aculab.com \
    --cc=error27@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=paulo.miguel.almeida.rodenas@gmail.com \
    --cc=realwakka@gmail.com \
    --cc=tegongkang@gmail.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