platform/kernel/linux-exynos.git
6 years agomedia: docs: don't show ToC for each part on PDF output
Mauro Carvalho Chehab [Sun, 3 Sep 2017 00:25:36 +0000 (20:25 -0400)]
media: docs: don't show ToC for each part on PDF output

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 <mchehab@s-opensource.com>
6 years agomedia: cec uapi: Adjust table sizes for PDF output
Mauro Carvalho Chehab [Sun, 3 Sep 2017 00:02:42 +0000 (20:02 -0400)]
media: cec uapi: Adjust table sizes for PDF output

Several tables at this media book chapter have issues
when PDF is produced. Adjust them.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: mc uapi: adjust some table sizes for PDF output
Mauro Carvalho Chehab [Sat, 2 Sep 2017 23:29:53 +0000 (19:29 -0400)]
media: mc uapi: adjust some table sizes for PDF output

Some cells are too small to fit the text written to it.

Increase it. No text changes.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: rc-sysfs-nodes.rst: better use literals
Mauro Carvalho Chehab [Sat, 2 Sep 2017 22:59:25 +0000 (18:59 -0400)]
media: rc-sysfs-nodes.rst: better use literals

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 <mchehab@s-opensource.com>
6 years agomedia: docs: fix PDF build with Sphinx 1.4
Mauro Carvalho Chehab [Sat, 2 Sep 2017 21:46:52 +0000 (17:46 -0400)]
media: docs: fix PDF build with Sphinx 1.4

Commit 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.
<to be read again>
                   \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 <mchehab@s-opensource.com>
6 years agomedia: v4l uAPI docs: adjust some tables for PDF output
Mauro Carvalho Chehab [Sat, 2 Sep 2017 20:50:45 +0000 (16:50 -0400)]
media: v4l uAPI docs: adjust some tables for PDF output

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 <mchehab@s-opensource.com>
6 years agomedia: vidioc-g-tuner.rst: Fix table number of cols
Mauro Carvalho Chehab [Sat, 2 Sep 2017 20:48:28 +0000 (16:48 -0400)]
media: vidioc-g-tuner.rst: Fix table number of cols

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 <mchehab@s-opensource.com>
6 years agomedia: vidioc-querycap: use a more realistic value for KERNEL_VERSION
Mauro Carvalho Chehab [Sat, 2 Sep 2017 20:32:15 +0000 (16:32 -0400)]
media: vidioc-querycap: use a more realistic value for KERNEL_VERSION

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 <mchehab@s-opensource.com>
6 years agomedia: v4l uAPI: add descriptions for arguments to all ioctls
Mauro Carvalho Chehab [Sat, 2 Sep 2017 13:54:48 +0000 (09:54 -0400)]
media: v4l uAPI: add descriptions for arguments to all ioctls

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 <mchehab@s-opensource.com>
6 years agomedia: ca.h: document ca_msg and the corresponding ioctls
Mauro Carvalho Chehab [Mon, 4 Sep 2017 12:03:40 +0000 (08:03 -0400)]
media: ca.h: document ca_msg and the corresponding ioctls

Usually, CA messages are sent/received via reading/writing at
the CA device node. However, two drivers (dst_ca and firedtv-ci)
also implement it via ioctls.

Apparently, on both cases, the net result is the same.

Anyway, let's document it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: ca docs: document CA_SET_DESCR ioctl and structs
Mauro Carvalho Chehab [Mon, 4 Sep 2017 00:50:17 +0000 (20:50 -0400)]
media: ca docs: document CA_SET_DESCR ioctl and structs

The av7110 driver uses CA_SET_DESCR to store the descrambler
control words at the CA descrambler slots.

Document it.

Thanks-to: Honza Petrouš <jpetrous@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: net.h: add kernel-doc and use it at Documentation/
Mauro Carvalho Chehab [Fri, 1 Sep 2017 19:45:47 +0000 (15:45 -0400)]
media: net.h: add kernel-doc and use it at Documentation/

As we did with frontend.h, ca.h and dmx.h, move the struct
definition to net.h.

That should help to keep it updated, as more stuff gets
added there.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: frontend.h: Avoid the term DVB when doesn't refer to a delivery system
Mauro Carvalho Chehab [Fri, 1 Sep 2017 19:05:28 +0000 (15:05 -0400)]
media: frontend.h: Avoid the term DVB when doesn't refer to a delivery system

The DVB term can either refer to the subsystem or to a delivery
system. Avoid it in the first case at the kernel-doc markups.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: intro.rst: don't assume audio and video codecs to be MPEG2
Mauro Carvalho Chehab [Fri, 1 Sep 2017 18:44:31 +0000 (14:44 -0400)]
media: intro.rst: don't assume audio and video codecs to be MPEG2

Originally, when DVB was introduced, all codecs would be part of
MPEG2 standard. That's not true anymore, as there are a large
number of codec standards used on digital TV nowadays.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dvbstb.svg: use dots for the optional parts of the hardware
Mauro Carvalho Chehab [Fri, 1 Sep 2017 18:14:48 +0000 (14:14 -0400)]
media: dvbstb.svg: use dots for the optional parts of the hardware

The hardware description mentions that some parts are optional.
Make it clearer at the drawing.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dmx-get-pes-pids.rst: document the ioctl
Mauro Carvalho Chehab [Fri, 1 Sep 2017 17:44:28 +0000 (13:44 -0400)]
media: dmx-get-pes-pids.rst: document the ioctl

