cron job: media_tree daily build: WARNINGS

2017-09-02 Thread Hans Verkuil
This message is generated daily by a cron job that builds media_tree for
the kernels and architectures in the list below.

Results of the daily build of media_tree:

date:   Sun Sep  3 05:00:14 CEST 2017
media-tree git hash:fce4b371fe5c99a9c05db8493d72f0d1a474ab26
media_build git hash:   767234f97b7e967bd0ce362957de82764937951c
v4l-utils git hash: 3296adfa7fa169111bf37c041c0ca70ac8506054
gcc version:i686-linux-gcc (GCC) 7.1.0
sparse version: v0.5.0
smatch version: v0.5.0-3553-g78b2ea6
host hardware:  x86_64
host os:4.12.0-164

linux-git-arm-at91: OK
linux-git-arm-davinci: OK
linux-git-arm-multi: OK
linux-git-arm-pxa: OK
linux-git-arm-stm32: OK
linux-git-blackfin-bf561: OK
linux-git-i686: OK
linux-git-m32r: OK
linux-git-mips: OK
linux-git-powerpc64: OK
linux-git-sh: OK
linux-git-x86_64: OK
linux-2.6.36.4-i686: WARNINGS
linux-2.6.37.6-i686: WARNINGS
linux-2.6.38.8-i686: WARNINGS
linux-2.6.39.4-i686: WARNINGS
linux-3.0.60-i686: WARNINGS
linux-3.1.10-i686: WARNINGS
linux-3.2.37-i686: WARNINGS
linux-3.3.8-i686: WARNINGS
linux-3.4.27-i686: WARNINGS
linux-3.5.7-i686: WARNINGS
linux-3.6.11-i686: WARNINGS
linux-3.7.4-i686: WARNINGS
linux-3.8-i686: WARNINGS
linux-3.9.2-i686: WARNINGS
linux-3.10.1-i686: WARNINGS
linux-3.11.1-i686: WARNINGS
linux-3.12.67-i686: WARNINGS
linux-3.13.11-i686: WARNINGS
linux-3.14.9-i686: WARNINGS
linux-3.15.2-i686: WARNINGS
linux-3.16.7-i686: WARNINGS
linux-3.17.8-i686: WARNINGS
linux-3.18.7-i686: WARNINGS
linux-3.19-i686: WARNINGS
linux-4.0.9-i686: WARNINGS
linux-4.1.33-i686: WARNINGS
linux-4.2.8-i686: WARNINGS
linux-4.3.6-i686: WARNINGS
linux-4.4.22-i686: WARNINGS
linux-4.5.7-i686: WARNINGS
linux-4.6.7-i686: WARNINGS
linux-4.7.5-i686: WARNINGS
linux-4.8-i686: OK
linux-4.9.26-i686: OK
linux-4.10.14-i686: OK
linux-4.11-i686: OK
linux-4.12.1-i686: OK
linux-2.6.36.4-x86_64: WARNINGS
linux-2.6.37.6-x86_64: WARNINGS
linux-2.6.38.8-x86_64: WARNINGS
linux-2.6.39.4-x86_64: WARNINGS
linux-3.0.60-x86_64: WARNINGS
linux-3.1.10-x86_64: WARNINGS
linux-3.2.37-x86_64: WARNINGS
linux-3.3.8-x86_64: WARNINGS
linux-3.4.27-x86_64: WARNINGS
linux-3.5.7-x86_64: WARNINGS
linux-3.6.11-x86_64: WARNINGS
linux-3.7.4-x86_64: WARNINGS
linux-3.8-x86_64: WARNINGS
linux-3.9.2-x86_64: WARNINGS
linux-3.10.1-x86_64: WARNINGS
linux-3.11.1-x86_64: WARNINGS
linux-3.12.67-x86_64: WARNINGS
linux-3.13.11-x86_64: WARNINGS
linux-3.14.9-x86_64: WARNINGS
linux-3.15.2-x86_64: WARNINGS
linux-3.16.7-x86_64: WARNINGS
linux-3.17.8-x86_64: WARNINGS
linux-3.18.7-x86_64: WARNINGS
linux-3.19-x86_64: WARNINGS
linux-4.0.9-x86_64: WARNINGS
linux-4.1.33-x86_64: WARNINGS
linux-4.2.8-x86_64: WARNINGS
linux-4.3.6-x86_64: WARNINGS
linux-4.4.22-x86_64: WARNINGS
linux-4.5.7-x86_64: WARNINGS
linux-4.6.7-x86_64: WARNINGS
linux-4.7.5-x86_64: WARNINGS
linux-4.8-x86_64: WARNINGS
linux-4.9.26-x86_64: WARNINGS
linux-4.10.14-x86_64: WARNINGS
linux-4.11-x86_64: WARNINGS
linux-4.12.1-x86_64: WARNINGS
apps: WARNINGS
spec-git: OK

Detailed results are available here:

http://www.xs4all.nl/~hverkuil/logs/Sunday.log

Full logs are available here:

http://www.xs4all.nl/~hverkuil/logs/Sunday.tar.bz2

The Media Infrastructure API from this daily build is here:

http://www.xs4all.nl/~hverkuil/spec/index.html


[PATCH 04/12] media: v4l uAPI docs: adjust some tables for PDF output

2017-09-02 Thread Mauro Carvalho Chehab
On tests with Spinx 1.4, some tables are still writing text
outside cells. Adjust those tables.

PS.: As this was revisited several times, I suspect that this
will only be fully fixed if we add tabularcolumns to all tables
at the V4L2 part of the book.

Signed-off-by: Mauro Carvalho Chehab 
---
 Documentation/media/uapi/v4l/colorspaces-defs.rst   | 2 ++
 Documentation/media/uapi/v4l/pixfmt-srggb10p.rst| 2 +-
 Documentation/media/uapi/v4l/v4l2-selection-targets.rst | 2 +-
 Documentation/media/uapi/v4l/vidioc-enum-framesizes.rst | 2 ++
 Documentation/media/uapi/v4l/vidioc-querycap.rst| 2 +-
 Documentation/media/uapi/v4l/vidioc-subscribe-event.rst | 4 ++--
 6 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/Documentation/media/uapi/v4l/colorspaces-defs.rst 
b/Documentation/media/uapi/v4l/colorspaces-defs.rst
index e67ed1e0b3fa..410907fe9415 100644
--- a/Documentation/media/uapi/v4l/colorspaces-defs.rst
+++ b/Documentation/media/uapi/v4l/colorspaces-defs.rst
@@ -76,6 +76,8 @@ whole range, 0-255, dividing the angular value by 1.41. The 
enum
 
 .. c:type:: v4l2_xfer_func
 
+.. tabularcolumns:: |p{5.5cm}|p{12.0cm}|
+
 .. flat-table:: V4L2 Transfer Function
 :header-rows:  1
 :stub-columns: 0
diff --git a/Documentation/media/uapi/v4l/pixfmt-srggb10p.rst 
b/Documentation/media/uapi/v4l/pixfmt-srggb10p.rst
index 86cd07e5bfa3..9e52610aa954 100644
--- a/Documentation/media/uapi/v4l/pixfmt-srggb10p.rst
+++ b/Documentation/media/uapi/v4l/pixfmt-srggb10p.rst
@@ -36,7 +36,7 @@ Each cell is one byte.
 
 .. raw:: latex
 
-\small
+\newline\small
 
 .. tabularcolumns:: |p{2.0cm}|p{1.0cm}|p{1.0cm}|p{1.0cm}|p{1.0cm}|p{10.0cm}|
 
diff --git a/Documentation/media/uapi/v4l/v4l2-selection-targets.rst 
b/Documentation/media/uapi/v4l/v4l2-selection-targets.rst
index cab07de6f4da..87433ec76c6b 100644
--- a/Documentation/media/uapi/v4l/v4l2-selection-targets.rst
+++ b/Documentation/media/uapi/v4l/v4l2-selection-targets.rst
@@ -12,7 +12,7 @@ of the two interfaces they are used.
 
 .. _v4l2-selection-targets-table:
 
-.. tabularcolumns:: |p{5.8cm}|p{1.4cm}|p{6.5cm}|p{1.2cm}|p{1.6cm}|
+.. tabularcolumns:: |p{6.0cm}|p{1.4cm}|p{7.4cm}|p{1.2cm}|p{1.4cm}|
 
 .. flat-table:: Selection target definitions
 :header-rows:  1
diff --git a/Documentation/media/uapi/v4l/vidioc-enum-framesizes.rst 
b/Documentation/media/uapi/v4l/vidioc-enum-framesizes.rst
index 8fcc46d307d5..6de117f163e0 100644
--- a/Documentation/media/uapi/v4l/vidioc-enum-framesizes.rst
+++ b/Documentation/media/uapi/v4l/vidioc-enum-framesizes.rst
@@ -140,6 +140,8 @@ application should zero out all members except for the *IN* 
fields.
 
 .. c:type:: v4l2_frmsizeenum
 
+.. tabularcolumns:: |p{1.4cm}|p{5.9cm}|p{2.3cm}|p{8.0cm}|
+
 .. flat-table:: struct v4l2_frmsizeenum
 :header-rows:  0
 :stub-columns: 0
diff --git a/Documentation/media/uapi/v4l/vidioc-querycap.rst 
b/Documentation/media/uapi/v4l/vidioc-querycap.rst
index 7553b44692b4..66fb1b3d6e6e 100644
--- a/Documentation/media/uapi/v4l/vidioc-querycap.rst
+++ b/Documentation/media/uapi/v4l/vidioc-querycap.rst
@@ -133,7 +133,7 @@ specification the ioctl returns an ``EINVAL`` error code.
 
 
 
-.. tabularcolumns:: |p{6cm}|p{2.2cm}|p{8.8cm}|
+.. tabularcolumns:: |p{6.1cm}|p{2.2cm}|p{8.7cm}|
 
 .. _device-capabilities:
 
diff --git a/Documentation/media/uapi/v4l/vidioc-subscribe-event.rst 
b/Documentation/media/uapi/v4l/vidioc-subscribe-event.rst
index a95cbf2a126d..b521efa53ceb 100644
--- a/Documentation/media/uapi/v4l/vidioc-subscribe-event.rst
+++ b/Documentation/media/uapi/v4l/vidioc-subscribe-event.rst
@@ -40,7 +40,7 @@ Subscribe or unsubscribe V4L2 event. Subscribed events are 
dequeued by
 using the :ref:`VIDIOC_DQEVENT` ioctl.
 
 
-.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
+.. tabularcolumns:: |p{4.6cm}|p{4.4cm}|p{8.7cm}|
 
 .. c:type:: v4l2_event_subscription
 
@@ -73,7 +73,7 @@ using the :ref:`VIDIOC_DQEVENT` ioctl.
 
 
 
-.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}|
+.. tabularcolumns:: |p{6.8cm}|p{2.2cm}|p{8.5cm}|
 
 .. _event-flags:
 
-- 
2.13.5



[PATCH 06/12] media: rc-sysfs-nodes.rst: better use literals

2017-09-02 Thread Mauro Carvalho Chehab
A literal box provides a better visual when pdf and html output
is generated for things like the output of a sysfs devnode.
It alsod matches other conventions used within the media book.

So, use it.

While here, use literals for protocol names.

Signed-off-by: Mauro Carvalho Chehab 
---
 Documentation/media/uapi/rc/rc-sysfs-nodes.rst | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/Documentation/media/uapi/rc/rc-sysfs-nodes.rst 
b/Documentation/media/uapi/rc/rc-sysfs-nodes.rst
index 3476ae29708f..2d01358d5504 100644
--- a/Documentation/media/uapi/rc/rc-sysfs-nodes.rst
+++ b/Documentation/media/uapi/rc/rc-sysfs-nodes.rst
@@ -34,9 +34,9 @@ receiver device where N is the number of the receiver.
 /sys/class/rc/rcN/protocols
 ===
 
-Reading this file returns a list of available protocols, something like:
+Reading this file returns a list of available protocols, something like::
 
-``rc5 [rc6] nec jvc [sony]``
+   rc5 [rc6] nec jvc [sony]
 
 Enabled protocols are shown in [] brackets.
 
@@ -90,11 +90,11 @@ This value may be reset to 0 if the current protocol is 
altered.
 ==
 
 Reading this file returns a list of available protocols to use for the
-wakeup filter, something like:
+wakeup filter, something like::
 
-``rc-5 nec nec-x rc-6-0 rc-6-6a-24 [rc-6-6a-32] rc-6-mce``
+   rc-5 nec nec-x rc-6-0 rc-6-6a-24 [rc-6-6a-32] rc-6-mce
 
-Note that protocol variants are listed, so "nec", "sony", "rc-5", "rc-6"
+Note that protocol variants are listed, so ``nec``, ``sony``, ``rc-5``, 
``rc-6``
 have their different bit length encodings listed if available.
 
 Note that all protocol variants are listed.
-- 
2.13.5



[PATCH 03/12] media: vidioc-g-tuner.rst: Fix table number of cols

2017-09-02 Thread Mauro Carvalho Chehab
The Tuner Audio Matrix table is broken: the first row has 7
columns instead of 6, causing it to be parsed wrong and displayed
very badly on PDF output.

Fix it and adjust the table to look nice at PDF output

Signed-off-by: Mauro Carvalho Chehab 
---
 Documentation/media/uapi/v4l/vidioc-g-tuner.rst | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/Documentation/media/uapi/v4l/vidioc-g-tuner.rst 
b/Documentation/media/uapi/v4l/vidioc-g-tuner.rst
index 491866484f57..acdd15901a51 100644
--- a/Documentation/media/uapi/v4l/vidioc-g-tuner.rst
+++ b/Documentation/media/uapi/v4l/vidioc-g-tuner.rst
@@ -395,20 +395,23 @@ To change the radio frequency the
 
 \scriptsize
 
+.. tabularcolumns:: |p{1.5cm}|p{1.5cm}|p{2.9cm}|p{2.9cm}|p{2.9cm}|p{2.9cm}|
+
 .. _tuner-matrix:
 
 .. flat-table:: Tuner Audio Matrix
 :header-rows:  2
 :stub-columns: 0
+:widths: 7 7 14 14 14 14
 
 * -
-  - :cspan:`5` Selected ``V4L2_TUNER_MODE_``
+  - :cspan:`4` Selected ``V4L2_TUNER_MODE_``
 * - Received ``V4L2_TUNER_SUB_``
   - ``MONO``
   - ``STEREO``
   - ``LANG1``
   - ``LANG2 = SAP``
