]> git.karo-electronics.de Git - karo-tx-linux.git/log
karo-tx-linux.git
8 years agoMerge branch 'work.xattr' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Linus Torvalds [Mon, 11 Jan 2016 21:32:10 +0000 (13:32 -0800)]
Merge branch 'work.xattr' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs

Pull vfs xattr updates from Al Viro:
 "Andreas' xattr cleanup series.

  It's a followup to his xattr work that went in last cycle; -0.5KLoC"

* 'work.xattr' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
  xattr handlers: Simplify list operation
  ocfs2: Replace list xattr handler operations
  nfs: Move call to security_inode_listsecurity into nfs_listxattr
  xfs: Change how listxattr generates synthetic attributes
  tmpfs: listxattr should include POSIX ACL xattrs
  tmpfs: Use xattr handler infrastructure
  btrfs: Use xattr handler infrastructure
  vfs: Distinguish between full xattr names and proper prefixes
  posix acls: Remove duplicate xattr name definitions
  gfs2: Remove gfs2_xattr_acl_chmod
  vfs: Remove vfs_xattr_cmp

8 years agoMerge branch 'work.symlinks' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Linus Torvalds [Mon, 11 Jan 2016 21:13:23 +0000 (13:13 -0800)]
Merge branch 'work.symlinks' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs

Pull vfs RCU symlink updates from Al Viro:
 "Replacement of ->follow_link/->put_link, allowing to stay in RCU mode
  even if the symlink is not an embedded one.

  No changes since the mailbomb on Jan 1"

* 'work.symlinks' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
  switch ->get_link() to delayed_call, kill ->put_link()
  kill free_page_put_link()
  teach nfs_get_link() to work in RCU mode
  teach proc_self_get_link()/proc_thread_self_get_link() to work in RCU mode
  teach shmem_get_link() to work in RCU mode
  teach page_get_link() to work in RCU mode
  replace ->follow_link() with new method that could stay in RCU mode
  don't put symlink bodies in pagecache into highmem
  namei: page_getlink() and page_follow_link_light() are the same thing
  ufs: get rid of ->setattr() for symlinks
  udf: don't duplicate page_symlink_inode_operations
  logfs: don't duplicate page_symlink_inode_operations
  switch befs long symlinks to page_symlink_operations

8 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Linus Torvalds [Mon, 11 Jan 2016 20:54:03 +0000 (12:54 -0800)]
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs

Pull vfs compat_ioctl fixes from Al Viro:
 "This is basically Jann's patches from last week.  I have _not_
  included the stuff like switching i2c to ->compat_ioctl() into this
  one - those need more testing.

  Ideally I would like fs/compat_ioctl.c shrunk a lot, but that's a
  separate story"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
  compat_ioctl: don't call do_ioctl under set_fs(KERNEL_DS)
  compat_ioctl: don't pass fd around when not needed
  compat_ioctl: don't look up the fd twice

8 years agoMerge branch 'xfs-misc-fixes-for-4.5-2' into for-next
Dave Chinner [Mon, 11 Jan 2016 20:04:30 +0000 (07:04 +1100)]
Merge branch 'xfs-misc-fixes-for-4.5-2' into for-next

8 years agoxfs: handle dquot buffer readahead in log recovery correctly
Dave Chinner [Mon, 11 Jan 2016 20:04:01 +0000 (07:04 +1100)]
xfs: handle dquot buffer readahead in log recovery correctly

When we do dquot readahead in log recovery, we do not use a verifier
as the underlying buffer may not have dquots in it. e.g. the
allocation operation hasn't yet been replayed. Hence we do not want
to fail recovery because we detect an operation to be replayed has
not been run yet. This problem was addressed for inodes in commit
d891400 ("xfs: inode buffers may not be valid during recovery
readahead") but the problem was not recognised to exist for dquots
and their buffers as the dquot readahead did not have a verifier.

The result of not using a verifier is that when the buffer is then
next read to replay a dquot modification, the dquot buffer verifier
will only be attached to the buffer if *readahead is not complete*.
Hence we can read the buffer, replay the dquot changes and then add
it to the delwri submission list without it having a verifier
attached to it. This then generates warnings in xfs_buf_ioapply(),
which catches and warns about this case.

Fix this and make it handle the same readahead verifier error cases
as for inode buffers by adding a new readahead verifier that has a
write operation as well as a read operation that marks the buffer as
not done if any corruption is detected.  Also make sure we don't run
readahead if the dquot buffer has been marked as cancelled by
recovery.

This will result in readahead either succeeding and the buffer
having a valid write verifier, or readahead failing and the buffer
state requiring the subsequent read to resubmit the IO with the new
verifier.  In either case, this will result in the buffer always
ending up with a valid write verifier on it.

Note: we also need to fix the inode buffer readahead error handling
to mark the buffer with EIO. Brian noticed the code I copied from
there wrong during review, so fix it at the same time. Add comments
linking the two functions that handle readahead verifier errors
together so we don't forget this behavioural link in future.

cc: <stable@vger.kernel.org> # 3.12 - current
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agoxfs: inode recovery readahead can race with inode buffer creation
Dave Chinner [Mon, 11 Jan 2016 20:03:44 +0000 (07:03 +1100)]
xfs: inode recovery readahead can race with inode buffer creation

When we do inode readahead in log recovery, we do can do the
readahead before we've replayed the icreate transaction that stamps
the buffer with inode cores. The inode readahead verifier catches
this and marks the buffer as !done to indicate that it doesn't yet
contain valid inodes.

In adding buffer error notification  (i.e. setting b_error = -EIO at
the same time as as we clear the done flag) to such a readahead
verifier failure, we can then get subsequent inode recovery failing
with this error:

XFS (dm-0): metadata I/O error: block 0xa00060 ("xlog_recover_do..(read#2)") error 5 numblks 32

This occurs when readahead completion races with icreate item replay
such as:

inode readahead
find buffer
lock buffer
submit RA io
....
icreate recovery
    xfs_trans_get_buffer
find buffer
lock buffer
<blocks on RA completion>
.....
<ra completion>
fails verifier
clear XBF_DONE
set bp->b_error = -EIO
release and unlock buffer
<icreate gains lock>
icreate initialises buffer
marks buffer as done
adds buffer to delayed write queue
releases buffer

At this point, we have an initialised inode buffer that is up to
date but has an -EIO state registered against it. When we finally
get to recovering an inode in that buffer:

inode item recovery
    xfs_trans_read_buffer
find buffer
lock buffer
sees XBF_DONE is set, returns buffer
    sees bp->b_error is set
fail log recovery!

Essentially, we need xfs_trans_get_buf_map() to clear the error status of
the buffer when doing a lookup. This function returns uninitialised
buffers, so the buffer returned can not be in an error state and
none of the code that uses this function expects b_error to be set
on return. Indeed, there is an ASSERT(!bp->b_error); in the
transaction case in xfs_trans_get_buf_map() that would have caught
this if log recovery used transactions....

This patch firstly changes the inode readahead failure to set -EIO
on the buffer, and secondly changes xfs_buf_get_map() to never
return a buffer with an error state set so this first change doesn't
cause unexpected log recovery failures.

cc: <stable@vger.kernel.org> # 3.12 - current
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agoMerge remote-tracking branches 'spi/topic/sun4i', 'spi/topic/topcliff-pch' and 'spi...
Mark Brown [Mon, 11 Jan 2016 16:48:38 +0000 (16:48 +0000)]
Merge remote-tracking branches 'spi/topic/sun4i', 'spi/topic/topcliff-pch' and 'spi/topic/zynq' into spi-next

8 years agoMerge remote-tracking branches 'spi/topic/overlay', 'spi/topic/pxa2xx', 'spi/topic...
Mark Brown [Mon, 11 Jan 2016 16:48:35 +0000 (16:48 +0000)]
Merge remote-tracking branches 'spi/topic/overlay', 'spi/topic/pxa2xx', 'spi/topic/s3c64xx', 'spi/topic/sh-msiof' and 'spi/topic/spidev' into spi-next

8 years agoMerge remote-tracking branches 'spi/topic/lm70llp', 'spi/topic/loopback', 'spi/topic...
Mark Brown [Mon, 11 Jan 2016 16:48:33 +0000 (16:48 +0000)]
Merge remote-tracking branches 'spi/topic/lm70llp', 'spi/topic/loopback', 'spi/topic/mtk' and 'spi/topic/omap2-mcspi' into spi-next

8 years agoMerge remote-tracking branches 'spi/topic/dw', 'spi/topic/dw-mid', 'spi/topic/fsl...
Mark Brown [Mon, 11 Jan 2016 16:48:31 +0000 (16:48 +0000)]
Merge remote-tracking branches 'spi/topic/dw', 'spi/topic/dw-mid', 'spi/topic/fsl-espi' and 'spi/topic/imx' into spi-next

8 years agoMerge remote-tracking branches 'spi/topic/bcm63xx', 'spi/topic/butterfly', 'spi/topic...
Mark Brown [Mon, 11 Jan 2016 16:48:30 +0000 (16:48 +0000)]
Merge remote-tracking branches 'spi/topic/bcm63xx', 'spi/topic/butterfly', 'spi/topic/cadence' and 'spi/topic/davinci' into spi-next

8 years agoMerge remote-tracking branch 'spi/topic/sunxi' into spi-next
Mark Brown [Mon, 11 Jan 2016 16:48:29 +0000 (16:48 +0000)]
Merge remote-tracking branch 'spi/topic/sunxi' into spi-next

8 years agoMerge remote-tracking branch 'spi/topic/core' into spi-next
Mark Brown [Mon, 11 Jan 2016 16:48:29 +0000 (16:48 +0000)]
Merge remote-tracking branch 'spi/topic/core' into spi-next

8 years agoMerge remote-tracking branch 'spi/fix/mtk' into spi-linus
Mark Brown [Mon, 11 Jan 2016 16:48:27 +0000 (16:48 +0000)]
Merge remote-tracking branch 'spi/fix/mtk' into spi-linus

8 years ago[media] Postpone the addition of MEDIA_IOC_G_TOPOLOGY
Mauro Carvalho Chehab [Mon, 28 Dec 2015 14:03:47 +0000 (12:03 -0200)]
[media] Postpone the addition of MEDIA_IOC_G_TOPOLOGY

There are a few discussions left with regards to this ioctl:

1) the name of the new structs will contain _v2_ on it?
2) what's the best alternative to avoid compat32 issues?