This ioctl is supported by the DVB core, but was never
documented.

Add a documentation for it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dvb uAPI docs: minor editorial changes
Mauro Carvalho Chehab [Fri, 1 Sep 2017 16:21:49 +0000 (12:21 -0400)]
media: dvb uAPI docs: minor editorial changes

Do minor editorial changes to improve documentation readability:

- mark literals as such;
- add table markups to hint sizes;
- define what PES means;
- instead of hardcoding devnode numbers to zero (like adapter0/) use a
  question mark, to indicate that multiple devnodes may exist;
- add cross-references where useful.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dvbapi.rst: add an entry to DVB revision history
Mauro Carvalho Chehab [Fri, 1 Sep 2017 16:32:44 +0000 (12:32 -0400)]
media: dvbapi.rst: add an entry to DVB revision history

There are several missing items at the API history. Yet,
as we're doing a significant change there, add a new entry.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dvb-frontend-parameters.rst: fix the name of a struct
Mauro Carvalho Chehab [Fri, 1 Sep 2017 16:31:43 +0000 (12:31 -0400)]
media: dvb-frontend-parameters.rst: fix the name of a struct

The struct that contains an union of DVB parameters is
called dvb_frontend_parameters (and not FrontendParameters).

Fix it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dmx-fread.rst: specify how DMX_CHECK_CRC works
Mauro Carvalho Chehab [Fri, 1 Sep 2017 16:30:16 +0000 (12:30 -0400)]
media: dmx-fread.rst: specify how DMX_CHECK_CRC works

In the past, the documentation used to say that, if a CRC error
was found, a "-ECRC" error would be returned. That's not true:
the DVB core will just silently ignore such errors.

So, add an explicit note about that.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dvb uAPI docs: Prefer use "Digital TV instead of "DVB"
Mauro Carvalho Chehab [Fri, 1 Sep 2017 16:28:16 +0000 (12:28 -0400)]
media: dvb uAPI docs: Prefer use "Digital TV instead of "DVB"

The usage of the term "DVB" at the dvb API docs is confusing,
as, right now, it can refer to either the European digital TV
standard or to the subsystem.

So, prefer calling it as "Digital TV" on most places, to avoid
ambiguity.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: ca-fopen.rst: Fixes the device node name for CA
Mauro Carvalho Chehab [Fri, 1 Sep 2017 16:23:17 +0000 (12:23 -0400)]
media: ca-fopen.rst: Fixes the device node name for CA

The device node name for CA is wrong since ever. I suspect
that the name there was before DVBv3 (with was the first API
introduced at the Kernel).

Anyway, use the right name there.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dvb uAPI docs: adjust return value ioctl descriptions
Mauro Carvalho Chehab [Fri, 1 Sep 2017 16:15:43 +0000 (12:15 -0400)]
media: dvb uAPI docs: adjust return value ioctl descriptions

There are several issues on the return value for ioctls:

- Text is confusing;
- Some error codes don't exist;
- The non-generic error codes should come before the text
  that points to the generic error codes;
- Tables don't contain column size hints;
- Some references are not marked as such.

Correct them.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: gen-errors.rst: document ENXIO error code
Mauro Carvalho Chehab [Fri, 1 Sep 2017 16:20:12 +0000 (12:20 -0400)]
media: gen-errors.rst: document ENXIO error code

This error can be produced at least at the DVB subsystem.

As it is generic enough, document it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: gen-errors.rst: remove row number comments
Mauro Carvalho Chehab [Fri, 1 Sep 2017 16:19:17 +0000 (12:19 -0400)]
media: gen-errors.rst: remove row number comments

Those are introduced by the conversion scripts and don't
really help. Get rid of them.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dvb uapi docs: better organize header files
Mauro Carvalho Chehab [Fri, 1 Sep 2017 14:02:23 +0000 (10:02 -0400)]
media: dvb uapi docs: better organize header files

Instead of having one chapter per file, place all of them at
the same chapter. That better organize the chapters at the uAPI
documentation.

As a side effect, now all uAPI headers are at the same page,
at the html output, with makes easier to use it as a reference
index for the spec.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dst_ca: remove CA_SET_DESCR boilerplate
Mauro Carvalho Chehab [Fri, 1 Sep 2017 13:18:02 +0000 (09:18 -0400)]
media: dst_ca: remove CA_SET_DESCR boilerplate

This ioctl is not implemented at dst_ca driver. There's just
a boilerplate code there. Remove it, as it is unlikely that
anyone would implement it those days.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dvb rst: identify the documentation gap at the API
Mauro Carvalho Chehab [Fri, 1 Sep 2017 12:53:11 +0000 (08:53 -0400)]
media: dvb rst: identify the documentation gap at the API

Now that DVB spec is almost in sync, document what's missing.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dvb CA docs: place undocumented data together with ioctls
Mauro Carvalho Chehab [Fri, 1 Sep 2017 12:45:28 +0000 (08:45 -0400)]
media: dvb CA docs: place undocumented data together with ioctls

Right now, the same undocumented structs are on two places:
at ca_data_types.rst and together with their ioctls.

Move them to just one place and use the standard way to
represent them.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: ca-get-descr-info.rst: document this ioctl
Mauro Carvalho Chehab [Fri, 1 Sep 2017 12:39:43 +0000 (08:39 -0400)]
media: ca-get-descr-info.rst: document this ioctl

