i2c.h: Fix another gcc 4.0 compile failure
Subsystems (5)
PATCH 1/1 i2c.h: Fix another gcc 4.0 compile failure
From: Mickey Stein
Versions: linux-2.6.11-rc4-bk7, gcc4 (GCC) 4.0.0 20050217 (latest fc
rawhide from 19Feb DL)
gcc4 cvs seems to dislike "include/linux/i2c.h file":
Error msg: include/linux/i2c.h:{55,194} error: array type has
incomplete element type
A. Daplas has recently done a workaround for this on another header
file. A thread discussing this
can be found by following the link below:
http://gcc.gnu.org/ml/gcc/2005-02/msg00053.html
The patch changes the array declaration from "struct x y[]" format to
"struct x *y".
I realize its only a workaround, but the gcc guys seem to be aware of
this.
** Note: I'm a noob at this, so feel free to make chopped liver out of
this if its incorrect.
patch below is also attached since I'm not sure formatting survives
the cut&paste.
---
linux/i2c.h 2005-02-19 07:26:22.000000000 -0800 renamed from linux/i2c.h.sav 2005-02-19 07:02:52.000000000 -0800 +0 -0
@@ -55,7 +55,7 @@
/* Transfer num messages.
*/
-extern int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[],int num) ;
+extern int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msg,int num);
/*
* Some adapter types (i.e. PCF 8584 based ones) may support slave
behaviuor.
@@ -194,7 +194,7 @@
to NULL. If an adapter algorithm can do SMBus access, set smbus_xfer. If set to NULL, the SMBus protocol is simulated using common I2C messages */
- int (*master_xfer)(struct i2c_adapter *adap,struct i2c_msg msgs[],
+ int (*master_xfer)(struct i2c_adapter *adap,struct i2c_msg *msgs,
int num);
int (*smbus_xfer) (struct i2c_adapter *adap, u16 addr,
unsigned short flags, char read_write,
linux/i2c.h renamed from linux/i2c.h.sav +2 -2
@@ -55,7 +55,7 @@/* Transfer num messages. */ -extern int i2c_transfer (struct i2c_adapter *adap,struct i2c_msg msg[],int num); +extern int i2c_transfer (struct i2c_adapter *adap,struct i2c_msg *msg,int num);/* * Some adapter types (i.e. PCF 8584 based ones) may support slave behaviuor.
@@ -194,7 +194,7 @@to NULL. If an adapter algorithm can do SMBus access, set smbus_xfer. If set to NULL, the SMBus protocol is simulated using common I2C messages */ -int (*master_xfer)(struct i2c_adapter *adap,struct i2c_msg msgs[], +int (*master_xfer)(struct i2c_adapter *adap,struct i2c_msg *msgs,int num); int (*smbus_xfer) (struct i2c_adapter *adap, u16 addr, unsigned short flags, char read_write,
Quoted 15 lines · Mickey Stein
From: Mickey Stein
Versions: linux-2.6.11-rc4-bk7, gcc4 (GCC) 4.0.0 20050217 (latest fc
rawhide from 19Feb DL)gcc4 cvs seems to dislike "
include/linux/i2c.hfile":Error msg: include/linux/i2c.h:{55,194} error: array type has
incomplete element typeA. Daplas has recently done a workaround for this on another header
file. A thread discussing this
can be found by following the link below:
Quoted 8 lines
The patch changes the array declaration from "struct x y[]" format to
"struct x *y".
I realize its only a workaround, but the gcc guys seem to be aware of
this.
** Note: I'm a noob at this, so feel free to make chopped liver out of
this if its incorrect.
patch below is also attached since I'm not sure formatting survives
the cut&paste.
The patch looks sane, but before I apply it, care to also fix up all of the function pointers that are affected by this patch? Also the i2c_transfer() function itself should be changed (not just the header file.)
thanks,
greg k-h
Quoted 22 lines · Greg KH
Quoted 10 lines · Mickey Stein
From: Mickey Stein
Versions: linux-2.6.11-rc4-bk7, gcc4 (GCC) 4.0.0 20050217 (latest fc rawhide from 19Feb DL)gcc4 cvs seems to dislike "
include/linux/i2c.hfile":Error msg: include/linux/i2c.h:{55,194} error: array type has incomplete element type
A. Daplas has recently done a workaround for this on another header file. A thread discussing this can be found by following the link below:
Quoted 8 lines
http://gcc.gnu.org/ml/gcc/2005-02/msg00053.html
The patch changes the array declaration from "struct x y[]" format to "struct x *y". I realize its only a workaround, but the gcc guys seem to be aware of this.
** Note: I'm a noob at this, so feel free to make chopped liver out of this if its incorrect. patch below is also attached since I'm not sure formatting survives the cut&paste.
Quoted 11 lines
The patch looks sane, but before I apply it, care to also fix up all of the function pointers that are affected by this patch? Also the
i2c_transfer()function itself should be changed (not just the header file.)thanks,
greg k-h
Greg,
I took a look for other references similar to those in my first take at this and found a couple more files. Attached is another patch that hopefully addresses the all the similar cases. I tried it on today's (-bk8) kernel, with all i2c switches enabled.
From: Mickey Stein
Versions: linux-2.6.11-rc4-bk8, gcc4 (GCC) 4.0.0 20050217 (latest fc rawhide from 19Feb DL)
gcc4 cvs seems to dislike "include/linux/i2c.h, i2c-core.c files".
I also tweaked the Documentation/i2c/writing-clients file.
Error msg: include/linux/i2c.h:{55,194} error: array type has incomplete element type
A. Daplas has recently done a workaround for this on another header file. A thread discussing this can be found by following the link below:
http://gcc.gnu.org/ml/gcc/2005-02/msg00053.html
The patch changes the i2c-transfer code in i2c.h from "struct x y[]" format to "struct x *y". It also changes the associated i2c-transfer declarations in i2c-core.c.
It tweaks the Documentation/i2c/writing-clients file to reconcile i2c-transfer docs.
I realize its only a workaround, but the gcc guys seem to be aware of this.
Thanks very much,
Mickey Stein
include/linux/i2c.h renamed from include/linux/i2c.h.sav +2 -2
@@ -55,7 +55,7 @@/* Transfer num messages. */ -extern int i2c_transfer (struct i2c_adapter *adap,struct i2c_msg msg[],int num); +extern int i2c_transfer (struct i2c_adapter *adap,struct i2c_msg *msg,int num);/* * Some adapter types (i.e. PCF 8584 based ones) may support slave behaviuor.
@@ -194,7 +194,7 @@to NULL. If an adapter algorithm can do SMBus access, set smbus_xfer. If set to NULL, the SMBus protocol is simulated using common I2C messages */ -int (*master_xfer)(struct i2c_adapter *adap,struct i2c_msg msgs[], +int (*master_xfer)(struct i2c_adapter *adap,struct i2c_msg *msgs,int num); int (*smbus_xfer) (struct i2c_adapter *adap, u16 addr, unsigned short flags, char read_write,
drivers/i2c/i2c-core.c renamed from drivers/i2c/i2c-core.c.sav +1 -1
@@ -583,7 +583,7 @@* ---------------------------------------------------- */ -int i2c_transfer (struct i2c_adapter * adap,struct i2c_msg msgs[],int num) +int i2c_transfer (struct i2c_adapter * adap,struct i2c_msg *msgs,int num) {int ret;
Documentation/i2c/writing-clients renamed from Documentation/i2c/writing-clients.sav +1 -1
@@ -642,7 +642,7 @@ parameter contains the bytes the read/write, the third the length of the buffer. Returned is the actual number of bytes read/written. - extern int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[], + extern int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msg, int num); This sends a series of messages. Each message can be a read or write,
Quoted 42 lines · Mickey Stein
Quoted 29 lines · Greg KH
Quoted 15 lines · Mickey Stein
From: Mickey Stein
Versions: linux-2.6.11-rc4-bk7, gcc4 (GCC) 4.0.0 20050217 (latest fc
rawhide from 19Feb DL)gcc4 cvs seems to dislike "
include/linux/i2c.hfile":Error msg: include/linux/i2c.h:{55,194} error: array type has
incomplete element typeA. Daplas has recently done a workaround for this on another header file. A thread discussing this
can be found by following the link below:Quoted 10 lines
The patch changes the array declaration from "struct x y[]" format to "struct x *y".
I realize its only a workaround, but the gcc guys seem to be aware of this.
** Note: I'm a noob at this, so feel free to make chopped liver out of this if its incorrect.
patch below is also attached since I'm not sure formatting survives the cut&paste.Quoted 11 lines
The patch looks sane, but before I apply it, care to also fix up all of the function pointers that are affected by this patch? Also the
i2c_transfer()function itself should be changed (not just the header file.)thanks,
greg k-h
Quoted 7 lines
Greg,
I took a look for other references similar to those in my first take at this and found a couple more files.
Attached is another patch that hopefully addresses the all the similar cases. I tried it on today's (-bk8) kernel,
with all i2c switches enabled.
What about the i2c drivers that implement the master_xfer function? You will now have a bunch of compiler warnings if you build them with this patch, right?
thanks,
greg k-h
Greg, Mickey,
Since I already some of this patch done in the stuff I was working on, I finished it out. Here's a patch that cleans up all of them and a few other small things I found.
-Corey
Quoted 57 lines · Greg KH
Quoted 42 lines · Mickey Stein
Quoted 25 lines · Greg KH
Quoted 10 lines · Mickey Stein
From: Mickey Stein
Versions: linux-2.6.11-rc4-bk7, gcc4 (GCC) 4.0.0 20050217 (latest fc rawhide from 19Feb DL)gcc4 cvs seems to dislike "
include/linux/i2c.hfile":Error msg: include/linux/i2c.h:{55,194} error: array type has incomplete element type
A. Daplas has recently done a workaround for this on another header file. A thread discussing this can be found by following the link below:
Quoted 10 lines
http://gcc.gnu.org/ml/gcc/2005-02/msg00053.html
The patch changes the array declaration from "struct x y[]" format to "struct x *y". I realize its only a workaround, but the gcc guys seem to be aware of this.
** Note: I'm a noob at this, so feel free to make chopped liver out of this if its incorrect. patch below is also attached since I'm not sure formatting survives the cut&paste.Quoted 13 lines
The patch looks sane, but before I apply it, care to also fix up all of the function pointers that are affected by this patch? Also the
i2c_transfer()function itself should be changed (not just the header file.)thanks,
greg k-h
Quoted 7 lines
Greg,
I took a look for other references similar to those in my first take at this and found a couple more files. Attached is another patch that hopefully addresses the all the similar cases. I tried it on today's (-bk8) kernel, with all i2c switches enabled.
What about the i2c drivers that implement the
master_xferfunction? You will now have a bunch of compiler warnings if you build them with this patch, right?
Quoted 10 lines
thanks,
greg k-h
-
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/
Clean up some general I2C things. Convert all the msg[] in functions to *msg, fix some grammar, put () around all the #defines that are compound to avoid nasty side-effects, and convert some initializations to C99 versions to make them more change-resistant.
include/linux/i2c.h +27 -27
@@ -55,7 +55,7 @@/* Transfer num messages. */ -extern int i2c_transfer (struct i2c_adapter *adap,struct i2c_msg msg[],int num); +extern int i2c_transfer (struct i2c_adapter *adap,struct i2c_msg *msg,int num);/* * Some adapter types (i.e. PCF 8584 based ones) may support slave behaviuor.
@@ -190,11 +190,11 @@char name[32 ];/* textual description */ unsigned int id; -/* If an adapter algorithm can't to I2C-level access, set master_xfer +/* If an adapter algorithm can't do I2C-level access, set master_xfer to NULL. If an adapter algorithm can do SMBus access, set smbus_xfer. If set to NULL, the SMBus protocol is simulated using common I2C messages */ -int (*master_xfer)(struct i2c_adapter *adap,struct i2c_msg msgs[], +int (*master_xfer)(struct i2c_adapter *adap,struct i2c_msg *msgs,int num); int (*smbus_xfer) (struct i2c_adapter *adap, u16 addr, unsigned short flags, char read_write,
@@ -423,22 +423,22 @@#define I2C_FUNC_SMBUS_READ_BLOCK_DATA_PEC 0x40000000/* SMBus 2.0 */ #define I2C_FUNC_SMBUS_WRITE_BLOCK_DATA_PEC 0x80000000/* SMBus 2.0 */ -#define I2C_FUNC_SMBUS_BYTE I2C_FUNC_SMBUS_READ_BYTE | \ - I2C_FUNC_SMBUS_WRITE_BYTE -#define I2C_FUNC_SMBUS_BYTE_DATA I2C_FUNC_SMBUS_READ_BYTE_DATA | \ - I2C_FUNC_SMBUS_WRITE_BYTE_DATA -#define I2C_FUNC_SMBUS_WORD_DATA I2C_FUNC_SMBUS_READ_WORD_DATA | \ - I2C_FUNC_SMBUS_WRITE_WORD_DATA -#define I2C_FUNC_SMBUS_BLOCK_DATA I2C_FUNC_SMBUS_READ_BLOCK_DATA | \ - I2C_FUNC_SMBUS_WRITE_BLOCK_DATA -#define I2C_FUNC_SMBUS_I2C_BLOCK I2C_FUNC_SMBUS_READ_I2C_BLOCK | \ - I2C_FUNC_SMBUS_WRITE_I2C_BLOCK -#define I2C_FUNC_SMBUS_I2C_BLOCK_2 I2C_FUNC_SMBUS_READ_I2C_BLOCK_2 | \ - I2C_FUNC_SMBUS_WRITE_I2C_BLOCK_2 -#define I2C_FUNC_SMBUS_BLOCK_DATA_PEC I2C_FUNC_SMBUS_READ_BLOCK_DATA_PEC | \ - I2C_FUNC_SMBUS_WRITE_BLOCK_DATA_PEC -#define I2C_FUNC_SMBUS_WORD_DATA_PEC I2C_FUNC_SMBUS_READ_WORD_DATA_PEC | \ - I2C_FUNC_SMBUS_WRITE_WORD_DATA_PEC +#define I2C_FUNC_SMBUS_BYTE (I2C_FUNC_SMBUS_READ_BYTE | \ + I2C_FUNC_SMBUS_WRITE_BYTE) +#define I2C_FUNC_SMBUS_BYTE_DATA (I2C_FUNC_SMBUS_READ_BYTE_DATA | \ + I2C_FUNC_SMBUS_WRITE_BYTE_DATA) +#define I2C_FUNC_SMBUS_WORD_DATA (I2C_FUNC_SMBUS_READ_WORD_DATA | \ + I2C_FUNC_SMBUS_WRITE_WORD_DATA) +#define I2C_FUNC_SMBUS_BLOCK_DATA (I2C_FUNC_SMBUS_READ_BLOCK_DATA | \ + I2C_FUNC_SMBUS_WRITE_BLOCK_DATA) +#define I2C_FUNC_SMBUS_I2C_BLOCK (I2C_FUNC_SMBUS_READ_I2C_BLOCK | \ + I2C_FUNC_SMBUS_WRITE_I2C_BLOCK) +#define I2C_FUNC_SMBUS_I2C_BLOCK_2 (I2C_FUNC_SMBUS_READ_I2C_BLOCK_2 | \ + I2C_FUNC_SMBUS_WRITE_I2C_BLOCK_2) +#define I2C_FUNC_SMBUS_BLOCK_DATA_PEC (I2C_FUNC_SMBUS_READ_BLOCK_DATA_PEC | \ + I2C_FUNC_SMBUS_WRITE_BLOCK_DATA_PEC) +#define I2C_FUNC_SMBUS_WORD_DATA_PEC (I2C_FUNC_SMBUS_READ_WORD_DATA_PEC | \ + I2C_FUNC_SMBUS_WRITE_WORD_DATA_PEC)#define I2C_FUNC_SMBUS_READ_BYTE_PEC I2C_FUNC_SMBUS_READ_BYTE_DATA#define I2C_FUNC_SMBUS_WRITE_BYTE_PEC I2C_FUNC_SMBUS_WRITE_BYTE_DATA
@@ -447,14 +447,14 @@#define I2C_FUNC_SMBUS_BYTE_PEC I2C_FUNC_SMBUS_BYTE_DATA#define I2C_FUNC_SMBUS_BYTE_DATA_PEC I2C_FUNC_SMBUS_WORD_DATA -#define I2C_FUNC_SMBUS_EMUL I2C_FUNC_SMBUS_QUICK | \ - I2C_FUNC_SMBUS_BYTE | \ - I2C_FUNC_SMBUS_BYTE_DATA | \ - I2C_FUNC_SMBUS_WORD_DATA | \ - I2C_FUNC_SMBUS_PROC_CALL | \ - I2C_FUNC_SMBUS_WRITE_BLOCK_DATA | \ - I2C_FUNC_SMBUS_WRITE_BLOCK_DATA_PEC | \ - I2C_FUNC_SMBUS_I2C_BLOCK +#define I2C_FUNC_SMBUS_EMUL (I2C_FUNC_SMBUS_QUICK | \ + I2C_FUNC_SMBUS_BYTE | \ + I2C_FUNC_SMBUS_BYTE_DATA | \ + I2C_FUNC_SMBUS_WORD_DATA | \ + I2C_FUNC_SMBUS_PROC_CALL | \ + I2C_FUNC_SMBUS_WRITE_BLOCK_DATA | \ + I2C_FUNC_SMBUS_WRITE_BLOCK_DATA_PEC | \ + I2C_FUNC_SMBUS_I2C_BLOCK)/* * Data for SMBus Messages
drivers/i2c/algos/i2c-algo-bit.c +1 -1
@@ -466,7 +466,7 @@ }static int bit_xfer (struct i2c_adapter *i2c_adap, -struct i2c_msg msgs[],int num) +struct i2c_msg *msgs,int num) {struct i2c_msg *pmsg;struct i2c_algo_bit_data *adap = i2c_adap->algo_data;
drivers/i2c/algos/i2c-algo-pcf.c +1 -1
@@ -332,7 +332,7 @@ }static int pcf_xfer (struct i2c_adapter *i2c_adap, -struct i2c_msg msgs[], +struct i2c_msg *msgs,int num) {struct i2c_algo_pcf_data *adap = i2c_adap->algo_data;
drivers/i2c/algos/i2c-algo-pca.c +1 -1
@@ -178,7 +178,7 @@ }static int pca_xfer (struct i2c_adapter *i2c_adap, -struct i2c_msg msgs[], +struct i2c_msg *msgs,int num) {struct i2c_algo_pca_data *adap = i2c_adap->algo_data;
drivers/i2c/algos/i2c-algo-ite.c +6 -9
@@ -600,7 +600,7 @@* verify that the bus is not busy or in some unknown state. */ static int iic_xfer (struct i2c_adapter *i2c_adap, -struct i2c_msg msgs[], +struct i2c_msg *msgs,int num) {struct i2c_algo_iic_data *adap = i2c_adap->algo_data;
@@ -713,14 +713,11 @@/* -----exported algorithm data: ------------------------------------- */ static struct i2c_algorithm iic_algo = { -"ITE IIC algorithm" , -I2C_ALGO_IIC , - iic_xfer,/* master_xfer */ -NULL ,/* smbus_xfer */ -NULL ,/* slave_xmit */ -NULL ,/* slave_recv */ - algo_control,/* ioctl */ - iic_func,/* functionality */ + .name ="ITE IIC algorithm" , + .id =I2C_ALGO_IIC , + .master_xfer = iic_xfer, + .ioctl = algo_control, + .functionality = iic_func, };
drivers/i2c/algos/i2c-algo-sgi.c +1 -1
@@ -131,7 +131,7 @@return 0 ; } -static int sgi_xfer (struct i2c_adapter *i2c_adap,struct i2c_msg msgs[], +static int sgi_xfer (struct i2c_adapter *i2c_adap,struct i2c_msg *msgs,int num) {struct i2c_algo_sgi_data *adap = i2c_adap->algo_data;
drivers/i2c/algos/i2c-algo-sibyte.c +5 -8
@@ -136,14 +136,11 @@/* -----exported algorithm data: ------------------------------------- */ static struct i2c_algorithm i2c_sibyte_algo = { -"SiByte algorithm" , -I2C_ALGO_SIBYTE , -NULL ,/* master_xfer */ - smbus_xfer,/* smbus_xfer */ -NULL ,/* slave_xmit */ -NULL ,/* slave_recv */ - algo_control,/* ioctl */ - bit_func,/* functionality */ + .name ="SiByte algorithm" , + .id =I2C_ALGO_SIBYTE , + .smbus_xfer = smbus_xfer, + .ioctl = algo_control, + .functionality = bit_func, };/*
drivers/i2c/busses/i2c-mpc.c +1 -1
@@ -233,7 +233,7 @@return length; } -static int mpc_xfer (struct i2c_adapter *adap,struct i2c_msg msgs[],int num) +static int mpc_xfer (struct i2c_adapter *adap,struct i2c_msg *msgs,int num) {struct i2c_msg *pmsg;int i;
drivers/i2c/busses/i2c-s3c2410.c +1 -1
@@ -534,7 +534,7 @@*/ static int s3c24xx_i2c_xfer (struct i2c_adapter *adap, -struct i2c_msg msgs[],int num) +struct i2c_msg *msgs,int num) {struct s3c24xx_i2c *i2c = (struct s3c24xx_i2c *)adap->algo_data;int retry;
drivers/i2c/busses/i2c-au1550.c +1 -1
@@ -253,7 +253,7 @@ }static int -au1550_xfer (struct i2c_adapter *i2c_adap,struct i2c_msg msgs[],int num) +au1550_xfer (struct i2c_adapter *i2c_adap,struct i2c_msg *msgs,int num) {struct i2c_au1550_data *adap = i2c_adap->algo_data;struct i2c_msg *p;
drivers/i2c/busses/i2c-iop3xx.c +1 -1
@@ -361,7 +361,7 @@* master_xfer() - main read/write entry */ static int -iop3xx_i2c_master_xfer (struct i2c_adapter *i2c_adap,struct i2c_msg msgs[], +iop3xx_i2c_master_xfer (struct i2c_adapter *i2c_adap,struct i2c_msg *msgs,int num) {struct i2c_algo_iop3xx_data *iop3xx_adap = i2c_adap->algo_data;
drivers/i2c/busses/i2c-keywest.c +1 -1
@@ -399,7 +399,7 @@*/ static int keywest_xfer (struct i2c_adapter *adap, -struct i2c_msg msgs[], +struct i2c_msg *msgs,int num) {struct keywest_chan * chan =i2c_get_adapdata (adap);
drivers/i2c/busses/i2c-ibm_iic.c +1 -1
@@ -549,7 +549,7 @@* Generic master transfer entrypoint. * Returns the number of processed messages or error (<0) */ -static int iic_xfer (struct i2c_adapter *adap,struct i2c_msg msgs[],int num) +static int iic_xfer (struct i2c_adapter *adap,struct i2c_msg *msgs,int num) {struct ibm_iic_private * dev = (struct ibm_iic_private *)(i2c_get_adapdata (adap));volatile struct iic_regs __iomem *iic = dev->vaddr;
drivers/i2c/i2c-core.c +1 -1
@@ -583,7 +583,7 @@* ---------------------------------------------------- */ -int i2c_transfer (struct i2c_adapter * adap,struct i2c_msg msgs[],int num) +int i2c_transfer (struct i2c_adapter * adap,struct i2c_msg *msgs,int num) {int ret;
drivers/media/video/bttv-i2c.c +1 -1
@@ -245,7 +245,7 @@return retval; } -static int bttv_i2c_xfer (struct i2c_adapter *i2c_adap,struct i2c_msg msgs[],int num) +static int bttv_i2c_xfer (struct i2c_adapter *i2c_adap,struct i2c_msg *msgs,int num) {struct bttv *btv =i2c_get_adapdata (i2c_adap);int retval =0 ;