Re: [PATCH] i2c.h: Fix another gcc 4.0 compile failure

From: Mickey Stein (yekkim_at_pacbell.net)
Date: 02/20/05

  • Next message: Parag Warudkar: "Re: Needed faster implementation of do_gettimeofday()"
    Date:	Sun, 20 Feb 2005 07:40:24 -0800
    To: Greg KH <greg@kroah.com>
    
    
    

    Greg KH wrote:

    >On Sat, Feb 19, 2005 at 08:58:48AM -0800, Mickey Stein wrote:
    >
    >
    >>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.
    >>
    >>
    >
    >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

     Signed-off-by: Mickey Stein <yekkim@pacbell.net>

    
    

    --- ./include/linux/i2c.h.sav 2005-02-20 07:03:41.000000000 -0800
    +++ ./include/linux/i2c.h 2005-02-20 07:14:26.000000000 -0800
    @@ -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.sav 2005-02-20 07:03:53.000000000 -0800
    +++ ./drivers/i2c/i2c-core.c 2005-02-20 07:11:46.000000000 -0800
    @@ -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.sav 2005-02-20 07:05:12.000000000 -0800
    +++ ./Documentation/i2c/writing-clients 2005-02-20 07:08:29.000000000 -0800
    @@ -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,

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


  • Next message: Parag Warudkar: "Re: Needed faster implementation of do_gettimeofday()"

    Relevant Pages

    • Re: [PATCH] i2c.h: Fix another gcc 4.0 compile failure
      ... > A. Daplas has recently done a workaround for this on another header ... > patch below is also attached since I'm not sure formatting survives ... i2c_transferfunction itself should be changed (not just the header ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: Microsoft Security Bulletin MS03-010 - 331953
      ... No patch for NT4, workaround is to place the system behind a firewall. ... What about internal threats? ... > The Microsoft Security Response Center has released Microsoft Security ...
      (microsoft.public.win2000.security)
    • Re: CONFIG_VFAT_FS_DUALNAMES regressions
      ... If we have a workaround that is truely compatible with stuff and has no ... interoperability problems are acceptable, especially for file systems. ... Why - because the failure case is defined ("Sorry can't play ... long name creation" patch from May. ...
      (Linux-Kernel)
    • Re: IE6 form POST operation sporadic after sp KB832894 install
      ... We have configured our Apache 1.3.x web server to turn ... # The following directives modify normal HTTP response ... after I installed the latest IE patch and I cannot seem to ... I believe that his workaround fixes the problem for us. ...
      (microsoft.public.windows.inetexplorer.ie6.browser)
    • Re: Problem with locked down IIS and viewing PDFs
      ... Have you applied the patch with MS02-18? ... As for a workaround, you need to set RemoveServerHeader=0 in the URLScan.ini ... > when we go to view PDF documents on the site we get the following error: ... > Microsoft site to no avail. ...
      (microsoft.public.inetserver.iis.security)