Skip to contentSkip to conversation

Fix gcc4 error incomplete array element type

PATCH In review Jesse Millan 2 participants 3 messages May 20, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix gcc4 error incomplete array element type

This patch is in regards to fixing the gcc 4 warnings. It actually fixes a gcc 4 error by changing

struct i2c_msg msg[]

to

struct i2c_msg *msg

which is what gcc4 wants to see from now on.

F.Y.I I applied the kj patch, and this error has not been fixed as of yet. However, I found that this was changed in Andrew Morton mm4 patch.

include/linux/i2c.h renamed from include/linux/i2c.h.orig +2 -2
@@ -55,7 +55,7 @@ extern int i2c_master_recv(struct i2c_cl
 
 /* 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 *msgs,int num);
 
 /*
  * Some adapter types (i.e. PCF 8584 based ones) may support slave behaviuor.
@@ -194,7 +194,7 @@ struct i2c_algorithm {
 	   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,

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#1 lore raw
Quoted 5 lines · Jesse Millan

This patch is in regards to fixing the gcc 4 warnings. It actually fixes a gcc 4 error by changing

struct i2c_msg msg[]

Quoted 8 lines

to

struct i2c_msg *msg

which is what gcc4 wants to see from now on.

F.Y.I I applied the kj patch, and this error has not been fixed as of yet. However, I found that this was changed in Andrew Morton mm4 patch.

This is already fixed in the 2.6.12-rc4 kernel, correct?

thanks,

greg k-h

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#2 lore raw
In reply to Jesse Millan

include/linux/i2c.h extern int i2c_master_recv(struct i2c_cl · line 58

Quoted 8 lines · Jesse Millan
include/linux/i2c.h renamed from include/linux/i2c.h.orig +1 -1
@@ -55,7 +55,7 @@ extern int i2c_master_recv(struct i2c_cl
 
 /* 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 *msgs,int num);

Oh, and in the future, if you change a header file, you better change where the function is defined, otherwise you get a compiler error.

include/linux/i2c.h struct i2c_algorithm { · line 198

Quoted 8 lines
include/linux/i2c.h renamed from include/linux/i2c.h.orig +1 -1
  * Some adapter types (i.e. PCF 8584 based ones) may support slave behaviuor.
@@ -194,7 +194,7 @@ struct i2c_algorithm {
 	   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);

You would have gotten compiler warnings for not fixing up all of the i2c drivers that provide a master_xfer() function pointer, right?

See the 2.6.12-rc4 kernel for the real full fix for this.

thanks,

greg k-h

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors