Commit Graph

723139 Commits

Author SHA1 Message Date
Mauro Carvalho Chehab
9f577d6db5 media: dvb kAPI docs: document dvb_vb2.h
Document the data structures and functions inside this kAPI header.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-29 08:31:25 -05:00
Mauro Carvalho Chehab
15128beef1 media: dvb_vb2: get rid of DVB_BUF_TYPE_OUTPUT
This is currently unused. So, get rid of it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-29 07:54:12 -05:00
Mauro Carvalho Chehab
e73f9f6879 media: dvb_vb2: use strlcpy instead of strncpy
Instead of using strncpy(), use strlcpy(), in order to
ensure that a \0 char will be added at the end of the
string.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-29 07:53:30 -05:00
Mauro Carvalho Chehab
eb0f73ba12 media: v4l2-async: better describe match union at async match struct
Now that kernel-doc handles nested unions, better document the
match union at struct v4l2_async_subdev.

Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-29 07:15:14 -05:00
Mauro Carvalho Chehab
4e48afecd5 media: v4l2-async: simplify v4l2_async_subdev structure
The V4L2_ASYNC_MATCH_FWNODE match criteria requires just one
struct to be filled (struct fwnode_handle). The V4L2_ASYNC_MATCH_DEVNAME
match criteria requires just a device name.

So, it doesn't make sense to enclose those into structs,
as the criteria can go directly into the union.

That makes easier to document it, as we don't need to document
weird senseless structs.

At drivers, this makes even clearer about the match criteria.

Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Benoit Parrot <bparrot@ti.com>
Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Philipp Zabel <p.zabel@pengutronix.de>
Acked-by: Hyun Kwon <hyun.kwon@xilinx.com>
Acked-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-29 07:14:28 -05:00
Mauro Carvalho Chehab
d651ff916e media: v4l2-device.h: document helper macros
There are several macros that aren't documented using kernel-docs
markups.

Document them.

While here, add cross-references to structs on this file.

Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-29 07:11:22 -05:00
Yong Zhi
c2a6a07afe media: intel-ipu3: cio2: add new MIPI-CSI2 driver
This patch adds CIO2 CSI-2 device driver for
Intel's IPU3 camera sub-system support.

Signed-off-by: Yong Zhi <yong.zhi@intel.com>
Signed-off-by: Hyungwoo Yang <hyungwoo.yang@intel.com>
Signed-off-by: Rajmohan Mani <rajmohan.mani@intel.com>
Signed-off-by: Vijaykumar Ramya <ramya.vijaykumar@intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-29 07:00:51 -05:00
Yong Zhi
e62f528255 media: doc-rst: add IPU3 raw10 bayer pixel format definitions
The formats added by this patch are:

    V4L2_PIX_FMT_IPU3_SBGGR10
    V4L2_PIX_FMT_IPU3_SGBRG10
    V4L2_PIX_FMT_IPU3_SGRBG10
    V4L2_PIX_FMT_IPU3_SRGGB10

Signed-off-by: Hyungwoo Yang <hyungwoo.yang@intel.com>
Signed-off-by: Yong Zhi <yong.zhi@intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-29 06:35:08 -05:00
Yong Zhi
e8391b7654 media: videodev2.h, v4l2-ioctl: add IPU3 raw10 color format
Add IPU3 specific formats:

	V4L2_PIX_FMT_IPU3_SBGGR10
	V4L2_PIX_FMT_IPU3_SGBRG10
	V4L2_PIX_FMT_IPU3_SGRBG10
	V4L2_PIX_FMT_IPU3_SRGGB10

Signed-off-by: Yong Zhi <yong.zhi@intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-29 06:33:53 -05:00
Sakari Ailus
f6e8fe94da media: i2c: as3645a: Remove driver
Remove the V4L2 AS3645A sub-device driver in favour of the LED flash class
driver for the same hardware, drivers/leds/leds-as3645a.c. The latter uses
the V4L2 flash LED class framework to provide V4L2 sub-device interface.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-29 06:31:31 -05:00
Andy Shevchenko
96b2979ce5 media: staging: atomisp: Fix DMI matching entry for MRD7
MRD7 board has in particular

	Base Board Information
		Manufacturer: Intel Corp.
		Product Name: TABLET
		Version: MRD 7

