From: Andrew Morton <akpm@linux-foundation.org>
To: James Bottomley <James.Bottomley@SteelEye.com>
Cc: "Cameron, Steve" <Steve.Cameron@hp.com>,
"Miller, Mike (OS Dev)" <Mike.Miller@hp.com>,
Hisashi Hifumi <hifumi.hisashi@oss.ntt.co.jp>,
jens.axboe@oracle.com, linux-kernel@vger.kernel.org,
linux-scsi@vger.kernel.org
Subject: Re: [PATCH] cciss: Fix warnings during compilation under 32bitenvironment
Date: Fri, 20 Apr 2007 12:30:41 -0700 [thread overview]
Message-ID: <20070420123041.94aac1e1.akpm@linux-foundation.org> (raw)
In-Reply-To: <1177095007.3718.43.camel@mulgrave.il.steeleye.com>
On Fri, 20 Apr 2007 14:50:06 -0400
James Bottomley <James.Bottomley@SteelEye.com> wrote:
> > CONFIG_LBD=y gives us an additional 3kb of instructions on i386
> > allnoconfig. Other architectures might do less well. It's not a huge
> > difference, but that's the way in which creeping bloatiness happens.
>
> OK, sure, but if we really care about this saving, then unconditionally
> casting to u64 is therefore wrong as well ... this is starting to open
> quite a large can of worms ...
>
> For the record, if we have to do this, I fancy sector_upper_32() ... we
> should already have some similar accessor for dma_addr_t as well.
hm. How about this?
--- a/include/linux/kernel.h~upper-32-bits
+++ a/include/linux/kernel.h
@@ -40,6 +40,17 @@ extern const char linux_proc_banner[];
#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
#define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
+/**
+ * upper_32_bits - return bits 32-63 of a number
+ * @n: the number we're accessing
+ *
+ * A basic shift-right of a 64- or 32-bit quantity. Use this to suppress
+ * the "right shift count >= width of type" warning when that quantity is
+ * 32-bits.
+ */
+#define upper_32_bits(n) (((u64)(n)) >> 32)
+
+
#define KERN_EMERG "<0>" /* system is unusable */
#define KERN_ALERT "<1>" /* action must be taken immediately */
#define KERN_CRIT "<2>" /* critical conditions */
_
It seems to generate the desired code. I avoided Alan's ((n >> 31) >> 1)
trick because it'll generate peculiar results with signed 64-bit
quantities.
next prev parent reply other threads:[~2007-04-20 19:31 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <6.0.0.20.2.20070418160231.043f23c8@172.19.0.2>
2007-04-19 15:09 ` [PATCH] cciss: Fix warnings during compilation under 32bit environment Miller, Mike (OS Dev)
2007-04-19 15:18 ` James Bottomley
2007-04-19 16:12 ` Miller, Mike (OS Dev)
2007-04-19 16:22 ` James Bottomley
2007-04-19 16:26 ` [PATCH] cciss: Fix warnings during compilation under 32bitenvironment Miller, Mike (OS Dev)
2007-04-19 16:27 ` Cameron, Steve
2007-04-20 5:20 ` Andrew Morton
2007-04-20 13:10 ` James Bottomley
2007-04-20 13:36 ` Alan Cox
2007-04-20 18:43 ` Andrew Morton
2007-04-20 18:50 ` James Bottomley
2007-04-20 19:30 ` Andrew Morton [this message]
2007-04-20 20:20 ` James Bottomley
2007-04-20 21:12 ` Andrew Morton
2007-04-20 21:39 ` John Anthony Kazos Jr.
2007-04-21 0:55 ` [PATCH] utilities: add helper functions for safe 64-bit integer operations as 32-bit halves John Anthony Kazos Jr.
2007-04-21 10:08 ` Andrew Morton
2007-04-21 13:06 ` John Anthony Kazos Jr.
2007-04-21 21:01 ` Alan Cox
2007-04-21 21:06 ` Andrew Morton
2007-04-22 9:18 ` Christoph Hellwig
2007-04-22 12:38 ` Alan Cox
2007-04-22 12:35 ` Christoph Hellwig
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=20070420123041.94aac1e1.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=James.Bottomley@SteelEye.com \
--cc=Mike.Miller@hp.com \
--cc=Steve.Cameron@hp.com \
--cc=hifumi.hisashi@oss.ntt.co.jp \
--cc=jens.axboe@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
/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