[PATCH] Fix pragma packing in ip2 driver


[PATCH] Fix pragma packing in ip2 driver

Postby David Howells » Fri, 06 Jan 2006 03:10:17 GMT

The attached patch fixes the pragma packing in the ip2 driver by popping the
previous setting rather than explicitly assuming that the correct setting
is 4.

This also gets around a compiler bug in the FRV compiler when building

Signed-Off-By: David Howells < XXXX@XXXXX.COM >
warthog>diffstat -p1 ip2-pragma-2615rc5.diff 
 drivers/char/ip2/i2pack.h |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

diff -urp linux-2.6.15-rc5/drivers/char/ip2/i2pack.h linux-2.6.15-rc5-frv/drivers/char/ip2/i2pack.h
--- linux-2.6.15-rc5/drivers/char/ip2/i2pack.h	2004-06-18 13:41:44.000000000 +0100
+++ linux-2.6.15-rc5-frv/drivers/char/ip2/i2pack.h	2006-01-04 17:48:08.000000000 +0000
@@ -358,7 +358,7 @@ typedef struct _failStat
 #define MB_OUT_STRIPPED    0x40  // Board has read all output from fifo 
 #define MB_FATAL_ERROR     0x20  // Board has encountered a fatal error
-#pragma pack(4)                  // Reset padding to command-line default
+#pragma pack()                  // Reset padding to command-line default
 #endif      // I2PACK_H
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to  XXXX@XXXXX.COM 
More majordomo info at   http://www.**--****.com/ 
Please read the FAQ at   http://www.**--****.com/ 

Similar Threads:

1.one pragma pack vs. many, many __attribute__((packed))

2.[git patch] Move ip2.c and ip2main.c to drivers/char/ip2/

3.[RFC: 2.6 patch] move ip2.c and ip2main.c to drivers/char/ip2/

4.Why #pragma pack() not take effect?

Struct definition as following(on 32-bit Linux):

#pragma pack(push, 8)
struct MY_STRUCT
    char a[2];
    short b;
    short c;
    short d;
    int e;
    long long x;
    long long y;

During the test, result of 'sizeof(struct MY_STRUCT)' is 28. Why not 32?
As I had expected, a,b,c,d will be packed into one 8-byte, e one and x, y
two. Ain't I right?

If I get wrong usage of #pragma pack(), could anyone please tell me how to
get it work correctly?

BTW, what on earth is the difference between __attribute__ align() and
#pragma pack()?

Thanks in advance!

5.[PATCH] drivers/char/ip2: fix used-uninit'd bug

6. [patch 1/4] drivers/char/ip2/i2lib.c: replace direct assignment with set_current_state()

7. [PATCH] computone: remove unnecessary files from drivers/char/ip2

8. [2.5 patch] small drivers/char/ip2* cleanup

Return to linux


Who is online

Users browsing this forum: No registered users and 89 guest