Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=218e180e7ea5334e1f94121940ba82cd1f0f4e58
Commit:     218e180e7ea5334e1f94121940ba82cd1f0f4e58
Parent:     894b8788d7f265eb7c6f75a9a77cedeb48f51586
Author:     Andrew Morton <[EMAIL PROTECTED]>
AuthorDate: Thu May 10 03:15:18 2007 -0700
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Thu May 10 09:26:52 2007 -0700

    add upper-32-bits macro
    
    We keep on getting "right shift count >= width of type" warnings when doing
    things like
    
        sector_t s;
    
        x = s >> 56;
    
    because with CONFIG_LBD=n, s is only 32-bit.  Similar problems can occur 
with
    dma_addr_t's.
    
    So add a simple wrapper function which code can use to avoid this warning.
    The above example would become
    
        x = upper_32_bits(s) >> 24;
    
    The first user is in fact AFS.
    
    Cc: James Bottomley <[EMAIL PROTECTED]>
    Cc: "Cameron, Steve" <[EMAIL PROTECTED]>
    Cc: "Miller, Mike (OS Dev)" <[EMAIL PROTECTED]>
    Cc: Hisashi Hifumi <[EMAIL PROTECTED]>
    Cc: Alan Cox <[EMAIL PROTECTED]>
    Cc: David Howells <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 include/linux/kernel.h |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 144b615..8645181 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -41,6 +41,16 @@ 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) ((u32)(((n) >> 16) >> 16))
+
 #define        KERN_EMERG      "<0>"   /* system is unusable                   
*/
 #define        KERN_ALERT      "<1>"   /* action must be taken immediately     
*/
 #define        KERN_CRIT       "<2>"   /* critical conditions                  
*/
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to