Due to that, let's postpone the addition of this new ioctl to
the next Kernel version, to give people more time to discuss it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] mxl111sf: Add a tuner entity
Mauro Carvalho Chehab [Wed, 30 Dec 2015 13:09:39 +0000 (11:09 -0200)]
[media] mxl111sf: Add a tuner entity

While mxl111sf may have multiple frontends, it has just one
tuner. Reflect that on the media graph.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] dvbdev: create links on devices with multiple frontends
Mauro Carvalho Chehab [Wed, 30 Dec 2015 12:11:53 +0000 (10:11 -0200)]
[media] dvbdev: create links on devices with multiple frontends

Devices like mxl111sf-based WinTV Aero-m have multiple
frontends, all linked on the same demod. Currently, the
dvb_create_graph() function is not smart enough to create
multiple links. Fix it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media-entitiy: add a function to create multiple links
Mauro Carvalho Chehab [Wed, 30 Dec 2015 11:45:48 +0000 (09:45 -0200)]
[media] media-entitiy: add a function to create multiple links

Sometimes, it is desired to create 1:n and n:1 or even
n:n links between different entities with the same
function.

This is actually needed to support DVB devices that
have multiple frontends. While we could do a function
like that internally at the DVB core, such function is
generic enough to be at media-entity, and it could be
useful on some other places.

So, add such function.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] dvb-usb-v2: postpone removal of media_device
Mauro Carvalho Chehab [Tue, 29 Dec 2015 18:45:21 +0000 (16:45 -0200)]
[media] dvb-usb-v2: postpone removal of media_device

We should not remove the media_device until its last usage,
or we may have use after free troubles.

So, move the per-adapter media_device removal to happen at
the end of the adapter removal code.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] dvbdev: Add RF connector if needed
Mauro Carvalho Chehab [Tue, 29 Dec 2015 13:52:23 +0000 (11:52 -0200)]
[media] dvbdev: Add RF connector if needed

Several pure digital TV devices have a frontend with the tuner
integrated on it. Add the RF connector when dvb_create_media_graph()
is called on such devices.

Tested with siano and dvb_usb_mxl111sf drivers.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] dvbdev: remove two dead functions if !CONFIG_MEDIA_CONTROLLER_DVB
Mauro Carvalho Chehab [Mon, 28 Dec 2015 12:30:06 +0000 (10:30 -0200)]
[media] dvbdev: remove two dead functions if !CONFIG_MEDIA_CONTROLLER_DVB

Those functions are used only if CONFIG_MEDIA_CONTROLLER_DVB.
Without that, if !CONFIG_MEDIA_CONTROLLER_DVB, it would produce
two warnings:

drivers/media/dvb-core/dvbdev.c:219:12: warning: 'dvb_create_tsout_entity' defined but not used [-Wunused-function]
 static int dvb_create_tsout_entity(struct dvb_device *dvbdev,
            ^
drivers/media/dvb-core/dvbdev.c:264:12: warning: 'dvb_create_media_entity' defined but not used [-Wunused-function]
 static int dvb_create_media_entity(struct dvb_device *dvbdev,
            ^

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] call media_device_init() before registering the V4L2 device
Mauro Carvalho Chehab [Mon, 28 Dec 2015 11:24:23 +0000 (09:24 -0200)]
[media] call media_device_init() before registering the V4L2 device

Currently, v4l2_device_register() doesn't use the media_device
struct. So, calling media_device_init() could be called either
before or after v4l2_device_register().

Yet, it is a good practice to initialize everything before calling
the register functions. Also, the other drivers call
media_device_init() before registering the V4L2 device.

So, move the call for media_device_init() to happen earlier on
exynos4-is and s3c-camif.

This is just a cleanup patch.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] uapi/media.h: Use u32 for the number of graph objects
Mauro Carvalho Chehab [Thu, 17 Dec 2015 11:07:38 +0000 (09:07 -0200)]
[media] uapi/media.h: Use u32 for the number of graph objects

While we need to keep a u64 alignment to avoid compat32 issues,
having the number of entities/pads/links/interfaces represented
by an u64 is incoherent with the ID number, with is an u32.

In order to make it coherent, change those quantities to u32.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media-entity: don't sleep at media_device_register_entity()
Mauro Carvalho Chehab [Wed, 16 Dec 2015 17:33:54 +0000 (15:33 -0200)]
[media] media-entity: don't sleep at media_device_register_entity()

media_device_register_entity() is protected by a spin_lock.

Calling ida_pre_get() with GFP_KERNEL may put it to sleep,
with is a bad idea and causes this warning:

[ 8812.397195] BUG: sleeping function called from invalid context at mm/slub.c:1287
[ 8812.397203] in_atomic(): 1, irqs_disabled(): 0, pid: 15179, name: modprobe
[ 8812.397207] INFO: lockdep is turned off.
[ 8812.397213] CPU: 2 PID: 15179 Comm: modprobe Tainted: G    B           4.4.0-rc2+ #41
[ 8812.397218] Hardware name:                  /NUC5i7RYB, BIOS RYBDWi35.86A.0350.2015.0812.1722 08/12/2015
[ 8812.397222]  0000000000000000 ffff880314c77268 ffffffff818f8ba7 ffff8803b17dde00
[ 8812.397232]  ffff880314c77290 ffffffff811c2ee5 ffff8803b17dde00 ffffffff8284dbc9
[ 8812.397241]  0000000000000507 ffff880314c772d0 ffffffff811c30d5 0000000041b58ab3
[ 8812.397250] Call Trace:
[ 8812.397258]  [<ffffffff818f8ba7>] dump_stack+0x4b/0x64
[ 8812.397265]  [<ffffffff811c2ee5>] ___might_sleep+0x245/0x3a0
[ 8812.397270]  [<ffffffff811c30d5>] __might_sleep+0x95/0x1a0
[ 8812.397276]  [<ffffffff818fd083>] ? ida_pre_get+0x113/0x250
[ 8812.397282]  [<ffffffff8153bb77>] kmem_cache_alloc+0x197/0x250
[ 8812.397288]  [<ffffffff818fd083>] ida_pre_get+0x113/0x250
[ 8812.397293]  [<ffffffff818fd265>] ida_simple_get+0xa5/0x170
[ 8812.397298]  [<ffffffff818fd1c0>] ? ida_pre_get+0x250/0x250
[ 8812.397306]  [<ffffffffa07382d1>] media_device_register_entity+0x171/0x420 [media]
[ 8812.397318]  [<ffffffffa129e76f>] v4l2_device_register_subdev+0x34f/0x640 [videodev]
[ 8812.397324]  [<ffffffffa0768dea>] v4l2_i2c_new_subdev_board+0x12a/0x250 [v4l2_common]
[ 8812.397330]  [<ffffffffa0768fe7>] v4l2_i2c_new_subdev+0xd7/0x110 [v4l2_common]
[ 8812.397337]  [<ffffffffa0768f10>] ? v4l2_i2c_new_subdev_board+0x250/0x250 [v4l2_common]
[ 8812.397347]  [<ffffffffa13d2f76>] au0828_card_analog_fe_setup+0x2e6/0x3f0 [au0828]
[ 8812.397352]  [<ffffffff814450cc>] ? power_down+0xc4/0xc4
[ 8812.397361]  [<ffffffffa13d2c90>] ? au0828_tuner_callback+0x160/0x160 [au0828]
[ 8812.397370]  [<ffffffffa13d319f>] au0828_card_setup+0x11f/0x340 [au0828]
[ 8812.397378]  [<ffffffffa13d3080>] ? au0828_card_analog_fe_setup+0x3f0/0x3f0 [au0828]
[ 8812.397384]  [<ffffffff812a575b>] ? msleep+0x7b/0xc0
[ 8812.397393]  [<ffffffffa13d0d79>] au0828_usb_probe+0x679/0xcf0 [au0828]
[ 8812.397399]  [<ffffffff81d7619d>] usb_probe_interface+0x45d/0x940
[ 8812.397406]  [<ffffffff81ca7004>] driver_probe_device+0x454/0xd90
[ 8812.397411]  [<ffffffff81ca7940>] ? driver_probe_device+0xd90/0xd90
[ 8812.397417]  [<ffffffff81ca7940>] ? driver_probe_device+0xd90/0xd90
[ 8812.397422]  [<ffffffff81ca7a61>] __driver_attach+0x121/0x160
[ 8812.397427]  [<ffffffff81ca141f>] bus_for_each_dev+0x11f/0x1a0
[ 8812.397433]  [<ffffffff81ca1300>] ? subsys_dev_iter_exit+0x10/0x10
[ 8812.397439]  [<ffffffff822917d7>] ? _raw_spin_unlock+0x27/0x40
[ 8812.397445]  [<ffffffff81ca5d4d>] driver_attach+0x3d/0x50
[ 8812.397450]  [<ffffffff81ca5039>] bus_add_driver+0x4c9/0x770
[ 8812.397456]  [<ffffffff81ca944c>] driver_register+0x18c/0x3b0
[ 8812.397462]  [<ffffffff8124c952>] ? __raw_spin_lock_init+0x32/0x100
[ 8812.397468]  [<ffffffff81d71e58>] usb_register_driver+0x1f8/0x440
[ 8812.397473]  [<ffffffffa0208000>] ? 0xffffffffa0208000
[ 8812.397481]  [<ffffffffa02080b7>] au0828_init+0xb7/0x1000 [au0828]
[ 8812.397486]  [<ffffffff810021b1>] do_one_initcall+0x141/0x300
[ 8812.397492]  [<ffffffff81002070>] ? try_to_run_init_process+0x40/0x40
[ 8812.397497]  [<ffffffff8123bbf6>] ? trace_hardirqs_on_caller+0x16/0x590
[ 8812.397502]  [<ffffffff815406e6>] ? kasan_unpoison_shadow+0x36/0x50
[ 8812.397507]  [<ffffffff815406e6>] ? kasan_unpoison_shadow+0x36/0x50
[ 8812.397512]  [<ffffffff815406e6>] ? kasan_unpoison_shadow+0x36/0x50
[ 8812.397517]  [<ffffffff815407f7>] ? __asan_register_globals+0x87/0xa0
[ 8812.397524]  [<ffffffff814454e5>] do_init_module+0x1d0/0x5a4
[ 8812.397530]  [<ffffffff812ed7e8>] load_module+0x6648/0x9d70
[ 8812.397535]  [<ffffffff812e4b70>] ? symbol_put_addr+0x50/0x50
[ 8812.397546]  [<ffffffff812e71a0>] ? module_frob_arch_sections+0x20/0x20
[ 8812.397552]  [<ffffffff8158e950>] ? open_exec+0x50/0x50
[ 8812.397559]  [<ffffffff811648db>] ? ns_capable+0x5b/0xd0
[ 8812.397565]  [<ffffffff812f1208>] SyS_finit_module+0x108/0x130
[ 8812.397571]  [<ffffffff812f1100>] ? SyS_init_module+0x1f0/0x1f0
[ 8812.397576]  [<ffffffff81004044>] ? lockdep_sys_exit_thunk+0x12/0x14
[ 8812.397582]  [<ffffffff82292236>] entry_SYSCALL_64_fastpath+0x16/0x7a

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media-entity: increase max number of PADs
Mauro Carvalho Chehab [Wed, 16 Dec 2015 17:18:25 +0000 (15:18 -0200)]
[media] media-entity: increase max number of PADs

The DVB drivers may have 257 PADs. Get the next power of two
that would accomodate that amount.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media-entity.h: document the remaining functions
Mauro Carvalho Chehab [Wed, 16 Dec 2015 17:15:18 +0000 (15:15 -0200)]
[media] media-entity.h: document the remaining functions

There are two ancillary functions that are missing comments.

While those are used only internally at media-entity.c,
document them, for completeness.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media-device.h: use just one u32 counter for object ID
Mauro Carvalho Chehab [Wed, 16 Dec 2015 16:28:01 +0000 (14:28 -0200)]
[media] media-device.h: use just one u32 counter for object ID

Instead of using one u32 counter per type for object IDs, use
just one counter. With such change, it makes sense to simplify
the debug logs too.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media-entity.h fix documentation for several parameters
Mauro Carvalho Chehab [Wed, 16 Dec 2015 15:58:31 +0000 (13:58 -0200)]
[media] media-entity.h fix documentation for several parameters

Several parameters added by the media_ent_enum patches
were declared with wrong argument names:
include/media/media-device.h:333: warning: No description found for parameter 'entity_internal_idx_max'
include/media/media-device.h:354: warning: No description found for parameter 'ent_enum'
include/media/media-device.h:354: warning: Excess function parameter 'e' description in 'media_entity_enum_init'
include/media/media-device.h:333: warning: No description found for parameter 'entity_internal_idx_max'
include/media/media-device.h:354: warning: No description found for parameter 'ent_enum'
include/media/media-device.h:354: warning: Excess function parameter 'e' description in 'media_entity_enum_init'
include/media/media-entity.h:397: warning: No description found for parameter 'ent_enum'
include/media/media-entity.h:397: warning: Excess function parameter 'e' description in 'media_entity_enum_zero'
include/media/media-entity.h:409: warning: No description found for parameter 'ent_enum'
include/media/media-entity.h:409: warning: Excess function parameter 'e' description in 'media_entity_enum_set'
include/media/media-entity.h:424: warning: No description found for parameter 'ent_enum'
include/media/media-entity.h:424: warning: Excess function parameter 'e' description in 'media_entity_enum_clear'
include/media/media-entity.h:441: warning: No description found for parameter 'ent_enum'
include/media/media-entity.h:441: warning: Excess function parameter 'e' description in 'media_entity_enum_test'
include/media/media-entity.h:458: warning: No description found for parameter 'ent_enum'
include/media/media-entity.h:458: warning: Excess function parameter 'e' description in 'media_entity_enum_test_and_set'
include/media/media-entity.h:474: warning: No description found for parameter 'ent_enum'
include/media/media-entity.h:474: warning: Excess function parameter 'e' description in 'media_entity_enum_empty'
include/media/media-entity.h:474: warning: Excess function parameter 'entity' description in 'media_entity_enum_empty'
include/media/media-entity.h:489: warning: No description found for parameter 'ent_enum1'
include/media/media-entity.h:489: warning: No description found for parameter 'ent_enum2'
include/media/media-entity.h:489: warning: Excess function parameter 'e' description in 'media_entity_enum_intersects'
include/media/media-entity.h:489: warning: Excess function parameter 'f' description in 'media_entity_enum_intersects'

Fix them.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] DocBook: document media_entity_graph_walk_cleanup()
Mauro Carvalho Chehab [Wed, 16 Dec 2015 15:56:14 +0000 (13:56 -0200)]
[media] DocBook: document media_entity_graph_walk_cleanup()

This function was added recently, but weren't documented.
Add documentation for it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] move documentation to the header files
Mauro Carvalho Chehab [Wed, 16 Dec 2015 15:53:04 +0000 (13:53 -0200)]
[media] move documentation to the header files

Some exported functions were still documented at the .c file,
instead of documenting at the .h one.

Move the documentation to the right place, as we only use headers
at media device-drivers.xml DocBook.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media: Move MEDIA_ENTITY_MAX_PADS from media-entity.h to media-entity.c
Sakari Ailus [Wed, 16 Dec 2015 13:32:37 +0000 (11:32 -0200)]
[media] media: Move MEDIA_ENTITY_MAX_PADS from media-entity.h to media-entity.c

This isn't really a part of any interface drivers are expected to use. In
order to keep drivers from using it, hide it in media-entity.c. This was
always an arbitrary number and should be removed in the long run.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media: Remove pre-allocated entity enumeration bitmap
Sakari Ailus [Wed, 16 Dec 2015 13:32:36 +0000 (11:32 -0200)]
[media] media: Remove pre-allocated entity enumeration bitmap

The bitmaps for entity enumerations used to be statically allocated. Now
that the drivers have been converted to use the new interface which
explicitly initialises the enum objects, drop the pre-allocated bitmaps.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] staging: v4l: davinci_vpbe: Use the new media graph walk interface
Sakari Ailus [Wed, 16 Dec 2015 13:32:35 +0000 (11:32 -0200)]
[media] staging: v4l: davinci_vpbe: Use the new media graph walk interface

The media graph walk requires initialisation and cleanup soon. Update the
users to perform the soon necessary API calls.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: Prabhakar Lad <prabhakar.lad@ti.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] staging: v4l: omap4iss: Use the new media graph walk interface
Sakari Ailus [Wed, 16 Dec 2015 13:32:34 +0000 (11:32 -0200)]
[media] staging: v4l: omap4iss: Use the new media graph walk interface

The media graph walk requires initialisation and cleanup soon. Update the
users to perform the soon necessary API calls.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] staging: v4l: omap4iss: Use media entity enumeration interface
Sakari Ailus [Wed, 16 Dec 2015 13:32:33 +0000 (11:32 -0200)]
[media] staging: v4l: omap4iss: Use media entity enumeration interface

Instead of using a bitmap directly in a driver, use the new media
entity enumeration interface to perform the same.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] staging: v4l: omap4iss: Fix sub-device power management code
Sakari Ailus [Wed, 16 Dec 2015 13:32:32 +0000 (11:32 -0200)]
[media] staging: v4l: omap4iss: Fix sub-device power management code

The same bug was present in the omap4iss driver as was in the omap3isp
driver. The code got copied to the omap4iss driver while broken. Fix the
omap4iss driver as well.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Use media entity enumeration interface
Sakari Ailus [Wed, 16 Dec 2015 13:32:31 +0000 (11:32 -0200)]
[media] v4l: vsp1: Use media entity enumeration interface

Instead of using a bitmap directly in a driver, use the new media entity
enumeration interface to perform the same.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: omap3isp: Use media entity enumeration interface
Sakari Ailus [Wed, 16 Dec 2015 13:32:30 +0000 (11:32 -0200)]
[media] v4l: omap3isp: Use media entity enumeration interface

Instead of using a bitmap directly in a driver, use the new media entity
enumeration interface to perform the same.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media: Keep using the same graph walk object for a given pipeline
Sakari Ailus [Wed, 16 Dec 2015 13:32:29 +0000 (11:32 -0200)]
[media] media: Keep using the same graph walk object for a given pipeline

Initialise a given graph walk object once, and then keep using it whilst
the same pipeline is running. Once the pipeline is stopped, release the
graph walk object.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media: Use entity enums in graph walk
Sakari Ailus [Wed, 16 Dec 2015 13:32:28 +0000 (11:32 -0200)]
[media] media: Use entity enums in graph walk

This will also mean that the necessary graph related data structures will
be allocated dynamically, removing the need for maximum ID checks.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Use the new media graph walk interface
Sakari Ailus [Wed, 16 Dec 2015 13:32:27 +0000 (15:32 +0200)]
[media] v4l: vsp1: Use the new media graph walk interface

The media graph walk requires initialisation and cleanup soon. Update the
users to perform the soon necessary API calls.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: xilinx: Use the new media graph walk interface
Sakari Ailus [Wed, 16 Dec 2015 13:32:26 +0000 (11:32 -0200)]
[media] v4l: xilinx: Use the new media graph walk interface

The media graph walk requires initialisation and cleanup soon. Update the
users to perform the soon necessary API calls.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: Hyun Kwon <hyun.kwon@xilinx.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: exynos4-is: Use the new media graph walk interface
Sakari Ailus [Wed, 16 Dec 2015 13:32:25 +0000 (15:32 +0200)]
[media] v4l: exynos4-is: Use the new media graph walk interface

The media graph walk requires initialisation and cleanup soon. Update the
users to perform the soon necessary API calls.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: Javier Martinez Canillas <javier@osg.samsung.com>
Cc: Kamil Debski <k.debski@samsung.com>
Cc: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: omap3isp: Use the new media graph walk interface
Sakari Ailus [Wed, 16 Dec 2015 13:32:24 +0000 (11:32 -0200)]
[media] v4l: omap3isp: Use the new media graph walk interface

The media graph walk requires initialisation and cleanup soon. Update the
users to perform the soon necessary API calls.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media: Use the new media graph walk interface
Sakari Ailus [Wed, 16 Dec 2015 13:32:23 +0000 (15:32 +0200)]
[media] media: Use the new media graph walk interface

The media graph walk requires initialisation and cleanup soon. Update the
users to perform the soon necessary API calls.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media: Amend media graph walk API by init and cleanup functions
Sakari Ailus [Wed, 16 Dec 2015 13:32:22 +0000 (11:32 -0200)]
[media] media: Amend media graph walk API by init and cleanup functions

Add media_entity_graph_walk_init() and media_entity_graph_walk_cleanup()
functions in order to dynamically allocate memory for the graph. This is
not done in media_entity_graph_walk_start() as there are situations where
e.g. correct error handling, that itself may not fail, requires successful
graph walk.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media: Move media graph state for streamon/off to the pipeline
Sakari Ailus [Wed, 16 Dec 2015 13:32:21 +0000 (11:32 -0200)]
[media] media: Move media graph state for streamon/off to the pipeline

The struct media_entity_graph was allocated in the stack, limiting the
number of entities that could be reasonably allocated. Instead, move the
struct to struct media_pipeline which is typically allocated using
kmalloc() instead.

The intent is to keep the enumeration around for later use for the
duration of the streaming. As streaming is eventually stopped, an
unfortunate memory allocation failure would prevent stopping the
streaming. As no memory will need to be allocated, the problem is avoided
altogether.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media: Add KernelDoc documentation for struct media_entity_graph
Sakari Ailus [Wed, 16 Dec 2015 13:32:20 +0000 (11:32 -0200)]
[media] media: Add KernelDoc documentation for struct media_entity_graph

KernelDoc doesn't appear to handle anonymous structs defined inside
another gracefully. As the struct is internal to the framework graph walk
algorithm, detailed documentation isn't seen very important.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media: Move struct media_entity_graph definition up
Sakari Ailus [Wed, 16 Dec 2015 13:32:19 +0000 (11:32 -0200)]
[media] media: Move struct media_entity_graph definition up

It will be needed in struct media_pipeline shortly.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media: Add an API to manage entity enumerations
Sakari Ailus [Wed, 16 Dec 2015 13:44:32 +0000 (11:44 -0200)]
[media] media: Add an API to manage entity enumerations

This is useful in e.g. knowing whether certain operations have already
been performed for an entity. The users include the framework itself (for
graph walking) and a number of drivers.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media: Introduce internal index for media entities
Sakari Ailus [Wed, 16 Dec 2015 13:32:17 +0000 (11:32 -0200)]
[media] media: Introduce internal index for media entities

The internal index can be used internally by the framework in order to keep
track of entities for a purpose or another. The internal index is constant
while it's registered to a media device, but the same index may be re-used
once the entity having that index is unregistered.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l2-device: fix a missing error code
Dan Carpenter [Tue, 15 Dec 2015 11:04:14 +0000 (09:04 -0200)]
[media] v4l2-device: fix a missing error code

We need to set "err = -ENOMEM" here.

Fixes: 38b11f19667a ('[media] v4l2-core: create MC interfaces for devnodes')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media-device: copy_to/from_user() returns positive
Dan Carpenter [Tue, 15 Dec 2015 11:00:40 +0000 (09:00 -0200)]
[media] media-device: copy_to/from_user() returns positive

The copy_to/from_user() functions return the number of bytes *not*
copied.  They don't return error codes.

Fixes: 4f6b3f363475 ('media] media-device: add support for MEDIA_IOC_G_TOPOLOGY ioctl')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media-device: set topology version 0 at media registration
Javier Martinez Canillas [Fri, 11 Dec 2015 22:57:09 +0000 (20:57 -0200)]
[media] media-device: set topology version 0 at media registration

The G_TOPOLOGY ioctl is used to get a graph topology and since in the
future a graph can be dynamically updated, there is a way to know the
topology version so userspace can be aware that the graph has changed.

The version 0 is reserved to indicate that the graph is static (i.e no
graphs updates since the media device was registered).

So, now that the media device initialization and registration has been
split and the media device node is not exposed to user-space until all
the entities have been registered and links created, it is safe to set
a topology version 0 in media_device_register().

Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Suggested-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l2-device: Register entity before calling subdev's registered ops
Sakari Ailus [Sun, 27 Dec 2015 23:45:00 +0000 (01:45 +0200)]
[media] v4l2-device: Register entity before calling subdev's registered ops

Registering a V4L2 sub-device includes, among other things, registering
the related media entity and calling the sub-device's registered op. Since
patch "media: convert links from array to list", creating a link between
two pads requires registering the entity first. If the registered() op
involves link creation, the link list head will not be initialised before
it is used.

Resolve this by first registering the entity, then calling its
registered() op.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] usb: check media device errors
Mauro Carvalho Chehab [Mon, 28 Dec 2015 11:55:49 +0000 (09:55 -0200)]
[media] usb: check media device errors

There are now two new warnings:

drivers/media/usb/dvb-usb-v2/dvb_usb_core.c: In function 'dvb_usbv2_media_device_register':
drivers/media/usb/dvb-usb-v2/dvb_usb_core.c:433:2: warning: ignoring return value of '__media_device_register', declared with attribute warn_unused_result [-Wunused-result]
  media_device_register(adap->dvb_adap.mdev);
  ^
drivers/media/usb/dvb-usb/dvb-usb-dvb.c: In function 'dvb_usb_media_device_register':
drivers/media/usb/dvb-usb/dvb-usb-dvb.c:128:2: warning: ignoring return value of '__media_device_register', declared with attribute warn_unused_result [-Wunused-result]
  media_device_register(adap->dvb_adap.mdev);
  ^

Those are because the drivers are not properly checking if the
media device init and register were succeeded.

Fix it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media-device: split media initialization and registration
Javier Martinez Canillas [Fri, 11 Dec 2015 22:57:08 +0000 (20:57 -0200)]
[media] media-device: split media initialization and registration

The media device node is registered and so made visible to user-space
before entities are registered and links created which means that the
media graph obtained by user-space could be only partially enumerated
if that happens too early before all the graph has been created.

To avoid this race condition, split the media init and registration
in separate functions and only register the media device node when
all the pending subdevices have been registered, either explicitly
by the driver or asynchronously using v4l2_async_register_subdev().

The media_device_register() had a check for drivers not filling dev
and model fields but all drivers in mainline set them and not doing
it will be a driver bug so change the function return to void and
add a BUG_ON() for dev being NULL instead.

Also, add a media_device_cleanup() function that will destroy the
graph_mutex that is initialized in media_device_init().

[mchehab@osg.samsung.com: Fix compilation if !CONFIG_MEDIA_CONTROLLER
 and remove two warnings added by this changeset]
Suggested-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media-device: better lock media_device_unregister()
Mauro Carvalho Chehab [Tue, 15 Dec 2015 10:36:51 +0000 (08:36 -0200)]
[media] media-device: better lock media_device_unregister()

If media_device_unregister() is called by two different
drivers, a race condition may happen, as the check if the
device is not registered is not protected.

Move the spin_lock() to happen earlier in the function, in order
to prevent such race condition.

Reported-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media-device: move media entity register/unregister functions
Mauro Carvalho Chehab [Tue, 15 Dec 2015 10:26:52 +0000 (08:26 -0200)]
[media] media-device: move media entity register/unregister functions

media entity register and unregister functions are called by media
device register/unregister. Move them to occur earlier, as we'll need
an unlocked version of media_device_entity_unregister() and we don't
want to add a function prototype without needing it.

No functional changes.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media-device: check before unregister if mdev was registered
Javier Martinez Canillas [Fri, 11 Dec 2015 22:57:07 +0000 (20:57 -0200)]
[media] media-device: check before unregister if mdev was registered

Most media functions that unregister, check if the corresponding register
function succeed before. So these functions can safely be called even if a
registration was never made or the component as already been unregistered.

Add the same check to media_device_unregister() function for consistency.

This will also allow to split the media_device_register() function in an
initialization and registration functions without the need to change the
generic cleanup functions and error code paths for all the media drivers.

Suggested-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media-entity: cache media_device on object removal
Mauro Carvalho Chehab [Tue, 15 Dec 2015 10:01:13 +0000 (08:01 -0200)]
[media] media-entity: cache media_device on object removal

As pointed by Dan, the commit f8fd4c61b5ae ("[media] media-entity:
protect object creation/removal using spin lock")' leads to the
following static checker warning:

drivers/media/media-entity.c:781 media_remove_intf_link()
error: dereferencing freed memory 'link'

drivers/media/media-entity.c
   777  void media_remove_intf_link(struct media_link *link)
   778  {
   779          spin_lock(&link->graph_obj.mdev->lock);
   780          __media_remove_intf_link(link);
   781          spin_unlock(&link->graph_obj.mdev->lock);

In practice, I didn't see any troubles even with KASAN enabled. I guess
gcc optimizer internally cached the mdev reference, instead of getting
it twice. Yet, it is a very bad idea to rely on such optimization. So,
let's fix the code.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media-entity: use mutes for link setup
Mauro Carvalho Chehab [Tue, 15 Dec 2015 09:58:18 +0000 (07:58 -0200)]
[media] media-entity: use mutes for link setup

Changeset f8fd4c61b5ae ("[media] media-entity: protect object
creation/removal using spin lock") changed the object creation/removal
protection to spin lock, as this is what's used on media-device,
keeping the mutex reserved for graph traversal routines. However, it
also changed the link setup, by mistake.

This could cause troubles, as the link setup can affect the graph
traversal, and this is likely the reason for a mutex there.

So, revert media_entity_setup_link() to use mutex.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media-devnode.h: document the remaining struct/functions
Mauro Carvalho Chehab [Sun, 13 Dec 2015 11:00:00 +0000 (09:00 -0200)]
[media] media-devnode.h: document the remaining struct/functions

There is one struct and two functions that were not documented.
Add the corresponding kernel-doc documentation for them.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media-devnode: move kernel-doc documentation to the header
Mauro Carvalho Chehab [Sun, 13 Dec 2015 10:40:45 +0000 (08:40 -0200)]
[media] media-devnode: move kernel-doc documentation to the header

As we're using the headers file only for documentation, move the
two kernel-doc macros to the header, and fix it to avoid
warnings.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media-device.h: document the last functions
Mauro Carvalho Chehab [Sun, 13 Dec 2015 10:36:58 +0000 (08:36 -0200)]
[media] media-device.h: document the last functions

Add kernel-doc documentation for media_device_get_devres and
media_device_find_devres.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media-entity.h: Document some ancillary functions
Mauro Carvalho Chehab [Sun, 13 Dec 2015 10:20:46 +0000 (08:20 -0200)]
[media] media-entity.h: Document some ancillary functions

Add a basic documentation for most ancillary functions.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media: Enforce single entity->pipe in a pipeline
Sakari Ailus [Sun, 29 Nov 2015 19:20:02 +0000 (17:20 -0200)]
[media] media: Enforce single entity->pipe in a pipeline

If a different entity->pipe in a pipeline was encountered, a warning was
issued but the execution continued as if nothing had happened. Return an
error instead right there.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] DocBook: Document MEDIA_IOC_G_TOPOLOGY
Mauro Carvalho Chehab [Sat, 12 Dec 2015 12:56:13 +0000 (10:56 -0200)]
[media] DocBook: Document MEDIA_IOC_G_TOPOLOGY

Add description for this new media controller ioctl.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] DocBook: add a table for Media Controller interfaces
Mauro Carvalho Chehab [Sat, 12 Dec 2015 12:54:45 +0000 (10:54 -0200)]
[media] DocBook: add a table for Media Controller interfaces

Document the media controller interfaces at the media
uAPI docbook.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] Docbook: media-types.xml: update the existing tables
Mauro Carvalho Chehab [Sat, 12 Dec 2015 12:29:30 +0000 (10:29 -0200)]
[media] Docbook: media-types.xml: update the existing tables

There were some changes on the media types that were not reflected
on the types tables. Update them to reflect the upstream changes.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] DocBook: move data types to a separate section
Mauro Carvalho Chehab [Sat, 12 Dec 2015 11:56:07 +0000 (09:56 -0200)]
[media] DocBook: move data types to a separate section

As MEDIA_IOC_G_TOPOLOGY shares the data types already declared
for entities, pads and links, we should move those to a separate
part of the document, and use cross-references where needed.

So, move the following tables to a separate section at the
DocBook:
media-entity-type
media-entity-flag
media-pad-flag
media-link-flag

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] DocBook: MC: add the concept of interfaces
Mauro Carvalho Chehab [Sat, 12 Dec 2015 10:59:14 +0000 (08:59 -0200)]
[media] DocBook: MC: add the concept of interfaces

The Media Controller next generation patches added a new graph
element type: interfaces. It also allows links between interfaces
and entities. Update the docbook to reflect that.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] dvbdev: Document the new MC-related fields
Mauro Carvalho Chehab [Sat, 12 Dec 2015 10:25:44 +0000 (08:25 -0200)]
[media] dvbdev: Document the new MC-related fields

The Media Controller next gen patchset added several new fields
to be used with it. Document them.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media.h: let be clear that tuners need to use connectors
Mauro Carvalho Chehab [Fri, 11 Dec 2015 20:26:53 +0000 (18:26 -0200)]
[media] media.h: let be clear that tuners need to use connectors

The V4L2 core won't be adding connectors to the tuners and other
entities that need them. Let it be clear.

Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media: move MEDIA_LNK_FL_INTERFACE_LINK logic to link creation
Mauro Carvalho Chehab [Fri, 11 Dec 2015 20:09:13 +0000 (18:09 -0200)]
[media] media: move MEDIA_LNK_FL_INTERFACE_LINK logic to link creation

Instead of flagging an interface link as MEDIA_LNK_FL_INTERFACE_LINK
only when returning to userspace, do it at link creation time.

That would allow using such flag internally, and cleans up a
little bit the code for G_TOPOLOGY ioctl.

[mchehab@osg.samsung.com: folded with a fixup from Dan Carpenter,
 replacing & by &&]
Suggested-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media-entity: remove unneded enclosing parenthesis
Javier Martinez Canillas [Fri, 11 Dec 2015 17:16:36 +0000 (15:16 -0200)]
[media] media-entity: remove unneded enclosing parenthesis

Commit 86ee417578a2 ("[media] media: convert links from array to list")
had many changes that were automated using coccinelle but the semantic
patch was not smart enough to rely on operators precedence and avoid
using unnecessary enclosing parenthesis.

This patch removes them since are not needed.

Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] uvcvideo: register entity subdev on init
Javier Martinez Canillas [Fri, 11 Dec 2015 17:16:35 +0000 (15:16 -0200)]
[media] uvcvideo: register entity subdev on init

The uvc_mc_register_entities() function iterated over the entities three
times to initialize the entities, register the subdev for the ones whose
type was UVC_TT_STREAMING and to create the entities links.

But this can be simplied by merging the init and registration logic in a
single loop.

Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] uvcvideo: remove pads prefix from uvc_mc_create_pads_links()
Javier Martinez Canillas [Fri, 11 Dec 2015 17:16:34 +0000 (15:16 -0200)]
[media] uvcvideo: remove pads prefix from uvc_mc_create_pads_links()

The function uvc_mc_create_pads_links() creates entities links but the
"pads" prefix is redundant since the driver doesn't handle any other
kind of link, so it can be removed.

Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: use else if instead of continue when creating links
Javier Martinez Canillas [Fri, 11 Dec 2015 17:16:33 +0000 (15:16 -0200)]
[media] v4l: vsp1: use else if instead of continue when creating links

The for loop in the vsp1_create_entities() function that create the links,
checks the entity type and call the proper link creation function but then
it uses continue to force the next iteration of the loop to take place and
skipping code in between that creates links for different entities types.

It is more readable and easier to understand if the if else constructs is
used instead of the continue statement.

Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: remove pads prefix from *_create_pads_links()
Javier Martinez Canillas [Fri, 11 Dec 2015 17:16:32 +0000 (15:16 -0200)]
[media] v4l: vsp1: remove pads prefix from *_create_pads_links()

The functions that create entities links are called *_create_pads_links()
but the "pads" prefix is redundant since the driver doesn't handle any
other kind of link so it can be removed.

Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] staging: omap4iss: remove pads prefix from *_create_pads_links()
Javier Martinez Canillas [Fri, 11 Dec 2015 17:16:31 +0000 (15:16 -0200)]
[media] staging: omap4iss: remove pads prefix from *_create_pads_links()

The functions that create ISS internal and external entities links are
called *_create_pads_links() but the "pads" prefix is redundant since
the driver doesn't handle any other kind of link so it can be removed.

Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] omap3isp: consistently use v4l2_dev var in complete notifier
Javier Martinez Canillas [Fri, 11 Dec 2015 17:16:30 +0000 (15:16 -0200)]
[media] omap3isp: consistently use v4l2_dev var in complete notifier

The isp_subdev_notifier_complete() complete callback defines a struct
v4l2_device *v4l2_dev to avoid needing two level of indirections to
access the V4L2 subdevs but the var is not always used when possible
as when calling v4l2_device_register_subdev_nodes().

So change that to consistently use the defined v4l2_dev pointer var.

Suggested-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] omap3isp: rename single labels to just error
Javier Martinez Canillas [Fri, 11 Dec 2015 17:16:29 +0000 (15:16 -0200)]
[media] omap3isp: rename single labels to just error

Commit bc36b30fe06b ("[media] omap3isp: separate links creation from
entities init") moved the link creation logic from the entities init
functions and so removed the error_link labels from the error paths.

But after that, some functions have a single error label so it makes
more sense to rename the label to just "error" in thi case.

Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] omap3isp: remove pads prefix from isp_create_pads_links()
Javier Martinez Canillas [Fri, 11 Dec 2015 17:16:28 +0000 (15:16 -0200)]
[media] omap3isp: remove pads prefix from isp_create_pads_links()