-  - ``LANG1_LANG2``\  [#f1]_
+  - ``LANG1_LANG2``\ [#f1]_
 * - ``MONO``
   - Mono
   - Mono/Mono
@@ -435,7 +438,7 @@ To change the radio frequency the
   - L+R/SAP (preferred) or L/R or L+R/L+R
 * - ``LANG1 | LANG2``
   - Language 1
-  - Lang1/Lang2 (deprecated [#f2]_) or Lang1/Lang1
+  - Lang1/Lang2 (deprecated\ [#f2]_) or Lang1/Lang1
   - Language 1
   - Language 2
   - Lang1/Lang2 (preferred) or Lang1/Lang1
-- 
2.13.5



[PATCH 02/12] media: vidioc-querycap: use a more realistic value for KERNEL_VERSION

2017-09-02 Thread Mauro Carvalho Chehab
In the past, V4L2 versions were 0.x.y, but that changed years
ago. Since Kernel 3.1, however, the numbering schema was changed
to match the Kernel version.

However, the presented example still uses the old numerating
schema, with is a misleading information.

So, update it to the new schema.

Signed-off-by: Mauro Carvalho Chehab 
---
 Documentation/media/uapi/v4l/vidioc-querycap.rst | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/Documentation/media/uapi/v4l/vidioc-querycap.rst 
b/Documentation/media/uapi/v4l/vidioc-querycap.rst
index 9494af96bae7..7553b44692b4 100644
--- a/Documentation/media/uapi/v4l/vidioc-querycap.rst
+++ b/Documentation/media/uapi/v4l/vidioc-querycap.rst
@@ -92,12 +92,13 @@ specification the ioctl returns an ``EINVAL`` error code.
stack from a newer kernel.
 
The version number is formatted using the ``KERNEL_VERSION()``
-   macro:
+   macro. For example if the media stack corresponds to the V4L2
+   version shipped with Kernel 4.14, it would be equivalent to:
 * - :cspan:`2`
 
``#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))``
 
-   ``__u32 version = KERNEL_VERSION(0, 8, 1);``
+   ``__u32 version = KERNEL_VERSION(4, 14, 0);``
 
``printf ("Version: %u.%u.%u\\n",``
 
-- 
2.13.5



[PATCH 09/12] media: docs: don't show ToC for each part on PDF output

2017-09-02 Thread Mauro Carvalho Chehab
The "Table of Contents" of a PDF file is generated only once,
at the beginning fo the output. It doesn't produce it on
each part.

So, don't output this text on each part of the document.

Signed-off-by: Mauro Carvalho Chehab 
---
 Documentation/media/cec-drivers/index.rst  | 4 +++-
 Documentation/media/dvb-drivers/index.rst  | 4 +++-
 Documentation/media/media_kapi.rst | 4 +++-
 Documentation/media/media_uapi.rst | 4 +++-
 Documentation/media/uapi/cec/cec-api.rst   | 5 -
 Documentation/media/uapi/dvb/dvbapi.rst| 4 +++-
 Documentation/media/uapi/mediactl/media-controller.rst | 4 +++-
 Documentation/media/uapi/rc/remote_controllers.rst | 4 +++-
 Documentation/media/uapi/v4l/v4l2.rst  | 4 +++-
 Documentation/media/v4l-drivers/index.rst  | 4 +++-
 10 files changed, 31 insertions(+), 10 deletions(-)

diff --git a/Documentation/media/cec-drivers/index.rst 
b/Documentation/media/cec-drivers/index.rst
index 1c817aa10bb6..7ef204823422 100644
--- a/Documentation/media/cec-drivers/index.rst
+++ b/Documentation/media/cec-drivers/index.rst
@@ -21,7 +21,9 @@ more details.
 
 For more details see the file COPYING in the source distribution of Linux.
 
-.. class:: toc-title
+.. only:: html
+
+.. class:: toc-title
 
 Table of Contents
 
diff --git a/Documentation/media/dvb-drivers/index.rst 
b/Documentation/media/dvb-drivers/index.rst
index ea0da6d63299..376141143ae9 100644
--- a/Documentation/media/dvb-drivers/index.rst
+++ b/Documentation/media/dvb-drivers/index.rst
@@ -19,7 +19,9 @@ more details.
 
 For more details see the file COPYING in the source distribution of Linux.
 
-.. class:: toc-title
+.. only:: html
+
+   .. class:: toc-title
 
Table of Contents
 
diff --git a/Documentation/media/media_kapi.rst 
b/Documentation/media/media_kapi.rst
index bc0638956a43..83da736fad72 100644
--- a/Documentation/media/media_kapi.rst
+++ b/Documentation/media/media_kapi.rst
@@ -20,7 +20,9 @@ more details.
 
 For more details see the file COPYING in the source distribution of Linux.
 
-.. class:: toc-title
+.. only:: html
+
+   .. class:: toc-title
 
 Table of Contents
 
diff --git a/Documentation/media/media_uapi.rst 
b/Documentation/media/media_uapi.rst
index fd8ebe002cd2..28eb35a1f965 100644
--- a/Documentation/media/media_uapi.rst
+++ b/Documentation/media/media_uapi.rst
@@ -14,7 +14,9 @@ any later version published by the Free Software Foundation. 
A copy of
 the license is included in the chapter entitled "GNU Free Documentation
 License".
 
-.. class:: toc-title
+.. only:: html
+
+   .. class:: toc-title
 
 Table of Contents
 
diff --git a/Documentation/media/uapi/cec/cec-api.rst 
b/Documentation/media/uapi/cec/cec-api.rst
index bb018709970c..b68ca9c1d2e0 100644
--- a/Documentation/media/uapi/cec/cec-api.rst
+++ b/Documentation/media/uapi/cec/cec-api.rst
@@ -10,7 +10,10 @@ Part V - Consumer Electronics Control API
 
 This part describes the CEC: Consumer Electronics Control
 
-.. class:: toc-title
+
+.. only:: html
+
+   .. class:: toc-title
 
 Table of Contents
 
diff --git a/Documentation/media/uapi/dvb/dvbapi.rst 
b/Documentation/media/uapi/dvb/dvbapi.rst
index 7d26e98e5a41..18c86b3a3af1 100644
--- a/Documentation/media/uapi/dvb/dvbapi.rst
+++ b/Documentation/media/uapi/dvb/dvbapi.rst
@@ -28,7 +28,9 @@ Part II - Digital TV API
 
 **Version 5.10**
 
-.. class:: toc-title
+.. only:: html
+
+   .. class:: toc-title
 
 Table of Contents
 
diff --git a/Documentation/media/uapi/mediactl/media-controller.rst 
b/Documentation/media/uapi/mediactl/media-controller.rst
index 7ae38d48969e..0eea4f9a07d5 100644
--- a/Documentation/media/uapi/mediactl/media-controller.rst
+++ b/Documentation/media/uapi/mediactl/media-controller.rst
@@ -8,7 +8,9 @@
 Part IV - Media Controller API
 ##
 
-.. class:: toc-title
+.. only:: html
+
+   .. class:: toc-title
 
 Table of Contents
 
diff --git a/Documentation/media/uapi/rc/remote_controllers.rst 
b/Documentation/media/uapi/rc/remote_controllers.rst
index 3e25cc9f65e0..46a8acb82125 100644
--- a/Documentation/media/uapi/rc/remote_controllers.rst
+++ b/Documentation/media/uapi/rc/remote_controllers.rst
@@ -8,7 +8,9 @@
 Part III - Remote Controller API
 
 
-.. class:: toc-title
+.. only:: html
+
+   .. class:: toc-title
 
 Table of Contents
 
diff --git a/Documentation/media/uapi/v4l/v4l2.rst 
b/Documentation/media/uapi/v4l/v4l2.rst
index f52a11c949d3..297c293d4c93 100644
--- a/Documentation/media/uapi/v4l/v4l2.rst
+++ b/Documentation/media/uapi/v4l/v4l2.rst
@@ -11,7 +11,9 @@ This part describes the Video for Linux API version 2 (V4L2 
API) specification.
 
 **Revision 4.5**
 
-.. class:: toc-title
+.. only:: html
+
+   .. class:: toc-title
 
 Table of Contents
 
diff --git 

[PATCH 10/12] media: v4l2-event.rst: adjust table to fit on PDF output

2017-09-02 Thread Mauro Carvalho Chehab
The tables there don't quite fit on PDF output.

Adjust it by adding a tabularcolumns macro.

Signed-off-by: Mauro Carvalho Chehab 
---
 Documentation/media/kapi/v4l2-event.rst | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/media/kapi/v4l2-event.rst 
b/Documentation/media/kapi/v4l2-event.rst
index 9a5e31546ae3..9938d21ef4d1 100644
--- a/Documentation/media/kapi/v4l2-event.rst
+++ b/Documentation/media/kapi/v4l2-event.rst
@@ -67,6 +67,8 @@ type).
 
 The ops argument allows the driver to specify a number of callbacks:
 
+.. tabularcolumns:: |p{1.5cm}|p{16.0cm}|
+
  ==
 Callback Description
  ==
-- 
2.13.5



[PATCH 01/12] media: v4l uAPI: add descriptions for arguments to all ioctls

2017-09-02 Thread Mauro Carvalho Chehab
Several ioctls are missing descriptions for the third argument
of the ioctl() command. They should have a description, as
otherwise the output won't be ok, and will sound like something
is missing.

So, add them.

Signed-off-by: Mauro Carvalho Chehab 
---
 Documentation/media/uapi/v4l/vidioc-create-bufs.rst| 1 +
 Documentation/media/uapi/v4l/vidioc-cropcap.rst| 1 +
 Documentation/media/uapi/v4l/vidioc-dbg-g-chip-info.rst| 1 +
 Documentation/media/uapi/v4l/vidioc-dbg-g-register.rst | 1 +
 Documentation/media/uapi/v4l/vidioc-dqevent.rst| 1 +
 Documentation/media/uapi/v4l/vidioc-dv-timings-cap.rst | 1 +
 Documentation/media/uapi/v4l/vidioc-encoder-cmd.rst| 2 +-
 Documentation/media/uapi/v4l/vidioc-enum-dv-timings.rst| 1 +
 Documentation/media/uapi/v4l/vidioc-enum-fmt.rst   | 1 +
 Documentation/media/uapi/v4l/vidioc-enum-frameintervals.rst| 5 ++---
 Documentation/media/uapi/v4l/vidioc-enum-framesizes.rst| 2 +-
 Documentation/media/uapi/v4l/vidioc-enum-freq-bands.rst| 1 +
 Documentation/media/uapi/v4l/vidioc-enumaudio.rst  | 1 +
 Documentation/media/uapi/v4l/vidioc-enumaudioout.rst   | 1 +
 Documentation/media/uapi/v4l/vidioc-enuminput.rst  | 1 +
 Documentation/media/uapi/v4l/vidioc-enumoutput.rst | 1 +
 Documentation/media/uapi/v4l/vidioc-enumstd.rst| 1 +
 Documentation/media/uapi/v4l/vidioc-expbuf.rst | 1 +
 Documentation/media/uapi/v4l/vidioc-g-audio.rst| 1 +
 Documentation/media/uapi/v4l/vidioc-g-audioout.rst | 1 +
 Documentation/media/uapi/v4l/vidioc-g-crop.rst | 1 +
 Documentation/media/uapi/v4l/vidioc-g-ctrl.rst | 1 +
 Documentation/media/uapi/v4l/vidioc-g-dv-timings.rst   | 1 +
 Documentation/media/uapi/v4l/vidioc-g-edid.rst | 1 +
 Documentation/media/uapi/v4l/vidioc-g-enc-index.rst| 1 +
 Documentation/media/uapi/v4l/vidioc-g-ext-ctrls.rst| 1 +
 Documentation/media/uapi/v4l/vidioc-g-fbuf.rst | 1 +
 Documentation/media/uapi/v4l/vidioc-g-fmt.rst  | 1 +
 Documentation/media/uapi/v4l/vidioc-g-frequency.rst| 1 +
 Documentation/media/uapi/v4l/vidioc-g-input.rst| 1 +
 Documentation/media/uapi/v4l/vidioc-g-jpegcomp.rst | 1 +
 Documentation/media/uapi/v4l/vidioc-g-modulator.rst| 1 +
 Documentation/media/uapi/v4l/vidioc-g-output.rst   | 1 +
 Documentation/media/uapi/v4l/vidioc-g-parm.rst | 1 +
 Documentation/media/uapi/v4l/vidioc-g-priority.rst | 2 +-
 Documentation/media/uapi/v4l/vidioc-g-selection.rst| 5 +
 Documentation/media/uapi/v4l/vidioc-g-sliced-vbi-cap.rst   | 1 +
 Documentation/media/uapi/v4l/vidioc-g-std.rst  | 1 +
 Documentation/media/uapi/v4l/vidioc-g-tuner.rst| 1 +
 Documentation/media/uapi/v4l/vidioc-overlay.rst| 1 +
 Documentation/media/uapi/v4l/vidioc-prepare-buf.rst| 1 +
 Documentation/media/uapi/v4l/vidioc-qbuf.rst   | 1 +
 Documentation/media/uapi/v4l/vidioc-query-dv-timings.rst   | 1 +
 Documentation/media/uapi/v4l/vidioc-querybuf.rst   | 1 +
 Documentation/media/uapi/v4l/vidioc-querycap.rst   | 1 +
 Documentation/media/uapi/v4l/vidioc-queryctrl.rst  | 2 ++
 Documentation/media/uapi/v4l/vidioc-querystd.rst   | 1 +
 Documentation/media/uapi/v4l/vidioc-reqbufs.rst| 2 +-
 Documentation/media/uapi/v4l/vidioc-s-hw-freq-seek.rst | 1 +
 Documentation/media/uapi/v4l/vidioc-streamon.rst   | 2 +-
 Documentation/media/uapi/v4l/vidioc-subdev-enum-frame-interval.rst | 1 +
 Documentation/media/uapi/v4l/vidioc-subdev-enum-frame-size.rst | 1 +
 Documentation/media/uapi/v4l/vidioc-subdev-enum-mbus-code.rst  | 1 +
 Documentation/media/uapi/v4l/vidioc-subdev-g-crop.rst  | 1 +
 Documentation/media/uapi/v4l/vidioc-subdev-g-fmt.rst   | 1 +
 Documentation/media/uapi/v4l/vidioc-subdev-g-frame-interval.rst| 1 +
 Documentation/media/uapi/v4l/vidioc-subdev-g-selection.rst | 1 +
 Documentation/media/uapi/v4l/vidioc-subscribe-event.rst| 1 +
 58 files changed, 60 insertions(+), 12 deletions(-)

diff --git a/Documentation/media/uapi/v4l/vidioc-create-bufs.rst 
b/Documentation/media/uapi/v4l/vidioc-create-bufs.rst
index aaca12fca06e..a39e18d69511 100644
--- a/Documentation/media/uapi/v4l/vidioc-create-bufs.rst
+++ b/Documentation/media/uapi/v4l/vidioc-create-bufs.rst
@@ -26,6 +26,7 @@ Arguments
 File descriptor returned by :ref:`open() `.
 
 

[PATCH 00/12] media documentation ReST fixes

2017-09-02 Thread Mauro Carvalho Chehab
This series contain media documentation ReST fixes, mostly related to
table parsing and the corresponding PDF output (tested with Sphinx 1.4).

It also contains a few documentation trivial improvements, from a
few minor issues I noticed when reading the PDF output text on some
places.

Probably the most important one is a regression that was causing the
media book build to return an error, introduced by changeset
70b074df4ed1 ("media: fix pdf build with Spinx 1.6"). 

My plan is to merge this patch series soon via the media tree, 
and send it upstream during this merge window.

Markus, 

Perhaps you could take a look on it. It is related to the usage of cspan
and the corresponding PDF output.

Mauro Carvalho Chehab (12):
  media: v4l uAPI: add descriptions for arguments to all ioctls
  media: vidioc-querycap: use a more realistic value for KERNEL_VERSION
  media: vidioc-g-tuner.rst: Fix table number of cols
  media: v4l uAPI docs: adjust some tables for PDF output
  media: docs: fix PDF build with Sphinx 1.4
  media: rc-sysfs-nodes.rst: better use literals
  media: mc uapi: adjust some table sizes for PDF output
  media: cec uapi: Adjust table sizes for PDF output
  media: docs: don't show ToC for each part on PDF output
  media: v4l2-event.rst: adjust table to fit on PDF output
  media: em28xx-cardlist.rst: update to reflect last changes
  media: docs-rst: cardlists: change their format to flat-tables

 Documentation/media/cec-drivers/index.rst  |   4 +-
 Documentation/media/dvb-drivers/index.rst  |   4 +-
 Documentation/media/kapi/v4l2-event.rst|   2 +
 Documentation/media/media_kapi.rst |   4 +-
 Documentation/media/media_uapi.rst |   4 +-
 Documentation/media/uapi/cec/cec-api.rst   |   5 +-
 .../media/uapi/cec/cec-ioc-adap-g-log-addrs.rst|   7 +-
 Documentation/media/uapi/cec/cec-ioc-dqevent.rst   |   9 +-
 Documentation/media/uapi/cec/cec-ioc-g-mode.rst|   2 +
 Documentation/media/uapi/cec/cec-ioc-receive.rst   |   2 +
 Documentation/media/uapi/dvb/dvbapi.rst|   4 +-
 .../media/uapi/mediactl/media-controller.rst   |   4 +-
 .../uapi/mediactl/media-ioc-enum-entities.rst  |   2 +-
 .../media/uapi/mediactl/media-ioc-g-topology.rst   |   2 +-
 Documentation/media/uapi/mediactl/media-types.rst  |   2 +-
 Documentation/media/uapi/rc/rc-sysfs-nodes.rst |  10 +-
 Documentation/media/uapi/rc/remote_controllers.rst |   4 +-
 Documentation/media/uapi/v4l/colorspaces-defs.rst  |   2 +
 Documentation/media/uapi/v4l/pixfmt-packed-rgb.rst |   6 +-
 Documentation/media/uapi/v4l/pixfmt-packed-yuv.rst |   3 +-
 Documentation/media/uapi/v4l/pixfmt-srggb10p.rst   |   2 +-
 .../media/uapi/v4l/v4l2-selection-targets.rst  |   2 +-
 Documentation/media/uapi/v4l/v4l2.rst  |   4 +-
 .../media/uapi/v4l/vidioc-create-bufs.rst  |   1 +
 Documentation/media/uapi/v4l/vidioc-cropcap.rst|   1 +
 .../media/uapi/v4l/vidioc-dbg-g-chip-info.rst  |   1 +
 .../media/uapi/v4l/vidioc-dbg-g-register.rst   |   1 +
 Documentation/media/uapi/v4l/vidioc-dqevent.rst|   1 +
 .../media/uapi/v4l/vidioc-dv-timings-cap.rst   |   1 +
 .../media/uapi/v4l/vidioc-encoder-cmd.rst  |   2 +-
 .../media/uapi/v4l/vidioc-enum-dv-timings.rst  |   1 +
 Documentation/media/uapi/v4l/vidioc-enum-fmt.rst   |   1 +
 .../media/uapi/v4l/vidioc-enum-frameintervals.rst  |   5 +-
 .../media/uapi/v4l/vidioc-enum-framesizes.rst  |   4 +-
 .../media/uapi/v4l/vidioc-enum-freq-bands.rst  |   1 +
 Documentation/media/uapi/v4l/vidioc-enumaudio.rst  |   1 +
 .../media/uapi/v4l/vidioc-enumaudioout.rst |   1 +
 Documentation/media/uapi/v4l/vidioc-enuminput.rst  |   1 +
 Documentation/media/uapi/v4l/vidioc-enumoutput.rst |   1 +
 Documentation/media/uapi/v4l/vidioc-enumstd.rst|   1 +
 Documentation/media/uapi/v4l/vidioc-expbuf.rst |   1 +
 Documentation/media/uapi/v4l/vidioc-g-audio.rst|   1 +
 Documentation/media/uapi/v4l/vidioc-g-audioout.rst |   1 +
 Documentation/media/uapi/v4l/vidioc-g-crop.rst |   1 +
 Documentation/media/uapi/v4l/vidioc-g-ctrl.rst |   1 +
 .../media/uapi/v4l/vidioc-g-dv-timings.rst |   1 +
 Documentation/media/uapi/v4l/vidioc-g-edid.rst |   1 +
 .../media/uapi/v4l/vidioc-g-enc-index.rst  |   1 +
 .../media/uapi/v4l/vidioc-g-ext-ctrls.rst  |   1 +
 Documentation/media/uapi/v4l/vidioc-g-fbuf.rst |   1 +
 Documentation/media/uapi/v4l/vidioc-g-fmt.rst  |   1 +
 .../media/uapi/v4l/vidioc-g-frequency.rst  |   1 +
 Documentation/media/uapi/v4l/vidioc-g-input.rst|   1 +
 Documentation/media/uapi/v4l/vidioc-g-jpegcomp.rst |   1 +
 .../media/uapi/v4l/vidioc-g-modulator.rst  |   1 +
 Documentation/media/uapi/v4l/vidioc-g-output.rst   |   1 +
 Documentation/media/uapi/v4l/vidioc-g-parm.rst |   1 +
 Documentation/media/uapi/v4l/vidioc-g-priority.rst |   2 +-
 .../media/uapi/v4l/vidioc-g-selection.rst  |   5 +-
 

[PATCH 05/12] media: docs: fix PDF build with Sphinx 1.4

2017-09-02 Thread Mauro Carvalho Chehab
changeset 70b074df4ed1 ("media: fix pdf build with Spinx 1.6") caused
a regression at Sphinx 1.4 PDF build: although it produces a full
document in batch mode, it returns errors on interactive mode:

[63]
Runaway argument?
{\relax
! Paragraph ended before \multicolumn was complete.

   \par
l.7703 \hline\end{tabulary}

The error seems to be due to some bug at Sphinx PDF output:
when multicolumns is used, it doesn't accept an empty string.

Just removing the :cpan:`1` and replacing by two empty
columns fix the issue.

Fixes: 70b074df4ed1 ("media: fix pdf build with Spinx 1.6")

Signed-off-by: Mauro Carvalho Chehab 
---
 Documentation/media/uapi/v4l/pixfmt-packed-rgb.rst | 6 --
 Documentation/media/uapi/v4l/pixfmt-packed-yuv.rst | 3 ++-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/Documentation/media/uapi/v4l/pixfmt-packed-rgb.rst 
b/Documentation/media/uapi/v4l/pixfmt-packed-rgb.rst
index bb85abcfceb5..4938d9655a41 100644
--- a/Documentation/media/uapi/v4l/pixfmt-packed-rgb.rst
+++ b/Documentation/media/uapi/v4l/pixfmt-packed-rgb.rst
@@ -35,7 +35,8 @@ next to each other in memory.
   - :cspan:`7` Byte 1
   - :cspan:`7` Byte 2
   - :cspan:`7` Byte 3
-* - :cspan:`1`
+* -
+  -
   - 7
   - 6
   - 5
@@ -665,7 +666,8 @@ either the corresponding ARGB or XRGB format, depending on 
the driver.
   - :cspan:`7` Byte 2
 
   - :cspan:`7` Byte 3
-* - :cspan:`1`
+* -
+  -
   - 7
   - 6
   - 5
diff --git a/Documentation/media/uapi/v4l/pixfmt-packed-yuv.rst 
b/Documentation/media/uapi/v4l/pixfmt-packed-yuv.rst
index d6a6e890f5a9..d7644b411ccc 100644
--- a/Documentation/media/uapi/v4l/pixfmt-packed-yuv.rst
+++ b/Documentation/media/uapi/v4l/pixfmt-packed-yuv.rst
@@ -37,7 +37,8 @@ component of each pixel in one 16 or 32 bit word.
   - :cspan:`7` Byte 2
 
   - :cspan:`7` Byte 3
-* - :cspan:`1`
+* -
+  -
   - 7
   - 6
   - 5
-- 
2.13.5



[PATCH 11/12] media: em28xx-cardlist.rst: update to reflect last changes

2017-09-02 Thread Mauro Carvalho Chehab
There were some new board additions. Update the cardlist
accordingly.

Signed-off-by: Mauro Carvalho Chehab 
---
 .../media/v4l-drivers/em28xx-cardlist.rst  | 210 +++--
 1 file changed, 106 insertions(+), 104 deletions(-)

diff --git a/Documentation/media/v4l-drivers/em28xx-cardlist.rst 
b/Documentation/media/v4l-drivers/em28xx-cardlist.rst
index 76b1d301754c..ef304da61354 100644
--- a/Documentation/media/v4l-drivers/em28xx-cardlist.rst
+++ b/Documentation/media/v4l-drivers/em28xx-cardlist.rst
@@ -1,107 +1,109 @@
 EM28xx cards list
 =
 
-=== 
 
 
==
-Card number Card name  
  Empia Chip   USB IDs
-=== 
 
 
==
-0   Unknown EM2800 video grabber   
  em2800   eb1a:2800
-1   Unknown EM2750/28xx video grabber  
  em2820 or em2840 eb1a:2710, eb1a:2820, eb1a:2821, eb1a:2860, eb1a:2861, 
eb1a:2862, eb1a:2863, eb1a:2870, eb1a:2881, eb1a:2883, eb1a:2868, eb1a:2875
-2   Terratec Cinergy 250 USB   
  em2820 or em2840 0ccd:0036
-3   Pinnacle PCTV USB 2
  em2820 or em2840 2304:0208
-4   Hauppauge WinTV USB 2  
  em2820 or em2840 2040:4200, 2040:4201
-5   MSI VOX USB 2.0
  em2820 or em2840
-6   Terratec Cinergy 200 USB   
  em2800
-7   Leadtek Winfast USB II 
  em2800   0413:6023
-8   Kworld USB2800 
  em2800
-9   Pinnacle Dazzle DVC 90/100/101/107 / Kaiser Baas Video to DVD 
maker  em2820 or em2840 1b80:e302, 1b80:e304, 2304:0207, 2304:021a, 093b:a003
-10  Hauppauge WinTV HVR 900
  em2880   2040:6500
-11  Terratec Hybrid XS 
  em2880
-12  Kworld PVR TV 2800 RF  
  em2820 or em2840
-13  Terratec Prodigy XS
  em2880
-14  SIIG AVTuner-PVR / Pixelview Prolink PlayTV USB 2.0
  em2820 or em2840
-15  V-Gear PocketTV
  em2800
-16  Hauppauge WinTV HVR 950
  em2883   2040:6513, 2040:6517, 2040:651b
-17  Pinnacle PCTV HD Pro Stick 
  em2880   2304:0227
-18  Hauppauge WinTV HVR 900 (R2)   
  em2880   2040:6502
-19  EM2860/SAA711X Reference Design
  em2860
-20  AMD ATI TV Wonder HD 600   
  em2880   0438:b002
-21  eMPIA Technology, Inc. GrabBeeX+ Video Encoder 
  em2800   eb1a:2801
-22  EM2710/EM2750/EM2751 webcam grabber
  em2750   eb1a:2750, eb1a:2751
-23  Huaqi DLCW-130 
  em2750
-24  D-Link DUB-T210 TV Tuner   
  em2820 or em2840 2001:f112
-25  Gadmei UTV310  
  em2820 or em2840
-26  Hercules Smart TV USB 2.0  
  em2820 or em2840
-27  Pinnacle PCTV USB 2 (Philips FM1216ME) 
  em2820 or em2840
-28  Leadtek Winfast USB II Deluxe  
  em2820 or em2840
-29  EM2860/TVP5150 Reference Design
  em2860
-30  Videology 20K14XUSB USB2.0 
  em2820 or em2840
-31  Usbgear VD204v9
  em2821
-32  Supercomp USB 2.0 TV   
  em2821
-33  Elgato Video Capture   
  em2860   0fd9:0033
-34  Terratec Cinergy A Hybrid XS   
  em2860   0ccd:004f
-35  Typhoon DVD Maker  

[PATCH 07/12] media: mc uapi: adjust some table sizes for PDF output

2017-09-02 Thread Mauro Carvalho Chehab
Some cells are too small to fit the text written to it.

Increase it. No text changes.

Signed-off-by: Mauro Carvalho Chehab 
---
 Documentation/media/uapi/mediactl/media-ioc-enum-entities.rst | 2 +-
 Documentation/media/uapi/mediactl/media-ioc-g-topology.rst| 2 +-
 Documentation/media/uapi/mediactl/media-types.rst | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/Documentation/media/uapi/mediactl/media-ioc-enum-entities.rst 
b/Documentation/media/uapi/mediactl/media-ioc-enum-entities.rst
index 0fd329279bef..b59ce149efb5 100644
--- a/Documentation/media/uapi/mediactl/media-ioc-enum-entities.rst
+++ b/Documentation/media/uapi/mediactl/media-ioc-enum-entities.rst
@@ -51,7 +51,7 @@ id's until they get an error.
 
 .. c:type:: media_entity_desc
 
-.. tabularcolumns:: |p{1.5cm}|p{1.5cm}|p{1.5cm}|p{1.5cm}|p{11.5cm}|
+.. tabularcolumns:: |p{1.5cm}|p{1.7cm}|p{1.6cm}|p{1.5cm}|p{11.2cm}|
 
 .. flat-table:: struct media_entity_desc
 :header-rows:  0
diff --git a/Documentation/media/uapi/mediactl/media-ioc-g-topology.rst 
b/Documentation/media/uapi/mediactl/media-ioc-g-topology.rst
index add8281494f8..997e6b17440d 100644
--- a/Documentation/media/uapi/mediactl/media-ioc-g-topology.rst
+++ b/Documentation/media/uapi/mediactl/media-ioc-g-topology.rst
@@ -46,7 +46,7 @@ other values untouched.
 If the ``topology_version`` remains the same, the ioctl should fill the
 desired arrays with the media graph elements.
 
-.. tabularcolumns:: |p{1.6cm}|p{3.2cm}|p{12.7cm}|
+.. tabularcolumns:: |p{1.6cm}|p{3.4cm}|p{12.5cm}|
 
 .. c:type:: media_v2_topology
 
diff --git a/Documentation/media/uapi/mediactl/media-types.rst 
b/Documentation/media/uapi/mediactl/media-types.rst
index 71078565d644..8d64b0c06ebc 100644
--- a/Documentation/media/uapi/mediactl/media-types.rst
+++ b/Documentation/media/uapi/mediactl/media-types.rst
@@ -5,7 +5,7 @@
 Types and flags used to represent the media graph elements
 ==
 
-..  tabularcolumns:: |p{8.0cm}|p{10.5cm}|
+..  tabularcolumns:: |p{8.2cm}|p{10.3cm}|
 
 .. _media-entity-type:
 
-- 
2.13.5



[PATCH 12/12] media: docs-rst: cardlists: change their format to flat-tables

2017-09-02 Thread Mauro Carvalho Chehab
Most tables there don't fit on 80 columns. Some are very big.

While those tables are actually generated via scripts, every
time a new board is added, the entire table could be reformatted.
>From the diffstat PoV, that's bad, as it is hard to see what
happened.

One such example is at changeset 4868f6e1fce6 ("media:
em28xx-cardlist.rst: update to reflect last changes"):

The USB ID for "Plextor ConvertX PX-AV100U" was added to card
number 9, with caused the entire table to be reformatted.

So, instead, use flat-tables. While here, fix PDF output,
by adding tablecolumns to the tables that need it.

Signed-off-by: Mauro Carvalho Chehab 
---
 .../media/v4l-drivers/au0828-cardlist.rst  |  44 +-
 Documentation/media/v4l-drivers/bttv-cardlist.rst  | 849 +
 .../media/v4l-drivers/cx23885-cardlist.rst | 304 +--
 Documentation/media/v4l-drivers/cx88-cardlist.rst  | 469 --
 .../media/v4l-drivers/em28xx-cardlist.rst  | 525 ---
 Documentation/media/v4l-drivers/ivtv-cardlist.rst  | 169 +++-
 .../media/v4l-drivers/saa7134-cardlist.rst | 999 -
 .../media/v4l-drivers/saa7164-cardlist.rst |  84 +-
 .../media/v4l-drivers/tm6000-cardlist.rst  |  99 +-
 .../media/v4l-drivers/usbvision-cardlist.rst   | 349 +--
 10 files changed, 3101 insertions(+), 790 deletions(-)

diff --git a/Documentation/media/v4l-drivers/au0828-cardlist.rst 
b/Documentation/media/v4l-drivers/au0828-cardlist.rst
index 82d2567bc7c1..bb87b7b36a83 100644
--- a/Documentation/media/v4l-drivers/au0828-cardlist.rst
+++ b/Documentation/media/v4l-drivers/au0828-cardlist.rst
@@ -1,13 +1,37 @@
 AU0828 cards list
 =
 
-=== == 
===
-Card number Card name  USB IDs
-=== == 
===
-0   Unknown board
-1   Hauppauge HVR950Q  2040:7200, 2040:7210, 2040:7217, 
2040:721b, 2040:721e, 2040:721f, 2040:7280, 0fd9:0008, 2040:7260, 2040:7213, 
2040:7270
-2   Hauppauge HVR850   2040:7240
-3   DViCO FusionHDTV USB   0fe9:d620
-4   Hauppauge HVR950Q rev xxF8 2040:7201, 2040:7211, 2040:7281
-5   Hauppauge Woodbury 05e1:0480, 2040:8200
-=== == 
===
+.. tabularcolumns:: |p{1.4cm}|p{6.5cm}|p{10.0cm}|
+
+.. flat-table::
+   :header-rows: 1
+   :widths: 2 19 18
+   :stub-columns: 0
+
+   * - Card number
+ - Card name
+ - USB IDs
+
+   * - 0
+ - Unknown board
+ -
+
+   * - 1
+ - Hauppauge HVR950Q
+ - 2040:7200, 2040:7210, 2040:7217, 2040:721b, 2040:721e, 2040:721f, 
2040:7280, 0fd9:0008, 2040:7260, 2040:7213, 2040:7270
+
+   * - 2
+ - Hauppauge HVR850
+ - 2040:7240
+
+   * - 3
+ - DViCO FusionHDTV USB
+ - 0fe9:d620
+
+   * - 4
+ - Hauppauge HVR950Q rev xxF8
+ - 2040:7201, 2040:7211, 2040:7281
+
+   * - 5
+ - Hauppauge Woodbury
+ - 05e1:0480, 2040:8200
diff --git a/Documentation/media/v4l-drivers/bttv-cardlist.rst 
b/Documentation/media/v4l-drivers/bttv-cardlist.rst
index 28a01cd6cf2e..8da27b924e01 100644
--- a/Documentation/media/v4l-drivers/bttv-cardlist.rst
+++ b/Documentation/media/v4l-drivers/bttv-cardlist.rst
@@ -1,174 +1,681 @@
 BTTV cards list
 ===
 
-=== 
=
 
==
-Card number Card name  
   PCI IDs
-=== 
=
 
==
-0*** UNKNOWN/GENERIC ***
-1   MIRO PCTV
-2   Hauppauge (bt848)
-3   STB, Gateway P/N 6000699 (bt848)
-4   Intel Create and Share PCI/ Smart Video Recorder III
-5   Diamond DTV2000
-6   AVerMedia TVPhone
-7   MATRIX-Vision MV-Delta
-8   Lifeview FlyVideo II (Bt848) LR26 / MAXI TV Video PCI2 LR26
-9   IMS/IXmicro TurboTV
-10  Hauppauge (bt878)  
   0070:13eb, 0070:3900, 2636:10b4
-11  MIRO PCTV pro
-12  ADS Technologies Channel Surfer TV (bt848)
-13  AVerMedia TVCapture 98 

[PATCH 08/12] media: cec uapi: Adjust table sizes for PDF output

2017-09-02 Thread Mauro Carvalho Chehab
Several tables at this media book chapter have issues
when PDF is produced. Adjust them.

Signed-off-by: Mauro Carvalho Chehab 
---
 Documentation/media/uapi/cec/cec-ioc-adap-g-log-addrs.rst | 7 +--
 Documentation/media/uapi/cec/cec-ioc-dqevent.rst  | 9 +
 Documentation/media/uapi/cec/cec-ioc-g-mode.rst   | 2 ++
 Documentation/media/uapi/cec/cec-ioc-receive.rst  | 2 ++
 4 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/Documentation/media/uapi/cec/cec-ioc-adap-g-log-addrs.rst 
b/Documentation/media/uapi/cec/cec-ioc-adap-g-log-addrs.rst
index b25e003a04d7..84f431a022ad 100644
--- a/Documentation/media/uapi/cec/cec-ioc-adap-g-log-addrs.rst
+++ b/Documentation/media/uapi/cec/cec-ioc-adap-g-log-addrs.rst
@@ -65,7 +65,7 @@ logical address types are already defined will return with 
error ``EBUSY``.
 
 .. c:type:: cec_log_addrs
 
-.. tabularcolumns:: |p{1.0cm}|p{7.5cm}|p{8.0cm}|
+.. tabularcolumns:: |p{1.0cm}|p{8.0cm}|p{7.5cm}|
 
 .. cssclass:: longtable
 
@@ -148,6 +148,9 @@ logical address types are already defined will return with 
error ``EBUSY``.
 give the CEC framework more information about the device type, even
 though the framework won't use it directly in the CEC message.
 
+
+.. tabularcolumns:: |p{7.8cm}|p{1.0cm}|p{8.7cm}|
+
 .. _cec-log-addrs-flags:
 
 .. flat-table:: Flags for struct cec_log_addrs
@@ -183,7 +186,7 @@ logical address types are already defined will return with 
error ``EBUSY``.
All other messages are ignored.
 
 
-.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}|
+.. tabularcolumns:: |p{7.8cm}|p{1.0cm}|p{8.7cm}|
 
 .. _cec-versions:
 
diff --git a/Documentation/media/uapi/cec/cec-ioc-dqevent.rst 
b/Documentation/media/uapi/cec/cec-ioc-dqevent.rst
index db615e3405c0..a5c821809cc6 100644
--- a/Documentation/media/uapi/cec/cec-ioc-dqevent.rst
+++ b/Documentation/media/uapi/cec/cec-ioc-dqevent.rst
@@ -87,7 +87,7 @@ it is guaranteed that the state did change in between the two 
events.
this is more than enough.
 
 
-.. tabularcolumns:: |p{1.0cm}|p{4.2cm}|p{2.5cm}|p{8.8cm}|
+.. tabularcolumns:: |p{1.0cm}|p{4.4cm}|p{2.5cm}|p{9.6cm}|
 
 .. c:type:: cec_event
 
@@ -98,10 +98,11 @@ it is guaranteed that the state did change in between the 
two events.
 
 * - __u64
   - ``ts``
-  - :cspan:`1` Timestamp of the event in ns.
+  - :cspan:`1`\ Timestamp of the event in ns.
 
-   The timestamp has been taken from the ``CLOCK_MONOTONIC`` clock. To 
access
-   the same clock from userspace use :c:func:`clock_gettime`.
+   The timestamp has been taken from the ``CLOCK_MONOTONIC`` clock.
+
+   To access the same clock from userspace use :c:func:`clock_gettime`.
 * - __u32
   - ``event``
   - :cspan:`1` The CEC event type, see :ref:`cec-events`.
diff --git a/Documentation/media/uapi/cec/cec-ioc-g-mode.rst 
b/Documentation/media/uapi/cec/cec-ioc-g-mode.rst
index 4d8e0647e832..508e2e325683 100644
--- a/Documentation/media/uapi/cec/cec-ioc-g-mode.rst
+++ b/Documentation/media/uapi/cec/cec-ioc-g-mode.rst
@@ -108,6 +108,8 @@ Available follower modes are:
 
 .. _cec-mode-follower_e:
 
+.. cssclass:: longtable
+
 .. flat-table:: Follower Modes
 :header-rows:  0
 :stub-columns: 0
diff --git a/Documentation/media/uapi/cec/cec-ioc-receive.rst 
b/Documentation/media/uapi/cec/cec-ioc-receive.rst
index 267044f7ac30..0f397c535a4c 100644
--- a/Documentation/media/uapi/cec/cec-ioc-receive.rst
+++ b/Documentation/media/uapi/cec/cec-ioc-receive.rst
@@ -195,6 +195,8 @@ View On' messages from initiator 0xf ('Unregistered') to 
destination 0 ('TV').
valid if the :ref:`CEC_TX_STATUS_ERROR ` status 
bit is set.
 
 
+.. tabularcolumns:: |p{6.2cm}|p{1.0cm}|p{10.3cm}|
+
 .. _cec-msg-flags:
 
 .. flat-table:: Flags for struct cec_msg
-- 
2.13.5



[PATCH 7/7] [media] Mantis: Delete an unnecessary variable initialisation in mantis_pci_probe()

2017-09-02 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sat, 2 Sep 2017 22:05:22 +0200

The variable "err" will eventually be set to an appropriate value
a bit later. Thus omit the explicit initialisation at the beginning.

Signed-off-by: Markus Elfring 
---
 drivers/media/pci/mantis/mantis_cards.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/pci/mantis/mantis_cards.c 
b/drivers/media/pci/mantis/mantis_cards.c
index 6182ae44dd23..33dd99da0ed8 100644
--- a/drivers/media/pci/mantis/mantis_cards.c
+++ b/drivers/media/pci/mantis/mantis_cards.c
@@ -171,6 +171,6 @@ static int mantis_pci_probe(struct pci_dev *pdev,
struct mantis_pci_drvdata *drvdata;
struct mantis_pci *mantis;
struct mantis_hwconfig *config;
-   int err = 0;
+   int err;
 
mantis = kzalloc(sizeof(*mantis), GFP_KERNEL);
-- 
2.14.1



[PATCH 6/7] [media] Mantis: Improve a size determination in mantis_pci_probe()

2017-09-02 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sat, 2 Sep 2017 21:56:07 +0200

Replace the specification of a data structure by a pointer dereference
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring 
---
 drivers/media/pci/mantis/mantis_cards.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/pci/mantis/mantis_cards.c 
b/drivers/media/pci/mantis/mantis_cards.c
index 56a01f6f84c7..6182ae44dd23 100644
--- a/drivers/media/pci/mantis/mantis_cards.c
+++ b/drivers/media/pci/mantis/mantis_cards.c
@@ -173,5 +173,5 @@ static int mantis_pci_probe(struct pci_dev *pdev,
struct mantis_hwconfig *config;
int err = 0;
 
-   mantis = kzalloc(sizeof(struct mantis_pci), GFP_KERNEL);
+   mantis = kzalloc(sizeof(*mantis), GFP_KERNEL);
if (!mantis)
-- 
2.14.1



[PATCH 5/7] [media] Mantis: Delete an error message for a failed memory allocation in mantis_pci_probe()

2017-09-02 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sat, 2 Sep 2017 21:55:05 +0200

Omit an extra message for a memory allocation failure in this function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring 
---
 drivers/media/pci/mantis/mantis_cards.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/media/pci/mantis/mantis_cards.c 
b/drivers/media/pci/mantis/mantis_cards.c
index cdefffc16d9e..56a01f6f84c7 100644
--- a/drivers/media/pci/mantis/mantis_cards.c
+++ b/drivers/media/pci/mantis/mantis_cards.c
@@ -177,7 +177,5 @@ static int mantis_pci_probe(struct pci_dev *pdev,
-   if (mantis == NULL) {
-   printk(KERN_ERR "%s ERROR: Out of memory\n", __func__);
+   if (!mantis)
return -ENOMEM;
-   }
 
drvdata = (void *)pci_id->driver_data;
mantis->num = devs;
-- 
2.14.1



[PATCH 4/7] [media] Hopper: Delete an unnecessary variable initialisation in hopper_pci_probe()

2017-09-02 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sat, 2 Sep 2017 21:50:55 +0200

The variable "err" will be set to an appropriate value a bit later.
Thus omit the explicit initialisation at the beginning.

Signed-off-by: Markus Elfring 
---
 drivers/media/pci/mantis/hopper_cards.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/pci/mantis/hopper_cards.c 
b/drivers/media/pci/mantis/hopper_cards.c
index 88e5b2a97005..3826be19c156 100644
--- a/drivers/media/pci/mantis/hopper_cards.c
+++ b/drivers/media/pci/mantis/hopper_cards.c
@@ -161,6 +161,6 @@ static int hopper_pci_probe(struct pci_dev *pdev,
struct mantis_pci_drvdata *drvdata;
struct mantis_pci *mantis;
struct mantis_hwconfig *config;
-   int err = 0;
+   int err;
 
mantis = kzalloc(sizeof(*mantis), GFP_KERNEL);
-- 
2.14.1



[PATCH 3/7] [media] Hopper: Adjust a null pointer check in two functions

2017-09-02 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sat, 2 Sep 2017 21:25:50 +0200
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The script “checkpatch.pl” pointed information out like the following.

Comparison to NULL could be written !…

Thus fix the affected source code places.

Signed-off-by: Markus Elfring 
---
 drivers/media/pci/mantis/hopper_cards.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/pci/mantis/hopper_cards.c 
b/drivers/media/pci/mantis/hopper_cards.c
index fe7b40c306f7..88e5b2a97005 100644
--- a/drivers/media/pci/mantis/hopper_cards.c
+++ b/drivers/media/pci/mantis/hopper_cards.c
@@ -72,7 +72,7 @@ static irqreturn_t hopper_irq_handler(int irq, void *dev_id)
struct mantis_ca *ca;
 
mantis = (struct mantis_pci *) dev_id;
-   if (unlikely(mantis == NULL)) {
+   if (unlikely(!mantis)) {
dprintk(MANTIS_ERROR, 1, "Mantis == NULL");
return IRQ_NONE;
}
@@ -164,7 +164,7 @@ static int hopper_pci_probe(struct pci_dev *pdev,
int err = 0;
 
mantis = kzalloc(sizeof(*mantis), GFP_KERNEL);
-   if (mantis == NULL) {
+   if (!mantis) {
err = -ENOMEM;
goto fail0;
}
-- 
2.14.1



[PATCH 2/7] [media] Hopper: Improve a size determination in hopper_pci_probe()

2017-09-02 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sat, 2 Sep 2017 21:21:22 +0200

Replace the specification of a data structure by a pointer dereference
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring 
---
 drivers/media/pci/mantis/hopper_cards.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/pci/mantis/hopper_cards.c 
b/drivers/media/pci/mantis/hopper_cards.c
index cc1bb04d8cb4..fe7b40c306f7 100644
--- a/drivers/media/pci/mantis/hopper_cards.c
+++ b/drivers/media/pci/mantis/hopper_cards.c
@@ -163,7 +163,7 @@ static int hopper_pci_probe(struct pci_dev *pdev,
struct mantis_hwconfig *config;
int err = 0;
 
-   mantis = kzalloc(sizeof(struct mantis_pci), GFP_KERNEL);
+   mantis = kzalloc(sizeof(*mantis), GFP_KERNEL);
if (mantis == NULL) {
err = -ENOMEM;
goto fail0;
-- 
2.14.1



[PATCH 1/7] [media] Hopper: Delete an error message for a failed memory allocation in hopper_pci_probe()

2017-09-02 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sat, 2 Sep 2017 21:19:05 +0200

Omit an extra message for a memory allocation failure in this function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring 
---
 drivers/media/pci/mantis/hopper_cards.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/media/pci/mantis/hopper_cards.c 
b/drivers/media/pci/mantis/hopper_cards.c
index 68b5800030b7..cc1bb04d8cb4 100644
--- a/drivers/media/pci/mantis/hopper_cards.c
+++ b/drivers/media/pci/mantis/hopper_cards.c
@@ -168,4 +168,3 @@ static int hopper_pci_probe(struct pci_dev *pdev,
-   printk(KERN_ERR "%s ERROR: Out of memory\n", __func__);
err = -ENOMEM;
goto fail0;
}
-- 
2.14.1



[PATCH 0/7] [media] Mantis: Adjustments for three function implementations

2017-09-02 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sat, 2 Sep 2017 22:18:22 +0200

A few update suggestions were taken into account
from static source code analysis.

Markus Elfring (7):
  Delete an error message for a failed memory allocation in hopper_pci_probe()
  Improve a size determination in hopper_pci_probe()
  Adjust a null pointer check in two functions
  Delete an unnecessary variable initialisation in hopper_pci_probe()
  Delete an error message for a failed memory allocation in mantis_pci_probe()
  Improve a size determination in mantis_pci_probe()
  Delete an unnecessary variable initialisation in mantis_pci_probe()

 drivers/media/pci/mantis/hopper_cards.c | 9 -
 drivers/media/pci/mantis/mantis_cards.c | 8 +++-
 2 files changed, 7 insertions(+), 10 deletions(-)

-- 
2.14.1



[PATCH 3/3] [media] cx18: Adjust ten checks for null pointers

2017-09-02 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sat, 2 Sep 2017 19:49:23 +0200
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The script “checkpatch.pl” pointed information out like the following.

Comparison to NULL could be written …

Thus fix the affected source code places.

Signed-off-by: Markus Elfring 
---
 drivers/media/pci/cx18/cx18-driver.c | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/media/pci/cx18/cx18-driver.c 
b/drivers/media/pci/cx18/cx18-driver.c
index 49fc9b72ada5..c29e8ec880b3 100644
--- a/drivers/media/pci/cx18/cx18-driver.c
+++ b/drivers/media/pci/cx18/cx18-driver.c
@@ -255,7 +255,7 @@ static void request_module_async(struct work_struct *work)
request_module("cx18-alsa");
 
/* Initialize cx18-alsa for this instance of the cx18 device */
-   if (cx18_ext_init != NULL)
+   if (cx18_ext_init)
cx18_ext_init(dev);
 }
 
@@ -291,11 +291,11 @@ int cx18_msleep_timeout(unsigned int msecs, int intr)
 /* Release ioremapped memory */
 static void cx18_iounmap(struct cx18 *cx)
 {
-   if (cx == NULL)
+   if (!cx)
return;
 
/* Release io memory */
-   if (cx->enc_mem != NULL) {
+   if (cx->enc_mem) {
CX18_DEBUG_INFO("releasing enc_mem\n");
iounmap(cx->enc_mem);
cx->enc_mem = NULL;
@@ -649,15 +649,15 @@ static void cx18_process_options(struct cx18 *cx)
CX18_INFO("User specified %s card\n", cx->card->name);
else if (cx->options.cardtype != 0)
CX18_ERR("Unknown user specified type, trying to autodetect 
card\n");
-   if (cx->card == NULL) {
+   if (!cx->card) {
if (cx->pci_dev->subsystem_vendor == CX18_PCI_ID_HAUPPAUGE) {
cx->card = cx18_get_card(CX18_CARD_HVR_1600_ESMT);
CX18_INFO("Autodetected Hauppauge card\n");
}
}
-   if (cx->card == NULL) {
+   if (!cx->card) {
for (i = 0; (cx->card = cx18_get_card(i)); i++) {
-   if (cx->card->pci_list == NULL)
+   if (!cx->card->pci_list)
continue;
for (j = 0; cx->card->pci_list[j].device; j++) {
if (cx->pci_dev->device !=
@@ -676,7 +676,7 @@ static void cx18_process_options(struct cx18 *cx)
}
 done:
 
-   if (cx->card == NULL) {
+   if (!cx->card) {
cx->card = cx18_get_card(CX18_CARD_HVR_1600_ESMT);
CX18_ERR("Unknown card: vendor/device: [%04x:%04x]\n",
 cx->pci_dev->vendor, cx->pci_dev->device);
@@ -698,7 +698,7 @@ static int cx18_create_in_workq(struct cx18 *cx)
snprintf(cx->in_workq_name, sizeof(cx->in_workq_name), "%s-in",
 cx->v4l2_dev.name);
cx->in_work_queue = alloc_ordered_workqueue("%s", 0, cx->in_workq_name);
-   if (cx->in_work_queue == NULL) {
+   if (!cx->in_work_queue) {
CX18_ERR("Unable to create incoming mailbox handler thread\n");
return -ENOMEM;
}
@@ -1254,7 +1254,7 @@ static void cx18_cancel_out_work_orders(struct cx18 *cx)
 {
int i;
for (i = 0; i < CX18_MAX_STREAMS; i++)
-   if (>streams[i].video_dev != NULL)
+   if (>streams[i].video_dev)
cancel_work_sync(>streams[i].out_work_order);
 }
 
@@ -1299,7 +1299,7 @@ static void cx18_remove(struct pci_dev *pci_dev)
 
pci_disable_device(cx->pci_dev);
 
-   if (cx->vbi.sliced_mpeg_data[0] != NULL)
+   if (cx->vbi.sliced_mpeg_data[0])
for (i = 0; i < CX18_VBI_FRAMES; i++)
kfree(cx->vbi.sliced_mpeg_data[i]);
 
-- 
2.14.1



[PATCH 2/3] [media] cx18: Improve a size determination in cx18_probe()

2017-09-02 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sat, 2 Sep 2017 19:42:12 +0200

Replace the specification of a data structure by a pointer dereference
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring 
---
 drivers/media/pci/cx18/cx18-driver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/pci/cx18/cx18-driver.c 
b/drivers/media/pci/cx18/cx18-driver.c
index b267590e0877..49fc9b72ada5 100644
--- a/drivers/media/pci/cx18/cx18-driver.c
+++ b/drivers/media/pci/cx18/cx18-driver.c
@@ -909,5 +909,5 @@ static int cx18_probe(struct pci_dev *pci_dev,
return -ENOMEM;
}
 
-   cx = kzalloc(sizeof(struct cx18), GFP_ATOMIC);
+   cx = kzalloc(sizeof(*cx), GFP_ATOMIC);
if (!cx)
-- 
2.14.1



[PATCH 1/3] [media] cx18: Delete an error message for a failed memory allocation in cx18_probe()

2017-09-02 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sat, 2 Sep 2017 19:39:56 +0200

Omit an extra message for a memory allocation failure in this function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring 
---
 drivers/media/pci/cx18/cx18-driver.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/media/pci/cx18/cx18-driver.c 
b/drivers/media/pci/cx18/cx18-driver.c
index 8bce49cdad46..b267590e0877 100644
--- a/drivers/media/pci/cx18/cx18-driver.c
+++ b/drivers/media/pci/cx18/cx18-driver.c
@@ -913,8 +913,6 @@ static int cx18_probe(struct pci_dev *pci_dev,
-   if (cx == NULL) {
-   printk(KERN_ERR "cx18: cannot manage card %d, out of memory\n",
-  i);
+   if (!cx)
return -ENOMEM;
-   }
+
cx->pci_dev = pci_dev;
cx->instance = i;
 
-- 
2.14.1



[PATCH 0/3] [media] cx18: Adjustments for seven function implementations

2017-09-02 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sat, 2 Sep 2017 20:03:45 +0200

Three update suggestions were taken into account
from static source code analysis.

Markus Elfring (3):
  Delete an error message for a failed memory allocation
  Improve a size determination
  Adjust ten checks for null pointers

 drivers/media/pci/cx18/cx18-driver.c | 28 +---
 1 file changed, 13 insertions(+), 15 deletions(-)

-- 
2.14.1



[PATCH 7/7] [media] ov9740: Improve a size determination in ov9740_probe()

2017-09-02 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sat, 2 Sep 2017 16:46:03 +0200

Replace the specification of a data structure by a pointer dereference
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring 
---
 drivers/media/i2c/soc_camera/ov9740.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/i2c/soc_camera/ov9740.c 
b/drivers/media/i2c/soc_camera/ov9740.c
index f44f5da795f9..755de2289c39 100644
--- a/drivers/media/i2c/soc_camera/ov9740.c
+++ b/drivers/media/i2c/soc_camera/ov9740.c
@@ -935,5 +935,5 @@ static int ov9740_probe(struct i2c_client *client,
return -EINVAL;
}
 
-   priv = devm_kzalloc(>dev, sizeof(struct ov9740_priv), 
GFP_KERNEL);
+   priv = devm_kzalloc(>dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
-- 
2.14.1



[PATCH 6/7] [media] ov9740: Delete an error message for a failed memory allocation in ov9740_probe()

2017-09-02 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sat, 2 Sep 2017 16:44:36 +0200

Omit an extra message for a memory allocation failure in this function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring 
---
 drivers/media/i2c/soc_camera/ov9740.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/media/i2c/soc_camera/ov9740.c 
b/drivers/media/i2c/soc_camera/ov9740.c
index cc07b7ae5407..f44f5da795f9 100644
--- a/drivers/media/i2c/soc_camera/ov9740.c
+++ b/drivers/media/i2c/soc_camera/ov9740.c
@@ -939,7 +939,5 @@ static int ov9740_probe(struct i2c_client *client,
-   if (!priv) {
-   dev_err(>dev, "Failed to allocate private data!\n");
+   if (!priv)
return -ENOMEM;
-   }
 
v4l2_i2c_subdev_init(>subdev, client, _subdev_ops);
v4l2_ctrl_handler_init(>hdl, 13);
-- 
2.14.1



[PATCH 5/7] [media] ov9640: Improve a size determination in ov9640_probe()

2017-09-02 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sat, 2 Sep 2017 16:37:03 +0200

Replace the specification of a data structure by a pointer dereference
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring 
---
 drivers/media/i2c/soc_camera/ov9640.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/i2c/soc_camera/ov9640.c 
b/drivers/media/i2c/soc_camera/ov9640.c
index 0f02f022f3e9..67578f194928 100644
--- a/drivers/media/i2c/soc_camera/ov9640.c
+++ b/drivers/media/i2c/soc_camera/ov9640.c
@@ -675,5 +675,5 @@ static int ov9640_probe(struct i2c_client *client,
return -EINVAL;
}
 
-   priv = devm_kzalloc(>dev, sizeof(struct ov9640_priv), 
GFP_KERNEL);
+   priv = devm_kzalloc(>dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
-- 
2.14.1



[PATCH 4/7] [media] ov9640: Delete an error message for a failed memory allocation in ov9640_probe()

2017-09-02 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sat, 2 Sep 2017 16:34:27 +0200

Omit an extra message for a memory allocation failure in this function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring 
---
 drivers/media/i2c/soc_camera/ov9640.c | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/media/i2c/soc_camera/ov9640.c 
b/drivers/media/i2c/soc_camera/ov9640.c
index 0146d1f7aacb..0f02f022f3e9 100644
--- a/drivers/media/i2c/soc_camera/ov9640.c
+++ b/drivers/media/i2c/soc_camera/ov9640.c
@@ -679,8 +679,5 @@ static int ov9640_probe(struct i2c_client *client,
-   if (!priv) {
-   dev_err(>dev,
-   "Failed to allocate memory for private data!\n");
+   if (!priv)
return -ENOMEM;
-   }
 
v4l2_i2c_subdev_init(>subdev, client, _subdev_ops);
 
-- 
2.14.1



[PATCH 3/7] [media] ov6650: Delete an error message for a failed memory allocation in ov6650_probe()

2017-09-02 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sat, 2 Sep 2017 16:16:39 +0200

Omit an extra message for a memory allocation failure in this function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring 
---
 drivers/media/i2c/ov6650.c | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/media/i2c/ov6650.c b/drivers/media/i2c/ov6650.c
index 768f2950ea36..8975d16b2b24 100644
--- a/drivers/media/i2c/ov6650.c
+++ b/drivers/media/i2c/ov6650.c
@@ -954,8 +954,5 @@ static int ov6650_probe(struct i2c_client *client,
-   if (!priv) {
-   dev_err(>dev,
-   "Failed to allocate memory for private data!\n");
+   if (!priv)
return -ENOMEM;
-   }
 
v4l2_i2c_subdev_init(>subdev, client, _subdev_ops);
v4l2_ctrl_handler_init(>hdl, 13);
-- 
2.14.1



[PATCH 2/7] [media] ov2640: Improve a size determination in ov2640_probe()

2017-09-02 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sat, 2 Sep 2017 16:09:35 +0200

Replace the specification of a data structure by a pointer dereference
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring 
---
 drivers/media/i2c/ov2640.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/i2c/ov2640.c b/drivers/media/i2c/ov2640.c
index e4ae53410097..456aa977bce8 100644
--- a/drivers/media/i2c/ov2640.c
+++ b/drivers/media/i2c/ov2640.c
@@ -1097,5 +1097,5 @@ static int ov2640_probe(struct i2c_client *client,
return -EIO;
}
 
-   priv = devm_kzalloc(>dev, sizeof(struct ov2640_priv), 
GFP_KERNEL);
+   priv = devm_kzalloc(>dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
-- 
2.14.1



[PATCH 1/7] [media] ov2640: Delete an error message for a failed memory allocation in ov2640_probe()

2017-09-02 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sat, 2 Sep 2017 16:07:31 +0200

Omit an extra message for a memory allocation failure in this function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring 
---
 drivers/media/i2c/ov2640.c | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/media/i2c/ov2640.c b/drivers/media/i2c/ov2640.c
index e6d0c1f64f0b..e4ae53410097 100644
--- a/drivers/media/i2c/ov2640.c
+++ b/drivers/media/i2c/ov2640.c
@@ -1101,8 +1101,5 @@ static int ov2640_probe(struct i2c_client *client,
-   if (!priv) {
-   dev_err(>dev,
-   "Failed to allocate memory for private data!\n");
+   if (!priv)
return -ENOMEM;
-   }
 
if (client->dev.of_node) {
priv->clk = devm_clk_get(>dev, "xvclk");
-- 
2.14.1



[PATCH 0/7] [media] OmniVision: Adjustments for four function implementations

2017-09-02 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sat, 2 Sep 2017 17:01:23 +0200

A few update suggestions were taken into account
from static source code analysis.

Markus Elfring (7):
  Delete an error message for a failed memory allocation in ov2640_probe()
  Improve a size determination in ov2640_probe()
  Delete an error message for a failed memory allocation in ov6650_probe()
  Delete an error message for a failed memory allocation in ov9640_probe()
  Improve a size determination in ov9640_probe()
  Delete an error message for a failed memory allocation in ov9740_probe()
  Improve a size determination in ov9740_probe()

 drivers/media/i2c/ov2640.c| 7 ++-
 drivers/media/i2c/ov6650.c| 5 +
 drivers/media/i2c/soc_camera/ov9640.c | 7 ++-
 drivers/media/i2c/soc_camera/ov9740.c | 6 ++
 4 files changed, 7 insertions(+), 18 deletions(-)

-- 
2.14.1



Re: [PATCH v4l-utils] configure.ac: drop --disable-libv4l, disable plugin support instead

2017-09-02 Thread Thomas Petazzoni
Hello,

On Wed, 23 Aug 2017 13:06:13 +0200, Hans Verkuil wrote:
> On 08/21/17 23:02, Thomas Petazzoni wrote:
> > In commit 2e604dfbcd09b93f0808cedb2a0b324c5569a599 ("configure.ac: add
> > --disable-libv4l option"), an option --disable-libv4l was added. As
> > part of this, libv4l is no longer built at all in static linking
> > configurations, just because libv4l uses dlopen() for plugin support.
> > 
> > However, plugin support is only a side feature of libv4l, and one may
> > need to use libv4l in static configurations, just without plugin
> > support.
> > 
> > Therefore, this commit:
> > 
> >  - Essentially reverts 2e604dfbcd09b93f0808cedb2a0b324c5569a599, so
> >that libv4l can be built in static linking configurations again.
> > 
> >  - Adjusts the compilation of libv4l2 so that the plugin support is
> >not compiled in when dlopen() in static linking configuration
> >(dlopen is not available).
> > 
> > Signed-off-by: Thomas Petazzoni 
> > ---
> > NOTE: this was only build-time tested, not runtime tested.  
> 
> Hugues, can you test this to make sure this still does what you need?
> 
> It looks good to me, but I'd like to make sure it works for you as well
> before committing this.

Thanks for your feedback. Unfortunately, Hugues has not answered. What
can we do ?

Thanks,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com


[PATCH 4/4] [media] adv7842: Improve a size determination in adv7842_probe()

2017-09-02 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sat, 2 Sep 2017 12:53:15 +0200

Replace the specification of a data structure by a pointer dereference
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring 
---
 drivers/media/i2c/adv7842.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/i2c/adv7842.c b/drivers/media/i2c/adv7842.c
index 366a294edd7b..aa8b3bcdd750 100644
--- a/drivers/media/i2c/adv7842.c
+++ b/drivers/media/i2c/adv7842.c
@@ -3467,5 +3467,5 @@ static int adv7842_probe(struct i2c_client *client,
return -ENODEV;
}
 
-   state = devm_kzalloc(>dev, sizeof(struct adv7842_state), 
GFP_KERNEL);
+   state = devm_kzalloc(>dev, sizeof(*state), GFP_KERNEL);
if (!state)
-- 
2.14.1



[PATCH 3/4] [media] adv7842: Delete an error message for a failed memory allocation in adv7842_probe()

2017-09-02 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sat, 2 Sep 2017 12:50:19 +0200

Omit an extra message for a memory allocation failure in this function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring 
---
 drivers/media/i2c/adv7842.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/media/i2c/adv7842.c b/drivers/media/i2c/adv7842.c
index 303effda1a2e..366a294edd7b 100644
--- a/drivers/media/i2c/adv7842.c
+++ b/drivers/media/i2c/adv7842.c
@@ -3471,7 +3471,5 @@ static int adv7842_probe(struct i2c_client *client,
-   if (!state) {
-   v4l_err(client, "Could not allocate adv7842_state memory!\n");
+   if (!state)
return -ENOMEM;
-   }
 
/* platform data */
state->pdata = *pdata;
-- 
2.14.1



[PATCH 2/4] [media] adv7604: Adjust a null pointer check in three functions

2017-09-02 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sat, 2 Sep 2017 11:43:00 +0200
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The script “checkpatch.pl” pointed information out like the following.

Comparison to NULL could be written !…

Thus fix the affected source code places.

Signed-off-by: Markus Elfring 
---
 drivers/media/i2c/adv7604.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index cc693ef71f33..0a774d025858 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -1948,7 +1948,7 @@ static int adv76xx_set_format(struct v4l2_subdev *sd,
return -EINVAL;
 
info = adv76xx_format_info(state, format->format.code);
-   if (info == NULL)
+   if (!info)
info = adv76xx_format_info(state, MEDIA_BUS_FMT_YUYV8_2X8);
 
adv76xx_fill_format(state, >format);
@@ -2256,7 +2256,7 @@ static int adv76xx_get_edid(struct v4l2_subdev *sd, 
struct v4l2_edid *edid)
return 0;
}
 
-   if (data == NULL)
+   if (!data)
return -ENODATA;
 
if (edid->start_block >= state->edid.blocks)
@@ -3480,7 +3480,7 @@ static int adv76xx_probe(struct i2c_client *client,
state->i2c_clients[i] =
adv76xx_dummy_client(sd, state->pdata.i2c_addresses[i],
 0xf2 + i);
-   if (state->i2c_clients[i] == NULL) {
+   if (!state->i2c_clients[i]) {
err = -ENOMEM;
v4l2_err(sd, "failed to create i2c client %u\n", i);
goto err_i2c;
-- 
2.14.1



[PATCH 1/4] [media] adv7604: Delete an error message for a failed memory allocation in adv76xx_probe()

2017-09-02 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sat, 2 Sep 2017 11:28:55 +0200

Omit an extra message for a memory allocation failure in this function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring 
---
 drivers/media/i2c/adv7604.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 660bacb8f7d9..cc693ef71f33 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -3319,7 +3319,5 @@ static int adv76xx_probe(struct i2c_client *client,
-   if (!state) {
-   v4l_err(client, "Could not allocate adv76xx_state memory!\n");
+   if (!state)
return -ENOMEM;
-   }
 
state->i2c_clients[ADV76XX_PAGE_IO] = client;
 
-- 
2.14.1



[PATCH 0/4] [media] ADV7...: Adjustments for four function implementations

2017-09-02 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sat, 2 Sep 2017 14:49:43 +0200

A few update suggestions were taken into account
from static source code analysis.

Markus Elfring (4):
  Delete an error message for a failed memory allocation in adv76xx_probe()
  Adjust a null pointer check in three functions
  Delete an error message for a failed memory allocation in adv7842_probe()
  Improve a size determination in adv7842_probe()

 drivers/media/i2c/adv7604.c | 10 --
 drivers/media/i2c/adv7842.c |  6 ++
 2 files changed, 6 insertions(+), 10 deletions(-)

-- 
2.14.1



[PATCH 4/7] media: rc: ensure that protocols are enabled for scancode drivers

2017-09-02 Thread Sean Young
rc scancode drivers without change_protocol should have all
protocols enabled at all time. This was only true for cec and
ir-kbd-i2c.

Signed-off-by: Sean Young 
---
 drivers/media/cec/cec-core.c   | 1 -
 drivers/media/i2c/ir-kbd-i2c.c | 1 -
 drivers/media/rc/rc-main.c | 3 +++
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/media/cec/cec-core.c b/drivers/media/cec/cec-core.c
index 648136e552d5..dc7fd6f80bc0 100644
--- a/drivers/media/cec/cec-core.c
+++ b/drivers/media/cec/cec-core.c
@@ -277,7 +277,6 @@ struct cec_adapter *cec_allocate_adapter(const struct 
cec_adap_ops *ops,
adap->rc->input_id.version = 1;
adap->rc->driver_name = CEC_NAME;
adap->rc->allowed_protocols = RC_PROTO_BIT_CEC;
-   adap->rc->enabled_protocols = RC_PROTO_BIT_CEC;
adap->rc->priv = adap;
adap->rc->map_name = RC_MAP_CEC;
adap->rc->timeout = MS_TO_NS(100);
diff --git a/drivers/media/i2c/ir-kbd-i2c.c b/drivers/media/i2c/ir-kbd-i2c.c
index a374e2a0ac3d..8b5f7d0435e4 100644
--- a/drivers/media/i2c/ir-kbd-i2c.c
+++ b/drivers/media/i2c/ir-kbd-i2c.c
@@ -460,7 +460,6 @@ static int ir_probe(struct i2c_client *client, const struct 
i2c_device_id *id)
 */
rc->map_name   = ir->ir_codes;
rc->allowed_protocols = rc_proto;
-   rc->enabled_protocols = rc_proto;
if (!rc->driver_name)
rc->driver_name = MODULE_NAME;
 
diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c
index 981cccd6b988..8781055ee058 100644
--- a/drivers/media/rc/rc-main.c
+++ b/drivers/media/rc/rc-main.c
@@ -1638,6 +1638,9 @@ static int rc_prepare_rx_device(struct rc_dev *dev)
 
rc_proto = BIT_ULL(rc_map->rc_proto);
 
+   if (dev->driver_type == RC_DRIVER_SCANCODE && !dev->change_protocol)
+   dev->enabled_protocols = dev->allowed_protocols;
+
if (dev->change_protocol) {
rc = dev->change_protocol(dev, _proto);
if (rc < 0)
-- 
2.13.5



[PATCH 2/2] keytable: if the protocols cannot be changed, don't try

2017-09-02 Thread Sean Young
Note that if an invalid protocol was selected, we already get the error
"Invalid protocols selected".

Signed-off-by: Sean Young 
---
 utils/keytable/keytable.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/utils/keytable/keytable.c b/utils/keytable/keytable.c
index 7b0d1acb..1fd545b0 100644
--- a/utils/keytable/keytable.c
+++ b/utils/keytable/keytable.c
@@ -23,6 +23,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -991,10 +992,14 @@ static int v2_set_protocols(struct rc_device *rc_dev)
 {
FILE *fp;
char name[4096];
+   struct stat st;
 
strcpy(name, rc_dev->sysfs_name);
strcat(name, "/protocols");
 
+   if (!stat(name, ) && !(st.st_mode & 0222))
+   return 0;
+
fp = fopen(name, "w");
if (!fp) {
perror(name);
-- 
2.13.5



[PATCH 1/2] keytable: use DEV_NAME if available

2017-09-02 Thread Sean Young
The result from EVIOCGNAME can be truncated.

Signed-off-by: Sean Young 
---
 utils/keytable/keytable.c | 22 +++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/utils/keytable/keytable.c b/utils/keytable/keytable.c
index 5d12ec31..7b0d1acb 100644
--- a/utils/keytable/keytable.c
+++ b/utils/keytable/keytable.c
@@ -271,6 +271,7 @@ struct rc_device {
char *sysfs_name;   /* Device sysfs node name */
char *input_name;   /* Input device file name */
char *drv_name; /* Kernel driver that implements it */
+   char *dev_name; /* Kernel device name */
char *keytable_name;/* Keycode table name */
 
enum sysfs_ver version; /* sysfs version */
@@ -1076,6 +1077,10 @@ static int get_attribs(struct rc_device *rc_dev, char 
*sysfs_name)
rc_dev->drv_name = malloc(strlen(uevent->value) + 1);
strcpy(rc_dev->drv_name, uevent->value);
}
+   if (!strcmp(uevent->key, "DEV_NAME")) {
+   rc_dev->dev_name = malloc(strlen(uevent->value) + 1);
+   strcpy(rc_dev->dev_name, uevent->value);
+   }
if (!strcmp(uevent->key, "NAME")) {
rc_dev->keytable_name = malloc(strlen(uevent->value) + 
1);
strcpy(rc_dev->keytable_name, uevent->value);
@@ -1416,9 +1421,8 @@ static void show_evdev_attribs(int fd)
get_rate(fd, , );
 }
 
-static void device_info(int fd, char *prepend)
+static void device_name(int fd, char *prepend)
 {
-   struct input_id id;
char buf[32];
int rc;
 
@@ -1427,6 +1431,12 @@ static void device_info(int fd, char *prepend)
fprintf(stderr,_("%sName: %.*s\n"),prepend, rc, buf);
else
perror ("EVIOCGNAME");
+}
+
+static void device_info(int fd, char *prepend)
+{
+   struct input_id id;
+   int rc;
 
rc = ioctl(fd, EVIOCGID, );
if (rc >= 0)
@@ -1452,7 +1462,10 @@ static int show_sysfs_attribs(struct rc_device *rc_dev, 
char *name)
fprintf(stderr, _("Found %s (%s) with:\n"),
rc_dev->sysfs_name,
rc_dev->input_name);
-   fprintf(stderr, _("\tDriver %s, table %s\n"),
+   if (rc_dev->dev_name)
+   fprintf(stderr, _("\tName: %s\n"),
+   rc_dev->dev_name);
+   fprintf(stderr, _("\tDriver: %s, table: %s\n"),
rc_dev->drv_name,
rc_dev->keytable_name);
fprintf(stderr, _("\tSupported protocols: "));
@@ -1461,6 +1474,8 @@ static int show_sysfs_attribs(struct rc_device *rc_dev, 
char *name)
display_proto(rc_dev);
fd = open(rc_dev->input_name, O_RDONLY);
if (fd > 0) {
+   if (!rc_dev->dev_name)
+   device_name(fd, "\t");
device_info(fd, "\t");
show_evdev_attribs(fd);
close(fd);
@@ -1495,6 +1510,7 @@ int main(int argc, char *argv[])
perror(_("Can't open device"));
return -1;
}
+   device_name(fd, "");
device_info(fd, "");
close(fd);
return 0;
-- 
2.13.5



[PATCH 1/7] media: dvb: i2c transfers over usb cannot be done from stack

2017-09-02 Thread Sean Young
Since commit 29d2fef8be11 ("usb: catch attempts to submit urbs
with a vmalloc'd transfer buffer"), the AverMedia AverTV DVB-T
USB 2.0 (a800) fails to probe.

Cc: sta...@vger.kernel.org
Signed-off-by: Sean Young 
---
 drivers/media/dvb-frontends/dib3000mc.c | 50 ++--
 drivers/media/dvb-frontends/dvb-pll.c   | 21 +---
 drivers/media/tuners/mt2060.c   | 59 ++---
 3 files changed, 102 insertions(+), 28 deletions(-)

diff --git a/drivers/media/dvb-frontends/dib3000mc.c 
b/drivers/media/dvb-frontends/dib3000mc.c
index 224283fe100a..31ade5512a36 100644
--- a/drivers/media/dvb-frontends/dib3000mc.c
+++ b/drivers/media/dvb-frontends/dib3000mc.c
@@ -55,29 +55,57 @@ struct dib3000mc_state {
 
 static u16 dib3000mc_read_word(struct dib3000mc_state *state, u16 reg)
 {
-   u8 wb[2] = { (reg >> 8) | 0x80, reg & 0xff };
-   u8 rb[2];
struct i2c_msg msg[2] = {
-   { .addr = state->i2c_addr >> 1, .flags = 0,.buf = wb, 
.len = 2 },
-   { .addr = state->i2c_addr >> 1, .flags = I2C_M_RD, .buf = rb, 
.len = 2 },
+   { .addr = state->i2c_addr >> 1, .flags = 0,.len = 2 },
+   { .addr = state->i2c_addr >> 1, .flags = I2C_M_RD, .len = 2 },
};
+   u16 word;
+   u8 *b;
+
+   b = kmalloc(4, GFP_KERNEL);
+   if (!b)
+   return 0;
+
+   b[0] = (reg >> 8) | 0x80;
+   b[1] = reg;
+   b[2] = 0;
+   b[3] = 0;
+
+   msg[0].buf = b;
+   msg[1].buf = b + 2;
 
if (i2c_transfer(state->i2c_adap, msg, 2) != 2)
dprintk("i2c read error on %d\n",reg);
 
-   return (rb[0] << 8) | rb[1];
+   word = b[2] << 8 | b[3];
+   kfree(b);
+
+   return word;
 }
 
 static int dib3000mc_write_word(struct dib3000mc_state *state, u16 reg, u16 
val)
 {
-   u8 b[4] = {
-   (reg >> 8) & 0xff, reg & 0xff,
-   (val >> 8) & 0xff, val & 0xff,
-   };
struct i2c_msg msg = {
-   .addr = state->i2c_addr >> 1, .flags = 0, .buf = b, .len = 4
+   .addr = state->i2c_addr >> 1, .flags = 0, .len = 4
};
-   return i2c_transfer(state->i2c_adap, , 1) != 1 ? -EREMOTEIO : 0;
+   int rc;
+   u8 *b;
+
+   b = kmalloc(4, GFP_KERNEL);
+   if (!b)
+   return -ENOMEM;
+
+   b[0] = reg >> 8;
+   b[1] = reg;
+   b[2] = val >> 8;
+   b[3] = val;
+
+   msg.buf = b;
+
+   rc = i2c_transfer(state->i2c_adap, , 1) != 1 ? -EREMOTEIO : 0;
+   kfree(b);
+
+   return rc;
 }
 
 static int dib3000mc_identify(struct dib3000mc_state *state)
diff --git a/drivers/media/dvb-frontends/dvb-pll.c 
b/drivers/media/dvb-frontends/dvb-pll.c
index 7bec3e028bee..453c4f2a9012 100644
--- a/drivers/media/dvb-frontends/dvb-pll.c
+++ b/drivers/media/dvb-frontends/dvb-pll.c
@@ -753,13 +753,18 @@ struct dvb_frontend *dvb_pll_attach(struct dvb_frontend 
*fe, int pll_addr,
struct i2c_adapter *i2c,
unsigned int pll_desc_id)
 {
-   u8 b1 [] = { 0 };
-   struct i2c_msg msg = { .addr = pll_addr, .flags = I2C_M_RD,
-  .buf = b1, .len = 1 };
+   u8 *b1;
+   struct i2c_msg msg = { .addr = pll_addr, .flags = I2C_M_RD, .len = 1 };
struct dvb_pll_priv *priv = NULL;
int ret;
const struct dvb_pll_desc *desc;
 
+   b1 = kmalloc(1, GFP_KERNEL);
+   if (!b1)
+   return NULL;
+
+   msg.buf = b1;
+
if ((id[dvb_pll_devcount] > DVB_PLL_UNDEFINED) &&
(id[dvb_pll_devcount] < ARRAY_SIZE(pll_list)))
pll_desc_id = id[dvb_pll_devcount];
@@ -773,15 +778,19 @@ struct dvb_frontend *dvb_pll_attach(struct dvb_frontend 
*fe, int pll_addr,
fe->ops.i2c_gate_ctrl(fe, 1);
 
ret = i2c_transfer (i2c, , 1);
-   if (ret != 1)
+   if (ret != 1) {
+   kfree(b1);
return NULL;
+   }
if (fe->ops.i2c_gate_ctrl)
 fe->ops.i2c_gate_ctrl(fe, 0);
}
 
priv = kzalloc(sizeof(struct dvb_pll_priv), GFP_KERNEL);
-   if (priv == NULL)
+   if (!priv) {
+   kfree(b1);
return NULL;
+   }
 
priv->pll_i2c_address = pll_addr;
priv->i2c = i2c;
@@ -811,6 +820,8 @@ struct dvb_frontend *dvb_pll_attach(struct dvb_frontend 
*fe, int pll_addr,
"insmod option" : "autodetected");
}
 
+   kfree(b1);
+
return fe;
 }
 EXPORT_SYMBOL(dvb_pll_attach);
diff --git a/drivers/media/tuners/mt2060.c b/drivers/media/tuners/mt2060.c
index 2e487f9a2cc3..4983eeb39f36 100644
--- a/drivers/media/tuners/mt2060.c
+++ b/drivers/media/tuners/mt2060.c
@@ -38,41 +38,74 @@ MODULE_PARM_DESC(debug, "Turn on/off debugging 
(default:off).");
 static int 

[PATCH 7/7] media: rc: include device name in rc udev event

2017-09-02 Thread Sean Young
This name is also stored in the input's device name, but that
is not available in TX only hardware (no input device).

Signed-off-by: Sean Young 
---
 drivers/media/rc/rc-main.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c
index cf0c407d8f5b..9d9bdd1dec78 100644
--- a/drivers/media/rc/rc-main.c
+++ b/drivers/media/rc/rc-main.c
@@ -1480,6 +1480,8 @@ static int rc_dev_uevent(struct device *device, struct 
kobj_uevent_env *env)
ADD_HOTPLUG_VAR("NAME=%s", dev->rc_map.name);
if (dev->driver_name)
ADD_HOTPLUG_VAR("DRV_NAME=%s", dev->driver_name);
+   if (dev->device_name)
+   ADD_HOTPLUG_VAR("DEV_NAME=%s", dev->device_name);
 
return 0;
 }
-- 
2.13.5



[PATCH 6/7] media: rc: if protocols can't be changed, don't be writable

2017-09-02 Thread Sean Young
If the protocols of an rc device cannot be changed, ensure the sysfs
file is not writable.

This makes it possible to detect this from userspace, so ir-keytable
can deal with case without giving an error.

Signed-off-by: Sean Young 
---
 drivers/media/rc/rc-main.c | 28 +---
 1 file changed, 21 insertions(+), 7 deletions(-)

diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c
index 8781055ee058..cf0c407d8f5b 100644
--- a/drivers/media/rc/rc-main.c
+++ b/drivers/media/rc/rc-main.c
@@ -1487,7 +1487,10 @@ static int rc_dev_uevent(struct device *device, struct 
kobj_uevent_env *env)
 /*
  * Static device attribute struct with the sysfs attributes for IR's
  */
-static DEVICE_ATTR(protocols, 0644, show_protocols, store_protocols);
+static struct device_attribute dev_attr_ro_protocols =
+__ATTR(protocols, 0444, show_protocols, store_protocols);
+static struct device_attribute dev_attr_rw_protocols =
+__ATTR(protocols, 0644, show_protocols, NULL);
 static DEVICE_ATTR(wakeup_protocols, 0644, show_wakeup_protocols,
   store_wakeup_protocols);
 static RC_FILTER_ATTR(filter, S_IRUGO|S_IWUSR,
@@ -1499,13 +1502,22 @@ static RC_FILTER_ATTR(wakeup_filter, S_IRUGO|S_IWUSR,
 static RC_FILTER_ATTR(wakeup_filter_mask, S_IRUGO|S_IWUSR,
  show_filter, store_filter, RC_FILTER_WAKEUP, true);
 
-static struct attribute *rc_dev_protocol_attrs[] = {
-   _attr_protocols.attr,
+static struct attribute *rc_dev_rw_protocol_attrs[] = {
+   _attr_rw_protocols.attr,
NULL,
 };
 
-static const struct attribute_group rc_dev_protocol_attr_grp = {
-   .attrs  = rc_dev_protocol_attrs,
+static const struct attribute_group rc_dev_rw_protocol_attr_grp = {
+   .attrs  = rc_dev_rw_protocol_attrs,
+};
+
+static struct attribute *rc_dev_ro_protocol_attrs[] = {
+   _attr_ro_protocols.attr,
+   NULL,
+};
+
+static const struct attribute_group rc_dev_ro_protocol_attr_grp = {
+   .attrs  = rc_dev_ro_protocol_attrs,
 };
 
 static struct attribute *rc_dev_filter_attrs[] = {
@@ -1732,8 +1744,10 @@ int rc_register_device(struct rc_dev *dev)
dev_set_drvdata(>dev, dev);
 
dev->dev.groups = dev->sysfs_groups;
-   if (dev->driver_type != RC_DRIVER_IR_RAW_TX)
-   dev->sysfs_groups[attr++] = _dev_protocol_attr_grp;
+   if (dev->driver_type == RC_DRIVER_SCANCODE && !dev->change_protocol)
+   dev->sysfs_groups[attr++] = _dev_ro_protocol_attr_grp;
+   else if (dev->driver_type != RC_DRIVER_IR_RAW_TX)
+   dev->sysfs_groups[attr++] = _dev_rw_protocol_attr_grp;
if (dev->s_filter)
dev->sysfs_groups[attr++] = _dev_filter_attr_grp;
if (dev->s_wakeup_filter)
-- 
2.13.5



[PATCH 5/7] media: rc: dvb: use dvb device name for rc device

2017-09-02 Thread Sean Young
"IR-receiver inside an USB DVB receiver" is not descriptive and we have
a proper name available.

Signed-off-by: Sean Young 
---
 drivers/media/usb/dvb-usb/dvb-usb-remote.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/usb/dvb-usb/dvb-usb-remote.c 
b/drivers/media/usb/dvb-usb/dvb-usb-remote.c
index 0b03f9bd9c26..b027d378102a 100644
--- a/drivers/media/usb/dvb-usb/dvb-usb-remote.c
+++ b/drivers/media/usb/dvb-usb/dvb-usb-remote.c
@@ -279,7 +279,7 @@ static int rc_core_dvb_usb_remote_init(struct 
dvb_usb_device *d)
dev->change_protocol = d->props.rc.core.change_protocol;
dev->allowed_protocols = d->props.rc.core.allowed_protos;
usb_to_input_id(d->udev, >input_id);
-   dev->device_name = "IR-receiver inside an USB DVB receiver";
+   dev->device_name = d->desc->name;
dev->input_phys = d->rc_phys;
dev->dev.parent = >udev->dev;
dev->priv = d;
-- 
2.13.5



[PATCH 2/7] media: dvb: a800: port to rc-core

2017-09-02 Thread Sean Young
This receiver only accepts nec16 messages, I've tried many other protocols
and they're all dropped.

Signed-off-by: Sean Young 
---
 drivers/media/usb/dvb-usb/a800.c | 65 +---
 1 file changed, 14 insertions(+), 51 deletions(-)

diff --git a/drivers/media/usb/dvb-usb/a800.c b/drivers/media/usb/dvb-usb/a800.c
index 7ba975bea96a..540886b3bb29 100644
--- a/drivers/media/usb/dvb-usb/a800.c
+++ b/drivers/media/usb/dvb-usb/a800.c
@@ -37,48 +37,9 @@ static int a800_identify_state(struct usb_device *udev, 
struct dvb_usb_device_pr
return 0;
 }
 
-static struct rc_map_table rc_map_a800_table[] = {
-   { 0x0201, KEY_MODE },  /* SOURCE */
-   { 0x0200, KEY_POWER2 },  /* POWER */
-   { 0x0205, KEY_1 },   /* 1 */
-   { 0x0206, KEY_2 },   /* 2 */
-   { 0x0207, KEY_3 },   /* 3 */
-   { 0x0209, KEY_4 },   /* 4 */
-   { 0x020a, KEY_5 },   /* 5 */
-   { 0x020b, KEY_6 },   /* 6 */
-   { 0x020d, KEY_7 },   /* 7 */
-   { 0x020e, KEY_8 },   /* 8 */
-   { 0x020f, KEY_9 },   /* 9 */
-   { 0x0212, KEY_LEFT },/* L / DISPLAY */
-   { 0x0211, KEY_0 },   /* 0 */
-   { 0x0213, KEY_RIGHT },   /* R / CH RTN */
-   { 0x0217, KEY_CAMERA },  /* SNAP SHOT */
-   { 0x0210, KEY_LAST },/* 16-CH PREV */
-   { 0x021e, KEY_VOLUMEDOWN },  /* VOL DOWN */
-   { 0x020c, KEY_ZOOM },/* FULL SCREEN */
-   { 0x021f, KEY_VOLUMEUP },/* VOL UP */
-   { 0x0214, KEY_MUTE },/* MUTE */
-   { 0x0208, KEY_AUDIO },   /* AUDIO */
-   { 0x0219, KEY_RECORD },  /* RECORD */
-   { 0x0218, KEY_PLAY },/* PLAY */
-   { 0x021b, KEY_STOP },/* STOP */
-   { 0x021a, KEY_PLAYPAUSE },   /* TIMESHIFT / PAUSE */
-   { 0x021d, KEY_BACK },/* << / RED */
-   { 0x021c, KEY_FORWARD }, /* >> / YELLOW */
-   { 0x0203, KEY_TEXT },/* TELETEXT */
-   { 0x0204, KEY_EPG }, /* EPG */
-   { 0x0215, KEY_MENU },/* MENU */
-
-   { 0x0303, KEY_CHANNELUP },   /* CH UP */
-   { 0x0302, KEY_CHANNELDOWN }, /* CH DOWN */
-   { 0x0301, KEY_FIRST },   /* |<< / GREEN */
-   { 0x0300, KEY_LAST },/* >>| / BLUE */
-
-};
-
-static int a800_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
+static int a800_rc_query(struct dvb_usb_device *d)
 {
-   int ret;
+   int ret = 0;
u8 *key = kmalloc(5, GFP_KERNEL);
if (!key)
return -ENOMEM;
@@ -90,11 +51,12 @@ static int a800_rc_query(struct dvb_usb_device *d, u32 
*event, int *state)
goto out;
}
 
-   /* call the universal NEC remote processor, to find out the key's state 
and event */
-   dvb_usb_nec_rc_key_to_event(d,key,event,state);
-   if (key[0] != 0)
-   deb_rc("key: %*ph\n", 5, key);
-   ret = 0;
+   /* Note that extended nec and nec32 are dropped */
+   if (key[0] == 1)
+   rc_keydown(d->rc_dev, RC_PROTO_NEC,
+  RC_SCANCODE_NEC(key[1], key[3]), 0);
+   else if (key[0] == 2)
+   rc_repeat(d->rc_dev);
 out:
kfree(key);
return ret;
@@ -157,11 +119,12 @@ static struct dvb_usb_device_properties a800_properties = 
{
.power_ctrl   = a800_power_ctrl,
.identify_state   = a800_identify_state,
 
-   .rc.legacy = {
-   .rc_interval  = DEFAULT_RC_INTERVAL,
-   .rc_map_table = rc_map_a800_table,
-   .rc_map_size  = ARRAY_SIZE(rc_map_a800_table),
-   .rc_query = a800_rc_query,
+   .rc.core = {
+   .rc_interval= DEFAULT_RC_INTERVAL,
+   .rc_codes   = RC_MAP_AVERMEDIA_M135A,
+   .module_name= KBUILD_MODNAME,
+   .rc_query   = a800_rc_query,
+   .allowed_protos = RC_PROTO_BIT_NEC,
},
 
.i2c_algo = _i2c_algo,
-- 
2.13.5



[PATCH 3/7] media: rc: avermedia keymap for a800

2017-09-02 Thread Sean Young
The keymap is missing one key, and correct another.

Signed-off-by: Sean Young 
---
 drivers/media/rc/keymaps/rc-avermedia-m135a.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/media/rc/keymaps/rc-avermedia-m135a.c 
b/drivers/media/rc/keymaps/rc-avermedia-m135a.c
index 9882e2cde975..6d5a73b7ccec 100644
--- a/drivers/media/rc/keymaps/rc-avermedia-m135a.c
+++ b/drivers/media/rc/keymaps/rc-avermedia-m135a.c
@@ -43,7 +43,8 @@ static struct rc_map_table avermedia_m135a[] = {
{ 0x0213, KEY_RIGHT },  /* -> or L */
{ 0x0212, KEY_LEFT },   /* <- or R */
 
-   { 0x0217, KEY_SLEEP },  /* Capturar Imagem or Snapshot */
+   { 0x0215, KEY_MENU },
+   { 0x0217, KEY_CAMERA }, /* Capturar Imagem or Snapshot */
{ 0x0210, KEY_SHUFFLE },/* Amostra or 16 chan prev */
 
{ 0x0303, KEY_CHANNELUP },
-- 
2.13.5



[PATCH 0/7] a800 dvb rc changes

2017-09-02 Thread Sean Young
Various changes to make the a800 dvb adapter work again and to
improve its ir receiver.

Sean Young (7):
  media: dvb: i2c transfers over usb cannot be done from stack
  media: dvb: a800: port to rc-core
  media: rc: avermedia keymap for a800
  media: rc: ensure that protocols are enabled for scancode drivers
  media: rc: dvb: use dvb device name for rc device
  media: rc: if protocols can't be changed, don't be writable
  media: rc: include device name in rc udev event

 drivers/media/cec/cec-core.c  |  1 -
 drivers/media/dvb-frontends/dib3000mc.c   | 50 -
 drivers/media/dvb-frontends/dvb-pll.c | 21 ++---
 drivers/media/i2c/ir-kbd-i2c.c|  1 -
 drivers/media/rc/keymaps/rc-avermedia-m135a.c |  3 +-
 drivers/media/rc/rc-main.c| 33 +++---
 drivers/media/tuners/mt2060.c | 59 +++-
 drivers/media/usb/dvb-usb/a800.c  | 65 ++-
 drivers/media/usb/dvb-usb/dvb-usb-remote.c|  2 +-
 9 files changed, 145 insertions(+), 90 deletions(-)

-- 
2.13.5



Re: [PATCH V2 0/1] build: gpio-ir-tx for 3.13

2017-09-02 Thread Jasmin J.
Hello Hans!

> I moved gpio-ir-tx to 3.17. Is there a really urgent need to compile
> it for older kernels?
No, 3.17 is fine also.

BR,
   Jasmin


Re: [PATCH v6 5/5] v4l: fwnode: Support generic parsing of graph endpoints in a single port

2017-09-02 Thread Laurent Pinchart
Hi Sakari,

On Saturday, 2 September 2017 01:57:48 EEST Sakari Ailus wrote:
> On Fri, Sep 01, 2017 at 01:28:40PM +0200, Hans Verkuil wrote:
> >> diff --git a/include/media/v4l2-fwnode.h b/include/media/v4l2-fwnode.h
> >> index d063ab4ff67b..dd13604178b4 100644
> >> --- a/include/media/v4l2-fwnode.h
> >> +++ b/include/media/v4l2-fwnode.h
> >> @@ -249,4 +249,53 @@ int v4l2_async_notifier_parse_fwnode_endpoints(
> >>struct v4l2_fwnode_endpoint *vep,
> >>struct v4l2_async_subdev *asd));
> >> 
> >> +/**
> >> + * v4l2_async_notifier_parse_fwnode_endpoint - Set up async notifier
> >> for an
> >> + *   fwnode based sub-device
> >> + * @dev: @struct device pointer
> >> + * @notifier: pointer to  v4l2_async_notifier
> >> + * @port_id: port number
> >> + * @endpoint_id: endpoint number
> >> + * @asd_struct_size: size of the driver's async sub-device struct,
> >> including
> >> + * sizeof(struct v4l2_async_subdev). The 
> >> + * v4l2_async_subdev shall be the first member of
> >> + * the driver's async sub-device struct, i.e. both
> >> + * begin at the same memory address.
> >> + * @parse_single: driver's callback function called on each V4L2 fwnode
> >> endpoint
> >> + *
> >> + * Parse the fwnode endpoint of the @dev device corresponding to the
> >> given port
> >> + * and endpoint numbres and populate the async sub- devices array of
> >> the
> > 
> > numbers
> > no space after sub-
> > 
> > > + * notifier. The @parse_endpoint callback function is called for the
> > > endpoint
> > 
> > parse_single, but (as in the previous patch) I actually prefer
> > parse_endpoint.
> > 
> >> + * with the corresponding async sub-device pointer to let the caller
> >> initialize
> >> + * the driver-specific part of the async sub-device structure.
> >> + *
> >> + * The notifier memory shall be zeroed before this function is called
> >> on the
> >> + * notifier.
> > 
> > Should it? Doesn't this add additional subdevs?
> > 
> > I'm lost. What's the relationship between
> > v4l2_async_notifier_parse_fwnode_endpoints and this function? When do you
> > use which? When you should zero the notifier?
> I thought there would be advantages in this approach as it lets you to
> choose which endpoints specifically you want to parse. That said, the
> expectation is that the device has no endpoints that aren't supported in
> hardware either.
> 
> Some drivers currently iterate over all the endpoints and then validate
> them whereas others poke for some endpoints only (port 0, endpoint 0, for
> the rcar-vin driver, for instance). In DT binding documentation the
> endpoint numbers are currently not specified nor drivers have checked them.
> Common sense tells to use zero if there's no reason to do otherwise, but
> still this hasn't been documented nor validated in the past. So if we add
> that now, there could be a chance of breaking something.
> 
> Additionally, specifying the endpoints to parse explicitly has been seen
> beneficial (or even necessary) in parsing endpoints for devices that have
> both input and output interfaces. Perhaps Niklas can comment on that.
> 
> What I though was to introduce a specific error code (EPERM, better
> suggestions are taken)

Maybe ENOTCONN ?

> for the driver callback function (parse_endpoint) to silently skip endpoints
> the driver doesn't like for reason or another. This lets drivers to use the
> endpoint parser function added by the previous patch and still maintain the
> old behaviour, i.e. ignore endpoints that aren't explicitly recognised by
> the driver.
> 
> I'll drop this patch from the next version.

Parsing a specific endpoint of a specific port is probably indeed a bit too 
fine-grained, but I think there are use cases for parsing at the port level 
instead of parsing all ports.

-- 
Regards,

Laurent Pinchart



Re: [PATCH v6.1 4/5] v4l: fwnode: Support generic parsing of graph endpoints in a device

2017-09-02 Thread Laurent Pinchart
Hi Hans,

On Friday, 1 September 2017 14:18:55 EEST Hans Verkuil wrote:
> On 30/08/17 14:45, Sakari Ailus wrote:
> > The current practice is that drivers iterate over their endpoints and
> > parse each endpoint separately. This is very similar in a number of
> > drivers, implement a generic function for the job. Driver specific matters
> > can be taken into account in the driver specific callback.
> > 
> > Convert the omap3isp as an example.
> 
> It would be much easier to review if the omap3isp conversion was done in a
> separate patch. Ditto for the rcar conversion, and I prefer to have both
> at the end of the patch series, after the core code patches.
> 
> > Signed-off-by: Sakari Ailus 
> > ---
> > since v6:
> > 
> > - Set notifier->subdevs NULL and notifier->num_subdevs 0 in
> > 
> >   v4l2_async_notifier_release().
> >  
> >  drivers/media/platform/omap3isp/isp.c | 115 ++---
> >  drivers/media/platform/omap3isp/isp.h |   5 +-
> >  drivers/media/v4l2-core/v4l2-async.c  |  16 +
> >  drivers/media/v4l2-core/v4l2-fwnode.c | 131 +
> >  include/media/v4l2-async.h|  24 ++-
> >  include/media/v4l2-fwnode.h   |  48 +
> >  6 files changed, 254 insertions(+), 85 deletions(-)

[snip]

> > diff --git a/include/media/v4l2-async.h b/include/media/v4l2-async.h
> > index c69d8c8a66d0..cf13c7311a1c 100644
> > --- a/include/media/v4l2-async.h
> > +++ b/include/media/v4l2-async.h
> > @@ -18,7 +18,6 @@ struct device;
> >  struct device_node;
> >  struct v4l2_device;
> >  struct v4l2_subdev;
> > -struct v4l2_async_notifier;
> > 
> >  /* A random max subdevice number, used to allocate an array on stack */
> >  #define V4L2_MAX_SUBDEVS 128U
> > @@ -50,6 +49,10 @@ enum v4l2_async_match_type {
> >   * @match: union of per-bus type matching data sets
> >   * @list:  used to link struct v4l2_async_subdev objects, waiting to be
> >   * probed, to a notifier->waiting list
> > + *
> > + * When the struct is used as the first member of a driver specific
> 
> Just replace "the first member" by "part"...

I'd say "When the structure is embedded in a driver-specific structure, ...".

> > + * struct, the driver specific struct shall contain the @struct
> > + * v4l2_async_subdev as its first member.
> 
> ...since you mention in the second part that it has to be the first member.
> No need to mention that twice.
> 
> >   */

[snip]

> >  /**
> > + * v4l2_async_notifier_release - release notifier resources
> > + * @notifier: the notifier the resources of which are to be released
> 
> Just say: @notifier: pointer to  v4l2_async_notifier

I asked Sakari to be more explicit. Documenting an argument as "pointer to 
struct foo" is quite pointless, C is a typed language so it's evident from the 
function declaration. What pointer to pass to the function is a much more 
useful piece of information. This specific case is pretty trivial anyway, but 
in other cases, such as the dev pointer passed to the parse function, we need 
more than just documenting the variable type.

> > + *
> > + * Release memory resources related to a notifier, including the async
> 
> s/a/the/
> 
> > + * sub-devices allocated for the purposes of the notifier. The user is
> > + * responsible for releasing the notifier's resources after calling
> > + * @v4l2_async_notifier_parse_fwnode_endpoints.
> > + *
> > + * There is no harm from calling v4l2_async_notifier_release in other
> > + * cases as long as its memory has been zeroed after it has been
> > + * allocated.
> > + */
> > +void v4l2_async_notifier_release(struct v4l2_async_notifier *notifier);

[snip]

-- 
Regards,

Laurent Pinchart



Re: [PATCH v2 14/14] [media] v4l: Document explicit synchronization behaviour

2017-09-02 Thread Hans Verkuil
On 09/01/2017 08:21 PM, Gustavo Padovan wrote:
> Hi Hans,
> 
> 2017-09-01 Hans Verkuil :
> 
>> Hi Gustavo,
>>
>> I think I concentrate on this last patch first. Once I fully understand this
>> I can review the code. Remember, it's been a while for me since I last looked
>> at fences, so forgive me if I ask stupid questions. On the other hand, others
>> with a similar lack of understanding of fences probably have similar 
>> questions,
>> so it is a good indication where the documentation needs improvement :-)
> 
> Please ask as many as you want, those are the best questions. :)
> 
>>
>> On 01/09/17 03:50, Gustavo Padovan wrote:
>>> From: Gustavo Padovan 
>>>
>>> Add section to VIDIOC_QBUF about it
>>>
>>> Signed-off-by: Gustavo Padovan 
>>> ---q
>>>  Documentation/media/uapi/v4l/vidioc-qbuf.rst | 30 
>>> 
>>>  1 file changed, 30 insertions(+)
>>>
>>> diff --git a/Documentation/media/uapi/v4l/vidioc-qbuf.rst 
>>> b/Documentation/media/uapi/v4l/vidioc-qbuf.rst
>>> index 1f3612637200..6bd960d3972b 100644
>>> --- a/Documentation/media/uapi/v4l/vidioc-qbuf.rst
>>> +++ b/Documentation/media/uapi/v4l/vidioc-qbuf.rst
>>> @@ -117,6 +117,36 @@ immediately with an ``EAGAIN`` error code when no 
>>> buffer is available.
>>>  The struct :c:type:`v4l2_buffer` structure is specified in
>>>  :ref:`buffer`.
>>>  
>>> +Explicit Synchronization
>>> +
>>> +
>>> +Explicit Synchronization allows us to control the synchronization of
>>> +shared buffers from userspace by passing fences to the kernel and/or
>>> +receiving them from it. Fences passed to the kernel are named in-fences and
>>> +the kernel should wait them to signal before using the buffer, i.e., 
>>> queueing
>>> +it to the driver. On the other side, the kernel can create out-fences for 
>>> the
>>> +buffers it queues to the drivers, out-fences signal when the driver is
>>> +finished with buffer, that is the buffer is ready.
>>
>> This should add a line explaining that fences are represented by file 
>> descriptors.
> 
> Okay.
> 
>>
>>> +
>>> +The in-fences and out-fences are communicated at the ``VIDIOC_QBUF`` ioctl
>>> +using the ``V4L2_BUF_FLAG_IN_FENCE`` and ``V4L2_BUF_FLAG_OUT_FENCE`` buffer
>>> +flags and the `fence_fd` field. If an in-fence needs to be passed to the 
>>> kernel,
>>> +`fence_fd` should be set to the fence file descriptor number and the
>>> +``V4L2_BUF_FLAG_IN_FENCE`` should be set as well.
>>
>> Is it possible to have both flags at the same time? Or are they mutually 
>> exclusive?
>>
>> If only V4L2_BUF_FLAG_IN_FENCE is set, then what is the value of fence_fd 
>> after
>> the QBUF call? -1?
> 
> Yes, it is -1.
> 
>>
>>> +
>>> +To get a out-fence back from V4L2 the ``V4L2_BUF_FLAG_OUT_FENCE`` flag 
>>> should
>>> +be set and the `fence_fd` field will be returned with the out-fence file
>>> +descriptor related to the next buffer to be queued internally to the V4L2
>>> +driver. That means the out-fence may not be associated with the buffer in 
>>> the
>>> +current ``VIDIOC_QBUF`` ioctl call because the ordering in which videobuf2 
>>> core
>>> +queues the buffers to the drivers can't be guaranteed. To become aware of 
>>> the
>>> +buffer with which the out-fence will be attached the 
>>> ``V4L2_EVENT_BUF_QUEUED``
>>> +should be used. It will trigger an event for every buffer queued to the 
>>> V4L2
>>> +driver.
>>
>> General question: does it even make sense to use an out-fence if you don't 
>> know with
>> what buffer is it associated? I mean, QBUF returns an out fence, but only 
>> some
>> time later are you informed about a buffer being queued. It also looks like 
>> userspace
>> has to keep track of the issued out-fences and the queued buffers and map 
>> them
>> accordingly.
>>
>> If the out-fence cannot be used until you know the buffer as well, then 
>> wouldn't
>> it make more sense if the out-fence and the buffer index are both sent by the
>> event? Of course, in that case the event can only be sent to the owner file 
>> handle
>> of the streaming device node, but that's OK, we have that.
>>
>> Setting the OUT_FENCE flag will just cause this event to be sent whenever 
>> that
>> buffer is queued internally.
>>
>> Sorry if this just shows a complete lack of understanding of fences on my 
>> side,
>> that's perfectly possible.
> 
> Right, I can not think of anything that prevents what you are saying to
> work. I built it this way initially because on my lack of understanding
> of V4L2 (seems we complement each other here :) because I thought we
> needed to keep the QBUF ordering. In the last review you talked me away
> of this misconception but I really didn't took that to the
> implementation.
> 
> If there is no care about ordering, there is no need to receive the
> fence before and we could just do as you say. That makes sense to me.
> We could do it that way but I have one question, maybe a stupid one.