Fix the DMI matching entry for it.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-29 06:29:30 -05:00
Andy Shevchenko
321333a8c4 media: staging: atomisp: Use standard DMI match table
The traditional pattern is to use DMI matching table and provide a
corresponding driver_data in it.

Convert driver to use DMI matching table.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-29 06:29:06 -05:00
Andy Shevchenko
84cf77579c media: staging: atomisp: Unexport local function
There is no need to export function which is only used once in
the same module where it's defined.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-29 06:28:18 -05:00
Andy Shevchenko
cfb1693cec media: staging: atomisp: Remove redundant PCI code
There is no need to keep a reference to PCI root bridge.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-29 06:27:54 -05:00
Andy Shevchenko
e583bfbf63 media: staging: atomisp: Switch to use struct device_driver directly
In a preparation of split PCI glue driver from core part, convert
the driver to use more generic struct device_driver.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-29 06:27:34 -05:00
Andy Shevchenko
9e993ed053 media: staging: atomisp: Remove non-ACPI leftovers
Since all drivers are solely requiring ACPI enumeration, there is no
need to additionally check for legacy platform data or ACPI handle.

Remove leftovers from the sensors and platform code.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-29 06:26:55 -05:00
Andy Shevchenko
cb02ae3d71 media: staging: atomisp: Disable custom format for now
Custom video format 'M101' is not supported in upstream and as a result
user will get ugly warning:

 Unknown pixelformat 0x3130314d
 ------------[ cut here ]------------
 WARNING: CPU: 3 PID: 1574 at drivers/media/v4l2-core/v4l2-ioctl.c:1291 v4l_enum_fmt+0xcf1/0x13a0 [videodev]

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-29 06:26:15 -05:00
Andy Shevchenko
5ef4614cd7 media: staging: atomisp: lm3554: Fix control values
Driver fails to initialize due to insane settings in the
control init array.

Fix this by moving to sanity.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-29 06:25:40 -05:00
Andy Shevchenko
6aebb3c6da media: staging: atomisp: Remove duplicate NULL-check
GPIO framework checks for NULL pointer when gpiod_set_value() is called.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-29 06:25:04 -05:00
Andy Shevchenko
cae8b2e138 media: staging: atomisp: Don't leak GPIO resources if clk_get() failed
In case devm_clk_get() call fails the previously requested GPIOs are
left requested.

Fix this by moving GPIO request code after devm_clk_get() call.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-29 06:24:44 -05:00
Aishwarya Pant
5fac8da586 media: staging: atomisp2: replace DEVICE_ATTR with DEVICE_ATTR_RO
This is a clean-up patch which replaces DEVICE_ATTR() macro with file
permission specific DEVICE_ATTR_RO() macro for compaction and
readability.

Done using coccinelle:

@r@
identifier attr, show_fn;
declarer name DEVICE_ATTR;
@@

DEVICE_ATTR(attr, \(S_IRUGO\|0444\), show_fn, NULL);

@script: python p@
attr_show;
attr << r.attr;
@@

// standardise the show fn name to {attr}_show
coccinelle.attr_show = attr + "_show"

@@
identifier r.attr, r.show_fn;
declarer name DEVICE_ATTR_RO;
@@

// change the attr declaration
- DEVICE_ATTR(attr, \(S_IRUGO\|0444\), show_fn, NULL);
+ DEVICE_ATTR_RO(attr);

@rr@
identifier r.show_fn, p.attr_show;
@@

// rename the show function
- show_fn
+ attr_show
	(...) {
	...
  }

@depends on rr@
identifier r.show_fn, p.attr_show;
@@

// rename fn usages
- show_fun
+ attr_show

Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-29 06:24:18 -05:00
Sergiy Redko
eae79ed596 media: Staging: media: atomisp: made function static
Fixed sparse warning by making 'dtrace_dot' function static.

