linux/compat.h: port lower_32_bits and upper_32_bits from Linux
Subsystems (2)
PATCH 1/1 linux/compat.h: port lower_32_bits and upper_32_bits from Linux
lower_32_bits and upper_32_bits are very useful while programming. Port these two functions here from Linux:include/linux/kernel.h, also remove the definition in drivers/usb/host/xhci.h. Later on, developers could include linux/compat.h if they want to use these two functions.
--- drivers/usb/host/xhci.h | 4 +--- include/linux/compat.h | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 3 deletions(-)
drivers/usb/host/xhci.h +1 -3
@@ -20,9 +20,7 @@#include <asm/cache.h> #include <asm/io.h> #include <linux/list.h> - -#define upper_32_bits (n) (u32)((n) >> 32) -#define lower_32_bits (n) (u32)(n) +#include <linux/compat.h> #define MAX_EP_CTX_NUM 31#define XHCI_ALIGNMENT 64
include/linux/compat.h +17 -0
@@ -57,4 +57,21 @@ , __FILE__, __LINE__); }#define PAGE_SIZE 4096 + +/** +* 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)) + +/** +* lower_32_bits - return bits 0-31 of a number +* @n: the number we're accessing +*/ +#define lower_32_bits (n) ((u32)(n)) +#endif
Signature · 1 line
1.9.0
PATCH 1/1 linux/compat.h: port lower_32_bits and upper_32_bits from Linux
Quoted 7 lines · Lijun Pan
lower_32_bitsandupper_32_bitsare very useful while programming. Port these two functions here from Linux:include/linux/kernel.h, also remove the definition indrivers/usb/host/xhci.h. Later on, developers could includelinux/compat.hif they want to use these two functions.Signed-off-by Lijun Pan <[email protected]>
Per
http://www.denx.de/wiki/view/U-Boot/Patches#Attributing_Code_Copyrights_Sign
you need to say what git hash or tag this comes from in the kernel.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140606/509f0fc4/attachment.pgp>
PATCH 1/1 linux/compat.h: port lower_32_bits and upper_32_bits from Linux
In reply to Lijun PanDear Lijun Pan,
Quoted 1 line · In message <[email protected]> you…
lower_32_bitsandupper_32_bitsare very useful while programming.
"is very useful" is not enough reason to add any code.
Where are the actual users of these functions? We will not add dead code.
Quoted 3 lines
+/**
+ *upper_32_bits- return bits 32-63 of a number
+ * @n: the number we're accessing
Hm... This comment is definitely wrong for the Power Architecture, where bit 0 is always the most significan bit, so upper_32_bits would reutn bits 0...31.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Children are natural mimics who act like their parents despite every effort to teach them good manners.
A message that is not in the archive (sent off-list or not yet received): 8a9667bd97ae488198eebd93bc38189c@DM2PR03MB368.namprd03.prod.outlook.com
PATCH 1/1 linux/compat.h: port lower_32_bits and upper_32_bits from Linux
Dear Lijun Pan,
Quoted 7 lines · In message <8a9667bd97ae488198eebd93bc38189c@DM2PR03MB368.namprd03.prod.outlook…
Quoted 5 lines
"is very useful" is not enough reason to add any code.
Where are the actual users of these functions? We will not add dead code.
I will be the actual user. I will upstream some codes using these functions.
Then please submit this patch as part of the series where you will actually use these functions.
Quoted 1 line
Also,
drivers/usb/host/xhci.huses these. 64 bit architecture is becoming
Actually it uses only lower_32_bits(), and totally ignores the upper 32 bits, it there should be any. To me this looks like a bug.
Quoted 5 lines
Quoted 3 lines
Hm... This comment is definitely wrong for the Power Architecture, where bit 0 is always the most significan bit, so
upper_32_bitswould reutn bits 0...31.I will modify the comment.
Thanks.
Best regards,
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de You can't have everything... where would you put it? - Steven Wright