public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Robert Love <rml@tech9.net>
To: torvalds@transmeta.com
Cc: Sven Vermeulen <sven.vermeulen@rug.ac.be>, linux-kernel@vger.kernel.org
Subject: [PATCH] Re: 2.4.14-pre3: some compilerwarnings...
Date: 27 Oct 2001 13:30:04 -0400	[thread overview]
Message-ID: <1004203813.3272.57.camel@phantasy> (raw)
In-Reply-To: <1004202984.3274.53.camel@phantasy>
In-Reply-To: <20011027185158.A5848@Zenith.starcenter>  <1004202984.3274.53.camel@phantasy>

On Sat, 2001-10-27 at 13:16, Robert Love wrote:
> <snip>

Hm, while we are at it, let's cleanup the MIN macros, too...might as
well just use the built-in system min.  This patch includes that cleanup
as well as the typecast fix.  Ignore the old, apply this, enjoy.

diff -urN linux-2.4.14-pre3/drivers/char/random.c linux/drivers/char/random.c
--- linux-2.4.14-pre3/drivers/char/random.c	Sat Oct 27 13:13:03 2001
+++ linux/drivers/char/random.c	Sat Oct 27 13:26:34 2001
@@ -406,10 +406,6 @@
  * 
  *****************************************************************/
 
-#ifndef MIN
-#define MIN(a,b) (((a) < (b)) ? (a) : (b))
-#endif
-
 /*
  * Unfortunately, while the GCC optimizer for the i386 understands how
  * to optimize a static rotate left of x bits, it doesn't know how to
@@ -1245,8 +1241,9 @@
 
 	if (r->entropy_count < nbytes * 8 &&
 	    r->entropy_count < r->poolinfo.POOLBITS) {
-		int nwords = min(r->poolinfo.poolwords - r->entropy_count/32,
-				 sizeof(tmp) / 4);
+		int nwords = min_t(int,
+				   r->poolinfo.poolwords - r->entropy_count/32,
+				   sizeof(tmp) / 4);
 
 		DEBUG_ENT("xfer %d from primary to %s (have %d, need %d)\n",
 			  nwords * 32,
@@ -1359,7 +1356,7 @@
 #endif
 		
 		/* Copy data to destination buffer */
-		i = MIN(nbytes, HASH_BUFFER_SIZE*sizeof(__u32)/2);
+		i = min(nbytes, HASH_BUFFER_SIZE*sizeof(__u32)/2);
 		if (flags & EXTRACT_ENTROPY_USER) {
 			i -= copy_to_user(buf, (__u8 const *)tmp, i);
 			if (!i) {
@@ -1586,7 +1583,7 @@
 	size_t		c = count;
 
 	while (c > 0) {
-		bytes = MIN(c, sizeof(buf));
+		bytes = min(c, sizeof(buf));
 
 		bytes -= copy_from_user(&buf, p, bytes);
 		if (!bytes) {


	Robert Love


  reply	other threads:[~2001-10-27 17:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-27 16:51 2.4.14-pre3: some compilerwarnings Sven Vermeulen
2001-10-27 17:16 ` Robert Love
2001-10-27 17:30   ` Robert Love [this message]
2001-10-31 17:12   ` Ragnar Hojland Espinosa

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=1004203813.3272.57.camel@phantasy \
    --to=rml@tech9.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sven.vermeulen@rug.ac.be \
    --cc=torvalds@transmeta.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