Signed-off-by: Sergiy Redko <sergredko@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-29 06:23:58 -05:00
Riccardo Schirone
c9b56dd21a media: staging: fix indentation in atomisp-ov5693
Fix "suspect code indent for conditional statements" checkpatch issue

Signed-off-by: Riccardo Schirone <sirmy15@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-29 06:23:39 -05:00
Riccardo Schirone
ebcfbf8279 media: staging: improves comparisons readability in atomisp-ov5693
Fix "Comparisons should place the constant on the right side of the
test" checkpatch issue.

Signed-off-by: Riccardo Schirone <sirmy15@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-29 06:23:24 -05:00
Riccardo Schirone
4853dd1ae8 media: staging: improve comments usage in atomisp-ov5693
- Fix "Block comments use a trailing */ on a separate line" checkpatch
  issue
- Fix "Block comments use * on subsequent lines" checkpatch issue

Signed-off-by: Riccardo Schirone <sirmy15@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-29 06:22:47 -05:00
Riccardo Schirone
1e5c49fce6 media: staging: add missing blank line after declarations in atomisp-ov5693
Fix "Missing a blank line after declarations" warning reported by
checkpatch.

Signed-off-by: Riccardo Schirone <sirmy15@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-29 06:22:24 -05:00
Sinan Kaya
2c5ff86612 media: atomisp: deprecate pci_get_bus_and_slot()
pci_get_bus_and_slot() is restrictive such that it assumes domain=0 as
where a PCI device is present. This restricts the device drivers to be
reused for other domain numbers.

Getting ready to remove pci_get_bus_and_slot() function. Since ISP always
uses domain 0, hard-code it in the code when calling the replacement
function pci_get_domain_bus_and_slot().

Signed-off-by: Sinan Kaya <okaya@codeaurora.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-29 06:21:38 -05:00
Arnd Bergmann
456e7b1804 media: staging: atomisp: convert timestamps to ktime_t
timespec overflows in 2038 on 32-bit architectures, and the
getnstimeofday() suffers from possible time jumps, so the
timestamps here are better done using ktime_get(), which has
neither of those problems.

In case of ov2680, we don't seem to use the timestamp at
all, so I just remove it.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-29 06:21:02 -05:00
Jeremy Sowden
ea90b17116 media: staging: atomisp: fixes for "symbol was not declared. Should it be static?" sparse warnings
Defined some const arrays as static since they don't need external linkage.

Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-29 06:20:35 -05:00
Jeremy Sowden
caa7d69da8 media: staging: atomisp: fix for sparse "using plain integer as NULL pointer" warnings
The "address" member of struct ia_css_host_data is a pointer-to-char,
so define default as NULL.

Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-29 06:19:36 -05:00
Fengguang Wu
201b56737f media: fix semicolon.cocci warnings
drivers/media/common/videobuf/videobuf2-core.c:2525:34-35: Unneeded semicolon

 Remove unneeded semicolon.

Generated by: scripts/coccinelle/misc/semicolon.cocci

Fixes: 03fbdb2fc2 ("media: move videobuf2 to drivers/media/common")

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
2017-12-28 14:25:07 -05:00
Mauro Carvalho Chehab
ada795551a media: don't include drivers/media/i2c at cflags
Most of the I2C headers got moved a long time ago to
include/media/i2c. Stop including them at the patch.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-28 14:14:09 -05:00
Mauro Carvalho Chehab
fada193559 media: move dvb kAPI headers to include/media
Except for DVB, all media kAPI headers are at include/media.

Move the headers to it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-28 13:16:01 -05:00
Mauro Carvalho Chehab
a114a585be media: dvb-core: get rid of mmap reserved field
The "reserved" field was a way, used at V4L2 API, to add new
data to existing structs without breaking userspace. However,
there are now clever ways of doing that, without needing to add
an uneeded overhead. So, get rid of them.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-28 11:17:31 -05:00
Mauro Carvalho Chehab
a1f18fdc72 media: dvb uAPI docs: document mmap-related ioctls
5 new ioctls were added to the DVB demux API, in order to
handle memory maped I/O. Add documentation for them.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-28 11:17:30 -05:00
Mauro Carvalho Chehab
f8aaf48771 media: dvb uAPI docs: document demux mmap/munmap syscalls
With the new dmx mmap interface, those two syscalls are now
handled by the subsystem. Document them.

This patch is based on the V4L2 text for those ioctls.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-28 11:17:30 -05:00
Mauro Carvalho Chehab
03fbdb2fc2 media: move videobuf2 to drivers/media/common
Now that VB2 is used by both V4L2 and DVB core, move it to
the common part of the subsystem.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-28 11:17:29 -05:00
Mauro Carvalho Chehab
4021053ed5 media: dvb-core: make DVB mmap API optional
This API is still experimental. Make it optional, allowing to
compile the code without it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-28 11:17:29 -05:00
Mauro Carvalho Chehab
651d666605 fs: compat_ioctl: add new DVB demux ioctls
Use trivial handling for the new DVB demux ioctls, as none
of them passes a pointer inside their structures.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-28 11:17:29 -05:00
Mauro Carvalho Chehab
7b361cf002 media: dvb_vb2: add SPDX headers
This code is released under GPL. Add the corresponding SPDX
headers.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-28 11:17:28 -05:00
Mauro Carvalho Chehab
19393a0357 media: dvb_vb2: Use the sanitized value after processed by VB2 core
if the number of buffers requested by the user is too big, the
VB core will truncate to a valid value.

Use it, instead of what the user requested.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-28 11:17:28 -05:00
Mauro Carvalho Chehab
2c06aa7c31 media: dvb_vb2: limit reqbufs size to a sane value
It is not a good idea to let users to request a very high buffer
size.