The function that creates the links between ISP internal and external
entities is called isp_create_pads_links() but the "pads" prefix is
redundant since the driver doesn't handle any other kind of link so
it can just be removed.

While being there, fix the function's kernel-doc since is not using
a proper format.

Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] omap3isp: remove per ISP module link creation functions
Javier Martinez Canillas [Fri, 11 Dec 2015 17:16:27 +0000 (15:16 -0200)]
[media] omap3isp: remove per ISP module link creation functions

The entities to video nodes links were created on separate functions for
each ISP module but since the only thing that these functions do is to
call media_create_pad_link(), there's no need for that indirection level
and all link creation logic can be just inlined in the caller function.

Also, since the only possible failure for the link creation is a memory
allocation, there is no need for error messages since the core already
reports a very verbose message in that case.

Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media-device: Use u64 ints for pointers
Mauro Carvalho Chehab [Fri, 11 Dec 2015 18:07:57 +0000 (16:07 -0200)]
[media] media-device: Use u64 ints for pointers

By using u64 integers and pointers, we can get rid of compat32
logic. So, let's do it!

Suggested-by: Arnd Bergmann <arnd@arndb.de>
Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media-device.h: Let clearer that entity function must be initialized
Mauro Carvalho Chehab [Fri, 11 Dec 2015 14:41:12 +0000 (12:41 -0200)]
[media] media-device.h: Let clearer that entity function must be initialized

Improve the documentation to let it clear that the entity function
must be initialized.

Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media: use unsigned for pad index
Mauro Carvalho Chehab [Fri, 11 Dec 2015 14:23:23 +0000 (12:23 -0200)]
[media] media: use unsigned for pad index

The pad index is unsigned. Replace the occurences of it where
pertinent.

Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media-entity.h: move kernel-doc tags from media-entity.c
Mauro Carvalho Chehab [Fri, 11 Dec 2015 14:14:58 +0000 (12:14 -0200)]
[media] media-entity.h: move kernel-doc tags from media-entity.c

Several additional functions are described at media-entity.c.
Moving them to the header file, to make the code cleaner and
to have all such macros at the same place.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media_entity: rename media_obj functions to *_create *_destroy
Mauro Carvalho Chehab [Fri, 11 Dec 2015 13:55:40 +0000 (11:55 -0200)]
[media] media_entity: rename media_obj functions to *_create *_destroy

Those media_obj_* functions are actually creating/destroying
media graph objects. So, rename them to better represent
what they're actually doing.

No functional changes.

This was created via this small shell script:

for i in $(git grep -l media_gobj_init); do sed s,media_gobj_init,media_gobj_create,g <$i >a && mv a $i; done
for i in $(git grep -l media_gobj_remove); do sed s,media_gobj_remove,media_gobj_destroy,g <$i >a && mv a $i; done

Suggested-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media_entity: get rid of a unused var
Mauro Carvalho Chehab [Fri, 11 Dec 2015 13:25:23 +0000 (11:25 -0200)]
[media] media_entity: get rid of a unused var

> > > + if (rlink != link->reverse) {
> > > + r++;
> >
> > The variable is incremented here but otherwise never used, you can remove it.

Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media-entity: get rid of forward __media_entity_remove_link() declaration
Mauro Carvalho Chehab [Fri, 11 Dec 2015 13:19:38 +0000 (11:19 -0200)]
[media] media-entity: get rid of forward __media_entity_remove_link() declaration

Move this function to happen earlier, in order to avoid
a uneeded forward declaration.

Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media: remove extra blank lines
Mauro Carvalho Chehab [Fri, 11 Dec 2015 13:12:57 +0000 (11:12 -0200)]
[media] media: remove extra blank lines

No functional changes.

Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media-device.h: Improve documentation and update it
Mauro Carvalho Chehab [Fri, 11 Dec 2015 13:06:08 +0000 (11:06 -0200)]
[media] media-device.h: Improve documentation and update it

Now that we moved the content of the media-framework.txt into
the kerneldoc documentation, move the per-function specific
documentation to the corresponding functions and clean it up.

It would be good if we had already the markdown kernel-doc
patches merged upstream, but, while we doesn't have it,
let's make it less ugly at device-drivers.xml.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media-entity.h: convert media_entity_cleanup to inline
Mauro Carvalho Chehab [Fri, 11 Dec 2015 11:13:23 +0000 (09:13 -0200)]
[media] media-entity.h: convert media_entity_cleanup to inline

This function was used in the past to free the links
that were allocated by the media controller core.

However, this is not needed anymore. We should likely
get rid of the funcion on some function, but, for now,
let's just convert into an inlined function and let the
compiler to get rid of it.

Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] DocBook: Move media-framework.txt contents to media-device.h
Mauro Carvalho Chehab [Fri, 11 Dec 2015 10:21:39 +0000 (08:21 -0200)]
[media] DocBook: Move media-framework.txt contents to media-device.h

Instead of using a text file, let's put it together with the
struct documentation for the Media Controller.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media-entity.h: get rid of revision and group_id fields
Mauro Carvalho Chehab [Fri, 11 Dec 2015 10:02:19 +0000 (08:02 -0200)]
[media] media-entity.h: get rid of revision and group_id fields

Both revision and group_id fields were never used and were always
initialized to zero. Remove them.

Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media framework: rename pads init function to media_entity_pads_init()
Mauro Carvalho Chehab [Fri, 11 Dec 2015 09:44:40 +0000 (07:44 -0200)]
[media] media framework: rename pads init function to media_entity_pads_init()

With the MC next gen rework, what's left for media_entity_init()
is to just initialize the PADs. However, certain devices, like
a FLASH led/light doesn't have any input or output PAD.

So, there's no reason why calling media_entity_init() would be
mandatory. Also, despite its name, what this function actually
does is to initialize the PADs data. So, rename it to
media_entity_pads_init() in order to reflect that.

The media entity actual init happens during entity register,
at media_device_register_entity(). We should move init of
num_links and num_backlinks to it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media-device: better name Kernelspace/Userspace links
Mauro Carvalho Chehab [Fri, 11 Dec 2015 09:25:01 +0000 (07:25 -0200)]
[media] media-device: better name Kernelspace/Userspace links

The __media_device_enum_links() copies links definitions from
Kernelspace to userspace. It has to work with 3 structs that
handle with links. Better name them to:
link: Kernelspace internal link representation, of the
type media_link;
klink_desc:  struct media_link_desc pointer to the
kernel memory where the data will be filled;
ulink_desc:  struct media_link_desc pointer to the
memory where the data will be copied to
userspace.

Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media-device: put headers in alphabetic order
Mauro Carvalho Chehab [Fri, 11 Dec 2015 09:23:09 +0000 (07:23 -0200)]
[media] media-device: put headers in alphabetic order

It is better to keep the headers in alphabetic order.

Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>