Instead of a generic boilerplate, fill it with relevant
information about this ioctl.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: ca-get-slot-info.rst: document this ioctl
Mauro Carvalho Chehab [Fri, 1 Sep 2017 12:32:56 +0000 (08:32 -0400)]
media: ca-get-slot-info.rst: document this ioctl

Instead of a generic boilerplate, fill it with relevant
information about this ioctl.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: ca-get-cap.rst: document this ioctl
Mauro Carvalho Chehab [Fri, 1 Sep 2017 12:07:46 +0000 (08:07 -0400)]
media: ca-get-cap.rst: document this ioctl

Instead of a generic boilerplate, fill it with relevant
information about this ioctl.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: ca-reset.rst: add some description to this ioctl
Mauro Carvalho Chehab [Fri, 1 Sep 2017 11:59:59 +0000 (07:59 -0400)]
media: ca-reset.rst: add some description to this ioctl

While we don't have any documentation for it, based on what's
there at Kaffeine and VDR, it seems that this command should
be issued before start using CA. So, document it as such.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dst_ca: return a proper error code from CA errors
Mauro Carvalho Chehab [Fri, 1 Sep 2017 12:21:04 +0000 (08:21 -0400)]
media: dst_ca: return a proper error code from CA errors

Right now, on several places, the driver is returning a
"-1" error to userspace, instead of a proper error code.

Fix it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: ca.h: document most CA data types
Mauro Carvalho Chehab [Fri, 1 Sep 2017 11:48:02 +0000 (07:48 -0400)]
media: ca.h: document most CA data types

For most of the stuff there, documenting is easy, as the
header file contains information.

Yet, I was unable to document two data structs:
ca_msg and ca_descr

As those two structs are used by a few drivers, keep them.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: ca.h: get rid of CA_SET_PID
Mauro Carvalho Chehab [Fri, 1 Sep 2017 11:41:49 +0000 (07:41 -0400)]
media: ca.h: get rid of CA_SET_PID

This ioctl seems to be some attempt to support a feature
at the bt8xx dst_ca driver. Yet, as said there, it
"needs more work". Right now, the code there is just
a boilerplate.

At the end of the day, no driver uses this ioctl, nor it is
documented anywhere (except for "needs more work").

So, get rid of it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: net.rst: Fix the level of a section of the net chapter
Mauro Carvalho Chehab [Thu, 31 Aug 2017 23:34:02 +0000 (19:34 -0400)]
media: net.rst: Fix the level of a section of the net chapter

Due to a mistake, the DVB net chapter was actually broken
into two different chapters. Fix it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dmx.h: add kernel-doc markups and use it at Documentation/
Mauro Carvalho Chehab [Thu, 31 Aug 2017 16:28:52 +0000 (12:28 -0400)]
media: dmx.h: add kernel-doc markups and use it at Documentation/

The demux documentation is pretty poor nowadays: most of the
structs and enums aren't documented at all.

Add proper kernel-doc markups for them and use it.

Now, the demux API data structures are fully documented :-)

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dmx.h: get rid of GET_DMX_EVENT
Mauro Carvalho Chehab [Thu, 31 Aug 2017 23:09:06 +0000 (19:09 -0400)]
media: dmx.h: get rid of GET_DMX_EVENT

This seems to be a pure fictional API :-)

It only exists at the DVB book, with no code implemeting it.

So, just get rid of it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dmx.h: get rid of DMX_SET_SOURCE
Mauro Carvalho Chehab [Thu, 31 Aug 2017 18:21:43 +0000 (14:21 -0400)]
media: dmx.h: get rid of DMX_SET_SOURCE

No driver uses this ioctl, nor it is documented anywhere.

So, get rid of it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dmx.h: get rid of DMX_GET_CAPS
Mauro Carvalho Chehab [Thu, 31 Aug 2017 18:11:34 +0000 (14:11 -0400)]
media: dmx.h: get rid of DMX_GET_CAPS

There's no driver currently using it; it is also not
documented about what it would be supposed to do.

So, get rid of it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dmx.h: get rid of unused DMX_KERNEL_CLIENT
Mauro Carvalho Chehab [Thu, 31 Aug 2017 16:52:45 +0000 (12:52 -0400)]
media: dmx.h: get rid of unused DMX_KERNEL_CLIENT

There's a flag defined for Digital TV demux that is not used
anywhere, called DMX_KERNEL_CLIENT. Get rid of it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: fe_property_parameters.rst: better document bandwidth
Mauro Carvalho Chehab [Thu, 31 Aug 2017 11:17:21 +0000 (07:17 -0400)]
media: fe_property_parameters.rst: better document bandwidth

Use a table to document the supported bandwidths. That makes
it clearer to readers.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: fe_property_parameters.rst: better define properties usage
Mauro Carvalho Chehab [Thu, 31 Aug 2017 11:16:17 +0000 (07:16 -0400)]
media: fe_property_parameters.rst: better define properties usage

Several frontend properties are specific to a subset of the
delivery systems. Make it clearer when describing each
property.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dvb frontend docs: use kernel-doc documentation
Mauro Carvalho Chehab [Wed, 30 Aug 2017 17:45:20 +0000 (13:45 -0400)]
media: dvb frontend docs: use kernel-doc documentation