So, add an upper limit.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-28 11:17:27 -05:00
Mauro Carvalho Chehab
7b6c96d59e media: dvb_vb2: fix a warning about streamoff logic
The streamoff logic is causing those warnings:

 WARNING: CPU: 3 PID: 3382 at drivers/media/v4l2-core/videobuf2-core.c:1652 __vb2_queue_cancel+0x177/0x250 [videobuf2_core]
 Modules linked in: bnep fuse xt_CHECKSUM iptable_mangle tun ebtable_filter ebtables ip6table_filter ip6_tables xt_physdev br_netfilter bluetooth bridge rfkill ecdh_generic stp llc nf_log_ipv4 nf_log_common xt_LOG xt_conntrack ipt_MASQUERADE nf_nat_masquerade_ipv4 iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack libcrc32c sunrpc vfat fat snd_hda_codec_hdmi rc_dib0700_nec i915 rc_pinnacle_pctv_hd em28xx_rc a8293 ts2020 m88ds3103 i2c_mux em28xx_dvb dib8000 dvb_usb_dib0700 dib0070 dib7000m dib0090 dvb_usb dvb_core uvcvideo snd_usb_audio videobuf2_v4l2 dib3000mc videobuf2_vmalloc videobuf2_memops dibx000_common videobuf2_core rc_core snd_usbmidi_lib snd_rawmidi em28xx tveeprom v4l2_common videodev media intel_rapl x86_pkg_temp_thermal intel_powerclamp coretemp snd_hda_intel
 kvm_intel snd_hda_codec kvm snd_hwdep snd_hda_core snd_seq irqbypass crct10dif_pclmul crc32_pclmul i2c_algo_bit ghash_clmulni_intel snd_seq_device drm_kms_helper snd_pcm intel_cstate intel_uncore snd_timer tpm_tis drm mei_wdt iTCO_wdt iTCO_vendor_support tpm_tis_core snd intel_rapl_perf mei_me mei tpm i2c_i801 soundcore lpc_ich video binfmt_misc hid_logitech_hidpp hid_logitech_dj e1000e crc32c_intel ptp pps_core analog gameport joydev
 CPU: 3 PID: 3382 Comm: lt-dvbv5-zap Not tainted 4.14.0+ #3
 Hardware name:                  /D53427RKE, BIOS RKPPT10H.86A.0048.2017.0506.1545 05/06/2017
 task: ffff94b93bbe1e40 task.stack: ffffb7a98320c000
 RIP: 0010:__vb2_queue_cancel+0x177/0x250 [videobuf2_core]
 RSP: 0018:ffffb7a98320fd40 EFLAGS: 00010202
 RAX: 0000000000000001 RBX: ffff94b92ff72428 RCX: 0000000000000000
 RDX: 0000000000000001 RSI: 0000000000000001 RDI: ffff94b92ff72428
 RBP: ffffb7a98320fd68 R08: ffff94b92ff725d8 R09: ffffb7a98320fcc8
 R10: ffff94b978003d98 R11: ffff94b92ff72428 R12: ffff94b92ff72428
 R13: 0000000000000282 R14: ffff94b92059ae20 R15: dead000000000100
 FS:  0000000000000000(0000) GS:ffff94b99e380000(0000) knlGS:0000000000000000
 CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
 CR2: 0000555953007d70 CR3: 000000012be09004 CR4: 00000000001606e0
 Call Trace:
  vb2_core_streamoff+0x28/0x90 [videobuf2_core]
  dvb_vb2_stream_off+0xd1/0x150 [dvb_core]
  dvb_dvr_release+0x114/0x120 [dvb_core]
  __fput+0xdf/0x1e0
  ____fput+0xe/0x10
  task_work_run+0x94/0xc0
  do_exit+0x2dc/0xba0
  do_group_exit+0x47/0xb0
  SyS_exit_group+0x14/0x20
  entry_SYSCALL_64_fastpath+0x1a/0xa5
 RIP: 0033:0x7f775e931ed8
 RSP: 002b:00007fff07019d68 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
 RAX: ffffffffffffffda RBX: 0000000001d02690 RCX: 00007f775e931ed8
 RDX: 0000000000000001 RSI: 000000000000003c RDI: 0000000000000001
 RBP: 00007fff0701a500 R08: 00000000000000e7 R09: ffffffffffffff70
 R10: 00007f775e854dd8 R11: 0000000000000246 R12: 0000000000000000
 R13: 00000000035fa000 R14: 000000000000000a R15: 000000000000000a
 Code: 00 00 04 74 1c 44 89 e8 49 83 c5 01 41 39 84 24 88 01 00 00 77 8a 5b 41 5c 41 5d 41 5e 41 5f 5d c3 48 89 df e8 bb fd ff ff eb da <0f> ff 41 8b b4 24 88 01 00 00 85 f6 74 34 bb 01 00 00 00 eb 10

There are actually two issues here:

1) list_del() should be called when changing the buffer state;

2) The logic with marks the buffers as done is at the wrong place.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-28 11:17:27 -05:00
Satendra Singh Thakur
57868acc36 media: videobuf2: Add new uAPI for DVB streaming I/O
Adds a new uAPI for DVB to use streaming I/O which is implemented
based on videobuf2, using those new ioctls:

- DMX_REQBUFS:  Request kernel to allocate buffers which count and size
	        are dedicated by user.
- DMX_QUERYBUF: Get the buffer information like a memory offset which
		will mmap() and be shared with user-space.
- DMX_EXPBUF:   Just for testing whether buffer-exporting success or not.
- DMX_QBUF:     Pass the buffer to kernel-space.
- DMX_DQBUF:    Get back the buffer which may contain TS data.

Originally developed by: Junghak Sung <jh1009.sung@samsung.com>, as
seen at:
	https://patchwork.linuxtv.org/patch/31613/
	https://patchwork.kernel.org/patch/7334301/

The original patch was written before merging VB2-core functionalities
upstream. When such series was added, several adjustments were made,
fixing some issues with	V4L2, causing the original patch to be
non-trivially rebased.

After rebased, a few bugs in the patch were fixed. The patch was
also enhanced it and polling functionality got added.

The main changes over the original patch are:

