Re: linux-2.6.21 and __udivid3

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 27 Apr 2007 09:56:03 +0900 "l l" <[email protected]> wrote:

> Here is another compilation failure.
> 
> make
>   CHK     include/linux/version.h
>   CHK     include/linux/utsrelease.h
>   CHK     include/linux/compile.h
>   CC [M]  drivers/w1/w1.o
> drivers/w1/w1.c: In function 'w1_slave_read_id':
> drivers/w1/w1.c:118: error: cannot take address of bit-field 'family'
> drivers/w1/w1.c:118: error: cannot take address of bit-field 'family'
> drivers/w1/w1.c:118: error: cannot take address of bit-field 'family'
> drivers/w1/w1.c:118: error: cannot take address of bit-field 'family'
> drivers/w1/w1.c:118: error: cannot take address of bit-field 'family'
> drivers/w1/w1.c:118: error: cannot take address of bit-field 'family'
> make[2]: *** [drivers/w1/w1.o] Error 1
> make[1]: *** [drivers/w1] Error 2
> make: *** [drivers] Error 2

hm,

		memcpy(buf, (u8 *)&sl->reg_num, count);

and

struct w1_reg_num
{
#if defined(__LITTLE_ENDIAN_BITFIELD)
	__u64	family:8,
		id:48,
		crc:8;
#elif defined(__BIG_ENDIAN_BITFIELD)
	__u64	crc:8,
		id:48,
		family:8;
#else
#error "Please fix <asm/byteorder.h>"
#endif
};

the compiler is being a bit pedantic there, IMO.  What version of gcc are
you using?

Does this help?


--- a/drivers/w1/w1.h~w1-build-fix
+++ a/drivers/w1/w1.h
@@ -22,19 +22,23 @@
 #ifndef __W1_H
 #define __W1_H
 
-struct w1_reg_num
-{
+struct w1_reg_num {
+	union {
+		__u64 unused;	/* So gcc will permit pointers to this struct */
+		struct {
 #if defined(__LITTLE_ENDIAN_BITFIELD)
-	__u64	family:8,
-		id:48,
-		crc:8;
+			__u64	family:8,
+				id:48,
+				crc:8;
 #elif defined(__BIG_ENDIAN_BITFIELD)
-	__u64	crc:8,
-		id:48,
-		family:8;
+			__u64	crc:8,
+				id:48,
+				family:8;
 #else
 #error "Please fix <asm/byteorder.h>"
 #endif
+		};
+	};
 };
 
 #ifdef __KERNEL__
_

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux