Commit 96ad05d3 authored by Mickey Stein's avatar Mickey Stein Committed by Greg Kroah-Hartman

[PATCH] I2C: Fix some gcc 4.0 compile failures and warnings

gcc 4.0.x cvs seems to dislike "include/linux/i2c.h file" and others due
to a current gcc 4.0.x change having to do with array declarations.

Example 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(struct i2c_msg) declaration used by
*i2c_transfer and *master_xfer from "struct i2c_msg msg[]" format to
"struct i2c_msg *msg".

After some grepping, I came up with about a dozen files that used the
format disliked by gcc4 that're addressed by the attached patch.
Tested on gcc 3.x & gcc 4.x by configuring kernel with all i2c switches
enabled as module, and saw no errors or warnings in i2c.
Signed-off-by: default avatarMickey Stein <yekkim@pacbell.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 01389791
...@@ -638,7 +638,7 @@ contains the i2c address, so you do not have to include it. The second ...@@ -638,7 +638,7 @@ contains the i2c address, so you do not have to include it. The second
parameter contains the bytes the read/write, the third the length of the parameter contains the bytes the read/write, the third the length of the
buffer. Returned is the actual number of bytes read/written. 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); int num);
This sends a series of messages. Each message can be a read or write, This sends a series of messages. Each message can be a read or write,
......
...@@ -490,7 +490,7 @@ static int iic_readbytes(struct i2c_adapter *i2c_adap, char *buf, int count, ...@@ -490,7 +490,7 @@ static int iic_readbytes(struct i2c_adapter *i2c_adap, char *buf, int count,
* condition. * condition.
*/ */
#if 0 #if 0
static int iic_combined_transaction(struct i2c_adapter *i2c_adap, struct i2c_msg msgs[], int num) static int iic_combined_transaction(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs, int num)
{ {
int i; int i;
struct i2c_msg *pmsg; struct i2c_msg *pmsg;
...@@ -600,7 +600,7 @@ static inline int iic_doAddress(struct i2c_algo_iic_data *adap, ...@@ -600,7 +600,7 @@ static inline int iic_doAddress(struct i2c_algo_iic_data *adap,
* verify that the bus is not busy or in some unknown state. * verify that the bus is not busy or in some unknown state.
*/ */
static int iic_xfer(struct i2c_adapter *i2c_adap, static int iic_xfer(struct i2c_adapter *i2c_adap,
struct i2c_msg msgs[], struct i2c_msg *msgs,
int num) int num)
{ {
struct i2c_algo_iic_data *adap = i2c_adap->algo_data; struct i2c_algo_iic_data *adap = i2c_adap->algo_data;
......
...@@ -178,7 +178,7 @@ static void pca_reset(struct i2c_algo_pca_data *adap) ...@@ -178,7 +178,7 @@ static void pca_reset(struct i2c_algo_pca_data *adap)
} }
static int pca_xfer(struct i2c_adapter *i2c_adap, static int pca_xfer(struct i2c_adapter *i2c_adap,
struct i2c_msg msgs[], struct i2c_msg *msgs,
int num) int num)
{ {
struct i2c_algo_pca_data *adap = i2c_adap->algo_data; struct i2c_algo_pca_data *adap = i2c_adap->algo_data;
......
...@@ -332,7 +332,7 @@ static inline int pcf_doAddress(struct i2c_algo_pcf_data *adap, ...@@ -332,7 +332,7 @@ static inline int pcf_doAddress(struct i2c_algo_pcf_data *adap,
} }
static int pcf_xfer(struct i2c_adapter *i2c_adap, static int pcf_xfer(struct i2c_adapter *i2c_adap,
struct i2c_msg msgs[], struct i2c_msg *msgs,
int num) int num)
{ {
struct i2c_algo_pcf_data *adap = i2c_adap->algo_data; struct i2c_algo_pcf_data *adap = i2c_adap->algo_data;
......
...@@ -131,7 +131,7 @@ static int i2c_write(struct i2c_algo_sgi_data *adap, unsigned char *buf, ...@@ -131,7 +131,7 @@ static int i2c_write(struct i2c_algo_sgi_data *adap, unsigned char *buf,
return 0; 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) int num)
{ {
struct i2c_algo_sgi_data *adap = i2c_adap->algo_data; struct i2c_algo_sgi_data *adap = i2c_adap->algo_data;
......
...@@ -253,7 +253,7 @@ i2c_write(struct i2c_au1550_data *adap, unsigned char *buf, ...@@ -253,7 +253,7 @@ i2c_write(struct i2c_au1550_data *adap, unsigned char *buf,
} }
static int 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_au1550_data *adap = i2c_adap->algo_data;
struct i2c_msg *p; struct i2c_msg *p;
......
...@@ -549,7 +549,7 @@ static inline int iic_address_neq(const struct i2c_msg* p1, ...@@ -549,7 +549,7 @@ static inline int iic_address_neq(const struct i2c_msg* p1,
* Generic master transfer entrypoint. * Generic master transfer entrypoint.
* Returns the number of processed messages or error (<0) * 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)); struct ibm_iic_private* dev = (struct ibm_iic_private*)(i2c_get_adapdata(adap));
volatile struct iic_regs __iomem *iic = dev->vaddr; volatile struct iic_regs __iomem *iic = dev->vaddr;
......
...@@ -361,7 +361,7 @@ iop3xx_i2c_handle_msg(struct i2c_adapter *i2c_adap, struct i2c_msg* pmsg) ...@@ -361,7 +361,7 @@ iop3xx_i2c_handle_msg(struct i2c_adapter *i2c_adap, struct i2c_msg* pmsg)
* master_xfer() - main read/write entry * master_xfer() - main read/write entry
*/ */
static int 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) int num)
{ {
struct i2c_algo_iop3xx_data *iop3xx_adap = i2c_adap->algo_data; struct i2c_algo_iop3xx_data *iop3xx_adap = i2c_adap->algo_data;
......
...@@ -399,7 +399,7 @@ keywest_smbus_xfer( struct i2c_adapter* adap, ...@@ -399,7 +399,7 @@ keywest_smbus_xfer( struct i2c_adapter* adap,
*/ */
static int static int
keywest_xfer( struct i2c_adapter *adap, keywest_xfer( struct i2c_adapter *adap,
struct i2c_msg msgs[], struct i2c_msg *msgs,
int num) int num)
{ {
struct keywest_chan* chan = i2c_get_adapdata(adap); struct keywest_chan* chan = i2c_get_adapdata(adap);
......
...@@ -233,7 +233,7 @@ static int mpc_read(struct mpc_i2c *i2c, int target, ...@@ -233,7 +233,7 @@ static int mpc_read(struct mpc_i2c *i2c, int target,
return length; 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; struct i2c_msg *pmsg;
int i; int i;
......
...@@ -483,7 +483,7 @@ static int s3c24xx_i2c_set_master(struct s3c24xx_i2c *i2c) ...@@ -483,7 +483,7 @@ static int s3c24xx_i2c_set_master(struct s3c24xx_i2c *i2c)
* this starts an i2c transfer * this starts an i2c transfer
*/ */
static int s3c24xx_i2c_doxfer(struct s3c24xx_i2c *i2c, struct i2c_msg msgs[], int num) static int s3c24xx_i2c_doxfer(struct s3c24xx_i2c *i2c, struct i2c_msg *msgs, int num)
{ {
unsigned long timeout; unsigned long timeout;
int ret; int ret;
...@@ -534,7 +534,7 @@ static int s3c24xx_i2c_doxfer(struct s3c24xx_i2c *i2c, struct i2c_msg msgs[], in ...@@ -534,7 +534,7 @@ static int s3c24xx_i2c_doxfer(struct s3c24xx_i2c *i2c, struct i2c_msg msgs[], in
*/ */
static int s3c24xx_i2c_xfer(struct i2c_adapter *adap, 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; struct s3c24xx_i2c *i2c = (struct s3c24xx_i2c *)adap->algo_data;
int retry; int retry;
......
...@@ -582,7 +582,7 @@ module_exit(i2c_exit); ...@@ -582,7 +582,7 @@ module_exit(i2c_exit);
* ---------------------------------------------------- * ----------------------------------------------------
*/ */
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; int ret;
......
...@@ -25,7 +25,7 @@ static inline u32 saa7146_i2c_status(struct saa7146_dev *dev) ...@@ -25,7 +25,7 @@ static inline u32 saa7146_i2c_status(struct saa7146_dev *dev)
sent through the saa7146. have a look at the specifications p. 122 ff sent through the saa7146. have a look at the specifications p. 122 ff
to understand this. it returns the number of u32s to send, or -1 to understand this. it returns the number of u32s to send, or -1
in case of an error. */ in case of an error. */
static int saa7146_i2c_msg_prepare(const struct i2c_msg m[], int num, u32 *op) static int saa7146_i2c_msg_prepare(const struct i2c_msg *m, int num, u32 *op)
{ {
int h1, h2; int h1, h2;
int i, j, addr; int i, j, addr;
...@@ -89,7 +89,7 @@ static int saa7146_i2c_msg_prepare(const struct i2c_msg m[], int num, u32 *op) ...@@ -89,7 +89,7 @@ static int saa7146_i2c_msg_prepare(const struct i2c_msg m[], int num, u32 *op)
which bytes were read through the adapter and write them back to the corresponding which bytes were read through the adapter and write them back to the corresponding
i2c-message. but instead, we simply write back all bytes. i2c-message. but instead, we simply write back all bytes.
fixme: this could be improved. */ fixme: this could be improved. */
static int saa7146_i2c_msg_cleanup(const struct i2c_msg m[], int num, u32 *op) static int saa7146_i2c_msg_cleanup(const struct i2c_msg *m, int num, u32 *op)
{ {
int i, j; int i, j;
int op_count = 0; int op_count = 0;
...@@ -272,7 +272,7 @@ static int saa7146_i2c_writeout(struct saa7146_dev *dev, u32* dword, int short_d ...@@ -272,7 +272,7 @@ static int saa7146_i2c_writeout(struct saa7146_dev *dev, u32* dword, int short_d
return 0; return 0;
} }
int saa7146_i2c_transfer(struct saa7146_dev *dev, const struct i2c_msg msgs[], int num, int retries) int saa7146_i2c_transfer(struct saa7146_dev *dev, const struct i2c_msg *msgs, int num, int retries)
{ {
int i = 0, count = 0; int i = 0, count = 0;
u32* buffer = dev->d_i2c.cpu_addr; u32* buffer = dev->d_i2c.cpu_addr;
...@@ -372,7 +372,7 @@ int saa7146_i2c_transfer(struct saa7146_dev *dev, const struct i2c_msg msgs[], i ...@@ -372,7 +372,7 @@ int saa7146_i2c_transfer(struct saa7146_dev *dev, const struct i2c_msg msgs[], i
} }
/* utility functions */ /* utility functions */
static int saa7146_i2c_xfer(struct i2c_adapter* adapter, struct i2c_msg msg[], int num) static int saa7146_i2c_xfer(struct i2c_adapter* adapter, struct i2c_msg *msg, int num)
{ {
struct saa7146_dev* dev = i2c_get_adapdata(adapter); struct saa7146_dev* dev = i2c_get_adapdata(adapter);
......
...@@ -293,7 +293,7 @@ static u32 flex_i2c_write(struct adapter *adapter, u32 device, u32 bus, u32 addr ...@@ -293,7 +293,7 @@ static u32 flex_i2c_write(struct adapter *adapter, u32 device, u32 bus, u32 addr
return buf - start; return buf - start;
} }
static int master_xfer(struct i2c_adapter* adapter, struct i2c_msg msgs[], int num) static int master_xfer(struct i2c_adapter* adapter, struct i2c_msg *msgs, int num)
{ {
struct adapter *tmp = i2c_get_adapdata(adapter); struct adapter *tmp = i2c_get_adapdata(adapter);
int i, ret = 0; int i, ret = 0;
......
...@@ -38,7 +38,7 @@ int dibusb_i2c_msg(struct usb_dibusb *dib, u8 addr, ...@@ -38,7 +38,7 @@ int dibusb_i2c_msg(struct usb_dibusb *dib, u8 addr,
/* /*
* I2C master xfer function * I2C master xfer function
*/ */
static int dibusb_i2c_xfer(struct i2c_adapter *adap,struct i2c_msg msg[],int num) static int dibusb_i2c_xfer(struct i2c_adapter *adap,struct i2c_msg *msg,int num)
{ {
struct usb_dibusb *dib = i2c_get_adapdata(adap); struct usb_dibusb *dib = i2c_get_adapdata(adap);
int i; int i;
......
...@@ -252,7 +252,7 @@ static int ttusb_i2c_msg(struct ttusb *ttusb, ...@@ -252,7 +252,7 @@ static int ttusb_i2c_msg(struct ttusb *ttusb,
return rcv_len; return rcv_len;
} }
static int master_xfer(struct i2c_adapter* adapter, struct i2c_msg msg[], int num) static int master_xfer(struct i2c_adapter* adapter, struct i2c_msg *msg, int num)
{ {
struct ttusb *ttusb = i2c_get_adapdata(adapter); struct ttusb *ttusb = i2c_get_adapdata(adapter);
int i = 0; int i = 0;
......
...@@ -245,7 +245,7 @@ bttv_i2c_readbytes(struct bttv *btv, const struct i2c_msg *msg, int last) ...@@ -245,7 +245,7 @@ bttv_i2c_readbytes(struct bttv *btv, const struct i2c_msg *msg, int last)
return retval; 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); struct bttv *btv = i2c_get_adapdata(i2c_adap);
int retval = 0; int retval = 0;
......
...@@ -236,7 +236,7 @@ static inline int i2c_recv_byte(struct saa7134_dev *dev) ...@@ -236,7 +236,7 @@ static inline int i2c_recv_byte(struct saa7134_dev *dev)
} }
static int saa7134_i2c_xfer(struct i2c_adapter *i2c_adap, static int saa7134_i2c_xfer(struct i2c_adapter *i2c_adap,
struct i2c_msg msgs[], int num) struct i2c_msg *msgs, int num)
{ {
struct saa7134_dev *dev = i2c_adap->algo_data; struct saa7134_dev *dev = i2c_adap->algo_data;
enum i2c_status status; enum i2c_status status;
......
...@@ -55,7 +55,7 @@ extern int i2c_master_recv(struct i2c_client *,char* ,int); ...@@ -55,7 +55,7 @@ extern int i2c_master_recv(struct i2c_client *,char* ,int);
/* Transfer num messages. /* 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. * Some adapter types (i.e. PCF 8584 based ones) may support slave behaviuor.
...@@ -191,7 +191,7 @@ struct i2c_algorithm { ...@@ -191,7 +191,7 @@ struct i2c_algorithm {
to NULL. If an adapter algorithm can do SMBus access, set to NULL. If an adapter algorithm can do SMBus access, set
smbus_xfer. If set to NULL, the SMBus protocol is simulated smbus_xfer. If set to NULL, the SMBus protocol is simulated
using common I2C messages */ 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 num);
int (*smbus_xfer) (struct i2c_adapter *adap, u16 addr, int (*smbus_xfer) (struct i2c_adapter *adap, u16 addr,
unsigned short flags, char read_write, unsigned short flags, char read_write,
......
...@@ -157,7 +157,7 @@ struct saa7146_dev ...@@ -157,7 +157,7 @@ struct saa7146_dev
/* from saa7146_i2c.c */ /* from saa7146_i2c.c */
int saa7146_i2c_adapter_prepare(struct saa7146_dev *dev, struct i2c_adapter *i2c_adapter, u32 bitrate); int saa7146_i2c_adapter_prepare(struct saa7146_dev *dev, struct i2c_adapter *i2c_adapter, u32 bitrate);
int saa7146_i2c_transfer(struct saa7146_dev *saa, const struct i2c_msg msgs[], int num, int retries); int saa7146_i2c_transfer(struct saa7146_dev *saa, const struct *i2c_msg msgs, int num, int retries);
/* from saa7146_core.c */ /* from saa7146_core.c */
extern struct list_head saa7146_devices; extern struct list_head saa7146_devices;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment