07 Jun, 2014

1 commit

  • When running sparse over drivers/media/v4l2-core/v4l2-ioctl.c I get these
    errors:

    drivers/media/v4l2-core/v4l2-ioctl.c:2043:9: error: bad integer constant expression
    drivers/media/v4l2-core/v4l2-ioctl.c:2044:9: error: bad integer constant expression
    drivers/media/v4l2-core/v4l2-ioctl.c:2045:9: error: bad integer constant expression
    drivers/media/v4l2-core/v4l2-ioctl.c:2046:9: error: bad integer constant expression

    etc.

    The root cause of that turns out to be in include/asm-generic/ioctl.h:

    #include

    /* provoke compile error for invalid uses of size argument */
    extern unsigned int __invalid_size_argument_for_IOC;
    #define _IOC_TYPECHECK(t) \
    ((sizeof(t) == sizeof(t[1]) && \
    sizeof(t) < (1 << _IOC_SIZEBITS)) ? \
    sizeof(t) : __invalid_size_argument_for_IOC)

    If it is defined as this (as is already done if __KERNEL__ is not defined):

    #define _IOC_TYPECHECK(t) (sizeof(t))

    then all is well with the world.

    This patch allows sparse to work correctly.

    Signed-off-by: Hans Verkuil
    Reviewed-by: Josh Triplett
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Hans Verkuil
     

05 Oct, 2012

1 commit


13 Aug, 2008

1 commit

  • The attached patch seems to already exist in a number of branches -- it
    keeps popping up on Google for me, and is certainly already in Debian --
    but is strangely absent from mainstream.

    The problem appears to be that the patched file ends up as part of the
    target toolchain, but unfortunately the gcc constant folding doesn't
    appear to eliminate the __invalid_size_argument_for_IOC value early
    enough. Certainly compiling C++ programs which use _IO... macros as
    constants fails without this patch.

    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Michael Abbott
     

29 Apr, 2008

1 commit

  • In the spirit of a number of other asm-generic header files,
    generalize asm-generic/ioctl.h to allow arch-specific ioctl.h headers
    to simply override _IOC_SIZEBITS and/or _IOC_DIRBITS before including
    this header file, allowing a number of ioctl.h header files to be
    shortened considerably.

    Signed-off-by: Robert P. J. Day
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Robert P. J. Day
     

11 Jan, 2006

1 commit