dvb_vb2_fill_buffer():
	- Set the size of the outgoing buffer after while loop using
	  vb2_set_plane_payload;

	- Added NULL check for source buffer as per normal convention
	  of demux driver, this is called twice, first time with valid
	  buffer second time with NULL pointer, if its not handled,
	  it will result in  crash

	- Restricted spinlock for only list_* operations

dvb_vb2_init():
	- Restricted q->io_modes to only VB2_MMAP as its the only
	  supported mode

dvb_vb2_release():
	- Replaced the && in if condiion with &, because otherwise
	  it was always getting satisfied.

dvb_vb2_stream_off():
	- Added list_del code for enqueud buffers upon stream off

dvb_vb2_poll():
	- Added this new function in order to support polling

dvb_demux_poll() and dvb_dvr_poll()
	- dvb_vb2_poll() is now called from these functions

- Ported this patch and latest videobuf2 to lower kernel versions and
  tested auto scan.

Co-developed-by: Junghak Sung <jh1009.sung@samsung.com>

[mchehab@s-opensource.com: checkpatch fixes]
Signed-off-by: Junghak Sung <jh1009.sung@samsung.com>
Signed-off-by: Geunyoung Kim <nenggun.kim@samsung.com>
Acked-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Acked-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Satendra Singh Thakur <satendra.t@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-28 10:59:02 -05:00
Mauro Carvalho Chehab
9eb124fe79 Merge branch 'docs-next' of git://git.lwn.net/linux into patchwork
* 'docs-next' of git://git.lwn.net/linux: (888 commits)
  w1_netlink.h: add support for nested structs
  scripts: kernel-doc: apply filtering rules to warnings
  scripts: kernel-doc: improve nested logic to handle multiple identifiers
  scripts: kernel-doc: handle nested struct function arguments
  scripts: kernel-doc: print the declaration name on warnings
  scripts: kernel-doc: get rid of $nested parameter
  scripts: kernel-doc: parse next structs/unions
  scripts: kernel-doc: replace tabs by spaces
  scripts: kernel-doc: change default to ReST format
  scripts: kernel-doc: improve argument handling
  scripts: kernel-doc: get rid of unused output formats
  docs: get rid of kernel-doc-nano-HOWTO.txt
  docs: kernel-doc.rst: add documentation about man pages
  docs: kernel-doc.rst: improve typedef documentation
  docs: kernel-doc.rst: improve structs chapter
  docs: kernel-doc.rst: improve function documentation section
  docs: kernel-doc.rst: improve private members description
  docs: kernel-doc.rst: better describe kernel-doc arguments
  docs: fix process/submit-checklist.rst Sphinx warning
  docs: ftrace-uses.rst fix varios code-block directives
  ...
2017-12-22 14:38:28 -05:00
Mauro Carvalho Chehab
aa931b44ae w1_netlink.h: add support for nested structs
Now that kernel-doc can hanle nested structs/unions, describe
such fields at w1_netlink_message_types.

Acked-by: Evgeniy Polyakov <zbr@ioremap.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
2017-12-21 13:41:47 -07:00
Mauro Carvalho Chehab
2defb27292 scripts: kernel-doc: apply filtering rules to warnings
When kernel-doc is called with output selection filters,
it will be called lots of time for a single file. If
there is a warning present there, it means that it may
print hundreds of identical warnings.

Worse than that, the -function NAME actually filters only
functions. So, it makes no sense at all to print warnings
for structs or enums.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
2017-12-21 13:41:47 -07:00
Mauro Carvalho Chehab
84ce5b9877 scripts: kernel-doc: improve nested logic to handle multiple identifiers
It is possible to use nested structs like:

struct {
	struct {
		void *arg1;
	} st1, st2, *st3, st4;
};

Handling it requires to split each parameter. Change the logic
to allow such definitions.

In order to test the new nested logic, the following file
was used to test

<code>
struct foo { int a; }; /* Just to avoid errors if compiled */

