24 Mar, 2019

3 commits

  • commit 4bc1ab41eee9d02ad2483bf8f51a7b72e3504eba upstream.

    Move upstream stream off to just after receiving the last EOF completion
    and disabling the CSI (and thus before disabling the IDMA channel) in
    csi_stop(). For symmetry also move upstream stream on to beginning of
    csi_start().

    Doing this makes csi_s_stream() more symmetric with prp_s_stream() which
    will require the same change to fix a hard lockup.

    Signed-off-by: Steve Longerbeam
    Cc: stable@vger.kernel.org # for 4.13 and up
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab
    Signed-off-by: Greg Kroah-Hartman

    Steve Longerbeam
     
  • commit 2e0fe66e0a136252f4d89dbbccdcb26deb867eb8 upstream.

    Disable the CSI immediately after receiving the last EOF before stream
    off (and thus before disabling the IDMA channel). Do this by moving the
    wait for EOF completion into a new function csi_idmac_wait_last_eof().

    This fixes a complete system hard lockup on the SabreAuto when streaming
    from the ADV7180, by repeatedly sending a stream off immediately followed
    by stream on:

    while true; do v4l2-ctl -d4 --stream-mmap --stream-count=3; done

    Eventually this either causes the system lockup or EOF timeouts at all
    subsequent stream on, until a system reset.

    The lockup occurs when disabling the IDMA channel at stream off. Disabling
    the CSI before disabling the IDMA channel appears to be a reliable fix for
    the hard lockup.

    Fixes: 4a34ec8e470cb ("[media] media: imx: Add CSI subdev driver")

    Reported-by: Gaël PORTAY
    Signed-off-by: Steve Longerbeam
    Cc: stable@vger.kernel.org # for 4.13 and up
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab
    Signed-off-by: Greg Kroah-Hartman

    Steve Longerbeam
     
  • commit a19c22677377b87e4354f7306f46ad99bc982a9f upstream.

    Upstream must be stopped immediately after receiving the last EOF and
    before disabling the IDMA channel. This can be accomplished by moving
    upstream stream off to just after receiving the last EOF completion in
    prp_stop(). For symmetry also move upstream stream on to end of
    prp_start().

    This fixes a complete system hard lockup on the SabreAuto when streaming
    from the ADV7180, by repeatedly sending a stream off immediately followed
    by stream on:

    while true; do v4l2-ctl -d1 --stream-mmap --stream-count=3; done

    Eventually this either causes the system lockup or EOF timeouts at all
    subsequent stream on, until a system reset.

    The lockup occurs when disabling the IDMA channel at stream off. Stopping
    the video data stream entering the IDMA channel before disabling the
    channel itself appears to be a reliable fix for the hard lockup.

    Fixes: f0d9c8924e2c3 ("[media] media: imx: Add IC subdev drivers")

    Reported-by: Gaël PORTAY
    Tested-by: Gaël PORTAY
    Signed-off-by: Steve Longerbeam
    Cc: stable@vger.kernel.org # for 4.13 and up
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab
    Signed-off-by: Greg Kroah-Hartman

    Steve Longerbeam
     

12 Sep, 2018

1 commit


16 Aug, 2018

1 commit

  • Pull media updates from Mauro Carvalho Chehab:

    - new Socionext MN88443x ISDB-S/T demodulator driver: mn88443x

    - new sensor drivers: ak7375, ov2680 and rj54n1cb0c

    - an old soc-camera sensor driver converted to the V4L2 framework:
    mt9v111

    - a new Voice-Coil Motor (VCM) driver: dw9807-vcm

    - some cleanups at cx25821, removing legacy unused code

    - some improvements at ddbridge driver

    - new platform driver: vicodec

    - some DVB API cleanups, removing ioctls and compat code for old
    out-of-tree drivers that were never merged upstream

    - improvements at DVB core to support frontents that support both
    Satellite and non-satellite delivery systems

    - got rid of the unused VIDIOC_RESERVED V4L2 ioctl

    - some cleanups/improvements at gl861 ISDB driver

    - several improvements on ov772x, ov7670 and ov5640, imx274, ov5645,
    and smiapp sensor drivers

    - fixes at em28xx to support dual TS devices

    - some cleanups at V4L2/VB2 locking logic

    - some API improvements at media controller

    - some cec core and drivers improvements

    - some uvcvideo improvements

    - some improvements at platform drivers: stm32-dcmi, rcar-vin, coda,
    reneseas-ceu, imx, vsp1, venus, camss

    - lots of other cleanups and fixes

    * tag 'media/v4.19-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (406 commits)
    Revert "media: vivid: shut up warnings due to a non-trivial logic"
    siano: get rid of an unused return code for debugfs register
    media: isp: fix a warning about a wrong struct initializer
    media: radio-wl1273: fix return code for the polling routine
    media: s3c-camif: fix return code for the polling routine
    media: saa7164: fix return codes for the polling routine
    media: exynos-gsc: fix return code if mutex was interrupted
    media: mt9v111: Fix build error with no VIDEO_V4L2_SUBDEV_API
    media: xc4000: get rid of uneeded casts
    media: drxj: get rid of uneeded casts
    media: tuner-xc2028: don't use casts for printing sizes
    media: cleanup fall-through comments
    media: vivid: shut up warnings due to a non-trivial logic
    media: rtl28xxu: be sure that it won't go past the array size
    media: mt9v111: avoid going past the buffer
    media: vsp1_dl: add a description for cmdpool field
    media: sta2x11: add a missing parameter description
    media: v4l2-mem2mem: add descriptions to MC fields
    media: i2c: fix warning in Aptina MT9V111
    media: imx: shut up a false positive warning
    ...

    Linus Torvalds
     

08 Aug, 2018

1 commit

  • As Ian pointed out, adding a '-' to the fallthrough seems to meet
    the regex requirements at level 3 of the warning, at least when
    the comment fits into a single line.

    So, replace by a single line the comments that were broken into
    multiple lines just to make gcc -Wimplicit-fallthrough=3 happy.

    Suggested-by: Ian Arkver
    Signed-off-by: Mauro Carvalho Chehab

    Mauro Carvalho Chehab
     

07 Aug, 2018