Now that frontend.h contains most documentation for the frontend,
remove the duplicated information from Documentation/ and use the
kernel-doc auto-generated one instead.

That should simplify maintainership of DVB frontend uAPI, as most
of the documentation will stick with the header file.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dvb/frontend.h: document the uAPI file
Mauro Carvalho Chehab [Wed, 30 Aug 2017 12:12:38 +0000 (08:12 -0400)]
media: dvb/frontend.h: document the uAPI file

Most of the stuff at the Digital TV frontend header file
are documented only at the Documentation. However, a few
kernel-doc markups are there, several of them with parsing
issues.

Add the missing documentation, copying definitions from the
Documentation when it applies, fixing some bugs.

Please notice that DVBv3 stuff that were deprecated weren't
commented by purpose. Instead, they were clearly tagged as
such.

This patch prepares to move part of the documentation from
Documentation/ to kernel-doc comments.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dvb/frontend.h: move out a private internal structure
Mauro Carvalho Chehab [Wed, 30 Aug 2017 11:55:47 +0000 (07:55 -0400)]
media: dvb/frontend.h: move out a private internal structure

struct dtv_cmds_h is just an ancillary struct used by the
dvb_frontend.c to internally store frontend commands.

It doesn't belong to the userspace header, nor it is used anywhere,
except inside the DVB core. So, remove it from the header.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dvb/intro: adjust the notices about optional hardware
Mauro Carvalho Chehab [Wed, 30 Aug 2017 09:25:20 +0000 (05:25 -0400)]
media: dvb/intro: adjust the notices about optional hardware

Both CA and decoders are optional. Also, the presence or
absence has nothing to do on being a PCI card or not.

Nowadays, most hardware leaves the decoders to either the
GPU or to some ISP inside the SoC, instead of implementing
it inside the Digital TV part of the device.

So, change the wording to reflect the hardware changes.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dvb/intro: update the history part of the document
Mauro Carvalho Chehab [Wed, 30 Aug 2017 09:20:45 +0000 (05:20 -0400)]
media: dvb/intro: update the history part of the document

Convergence doesn't exist anymore. The community itself maintains
the spec. Update accordingly.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dvb/intro: update references for TV standards
Mauro Carvalho Chehab [Wed, 30 Aug 2017 09:19:25 +0000 (05:19 -0400)]
media: dvb/intro: update references for TV standards

The references there are only for DVB. Add missing references for
ATSC and ISDB standards.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dvb/intro: use the term Digital TV to refer to the system
Mauro Carvalho Chehab [Wed, 30 Aug 2017 09:15:40 +0000 (05:15 -0400)]
media: dvb/intro: use the term Digital TV to refer to the system

On several places at the introduction, a digital TV board and its
kernel support is called as DVB. The reason is simple: by the
time the document was written, there were no other digital TV
standards :-)

Modernize the specs by referring to them as Digital TV.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dmx.h: split typedefs from structs
Mauro Carvalho Chehab [Fri, 1 Sep 2017 10:09:14 +0000 (06:09 -0400)]
media: dmx.h: split typedefs from structs

Using typedefs inside the Kernel is against CodingStyle, and
there's no good usage here.

Just like we did at frontend.h, at commit 0df289a209e0
("[media] dvb: Get rid of typedev usage for enums"), let's keep
those typedefs only to provide userspace backward compatibility.

No functional changes.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: ca.h: split typedefs from structs
Mauro Carvalho Chehab [Fri, 1 Sep 2017 09:43:39 +0000 (05:43 -0400)]
media: ca.h: split typedefs from structs

Using typedefs inside the Kernel is against CodingStyle, and
there's no good usage here.

Just like we did at frontend.h, at commit 0df289a209e0 ("[media] dvb:
Get rid of typedev usage for enums"), let's keep those typedefs only
to provide userspace backward compatibility.

No functional changes.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: serial_ir: fix tx timing calculation on 32-bit
Sean Young [Wed, 23 Aug 2017 15:06:04 +0000 (11:06 -0400)]
media: serial_ir: fix tx timing calculation on 32-bit

Move the calculation to where it is needed, so the result doesn't
need to be stored in the device struct.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: rc: gpio-ir-tx: use ktime accessor functions
Sean Young [Fri, 25 Aug 2017 14:45:47 +0000 (10:45 -0400)]
media: rc: gpio-ir-tx: use ktime accessor functions

Prefer using accessor functions so we are not dependent on the ktime_t
type.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: rc: use ktime accessor functions
Jasmin Jessich [Fri, 25 Aug 2017 09:59:41 +0000 (05:59 -0400)]
media: rc: use ktime accessor functions

Prefer using accessor functions so we are not dependent on the ktime_t
type.

Signed-off-by: Jasmin Jessich <jasmin@anw.at>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: max2175: Propagate the real error on devm_clk_get() failure
Fabio Estevam [Sun, 27 Aug 2017 16:30:35 +0000 (12:30 -0400)]
media: max2175: Propagate the real error on devm_clk_get() failure

When devm_clk_get() fails we should return the real error code
instead of always returning -ENODEV.

This allows defer probe to happen in the case the clock provider has
not been enabled by the time max2175 driver gets probed.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: cx23885: Explicitly list Hauppauge model numbers of HVR-4400 and HVR-5500
Matthias Schwarzott [Sun, 27 Aug 2017 12:26:07 +0000 (08:26 -0400)]
media: cx23885: Explicitly list Hauppauge model numbers of HVR-4400 and HVR-5500

Add two new model numbers to suppress this message in kernel log:
  cx23885: cx23885[0]: warning: unknown hauppauge model #121029

Add these model numbers:
* Model 121019 - WinTV-HVR4400
* Model 121029 - WinTV-HVR5500

For WinTV-HVR4400 the documentation and my hardware differ:

Documentation says it supports DVB-S/S2 and DVB-T,
but my hardware also supports DVB-C.

Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: i2c: adv748x: Export I2C device table entries as module aliases
Javier Martinez Canillas [Wed, 9 Aug 2017 09:37:30 +0000 (05:37 -0400)]
media: i2c: adv748x: Export I2C device table entries as module aliases

The I2C core always reports a MODALIAS of the form i2c:<foo> even if the
device was registered via OF, and the driver is only exporting the OF ID
table entries as module aliases.

So if the driver is built as module, autoload won't work since udev/kmod
won't be able to match the registered OF device with its driver module.

Before this patch:

$ modinfo drivers/media/i2c/adv748x/adv748x.ko | grep alias
alias:          of:N*T*Cadi,adv7482C*
alias:          of:N*T*Cadi,adv7482
alias:          of:N*T*Cadi,adv7481C*
alias:          of:N*T*Cadi,adv7481

After this patch:

modinfo drivers/media/i2c/adv748x/adv748x.ko | grep alias
alias:          of:N*T*Cadi,adv7482C*
alias:          of:N*T*Cadi,adv7482
alias:          of:N*T*Cadi,adv7481C*
alias:          of:N*T*Cadi,adv7481
alias:          i2c:adv7482
alias:          i2c:adv7481

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: staging/imx: always select VIDEOBUF2_DMA_CONTIG
Arnd Bergmann [Mon, 7 Aug 2017 10:49:18 +0000 (06:49 -0400)]
media: staging/imx: always select VIDEOBUF2_DMA_CONTIG

I ran into a rare build error during randconfig testing:

drivers/staging/media/imx/imx-media-capture.o: In function `capture_stop_streaming':
imx-media-capture.c:(.text+0x224): undefined reference to `vb2_buffer_done'
drivers/staging/media/imx/imx-media-capture.o: In function `imx_media_capture_device_register':
imx-media-capture.c:(.text+0xe60): undefined reference to `vb2_queue_init'
imx-media-capture.c:(.text+0xfa0): undefined reference to `vb2_dma_contig_memops'

While VIDEOBUF2_DMA_CONTIG was already selected by the camera driver,
it wasn't necessarily there with just the base driver enabled.
This moves the 'select' statement to the top-level option to make
sure it's always available.

Fixes: 64b5a49df486 ("[media] media: imx: Add Capture Device Interface")

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dw2102: make dvb_usb_device_description structures const
Bhumika Goyal [Thu, 3 Aug 2017 10:00:32 +0000 (06:00 -0400)]
media: dw2102: make dvb_usb_device_description structures const

dvb_usb_device_description structures are only used during a copy
operation. Therefore, declare them as const.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: mn88473: reset stream ID reg if no PLP given
Olli Salonen [Sun, 30 Jul 2017 12:34:49 +0000 (08:34 -0400)]
media: mn88473: reset stream ID reg if no PLP given

If the PLP given is NO_STREAM_ID_FILTER (~0u) don't try to set that into the PLP register. Set PLP to 0 instead.

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: mn88472: reset stream ID reg if no PLP given
Olli Salonen [Sun, 30 Jul 2017 12:34:48 +0000 (08:34 -0400)]
media: mn88472: reset stream ID reg if no PLP given

If the PLP given is NO_STREAM_ID_FILTER (~0u) don't try to set that into the PLP register. Set PLP to 0 instead.

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dvb_frontend: initialize variable s with FE_NONE instead of 0
Colin Ian King [Fri, 21 Jul 2017 16:01:00 +0000 (12:01 -0400)]
media: dvb_frontend: initialize variable s with FE_NONE instead of 0

GIT_AUTHOR_NAME=Colin King
GIT_AUTHOR_EMAIL=colin.king@canonical.com

In a previous commit, we added FE_NONE as an unknown fe_status.
Initialize variable s to FE_NONE instead of the more opaque value 0.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: docs-next: update the fe_status documentation for FE_NONE
Colin Ian King [Fri, 21 Jul 2017 16:12:38 +0000 (12:12 -0400)]
media: docs-next: update the fe_status documentation for FE_NONE

Recently added FE_NONE to the enum fe_status, so update the
documentation accordingly.

[mchehab@s-opensource.com: change description to actually
 reflect what FE_NONE means: no lock of any kind]
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dvb_frontend: ensure that inital front end status initialized
Colin Ian King [Thu, 20 Jul 2017 22:12:07 +0000 (18:12 -0400)]
media: dvb_frontend: ensure that inital front end status initialized

The fe_status variable s is not initialized meaning it can have any
random garbage status.  This could be problematic if fe->ops.tune is
false as s is not updated by the call to fe->ops.tune() and a
subsequent check on the change status will using a garbage value.
Fix this by adding FE_NONE to the enum fe_status and initializing
s to this.

Detected by CoverityScan, CID#112887 ("Uninitialized scalar variable")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dvbproperty.rst: minor editorial changes
Mauro Carvalho Chehab [Sat, 26 Aug 2017 10:07:14 +0000 (06:07 -0400)]
media: dvbproperty.rst: minor editorial changes

Do some minor editorial changes to make this chapter visually
better, and the example a little bit clearer.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dvbproperty.rst: improve notes about legacy frontend calls
Mauro Carvalho Chehab [Sat, 26 Aug 2017 10:07:13 +0000 (06:07 -0400)]
media: dvbproperty.rst: improve notes about legacy frontend calls

The description of the DVBv5 API was written a long time ago,
where the API was still new, and there were not apps using it.

Now that the API is stable and used by new applications, clarify
that DVBv3 calls should not be used and why.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: frontend.rst: mention MMT at the documentation
Mauro Carvalho Chehab [Sat, 26 Aug 2017 10:07:12 +0000 (06:07 -0400)]
media: frontend.rst: mention MMT at the documentation

The ATSC 3.0 uses MPEG Media Transport, with is not currently
supported. Yet, we'll need to implement it sooner or later.
So, mention about it at the specs.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: frontend.rst: convert SEC note into footnote
Mauro Carvalho Chehab [Sat, 26 Aug 2017 10:07:11 +0000 (06:07 -0400)]
media: frontend.rst: convert SEC note into footnote

The description of what SEC means fits well as a footnote.
That makes the need of saying that SEC is only for Satellite
when it was mentioned, as the footnote already says that.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: frontend.rst: fix supported delivery systems
Mauro Carvalho Chehab [Sat, 26 Aug 2017 10:07:10 +0000 (06:07 -0400)]
media: frontend.rst: fix supported delivery systems

The introduction for the frontend chapter is not quite
correct:
  - it tells that it supports only three types of
    delivery systems, in opposite to three *groups*;
  - It adds ISDB-C to the list of supported systems,
    but, this is not true.

Fix it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dvb/intro.rst: Use verbatim font where needed
Mauro Carvalho Chehab [Sat, 26 Aug 2017 10:07:09 +0000 (06:07 -0400)]
media: dvb/intro.rst: Use verbatim font where needed

The device numbering for DVB uses "M" and "N" as vars for the
number of the device, but sometimes this is printed using normal
font instead of verbatim.

While here, remove an extra space after quotation marks.

This is a minor cleanup with no changes at the text.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: usbvision: Improve a size determination in usbvision_alloc()
Markus Elfring [Sat, 26 Aug 2017 20:22:13 +0000 (16:22 -0400)]
media: usbvision: Improve a size determination in usbvision_alloc()

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 <elfring@users.sourceforge.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: usbvision: Adjust eight checks for null pointers
Markus Elfring [Sat, 26 Aug 2017 20:16:52 +0000 (16:16 -0400)]
media: usbvision: Adjust eight checks for null pointers

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 <elfring@users.sourceforge.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: usbvision: Delete an error message for a failed memory allocation in usbvision...
Markus Elfring [Sat, 26 Aug 2017 20:06:05 +0000 (16:06 -0400)]
media: usbvision: Delete an error message for a failed memory allocation in usbvision_probe()

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 <elfring@users.sourceforge.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: Staging: media: radio-bcm2048: make video_device const
Bhumika Goyal [Sat, 26 Aug 2017 11:32:53 +0000 (07:32 -0400)]
media: Staging: media: radio-bcm2048: make video_device const

Make this const as it is only used in a copy operation.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: radio: make video_device const
Bhumika Goyal [Sat, 26 Aug 2017 08:43:43 +0000 (04:43 -0400)]
media: radio: make video_device const

Make these const as they are only used in a copy operation.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dib8000: remove some bogus dead code
Dan Carpenter [Sat, 26 Aug 2017 06:18:41 +0000 (02:18 -0400)]
media: dib8000: remove some bogus dead code

This function is broken.  It sets the wrong front_end to NULL.  But it's
not used, so let's just delete it.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dib9000: delete some unused broken code
Dan Carpenter [Sat, 26 Aug 2017 06:18:16 +0000 (02:18 -0400)]
media: dib9000: delete some unused broken code

The dib9000_remove_slave_frontend() function isn't used.

I was reviewing it because my static checker claims it writes one
element beyond the end of the array.  That's a false positive.  What it
actually does is, if there are two or more front ends, then it prints a
debug message to say that it removed the first one, stored in
state->fe[1], and then it "removes" (scare quotes on purpose) the second
one, stored in state->fe[2].  Deleting a front end from the middle is
not really supported and breaks code like dib9000_release() which
assumes the first NULL front end marks the end of the list.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: staging: omap4iss: make v4l2_file_operations const
Bhumika Goyal [Sat, 26 Aug 2017 06:15:53 +0000 (02:15 -0400)]
media: staging: omap4iss: make v4l2_file_operations const

Make this const as it is only stored in a const field of a
video_device structure.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: usbtv: make v4l2_file_operations const
Bhumika Goyal [Sat, 26 Aug 2017 06:13:46 +0000 (02:13 -0400)]
media: usbtv: make v4l2_file_operations const

Make this const as it is only stored in a const field of a
video_device structure.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: cx18: make v4l2_file_operations const
Bhumika Goyal [Sat, 26 Aug 2017 06:02:08 +0000 (02:02 -0400)]
media: cx18: make v4l2_file_operations const

Make this const as it is only stored in a const field of a
video_device structure.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: usb: make video_device const
Bhumika Goyal [Sat, 26 Aug 2017 13:11:30 +0000 (09:11 -0400)]
media: usb: make video_device const

Make these const as they are only used during a copy operation.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Acked-by: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: pci: make video_device const
Bhumika Goyal [Sat, 26 Aug 2017 13:08:11 +0000 (09:08 -0400)]
media: pci: make video_device const

Make these const as they are either used during a copy operation or
passed to a const argument of the function cx88_vdev_init.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: platform: make video_device const
Bhumika Goyal [Sat, 26 Aug 2017 12:57:26 +0000 (08:57 -0400)]
media: platform: make video_device const

Make these const as they are only used during a copy operation.
Done using Coccinelle:

@match disable optional_qualifier@
identifier s;
@@
static struct video_device s = {...};

@ref@
position p;
identifier match.s;
@@
s@p

@good1@
identifier match.s;
expression list[3] es;
position ref.p;
@@
cx88_vdev_init(es,&s@p,...)

@good2@
position ref.p;
identifier match.s,f,c;
expression e;
@@
(
e = s@p
|
e = s@p.f
|
c(...,s@p.f,...)
|
c(...,s@p,...)
)

@bad depends on  !good1 && !good2@
position ref.p;
identifier match.s;
@@
s@p

@depends on forall !bad disable optional_qualifier@
identifier match.s;
@@
static
+ const
struct video_device s;

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: au0828: fix RC_CORE dependency
Arnd Bergmann [Thu, 24 Aug 2017 22:22:28 +0000 (18:22 -0400)]
media: au0828: fix RC_CORE dependency

When RC_CORE is a loadable module, and au0828 is built-in including
the RC support, we get a link error:

drivers/media/usb/au0828/au0828-input.o: In function `au0828_get_key_au8522':
au0828-input.c:(.text+0x474): undefined reference to `ir_raw_event_store'
drivers/media/usb/au0828/au0828-input.o: In function `au0828_rc_register':
au0828-input.c:(.text+0x7c8): undefined reference to `rc_allocate_device'
au0828-input.c:(.text+0x8f8): undefined reference to `rc_register_device'

This adds an additional dependency, similar to the one for em28xx,
to ensure the broken configuration is never used.

Fixes: 2fcfd317f66c ("[media] au0828: add support for IR on HVR-950Q")

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dib0090: fix duplicated code for different branches
Gustavo A. R. Silva [Fri, 18 Aug 2017 01:23:44 +0000 (21:23 -0400)]
media: dib0090: fix duplicated code for different branches

Refactor code in order to avoid identical code for different branches.

This issue was detected with the help of Coccinelle.

Addresses-Coverity-ID: 1226795

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: mx2_emmaprp: Check for platform_get_irq() error
Fabio Estevam [Thu, 17 Aug 2017 21:12:05 +0000 (17:12 -0400)]
media: mx2_emmaprp: Check for platform_get_irq() error

platform_get_irq() may fail, so we should better check its return
value and propagate it in the case of error.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: docs-rst: media: Document broken frame handling in stream stop for CSI-2
Sakari Ailus [Wed, 16 Aug 2017 12:20:18 +0000 (08:20 -0400)]
media: docs-rst: media: Document broken frame handling in stream stop for CSI-2

Some CSI-2 transmitters will finish an ongoing frame whereas others will
not. Document that receiver drivers should not assume a particular
behaviour but to work in both cases.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dvb-frontends/stv0367: remove QAM_AUTO from ddb_fe_ops
Daniel Scheller [Mon, 14 Aug 2017 17:39:37 +0000 (13:39 -0400)]
media: dvb-frontends/stv0367: remove QAM_AUTO from ddb_fe_ops

Since the cab_* codepath doesn't recognize QAM_AUTO, don't announce that
it is supported when it really isn't. Fixes ie. w_scan from
unconditionally using QAM_AUTO on DVB-C scans.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: imx: use setup_timer
Cihangir Akturk [Sun, 13 Aug 2017 18:39:38 +0000 (14:39 -0400)]
media: imx: use setup_timer

Use setup_timer function instead of initializing timer with the
function and data fields.

Generated by: scripts/coccinelle/api/setup_timer.cocci.

Signed-off-by: Cihangir Akturk <cakturk@gmail.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Tested-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: mxl111sf: Fix potential null pointer dereference
Eugeniu Rosca [Sun, 13 Aug 2017 10:06:29 +0000 (06:06 -0400)]
media: mxl111sf: Fix potential null pointer dereference

Reviewing the delta between cppcheck output of v4.9.39 and v4.9.40
stable updates, I stumbled on the new warning:

mxl111sf.c:80: (warning) Possible null pointer dereference: rbuf

Since copying state->rcvbuf into rbuf is not needed in the 'write-only'
scenario (i.e. calling mxl111sf_ctrl_msg() from mxl111sf_i2c_send_data()
or from mxl111sf_write_reg()), bypass memcpy() in this case.

Fixes: d90b336f3f65 ("[media] mxl111sf: Fix driver to use heap allocate buffers for USB messages")

Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Reviewed-by: Michael Ira Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: au0828: fix unbalanced lock/unlock in au0828_usb_probe
Gustavo A. R. Silva [Sat, 12 Aug 2017 17:30:59 +0000 (13:30 -0400)]
media: au0828: fix unbalanced lock/unlock in au0828_usb_probe

Call mutex_unlock and free dev on failure.

Reported-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dvb-usb: Add memory free on error path in dw2102_probe()
Anton Vasilyev [Thu, 10 Aug 2017 15:27:44 +0000 (11:27 -0400)]
media: dvb-usb: Add memory free on error path in dw2102_probe()

If dw2102_probe() fails on dvb_usb_device_init(), then memleak occurs.

The patch adds deallocation to the error path.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Anton Vasilyev <vasilyev@ispras.ru>
Reviewed-by: Enrico Mioso <mrkiko.rs@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dvb-frontends/stv0910: change minsymrate to 100Ksyms/s
Daniel Scheller [Wed, 23 Aug 2017 16:10:02 +0000 (12:10 -0400)]
media: dvb-frontends/stv0910: change minsymrate to 100Ksyms/s

The demodulator supports symbol rates as low as 100Ksyms/s - the demod
setup in start() already handles such low symbol rates and reviewers
of stv0910 equipped cards even found and tested transponders with
SRs in that range. So, announce this in the fe_ops.

Cc: Ralph Metzler <rjkm@metzlerbros.de>
Cc: Richard Scobie <r.scobie@clear.net.nz>
Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: staging/cxd2099: Add module parameter for buffer mode
Daniel Scheller [Wed, 23 Aug 2017 16:10:01 +0000 (12:10 -0400)]
media: staging/cxd2099: Add module parameter for buffer mode

The buffer mode of the cxd2099 driver requires more work regarding error
handling and thus can cause issues in some cases, so disable it by default
and make that mode of operation controllable by users via a module
parameter (ie. 'modprobe cxd2099 buffermode=1' enables current behaviour).

The upstream codebase also has the buffer mode disabled by default, so
we should match this (but users still can test things out using the
modparm).

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Jasmin Jessich <jasmin@anw.at>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: ddbridge: fix sparse warnings
Daniel Scheller [Wed, 23 Aug 2017 16:10:00 +0000 (12:10 -0400)]
media: ddbridge: fix sparse warnings

Fix several

  drivers/media/pci/ddbridge/ddbridge-core.c: warning: symbol ... was not declared. Should it be static?
  drivers/media/pci/ddbridge/ddbridge-core.c: warning: Using plain integer as NULL pointer
  drivers/media/pci/ddbridge/ddbridge-io.h: warning: cast removes address space of expression
  drivers/media/pci/ddbridge/ddbridge-io.h: warning: incorrect type in argument 1 (different address spaces)

at multiple places.

Cc: Ralph Metzler <rjkm@metzlerbros.de>
Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: ddbridge: fix teardown/deregistration order in ddb_input_detach()
Daniel Scheller [Wed, 23 Aug 2017 16:09:59 +0000 (12:09 -0400)]
media: ddbridge: fix teardown/deregistration order in ddb_input_detach()

Brought to attention by Matthias Schwarzott <zzam@gentoo.org> by fixing
possible use-after-free faults in some demod drivers:

In ddb_input_detach(), the i2c_client is unregistered and removed before
dvb frontends are unregistered and detached. While no use-after-free issue
was observed so far, there is another issue with this:

dvb->attached keeps track of the state of the input/output registration,
and the i2c_client unregistration takes place only if everything was
successful (dvb->attached == 0x31). If for some reason an error occurred
during the frontend setup, that value stays at 0x20. In the following
error handling and cleanup, ddb_input_detach() will skip down to that
state, leaving the i2c_client registered, causing refcount issues.

Fix this by moving the i2c_client deregistration down to case 0x20.

Cc: Matthias Schwarzott <zzam@gentoo.org>
Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dvb-frontends/stv0910: release lock on gate_ctrl() failure
Daniel Scheller [Wed, 23 Aug 2017 16:09:58 +0000 (12:09 -0400)]
media: dvb-frontends/stv0910: release lock on gate_ctrl() failure

Whenever write_reg() fails to open/close the demod's I2C gate, release the
lock to avoid deadlocking situations. If I2c gate open failed, there's no
need to hold a lock, and if close fails, the mutex_unlock() at the end of
the function is never reached, leaving the mutex_lock in locked state,
which in turn will cause potential for deadlocks. Thus, release the lock
on failure.

While we're touching gate_ctrl(), add some explanation about the need for
locking and the shared I2C bus/gate.

Cc: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: cx231xx: fix use-after-free when unregistering the i2c_client for the dvb...
Matthias Schwarzott [Wed, 2 Aug 2017 16:46:00 +0000 (12:46 -0400)]
media: cx231xx: fix use-after-free when unregistering the i2c_client for the dvb demod

Calling i2c_unregister_device for a demod driver destroys the frontend object.
Later it is accessed by calling dvb_unregister_frontend and
dvb_frontend_detach.

In some cases this leads to a general protection fault with this
callstack:

  dvb_unregister_frontend+0x25/0x50 [dvb_core]
  dvb_fini+0xdb/0x160 [cx231xx_dvb]
  cx231xx_unregister_extension+0x3d/0xb0 [cx231xx]
  cx231xx_dvb_unregister+0x10/0x809 [cx231xx_dvb]
  SyS_delete_module+0x18a/0x240
  ? exit_to_usermode_loop+0x7b/0x80
  entry_SYSCALL_64_fastpath+0x17/0x98

Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>