/**
 * struct my_struct - a struct with nested unions and structs
 * @arg1: first argument of anonymous union/anonymous struct
 * @arg2: second argument of anonymous union/anonymous struct
 * @arg1b: first argument of anonymous union/anonymous struct
 * @arg2b: second argument of anonymous union/anonymous struct
 * @arg3: third argument of anonymous union/anonymous struct
 * @arg4: fourth argument of anonymous union/anonymous struct
 * @bar.st1.arg1: first argument of struct st1 on union bar
 * @bar.st1.arg2: second argument of struct st1 on union bar
 * @bar.st1.bar1: bar1 at st1
 * @bar.st1.bar2: bar2 at st1
 * @bar.st2.arg1: first argument of struct st2 on union bar
 * @bar.st2.arg2: second argument of struct st2 on union bar
 * @bar.st3.arg2: second argument of struct st3 on union bar
 * @f1: nested function on anonimous union/struct
 * @bar.st2.f2: nested function on named union/struct
 */
struct my_struct {
   /* Anonymous union/struct*/
   union {
	struct {
	    char arg1 : 1;
	    char arg2 : 3;
	};
       struct {
           int arg1b;
           int arg2b;
       };
       struct {
           void *arg3;
           int arg4;
           int (*f1)(char foo, int bar);
       };
   };
   union {
       struct {
           int arg1;
           int arg2;
	   struct foo bar1, *bar2;
       } st1;           /* bar.st1 is undocumented, cause a warning */
       struct {
           void *arg1;  /* bar.st3.arg1 is undocumented, cause a warning */
	    int arg2;
          int (*f2)(char foo, int bar); /* bar.st3.fn2 is undocumented, cause a warning */
       } st2, st3, *st4;
       int (*f3)(char foo, int bar); /* f3 is undocumented, cause a warning */
   } bar;               /* bar is undocumented, cause a warning */

   /* private: */
   int undoc_privat;    /* is undocumented but private, no warning */

   /* public: */
   int undoc_public;    /* is undocumented, cause a warning */
};
</code>

It produces the following warnings, as expected:

test2.h:57: warning: Function parameter or member 'bar' not described in 'my_struct'
test2.h:57: warning: Function parameter or member 'bar.st1' not described in 'my_struct'
test2.h:57: warning: Function parameter or member 'bar.st2' not described in 'my_struct'
test2.h:57: warning: Function parameter or member 'bar.st3' not described in 'my_struct'
test2.h:57: warning: Function parameter or member 'bar.st3.arg1' not described in 'my_struct'
test2.h:57: warning: Function parameter or member 'bar.st3.f2' not described in 'my_struct'
test2.h:57: warning: Function parameter or member 'bar.st4' not described in 'my_struct'
test2.h:57: warning: Function parameter or member 'bar.st4.arg1' not described in 'my_struct'
test2.h:57: warning: Function parameter or member 'bar.st4.arg2' not described in 'my_struct'
test2.h:57: warning: Function parameter or member 'bar.st4.f2' not described in 'my_struct'
test2.h:57: warning: Function parameter or member 'bar.f3' not described in 'my_struct'
test2.h:57: warning: Function parameter or member 'undoc_public' not described in 'my_struct'

Suggested-by: Markus Heiser <markus.heiser@darmarit.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
2017-12-21 13:41:47 -07:00
Mauro Carvalho Chehab
7c0d7e87a1 scripts: kernel-doc: handle nested struct function arguments
Function arguments are different than usual ones. So, an
special logic is needed in order to handle such arguments
on nested structs.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
2017-12-21 13:41:47 -07:00
Mauro Carvalho Chehab
151c468b44 scripts: kernel-doc: print the declaration name on warnings
The logic at create_parameterlist()'s ancillary push_parameter()
function has already a way to output the declaration name, with
would help to discover what declaration is missing.

However, currently, the logic is utterly broken, as it uses
the var $type with a wrong meaning. With the current code,
it will never print anything. I suspect that originally
it was using the second argument of output_declaration().

I opted to not rely on a globally defined $declaration_name,
but, instead, to pass it explicitly as a parameter.

While here, I removed a unaligned check for !$anon_struct_union.
This is not needed, as, if $anon_struct_union is not zero,
$parameterdescs{$param} will be defined.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
2017-12-21 13:41:47 -07:00