1 commit

  • With imx, gcc produces a false positive warning:

    drivers/staging/media/imx/imx-media-csi.c: In function 'csi_idmac_setup_channel':
    drivers/staging/media/imx/imx-media-csi.c:457:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
    if (passthrough) {
    ^
    drivers/staging/media/imx/imx-media-csi.c:464:2: note: here
    default:
    ^~~~~~~

    That's because the regex it uses for fall trough is not
    good enough. So, rearrange the fall through comment in a way
    that gcc will recognize.

    Signed-off-by: Mauro Carvalho Chehab

    Mauro Carvalho Chehab
     

25 Jul, 2018

1 commit

  • Including asm/cacheflush.h first results in the following build error
    when trying to build sparc32:allmodconfig, because 'struct page' has not
    been declared, and the function declaration ends up creating a separate
    (private) declaration of struct page (as a result of function arguments
    being in the scope of the function declaration and definition, not in
    global scope).

    The C scoping rules do not just affect variable visibility, they also
    affect type declaration visibility.

    The end result is that when the actual call site is seen in
    , the 'struct page' type in the caller is not the same
    'struct page' that the function was declared with, resulting in:

    In file included from arch/sparc/include/asm/page.h:10:0,
    ...
    from drivers/staging/media/omap4iss/iss_video.c:15:
    include/linux/highmem.h: In function 'clear_user_highpage':
    include/linux/highmem.h:137:31: error:
    passing argument 1 of 'sparc_flush_page_to_ram' from incompatible
    pointer type

    Include generic includes files first to fix the problem.

    Fixes: fc96d58c10162 ("[media] v4l: omap4iss: Add support for OMAP4 camera interface - Video devices")
    Suggested-by: Linus Torvalds
    Acked-by: David S. Miller
    Cc: Randy Dunlap
    Signed-off-by: Guenter Roeck
    [ Added explanation of C scope rules - Linus ]
    Signed-off-by: Linus Torvalds

    Guenter Roeck
     

04 Jul, 2018

5 commits

  • The IPU can only capture RGB565 with two 8-bit cycles in bayer/generic
    mode on the parallel bus, compared to a specific mode on MIPI CSI-2.
    To handle this, we extend imx_media_pixfmt with a cycles per pixel
    field, which is used for generic formats on the parallel bus.

    Based on the selected format and bus, we then update the width to
    account for the multiple cycles per pixel.

    Signed-off-by: Jan Luebbe
    Signed-off-by: Steve Longerbeam
    Reviewed-by: Philipp Zabel
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Jan Luebbe
     
  • By checking and handling the internal IPU formats (ARGB or AYUV) first,
    we don't need to check whether it's a bayer format, as we can default to
    passing the input format on in all other cases.

    This simplifies handling the different configurations for RGB565 between
    parallel and MIPI CSI-2, as we don't need to check the details of the
    format anymore.

    Signed-off-by: Jan Luebbe
    Reviewed-by: Philipp Zabel
    Reviewed-by: Steve Longerbeam
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Jan Luebbe
     
  • - enables gstreamer v4l2src lost frame detection, e.g:

    0:00:08.685185668 348 0x54f520 WARN v4l2src gstv4l2src.c:970:gst_v4l2src_create: lost frames detected: count = 141 - ts: 0:00:08.330177332

    - fixes v4l2-compliance test failure:

    Streaming ioctls:
    test read/write: OK (Not Supported)
    Video Capture:
    Buffer: 0 Sequence: 0 Field: None Timestamp: 92.991450s
    Buffer: 1 Sequence: 0 Field: None Timestamp: 93.008135s
    fail: v4l2-test-buffers.cpp(294): (int)g_sequence() < seq.last_seq + 1
    fail: v4l2-test-buffers.cpp(707): buf.check(q, last_seq)

    Signed-off-by: Peter Seiderer
    Reviewed-by: Steve Longerbeam
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Peter Seiderer
     
  • - fixes gstreamer v4l2src warning:

    0:00:00.716640334 349 0x164f720 WARN v4l2bufferpool gstv4l2bufferpool.c:1195:gst_v4l2_buffer_pool_dqbuf: Driver should never set v4l2_buffer.field to ANY

    - fixes v4l2-compliance test failure:

    Streaming ioctls:
    test read/write: OK (Not Supported)
    Video Capture:
    Buffer: 0 Sequence: 0 Field: Any Timestamp: 58.383658s
    fail: v4l2-test-buffers.cpp(297): g_field() == V4L2_FIELD_ANY

    Signed-off-by: Peter Seiderer
    Reviewed-by: Steve Longerbeam
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Peter Seiderer
     
  • Currently, this driver does not serialize its video4linux
    ioctls, which is a bug, as race conditions might appear.

    In addition, video_device and vb2_queue locks are now both
    mandatory. Add them, and implement wait_prepare and
    wait_finish.

    To stay on the safe side, this commit uses a single mutex
    for both locks. Better latency can be obtained by separating
    these if needed.

    Signed-off-by: Ezequiel Garcia
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Ezequiel Garcia
     

28 Jun, 2018

2 commits


16 Jun, 2018

2 commits

  • There are several places pointing to old documentation files:

    Documentation/video4linux/API.html
    Documentation/video4linux/bttv/
    Documentation/video4linux/cx2341x/fw-encoder-api.txt
    Documentation/video4linux/m5602.txt
    Documentation/video4linux/v4l2-framework.txt
    Documentation/video4linux/videobuf
    Documentation/video4linux/Zoran

    Make them point to the new location where available, removing
    otherwise.

    Signed-off-by: Mauro Carvalho Chehab
    Acked-by: Jonathan Corbet

    Mauro Carvalho Chehab
     
  • As we move stuff around, some doc references are broken. Fix some of
    them via this script:
    ./scripts/documentation-file-ref-check --fix

    Manually checked if the produced result is valid, removing a few
    false-positives.

    Acked-by: Takashi Iwai
    Acked-by: Masami Hiramatsu
    Acked-by: Stephen Boyd
    Acked-by: Charles Keepax
    Acked-by: Mathieu Poirier
    Reviewed-by: Coly Li
    Signed-off-by: Mauro Carvalho Chehab
    Acked-by: Jonathan Corbet

    Mauro Carvalho Chehab
     

13 Jun, 2018

3 commits

  • The vmalloc() function has no 2-factor argument form, so multiplication
    factors need to be wrapped in array_size(). This patch replaces cases of:

    vmalloc(a * b)

    with:
    vmalloc(array_size(a, b))

    as well as handling cases of:

    vmalloc(a * b * c)

    with:

    vmalloc(array3_size(a, b, c))

    This does, however, attempt to ignore constant size factors like:

    vmalloc(4 * 1024)

    though any constants defined via macros get caught up in the conversion.

    Any factors with a sizeof() of "unsigned char", "char", and "u8" were
    dropped, since they're redundant.

    The Coccinelle script used for this was:

    // Fix redundant parens around sizeof().
    @@
    type TYPE;
    expression THING, E;
    @@

    (
    vmalloc(
    - (sizeof(TYPE)) * E
    + sizeof(TYPE) * E
    , ...)
    |
    vmalloc(
    - (sizeof(THING)) * E
    + sizeof(THING) * E
    , ...)
    )

    // Drop single-byte sizes and redundant parens.
    @@
    expression COUNT;
    typedef u8;
    typedef __u8;
    @@

    (
    vmalloc(
    - sizeof(u8) * (COUNT)
    + COUNT
    , ...)
    |
    vmalloc(
    - sizeof(__u8) * (COUNT)
    + COUNT
    , ...)
    |
    vmalloc(
    - sizeof(char) * (COUNT)
    + COUNT
    , ...)
    |
    vmalloc(
    - sizeof(unsigned char) * (COUNT)
    + COUNT
    , ...)
    |
    vmalloc(
    - sizeof(u8) * COUNT
    + COUNT
    , ...)
    |
    vmalloc(
    - sizeof(__u8) * COUNT
    + COUNT
    , ...)
    |
    vmalloc(
    - sizeof(char) * COUNT
    + COUNT
    , ...)
    |
    vmalloc(
    - sizeof(unsigned char) * COUNT
    + COUNT
    , ...)
    )

    // 2-factor product with sizeof(type/expression) and identifier or constant.
    @@
    type TYPE;
    expression THING;
    identifier COUNT_ID;
    constant COUNT_CONST;
    @@

    (
    vmalloc(
    - sizeof(TYPE) * (COUNT_ID)
    + array_size(COUNT_ID, sizeof(TYPE))
    , ...)
    |
    vmalloc(
    - sizeof(TYPE) * COUNT_ID
    + array_size(COUNT_ID, sizeof(TYPE))
    , ...)
    |
    vmalloc(
    - sizeof(TYPE) * (COUNT_CONST)
    + array_size(COUNT_CONST, sizeof(TYPE))
    , ...)
    |
    vmalloc(
    - sizeof(TYPE) * COUNT_CONST
    + array_size(COUNT_CONST, sizeof(TYPE))
    , ...)
    |
    vmalloc(
    - sizeof(THING) * (COUNT_ID)
    + array_size(COUNT_ID, sizeof(THING))
    , ...)
    |
    vmalloc(
    - sizeof(THING) * COUNT_ID
    + array_size(COUNT_ID, sizeof(THING))
    , ...)
    |
    vmalloc(
    - sizeof(THING) * (COUNT_CONST)
    + array_size(COUNT_CONST, sizeof(THING))
    , ...)
    |
    vmalloc(
    - sizeof(THING) * COUNT_CONST
    + array_size(COUNT_CONST, sizeof(THING))
    , ...)
    )

    // 2-factor product, only identifiers.
    @@
    identifier SIZE, COUNT;
    @@

    vmalloc(
    - SIZE * COUNT
    + array_size(COUNT, SIZE)
    , ...)

    // 3-factor product with 1 sizeof(type) or sizeof(expression), with
    // redundant parens removed.
    @@
    expression THING;
    identifier STRIDE, COUNT;
    type TYPE;
    @@

    (
    vmalloc(
    - sizeof(TYPE) * (COUNT) * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    vmalloc(
    - sizeof(TYPE) * (COUNT) * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    vmalloc(
    - sizeof(TYPE) * COUNT * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    vmalloc(
    - sizeof(TYPE) * COUNT * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    vmalloc(
    - sizeof(THING) * (COUNT) * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    vmalloc(
    - sizeof(THING) * (COUNT) * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    vmalloc(
    - sizeof(THING) * COUNT * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    vmalloc(
    - sizeof(THING) * COUNT * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    )

    // 3-factor product with 2 sizeof(variable), with redundant parens removed.
    @@
    expression THING1, THING2;
    identifier COUNT;
    type TYPE1, TYPE2;
    @@

    (
    vmalloc(
    - sizeof(TYPE1) * sizeof(TYPE2) * COUNT
    + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
    , ...)
    |
    vmalloc(
    - sizeof(TYPE1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
    , ...)
    |
    vmalloc(
    - sizeof(THING1) * sizeof(THING2) * COUNT
    + array3_size(COUNT, sizeof(THING1), sizeof(THING2))
    , ...)
    |
    vmalloc(
    - sizeof(THING1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(THING1), sizeof(THING2))
    , ...)
    |
    vmalloc(
    - sizeof(TYPE1) * sizeof(THING2) * COUNT
    + array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
    , ...)
    |
    vmalloc(
    - sizeof(TYPE1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
    , ...)
    )

    // 3-factor product, only identifiers, with redundant parens removed.
    @@
    identifier STRIDE, SIZE, COUNT;
    @@

    (
    vmalloc(
    - (COUNT) * STRIDE * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    vmalloc(
    - COUNT * (STRIDE) * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    vmalloc(
    - COUNT * STRIDE * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    vmalloc(
    - (COUNT) * (STRIDE) * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    vmalloc(
    - COUNT * (STRIDE) * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    vmalloc(
    - (COUNT) * STRIDE * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    vmalloc(
    - (COUNT) * (STRIDE) * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    vmalloc(
    - COUNT * STRIDE * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    )

    // Any remaining multi-factor products, first at least 3-factor products
    // when they're not all constants...
    @@
    expression E1, E2, E3;
    constant C1, C2, C3;
    @@

    (
    vmalloc(C1 * C2 * C3, ...)
    |
    vmalloc(
    - E1 * E2 * E3
    + array3_size(E1, E2, E3)
    , ...)
    )

    // And then all remaining 2 factors products when they're not all constants.
    @@
    expression E1, E2;
    constant C1, C2;
    @@

    (
    vmalloc(C1 * C2, ...)
    |
    vmalloc(
    - E1 * E2
    + array_size(E1, E2)
    , ...)
    )

    Signed-off-by: Kees Cook

    Kees Cook
     
  • The devm_kzalloc() function has a 2-factor argument form, devm_kcalloc().
    This patch replaces cases of:

    devm_kzalloc(handle, a * b, gfp)

    with:
    devm_kcalloc(handle, a * b, gfp)

    as well as handling cases of:

    devm_kzalloc(handle, a * b * c, gfp)

    with:

    devm_kzalloc(handle, array3_size(a, b, c), gfp)

    as it's slightly less ugly than:

    devm_kcalloc(handle, array_size(a, b), c, gfp)

    This does, however, attempt to ignore constant size factors like:

    devm_kzalloc(handle, 4 * 1024, gfp)

    though any constants defined via macros get caught up in the conversion.

    Any factors with a sizeof() of "unsigned char", "char", and "u8" were
    dropped, since they're redundant.

    Some manual whitespace fixes were needed in this patch, as Coccinelle
    really liked to write "=devm_kcalloc..." instead of "= devm_kcalloc...".

    The Coccinelle script used for this was:

    // Fix redundant parens around sizeof().
    @@
    expression HANDLE;
    type TYPE;
    expression THING, E;
    @@

    (
    devm_kzalloc(HANDLE,
    - (sizeof(TYPE)) * E
    + sizeof(TYPE) * E
    , ...)
    |
    devm_kzalloc(HANDLE,
    - (sizeof(THING)) * E
    + sizeof(THING) * E
    , ...)
    )

    // Drop single-byte sizes and redundant parens.
    @@
    expression HANDLE;
    expression COUNT;
    typedef u8;
    typedef __u8;
    @@

    (
    devm_kzalloc(HANDLE,
    - sizeof(u8) * (COUNT)
    + COUNT
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(__u8) * (COUNT)
    + COUNT
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(char) * (COUNT)
    + COUNT
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(unsigned char) * (COUNT)
    + COUNT
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(u8) * COUNT
    + COUNT
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(__u8) * COUNT
    + COUNT
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(char) * COUNT
    + COUNT
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(unsigned char) * COUNT
    + COUNT
    , ...)
    )

    // 2-factor product with sizeof(type/expression) and identifier or constant.
    @@
    expression HANDLE;
    type TYPE;
    expression THING;
    identifier COUNT_ID;
    constant COUNT_CONST;
    @@

    (
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(TYPE) * (COUNT_ID)
    + COUNT_ID, sizeof(TYPE)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(TYPE) * COUNT_ID
    + COUNT_ID, sizeof(TYPE)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(TYPE) * (COUNT_CONST)
    + COUNT_CONST, sizeof(TYPE)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(TYPE) * COUNT_CONST
    + COUNT_CONST, sizeof(TYPE)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(THING) * (COUNT_ID)
    + COUNT_ID, sizeof(THING)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(THING) * COUNT_ID
    + COUNT_ID, sizeof(THING)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(THING) * (COUNT_CONST)
    + COUNT_CONST, sizeof(THING)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(THING) * COUNT_CONST
    + COUNT_CONST, sizeof(THING)
    , ...)
    )

    // 2-factor product, only identifiers.
    @@
    expression HANDLE;
    identifier SIZE, COUNT;
    @@

    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - SIZE * COUNT
    + COUNT, SIZE
    , ...)

    // 3-factor product with 1 sizeof(type) or sizeof(expression), with
    // redundant parens removed.
    @@
    expression HANDLE;
    expression THING;
    identifier STRIDE, COUNT;
    type TYPE;
    @@

    (
    devm_kzalloc(HANDLE,
    - sizeof(TYPE) * (COUNT) * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(TYPE) * (COUNT) * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(TYPE) * COUNT * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(TYPE) * COUNT * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(THING) * (COUNT) * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(THING) * (COUNT) * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(THING) * COUNT * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(THING) * COUNT * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    )

    // 3-factor product with 2 sizeof(variable), with redundant parens removed.
    @@
    expression HANDLE;
    expression THING1, THING2;
    identifier COUNT;
    type TYPE1, TYPE2;
    @@

    (
    devm_kzalloc(HANDLE,
    - sizeof(TYPE1) * sizeof(TYPE2) * COUNT
    + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(TYPE1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(THING1) * sizeof(THING2) * COUNT
    + array3_size(COUNT, sizeof(THING1), sizeof(THING2))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(THING1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(THING1), sizeof(THING2))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(TYPE1) * sizeof(THING2) * COUNT
    + array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(TYPE1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
    , ...)
    )

    // 3-factor product, only identifiers, with redundant parens removed.
    @@
    expression HANDLE;
    identifier STRIDE, SIZE, COUNT;
    @@

    (
    devm_kzalloc(HANDLE,
    - (COUNT) * STRIDE * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - COUNT * (STRIDE) * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - COUNT * STRIDE * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - (COUNT) * (STRIDE) * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - COUNT * (STRIDE) * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - (COUNT) * STRIDE * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - (COUNT) * (STRIDE) * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - COUNT * STRIDE * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    )

    // Any remaining multi-factor products, first at least 3-factor products,
    // when they're not all constants...
    @@
    expression HANDLE;
    expression E1, E2, E3;
    constant C1, C2, C3;
    @@

    (
    devm_kzalloc(HANDLE, C1 * C2 * C3, ...)
    |
    devm_kzalloc(HANDLE,
    - (E1) * E2 * E3
    + array3_size(E1, E2, E3)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - (E1) * (E2) * E3
    + array3_size(E1, E2, E3)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - (E1) * (E2) * (E3)
    + array3_size(E1, E2, E3)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - E1 * E2 * E3
    + array3_size(E1, E2, E3)
    , ...)
    )

    // And then all remaining 2 factors products when they're not all constants,
    // keeping sizeof() as the second factor argument.
    @@
    expression HANDLE;
    expression THING, E1, E2;
    type TYPE;
    constant C1, C2, C3;
    @@

    (
    devm_kzalloc(HANDLE, sizeof(THING) * C2, ...)
    |
    devm_kzalloc(HANDLE, sizeof(TYPE) * C2, ...)
    |
    devm_kzalloc(HANDLE, C1 * C2 * C3, ...)
    |
    devm_kzalloc(HANDLE, C1 * C2, ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(TYPE) * (E2)
    + E2, sizeof(TYPE)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(TYPE) * E2
    + E2, sizeof(TYPE)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(THING) * (E2)
    + E2, sizeof(THING)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(THING) * E2
    + E2, sizeof(THING)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - (E1) * E2
    + E1, E2
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - (E1) * (E2)
    + E1, E2
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - E1 * E2
    + E1, E2
    , ...)
    )

    Signed-off-by: Kees Cook

    Kees Cook
     
  • The kmalloc() function has a 2-factor argument form, kmalloc_array(). This
    patch replaces cases of:

    kmalloc(a * b, gfp)

    with:
    kmalloc_array(a * b, gfp)

    as well as handling cases of:

    kmalloc(a * b * c, gfp)

    with:

    kmalloc(array3_size(a, b, c), gfp)

    as it's slightly less ugly than:

    kmalloc_array(array_size(a, b), c, gfp)

    This does, however, attempt to ignore constant size factors like:

    kmalloc(4 * 1024, gfp)

    though any constants defined via macros get caught up in the conversion.

    Any factors with a sizeof() of "unsigned char", "char", and "u8" were
    dropped, since they're redundant.

    The tools/ directory was manually excluded, since it has its own
    implementation of kmalloc().

    The Coccinelle script used for this was:

    // Fix redundant parens around sizeof().
    @@
    type TYPE;
    expression THING, E;
    @@

    (
    kmalloc(
    - (sizeof(TYPE)) * E
    + sizeof(TYPE) * E
    , ...)
    |
    kmalloc(
    - (sizeof(THING)) * E
    + sizeof(THING) * E
    , ...)
    )

    // Drop single-byte sizes and redundant parens.
    @@
    expression COUNT;
    typedef u8;
    typedef __u8;
    @@

    (
    kmalloc(
    - sizeof(u8) * (COUNT)
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(__u8) * (COUNT)
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(char) * (COUNT)
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(unsigned char) * (COUNT)
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(u8) * COUNT
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(__u8) * COUNT
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(char) * COUNT
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(unsigned char) * COUNT
    + COUNT
    , ...)
    )

    // 2-factor product with sizeof(type/expression) and identifier or constant.
    @@
    type TYPE;
    expression THING;
    identifier COUNT_ID;
    constant COUNT_CONST;
    @@

    (
    - kmalloc
    + kmalloc_array
    (
    - sizeof(TYPE) * (COUNT_ID)
    + COUNT_ID, sizeof(TYPE)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(TYPE) * COUNT_ID
    + COUNT_ID, sizeof(TYPE)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(TYPE) * (COUNT_CONST)
    + COUNT_CONST, sizeof(TYPE)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(TYPE) * COUNT_CONST
    + COUNT_CONST, sizeof(TYPE)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(THING) * (COUNT_ID)
    + COUNT_ID, sizeof(THING)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(THING) * COUNT_ID
    + COUNT_ID, sizeof(THING)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(THING) * (COUNT_CONST)
    + COUNT_CONST, sizeof(THING)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(THING) * COUNT_CONST
    + COUNT_CONST, sizeof(THING)
    , ...)
    )

    // 2-factor product, only identifiers.
    @@
    identifier SIZE, COUNT;
    @@

    - kmalloc
    + kmalloc_array
    (
    - SIZE * COUNT
    + COUNT, SIZE
    , ...)

    // 3-factor product with 1 sizeof(type) or sizeof(expression), with
    // redundant parens removed.
    @@
    expression THING;
    identifier STRIDE, COUNT;
    type TYPE;
    @@

    (
    kmalloc(
    - sizeof(TYPE) * (COUNT) * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kmalloc(
    - sizeof(TYPE) * (COUNT) * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kmalloc(
    - sizeof(TYPE) * COUNT * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kmalloc(
    - sizeof(TYPE) * COUNT * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kmalloc(
    - sizeof(THING) * (COUNT) * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    kmalloc(
    - sizeof(THING) * (COUNT) * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    kmalloc(
    - sizeof(THING) * COUNT * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    kmalloc(
    - sizeof(THING) * COUNT * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    )

    // 3-factor product with 2 sizeof(variable), with redundant parens removed.
    @@
    expression THING1, THING2;
    identifier COUNT;
    type TYPE1, TYPE2;
    @@

    (
    kmalloc(
    - sizeof(TYPE1) * sizeof(TYPE2) * COUNT
    + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
    , ...)
    |
    kmalloc(
    - sizeof(TYPE1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
    , ...)
    |
    kmalloc(
    - sizeof(THING1) * sizeof(THING2) * COUNT
    + array3_size(COUNT, sizeof(THING1), sizeof(THING2))
    , ...)
    |
    kmalloc(
    - sizeof(THING1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(THING1), sizeof(THING2))
    , ...)
    |
    kmalloc(
    - sizeof(TYPE1) * sizeof(THING2) * COUNT
    + array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
    , ...)
    |
    kmalloc(
    - sizeof(TYPE1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
    , ...)
    )

    // 3-factor product, only identifiers, with redundant parens removed.
    @@
    identifier STRIDE, SIZE, COUNT;
    @@

    (
    kmalloc(
    - (COUNT) * STRIDE * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - COUNT * (STRIDE) * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - COUNT * STRIDE * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - (COUNT) * (STRIDE) * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - COUNT * (STRIDE) * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - (COUNT) * STRIDE * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - (COUNT) * (STRIDE) * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - COUNT * STRIDE * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    )

    // Any remaining multi-factor products, first at least 3-factor products,
    // when they're not all constants...
    @@
    expression E1, E2, E3;
    constant C1, C2, C3;
    @@

    (
    kmalloc(C1 * C2 * C3, ...)
    |
    kmalloc(
    - (E1) * E2 * E3
    + array3_size(E1, E2, E3)
    , ...)
    |
    kmalloc(
    - (E1) * (E2) * E3
    + array3_size(E1, E2, E3)
    , ...)
    |
    kmalloc(
    - (E1) * (E2) * (E3)
    + array3_size(E1, E2, E3)
    , ...)
    |
    kmalloc(
    - E1 * E2 * E3
    + array3_size(E1, E2, E3)
    , ...)
    )

    // And then all remaining 2 factors products when they're not all constants,
    // keeping sizeof() as the second factor argument.
    @@
    expression THING, E1, E2;
    type TYPE;
    constant C1, C2, C3;
    @@

    (
    kmalloc(sizeof(THING) * C2, ...)
    |
    kmalloc(sizeof(TYPE) * C2, ...)
    |
    kmalloc(C1 * C2 * C3, ...)
    |
    kmalloc(C1 * C2, ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(TYPE) * (E2)
    + E2, sizeof(TYPE)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(TYPE) * E2
    + E2, sizeof(TYPE)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(THING) * (E2)
    + E2, sizeof(THING)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(THING) * E2
    + E2, sizeof(THING)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - (E1) * E2
    + E1, E2
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - (E1) * (E2)
    + E1, E2
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - E1 * E2
    + E1, E2
    , ...)
    )

    Signed-off-by: Kees Cook

    Kees Cook
     

08 Jun, 2018

1 commit

  • Pull media updates from Mauro Carvalho Chehab:

    - remove of atomisp driver from staging, as nobody would have time to
    dedicate huge efforts to fix all the problems there. Also, we have a
    feeling that the driver may not even run the way it is.

    - move Zoran driver to staging, in order to be either fixed to use VB2
    and the proper media kAPIs or to be removed

    - remove videobuf-dvb driver, with is unused for a while

    - some V4L2 documentation fixes/improvements

    - new sensor drivers: imx258 and ov7251

    - a new driver was added to allow using I2C transparent drivers

    - several improvements at the ddbridge driver

    - several improvements at the ISDB pt1 driver, making it more coherent
    with the DVB framework

    - added a new platform driver for MIPI CSI-2 RX: cadence

    - now, all media drivers can be compiled on x86 with COMPILE_TEST

    - almost all media drivers now build on non-x86 architectures with
    COMPILE_TEST

    - lots of other random stuff: cleanups, support for new board models,
    bug fixes, etc

    * tag 'media/v4.18-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (464 commits)
    media: omap2: fix compile-testing with FB_OMAP2=m
    media: media/radio/Kconfig: add back RADIO_ISA
    media: v4l2-ioctl.c: fix missing unlock in __video_do_ioctl()
    media: pxa_camera: ignore -ENOIOCTLCMD from v4l2_subdev_call for s_power
    media: arch: sh: migor: Fix TW9910 PDN gpio
    media: staging: tegra-vde: Reset VDE regardless of memory client resetting failure
    media: marvel-ccic: mmp: select VIDEOBUF2_VMALLOC/DMA_CONTIG
    media: marvel-ccic: allow ccic and mmp drivers to coexist
    media: uvcvideo: Prevent setting unavailable flags
    media: ddbridge: conditionally enable fast TS for stv0910-equipped bridges
    media: dvb-frontends/stv0910: make TS speed configurable
    media: ddbridge/mci: add identifiers to function definition arguments
    media: ddbridge/mci: protect against out-of-bounds array access in stop()
    media: rc: ensure input/lirc device can be opened after register
    media: rc: nuvoton: Keep device enabled during reg init
    media: rc: nuvoton: Keep track of users on CIR enable/disable
    media: rc: nuvoton: Tweak the interrupt enabling dance
    media: uvcvideo: Support realtek's UVC 1.5 device
    media: uvcvideo: Fix driver reference counting
    media: gspca_zc3xx: Enable short exposure times for OV7648
    ...

    Linus Torvalds
     

05 Jun, 2018

1 commit


29 May, 2018

2 commits

  • DMA requests must be blocked before resetting VDE HW, otherwise it is
    possible to get a memory corruption or a machine hang. Use the reset
    control provided by the Memory Controller to block DMA before resetting
    the VDE HW.

    Signed-off-by: Dmitry Osipenko
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Dmitry Osipenko
     
  • Remove dependencies on HAS_DMA where a Kconfig symbol depends on another
    symbol that implies HAS_DMA, and, optionally, on "|| COMPILE_TEST".
    In most cases this other symbol is an architecture or platform specific
    symbol, or PCI.

    Generic symbols and drivers without platform dependencies keep their
    dependencies on HAS_DMA, to prevent compiling subsystems or drivers that
    cannot work anyway.

    This simplifies the dependencies, and allows to improve compile-testing.

    Note:
    - The various VIDEOBUF*DMA* symbols had to loose their dependencies on
    HAS_DMA, as they are selected by several individual drivers.

    Signed-off-by: Geert Uytterhoeven
    Reviewed-by: Mark Brown
    Acked-by: Robin Murphy
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Geert Uytterhoeven
     

26 May, 2018

3 commits

  • drivers/staging/media/imx/imx-media-capture.c: In function 'vidioc_querycap':
    drivers/staging/media/imx/imx-media-capture.c:76:2: warning: 'strncpy' output truncated copying 15 bytes from a string of length 17 [-Wstringop-truncation]
    strncpy(cap->driver, "imx-media-capture", sizeof(cap->driver) - 1);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    Signed-off-by: Hans Verkuil
    Acked-by: Steve Longerbeam
    Signed-off-by: Mauro Carvalho Chehab

    Hans Verkuil
     
  • In file included from media-git/include/linux/bitmap.h:9,
    from media-git/include/linux/cpumask.h:12,
    from media-git/arch/x86/include/asm/cpumask.h:5,
    from media-git/arch/x86/include/asm/msr.h:11,
    from media-git/arch/x86/include/asm/processor.h:21,
    from media-git/arch/x86/include/asm/cpufeature.h:5,
    from media-git/arch/x86/include/asm/thread_info.h:53,
    from media-git/include/linux/thread_info.h:38,
    from media-git/arch/x86/include/asm/preempt.h:7,
    from media-git/include/linux/preempt.h:81,
    from media-git/include/linux/spinlock.h:51,
    from media-git/include/linux/seqlock.h:36,
    from media-git/include/linux/time.h:6,
    from media-git/include/linux/stat.h:19,
    from media-git/include/linux/module.h:10,
    from media-git/drivers/staging/media/zoran/zoran_driver.c:44:
    In function 'strncpy',
    inlined from 'zoran_querycap' at media-git/drivers/staging/media/zoran/zoran_driver.c:1512:2:
    media-git/include/linux/string.h:246:9: warning: '__builtin_strncpy' output may be truncated copying 31 bytes from a string of length 31 [-Wstringop-truncation]
    return __builtin_strncpy(p, q, size);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Hans Verkuil
     
  • This driver hasn't been tested in a long, long time. The hardware is
    ancient and pretty much obsolete. This driver also needs to be converted
    to newer media frameworks (vb2!) but due to the lack of time and interest
    that is unlikely to happen.

    So this driver is a prime candidate for removal. If someone is interested
    in working on this driver to prevent its removal, then please contact the
    linux-media mailinglist.

    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Hans Verkuil
     

16 May, 2018

13 commits

  • The atomisp driver has a long list of todo items and little has been done
    to address these lately while more has been added. The driver is also not
    functional. In other words, the driver would not be getting out of staging
    in the foreseeable future. At the same time it consumes developer
    resources in order to maintain the flaky code base. Remove it.

    Signed-off-by: Sakari Ailus
    Signed-off-by: Mauro Carvalho Chehab

    Sakari Ailus
     
  • There are lots of data structs defined there but aren't used
    anywhere.

    Comment them out. Gets rid of those warnings:

    drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c:1808:45: warning: 'mt9m114_entity_ops' defined but not used [-Wunused-const-variable=]
    static const struct media_entity_operations mt9m114_entity_ops = {
    ^~~~~~~~~~~~~~~~~~
    In file included from drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c:35:0:
    drivers/staging/media/atomisp/i2c/mt9m114.h:805:34: warning: 'mt9m114_iq' defined but not used [-Wunused-const-variable=]
    static struct misensor_reg const mt9m114_iq[] = {
    ^~~~~~~~~~
    drivers/staging/media/atomisp/i2c/mt9m114.h:797:34: warning: 'mt9m114_antiflicker_60hz' defined but not used [-Wunused-const-variable=]
    static struct misensor_reg const mt9m114_antiflicker_60hz[] = {
    ^~~~~~~~~~~~~~~~~~~~~~~~
    drivers/staging/media/atomisp/i2c/mt9m114.h:789:34: warning: 'mt9m114_antiflicker_50hz' defined but not used [-Wunused-const-variable=]
    static struct misensor_reg const mt9m114_antiflicker_50hz[] = {
    ^~~~~~~~~~~~~~~~~~~~~~~~
    drivers/staging/media/atomisp/i2c/mt9m114.h:682:34: warning: 'mt9m114_720_480P_init' defined but not used [-Wunused-const-variable=]
    static struct misensor_reg const mt9m114_720_480P_init[] = {
    ^~~~~~~~~~~~~~~~~~~~~
    drivers/staging/media/atomisp/i2c/mt9m114.h:533:34: warning: 'mt9m114_960P_init' defined but not used [-Wunused-const-variable=]
    static struct misensor_reg const mt9m114_960P_init[] = {
    ^~~~~~~~~~~~~~~~~
    drivers/staging/media/atomisp/i2c/mt9m114.h:518:34: warning: 'mt9m114_wakeup_reg' defined but not used [-Wunused-const-variable=]
    static struct misensor_reg const mt9m114_wakeup_reg[] = {
    ^~~~~~~~~~~~~~~~~~
    drivers/staging/media/atomisp/i2c/mt9m114.h:504:34: warning: 'mt9m114_streaming' defined but not used [-Wunused-const-variable=]
    static struct misensor_reg const mt9m114_streaming[] = {
    ^~~~~~~~~~~~~~~~~
    drivers/staging/media/atomisp/i2c/mt9m114.h:497:34: warning: 'mt9m114_suspend' defined but not used [-Wunused-const-variable=]
    static struct misensor_reg const mt9m114_suspend[] = {
    ^~~~~~~~~~~~~~~
    drivers/staging/media/atomisp/i2c/mt9m114.h:393:34: warning: 'mt9m114_exitstandby' defined but not used [-Wunused-const-variable=]
    static struct misensor_reg const mt9m114_exitstandby[] = {
    ^~~~~~~~~~~~~~~~~~~

    Signed-off-by: Mauro Carvalho Chehab
    Signed-off-by: Sakari Ailus
    Signed-off-by: Mauro Carvalho Chehab

    Mauro Carvalho Chehab
     
  • It seems that, originally, the logic would allow selecting between
    fine and coarse integration. However, only coarse seems to be
    implemented.

    Get rid of this warning:

    drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c: In function 'mt9m114_s_exposure':
    drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c:1003:6: warning: variable 'exposure_local' set but not used [-Wunused-but-set-variable]
    u16 exposure_local[3];
    ^~~~~~~~~~~~~~

    Signed-off-by: Mauro Carvalho Chehab
    Signed-off-by: Sakari Ailus
    Signed-off-by: Mauro Carvalho Chehab

    Mauro Carvalho Chehab
     
  • If something wrong gets there, return the error.

    Get rid of this warning:

    drivers/staging/media/atomisp/i2c/atomisp-gc0310.c: In function 'gc0310_init':
    drivers/staging/media/atomisp/i2c/atomisp-gc0310.c:713:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable]
    int ret;
    ^~~

    Signed-off-by: Mauro Carvalho Chehab
    Signed-off-by: Sakari Ailus
    Signed-off-by: Mauro Carvalho Chehab

    Mauro Carvalho Chehab
     
  • drivers/staging/media/atomisp/i2c/atomisp-ov2680.c: In function ‘__ov2680_set_exposure’:
    drivers/staging/media/atomisp/i2c/atomisp-ov2680.c:400:10: warning: variable ‘hts’ set but not used [-Wunused-but-set-variable]
    u16 vts,hts;
    ^~~
    drivers/staging/media/atomisp/i2c/atomisp-ov2680.c: In function ‘ov2680_detect’:
    drivers/staging/media/atomisp/i2c/atomisp-ov2680.c:1164:5: warning: variable ‘revision’ set but not used [-Wunused-but-set-variable]
    u8 revision;
    ^~~~~~~~

    Signed-off-by: Mauro Carvalho Chehab
    Signed-off-by: Sakari Ailus
    Signed-off-by: Mauro Carvalho Chehab

    Mauro Carvalho Chehab
     
  • The register settings for several resolutions aren't used
    currently. So, comment them out.

    Fix those warnings:

    In file included from drivers/staging/media/atomisp/i2c/atomisp-gc2235.c:35:0:
    drivers/staging/media/atomisp/i2c/gc2235.h:340:32: warning: 'gc2235_960_640_30fps' defined but not used [-Wunused-const-variable=]
    static struct gc2235_reg const gc2235_960_640_30fps[] = {
    ^~~~~~~~~~~~~~~~~~~~
    drivers/staging/media/atomisp/i2c/gc2235.h:287:32: warning: 'gc2235_1296_736_30fps' defined but not used [-Wunused-const-variable=]
    static struct gc2235_reg const gc2235_1296_736_30fps[] = {
    ^~~~~~~~~~~~~~~~~~~~~
    In file included from drivers/staging/media/atomisp/i2c/atomisp-ov2722.c:35:0:
    drivers/staging/media/atomisp/i2c/ov2722.h:999:32: warning: 'ov2722_720p_30fps' defined but not used [-Wunused-const-variable=]
    static struct ov2722_reg const ov2722_720p_30fps[] = {
    ^~~~~~~~~~~~~~~~~
    drivers/staging/media/atomisp/i2c/ov2722.h:787:32: warning: 'ov2722_1M3_30fps' defined but not used [-Wunused-const-variable=]
    static struct ov2722_reg const ov2722_1M3_30fps[] = {
    ^~~~~~~~~~~~~~~~
    drivers/staging/media/atomisp/i2c/ov2722.h:476:32: warning: 'ov2722_VGA_30fps' defined but not used [-Wunused-const-variable=]
    static struct ov2722_reg const ov2722_VGA_30fps[] = {
    ^~~~~~~~~~~~~~~~
    drivers/staging/media/atomisp/i2c/ov2722.h:367:32: warning: 'ov2722_480P_30fps' defined but not used [-Wunused-const-variable=]
    static struct ov2722_reg const ov2722_480P_30fps[] = {
    ^~~~~~~~~~~~~~~~~
    drivers/staging/media/atomisp/i2c/ov2722.h:257:32: warning: 'ov2722_QVGA_30fps' defined but not used [-Wunused-const-variable=]
    static struct ov2722_reg const ov2722_QVGA_30fps[] = {
    ^~~~~~~~~~~~~~~~~
    drivers/staging/media/atomisp/i2c/atomisp-ov2680.c: In function '__ov2680_set_exposure':
    In file included from drivers/staging/media/atomisp/i2c/atomisp-ov2680.c:35:0:
    At top level:
    drivers/staging/media/atomisp/i2c/ov2680.h:736:33: warning: 'ov2680_1616x1082_30fps' defined but not used [-Wunused-const-variable=]
    static struct ov2680_reg const ov2680_1616x1082_30fps[] = {
    ^~~~~~~~~~~~~~~~~~~~~~
    drivers/staging/media/atomisp/i2c/ov2680.h:649:33: warning: 'ov2680_1456x1096_30fps' defined but not used [-Wunused-const-variable=]
    static struct ov2680_reg const ov2680_1456x1096_30fps[]= {
    ^~~~~~~~~~~~~~~~~~~~~~
    drivers/staging/media/atomisp/i2c/ov2680.h:606:33: warning: 'ov2680_1296x976_30fps' defined but not used [-Wunused-const-variable=]
    static struct ov2680_reg const ov2680_1296x976_30fps[] = {
    ^~~~~~~~~~~~~~~~~~~~~
    drivers/staging/media/atomisp/i2c/ov2680.h:563:33: warning: 'ov2680_720p_30fps' defined but not used [-Wunused-const-variable=]
    static struct ov2680_reg const ov2680_720p_30fps[] = {
    ^~~~~~~~~~~~~~~~~
    drivers/staging/media/atomisp/i2c/ov2680.h:520:33: warning: 'ov2680_800x600_30fps' defined but not used [-Wunused-const-variable=]
    static struct ov2680_reg const ov2680_800x600_30fps[] = {
    ^~~~~~~~~~~~~~~~~~~~
    drivers/staging/media/atomisp/i2c/ov2680.h:475:33: warning: 'ov2680_720x592_30fps' defined but not used [-Wunused-const-variable=]
    static struct ov2680_reg const ov2680_720x592_30fps[] = {
    ^~~~~~~~~~~~~~~~~~~~
    drivers/staging/media/atomisp/i2c/ov2680.h:433:33: warning: 'ov2680_656x496_30fps' defined but not used [-Wunused-const-variable=]
    static struct ov2680_reg const ov2680_656x496_30fps[] = {
    ^~~~~~~~~~~~~~~~~~~~
    drivers/staging/media/atomisp/i2c/ov2680.h:389:33: warning: 'ov2680_QVGA_30fps' defined but not used [-Wunused-const-variable=]
    static struct ov2680_reg const ov2680_QVGA_30fps[] = {
    ^~~~~~~~~~~~~~~~~
    drivers/staging/media/atomisp/i2c/ov2680.h:346:33: warning: 'ov2680_CIF_30fps' defined but not used [-Wunused-const-variable=]
    static struct ov2680_reg const ov2680_CIF_30fps[] = {
    ^~~~~~~~~~~~~~~~
    drivers/staging/media/atomisp/i2c/ov2680.h:301:33: warning: 'ov2680_QCIF_30fps' defined but not used [-Wunused-const-variable=]
    static struct ov2680_reg const ov2680_QCIF_30fps[] = {
    ^~~~~~~~~~~~~~~~~
    In file included from drivers/staging/media/atomisp/i2c/ov5693/atomisp-ov5693.c:36:0:
    drivers/staging/media/atomisp/i2c/ov5693/ov5693.h:988:32: warning: 'ov5693_1424x1168_30fps' defined but not used [-Wunused-const-variable=]
    static struct ov5693_reg const ov5693_1424x1168_30fps[] = {
    ^~~~~~~~~~~~~~~~~~~~~~
    drivers/staging/media/atomisp/i2c/ov5693/ov5693.h:954:32: warning: 'ov5693_2592x1944_30fps' defined but not used [-Wunused-const-variable=]
    static struct ov5693_reg const ov5693_2592x1944_30fps[] = {
    ^~~~~~~~~~~~~~~~~~~~~~
    drivers/staging/media/atomisp/i2c/ov5693/ov5693.h:889:32: warning: 'ov5693_2592x1456_30fps' defined but not used [-Wunused-const-variable=]
    static struct ov5693_reg const ov5693_2592x1456_30fps[] = {
    ^~~~~~~~~~~~~~~~~~~~~~
    drivers/staging/media/atomisp/i2c/ov5693/ov5693.h:862:32: warning: 'ov5693_1940x1096' defined but not used [-Wunused-const-variable=]
    static struct ov5693_reg const ov5693_1940x1096[] = {
    ^~~~~~~~~~~~~~~~
    drivers/staging/media/atomisp/i2c/ov5693/ov5693.h:796:32: warning: 'ov5693_1636p_30fps' defined but not used [-Wunused-const-variable=]
    static struct ov5693_reg const ov5693_1636p_30fps[] = {
    ^~~~~~~~~~~~~~~~~~
    drivers/staging/media/atomisp/i2c/ov5693/ov5693.h:758:32: warning: 'ov5693_1296x736' defined but not used [-Wunused-const-variable=]
    static struct ov5693_reg const ov5693_1296x736[] = {
    ^~~~~~~~~~~~~~~
    drivers/staging/media/atomisp/i2c/ov5693/ov5693.h:730:32: warning: 'ov5693_976x556' defined but not used [-Wunused-const-variable=]
    static struct ov5693_reg const ov5693_976x556[] = {
    ^~~~~~~~~~~~~~
    drivers/staging/media/atomisp/i2c/ov5693/ov5693.h:672:32: warning: 'ov5693_736x496' defined but not used [-Wunused-const-variable=]
    static struct ov5693_reg const ov5693_736x496[] = {
    ^~~~~~~~~~~~~~
    drivers/staging/media/atomisp/i2c/ov5693/ov5693.h:643:32: warning: 'ov5693_192x160' defined but not used [-Wunused-const-variable=]
    static struct ov5693_reg const ov5693_192x160[] = {
    ^~~~~~~~~~~~~~
    drivers/staging/media/atomisp/i2c/ov5693/ov5693.h:616:32: warning: 'ov5693_368x304' defined but not used [-Wunused-const-variable=]
    static struct ov5693_reg const ov5693_368x304[] = {
    ^~~~~~~~~~~~~~
    drivers/staging/media/atomisp/i2c/ov5693/ov5693.h:587:32: warning: 'ov5693_336x256' defined but not used [-Wunused-const-variable=]
    static struct ov5693_reg const ov5693_336x256[] = {
    ^~~~~~~~~~~~~~
    drivers/staging/media/atomisp/i2c/ov5693/ov5693.h:540:32: warning: 'ov5693_1296x976' defined but not used [-Wunused-const-variable=]
    static struct ov5693_reg const ov5693_1296x976[] = {
    ^~~~~~~~~~~~~~~
    drivers/staging/media/atomisp/i2c/ov5693/ov5693.h:509:32: warning: 'ov5693_654x496' defined but not used [-Wunused-const-variable=]
    static struct ov5693_reg const ov5693_654x496[] = {
    ^~~~~~~~~~~~~~

    Signed-off-by: Mauro Carvalho Chehab
    Signed-off-by: Sakari Ailus
    Signed-off-by: Mauro Carvalho Chehab

    Mauro Carvalho Chehab
     
  • The code with uses the dummy var is commented out. So,
    coment out its definition/initialization.

    Fix this warning:

    drivers/staging/media/atomisp/i2c/atomisp-gc2235.c: In function 'gc2235_get_intg_factor':
    drivers/staging/media/atomisp/i2c/atomisp-gc2235.c:249:26: warning: variable 'dummy' set but not used [-Wunused-but-set-variable]
    u16 reg_val, reg_val_h, dummy;
    ^~~~~

    Signed-off-by: Mauro Carvalho Chehab
    Signed-off-by: Sakari Ailus
    Signed-off-by: Mauro Carvalho Chehab

    Mauro Carvalho Chehab
     
  • The identation for several tables there are broken.

    Signed-off-by: Mauro Carvalho Chehab
    Signed-off-by: Sakari Ailus
    Signed-off-by: Mauro Carvalho Chehab

    Mauro Carvalho Chehab
     
  • When atomisp got merged, there were so many warnings with W=1
    that we simply disabled the ones that were causing troubles.

    Since then, several changes got applied to atomisp, and the
    number of warnings are a way smaller than it used to be.

    So, let's reenable warnings there and fix the issues.

    Signed-off-by: Mauro Carvalho Chehab
    Signed-off-by: Sakari Ailus
    Signed-off-by: Mauro Carvalho Chehab

    Mauro Carvalho Chehab
     
  • There's no sense for a Kernel driver to have __KERNEL macros
    on it.

    Signed-off-by: Mauro Carvalho Chehab
    Signed-off-by: Sakari Ailus
    Signed-off-by: Mauro Carvalho Chehab

    Mauro Carvalho Chehab
     
  • IA_CSS_ERROR shows the ddr_buffer_addr as a decimal value with a '0x'
    prefix, which is somewhat misleading.

    Let's fix it to print hexadecimal, as was intended.

    Fixes: 158aeefc("[media] atomisp: Add __printf validation and fix fallout")

    Cc: Alan Cox
    Cc: Joe Perches
    Signed-off-by: Shaokun Zhang
    Signed-off-by: Sakari Ailus
    Signed-off-by: Mauro Carvalho Chehab

    Shaokun Zhang
     
  • Remove boilerplate code by using macro module_pci_driver.

    Signed-off-by: YueHaibing
    Signed-off-by: Sakari Ailus
    Signed-off-by: Mauro Carvalho Chehab

    YueHaibing
     
  • Trivial fix to spelling mistake in ia_css_print message text

    Signed-off-by: Colin Ian King
    Signed-off-by: Sakari Ailus
    Signed-off-by: Mauro Carvalho Chehab

    Colin Ian King