<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-toradex.git/include/media/rc-core.h, branch v4.9.56</title>
<subtitle>Linux kernel for Apalis and Colibri modules</subtitle>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/'/>
<entry>
<title>[media] get rid of a number of problems at the cross references</title>
<updated>2016-09-22T13:00:23+00:00</updated>
<author>
<name>Mauro Carvalho Chehab</name>
<email>mchehab@s-opensource.com</email>
</author>
<published>2016-09-22T10:59:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=e383ce0736f5ce74bbc0e989c6d044e29fefb9dc'/>
<id>e383ce0736f5ce74bbc0e989c6d044e29fefb9dc</id>
<content type='text'>
As warned by linuxdoc[1] tool, using:

$ for i in $(git grep kernel-doc Documentation/media/kapi/|cut -d: -f4); do kernel-lintdoc --sloppy $i; done

    include/media/v4l2-dev.h:118 :WARN: function name from comment differs:  v4l2_prio_close &lt;--&gt; v4l2_prio_check
    include/media/v4l2-mc.h:56 [kernel-doc WARN] : enum name from comment differs:  if_vid_dec_index &lt;--&gt; if_vid_dec_pad_index
    include/media/v4l2-mc.h:71 [kernel-doc WARN] : enum name from comment differs:  if_aud_dec_index &lt;--&gt; if_aud_dec_pad_index
    include/media/v4l2-mem2mem.h:396 [kernel-doc WARN] : function name from comment differs:  v4l2_m2m_num_src_bufs_ready &lt;--&gt; v4l2_m2m_num_dst_bufs_ready
    drivers/media/dvb-core/dvb_math.h:28 [kernel-doc WARN] : function name from comment differs:  cintlog2 &lt;--&gt; intlog2
    include/media/v4l2-subdev.h:215 [kernel-doc WARN] : struct name from comment differs:  s_radio &lt;--&gt; v4l2_subdev_tuner_ops
    include/media/v4l2-subdev.h:890 [kernel-doc WARN] : function name from comment differs:  v4l2_set_subdevdata &lt;--&gt; v4l2_set_subdev_hostdata
    include/media/v4l2-subdev.h:901 [kernel-doc WARN] : function name from comment differs:  v4l2_get_subdevdata &lt;--&gt; v4l2_get_subdev_hostdata
    drivers/media/dvb-core/dvb_ringbuffer.h:196 [kernel-doc WARN] : function name from comment differs:  dvb_ringbuffer_writeuser &lt;--&gt; dvb_ringbuffer_write_user
    include/media/videobuf2-core.h:399 [kernel-doc WARN] : struct name from comment differs:  vb2_ops &lt;--&gt; vb2_buf_ops
    include/media/media-entity.h:132 [kernel-doc ERROR] : duplicate parameter definition 'source'
    include/media/media-entity.h:477 [kernel-doc WARN] : function name from comment differs:  media_entity_enum_test &lt;--&gt; media_entity_enum_test_and_set
    include/media/media-entity.h:535 [kernel-doc WARN] : function name from comment differs:  gobj_to_entity &lt;--&gt; gobj_to_pad
    include/media/media-entity.h:544 [kernel-doc WARN] : function name from comment differs:  gobj_to_entity &lt;--&gt; gobj_to_link
    include/media/media-entity.h:553 [kernel-doc WARN] : function name from comment differs:  gobj_to_entity &lt;--&gt; gobj_to_intf
    include/media/media-entity.h:562 [kernel-doc WARN] : function name from comment differs:  gobj_to_entity &lt;--&gt; intf_to_devnode
    include/media/rc-core.h:234 [kernel-doc WARN] : function name from comment differs:  rc_open &lt;--&gt; rc_close
    include/media/v4l2-ctrls.h:397 [kernel-doc WARN] : missing initial short description of 'v4l2_ctrl_handler_init'
    include/media/v4l2-dev.h:118 [kernel-doc WARN] : function name from comment differs:  v4l2_prio_close &lt;--&gt; v4l2_prio_check
    include/media/v4l2-event.h:225 [kernel-doc WARN] : missing initial short description of 'v4l2_src_change_event_subscribe'

[1] https://return42.github.io/linuxdoc/linux.html

The above are real issues at the documentation. On several cases,
caused by cut-and-paste.

 Fix them.

Signed-off-by: Mauro Carvalho Chehab &lt;mchehab@s-opensource.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
As warned by linuxdoc[1] tool, using:

$ for i in $(git grep kernel-doc Documentation/media/kapi/|cut -d: -f4); do kernel-lintdoc --sloppy $i; done

    include/media/v4l2-dev.h:118 :WARN: function name from comment differs:  v4l2_prio_close &lt;--&gt; v4l2_prio_check
    include/media/v4l2-mc.h:56 [kernel-doc WARN] : enum name from comment differs:  if_vid_dec_index &lt;--&gt; if_vid_dec_pad_index
    include/media/v4l2-mc.h:71 [kernel-doc WARN] : enum name from comment differs:  if_aud_dec_index &lt;--&gt; if_aud_dec_pad_index
    include/media/v4l2-mem2mem.h:396 [kernel-doc WARN] : function name from comment differs:  v4l2_m2m_num_src_bufs_ready &lt;--&gt; v4l2_m2m_num_dst_bufs_ready
    drivers/media/dvb-core/dvb_math.h:28 [kernel-doc WARN] : function name from comment differs:  cintlog2 &lt;--&gt; intlog2
    include/media/v4l2-subdev.h:215 [kernel-doc WARN] : struct name from comment differs:  s_radio &lt;--&gt; v4l2_subdev_tuner_ops
    include/media/v4l2-subdev.h:890 [kernel-doc WARN] : function name from comment differs:  v4l2_set_subdevdata &lt;--&gt; v4l2_set_subdev_hostdata
    include/media/v4l2-subdev.h:901 [kernel-doc WARN] : function name from comment differs:  v4l2_get_subdevdata &lt;--&gt; v4l2_get_subdev_hostdata
    drivers/media/dvb-core/dvb_ringbuffer.h:196 [kernel-doc WARN] : function name from comment differs:  dvb_ringbuffer_writeuser &lt;--&gt; dvb_ringbuffer_write_user
    include/media/videobuf2-core.h:399 [kernel-doc WARN] : struct name from comment differs:  vb2_ops &lt;--&gt; vb2_buf_ops
    include/media/media-entity.h:132 [kernel-doc ERROR] : duplicate parameter definition 'source'
    include/media/media-entity.h:477 [kernel-doc WARN] : function name from comment differs:  media_entity_enum_test &lt;--&gt; media_entity_enum_test_and_set
    include/media/media-entity.h:535 [kernel-doc WARN] : function name from comment differs:  gobj_to_entity &lt;--&gt; gobj_to_pad
    include/media/media-entity.h:544 [kernel-doc WARN] : function name from comment differs:  gobj_to_entity &lt;--&gt; gobj_to_link
    include/media/media-entity.h:553 [kernel-doc WARN] : function name from comment differs:  gobj_to_entity &lt;--&gt; gobj_to_intf
    include/media/media-entity.h:562 [kernel-doc WARN] : function name from comment differs:  gobj_to_entity &lt;--&gt; intf_to_devnode
    include/media/rc-core.h:234 [kernel-doc WARN] : function name from comment differs:  rc_open &lt;--&gt; rc_close
    include/media/v4l2-ctrls.h:397 [kernel-doc WARN] : missing initial short description of 'v4l2_ctrl_handler_init'
    include/media/v4l2-dev.h:118 [kernel-doc WARN] : function name from comment differs:  v4l2_prio_close &lt;--&gt; v4l2_prio_check
    include/media/v4l2-event.h:225 [kernel-doc WARN] : missing initial short description of 'v4l2_src_change_event_subscribe'

[1] https://return42.github.io/linuxdoc/linux.html

The above are real issues at the documentation. On several cases,
caused by cut-and-paste.

 Fix them.

Signed-off-by: Mauro Carvalho Chehab &lt;mchehab@s-opensource.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge branch 'patchwork' into topic/docs-next</title>
<updated>2016-07-23T10:59:19+00:00</updated>
<author>
<name>Mauro Carvalho Chehab</name>
<email>mchehab@s-opensource.com</email>
</author>
<published>2016-07-23T10:59:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=c278256d05a2fc75b427fa6a5dc0024faa93465d'/>
<id>c278256d05a2fc75b427fa6a5dc0024faa93465d</id>
<content type='text'>
* patchwork: (1492 commits)
  [media] cec: always check all_device_types and features
  [media] cec: poll should check if there is room in the tx queue
  [media] vivid: support monitor all mode
  [media] cec: fix test for unconfigured adapter in main message loop
  [media] cec: limit the size of the transmit queue
  [media] cec: zero unused msg part after msg-&gt;len
  [media] cec: don't set fh to NULL in CEC_TRANSMIT
  [media] cec: clear all status fields before transmit and always fill in sequence
  [media] cec: CEC_RECEIVE overwrote the timeout field
  [media] cxd2841er: Reading SNR for DVB-C added
  [media] cxd2841er: Reading BER and UCB for DVB-C added
  [media] cxd2841er: fix switch-case for DVB-C
  [media] cxd2841er: fix signal strength scale for ISDB-T
  [media] cxd2841er: adjust the dB scale for DVB-C
  [media] cxd2841er: provide signal strength for DVB-C
  [media] cxd2841er: fix BER report via DVBv5 stats API
  [media] mb86a20s: apply mask to val after checking for read failure
  [media] airspy: fix error logic during device register
  [media] s5p-cec/TODO: add TODO item
  [media] cec/TODO: drop comment about sphinx documentation
  ...

Signed-off-by: Mauro Carvalho Chehab &lt;mchehab@s-opensource.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* patchwork: (1492 commits)
  [media] cec: always check all_device_types and features
  [media] cec: poll should check if there is room in the tx queue
  [media] vivid: support monitor all mode
  [media] cec: fix test for unconfigured adapter in main message loop
  [media] cec: limit the size of the transmit queue
  [media] cec: zero unused msg part after msg-&gt;len
  [media] cec: don't set fh to NULL in CEC_TRANSMIT
  [media] cec: clear all status fields before transmit and always fill in sequence
  [media] cec: CEC_RECEIVE overwrote the timeout field
  [media] cxd2841er: Reading SNR for DVB-C added
  [media] cxd2841er: Reading BER and UCB for DVB-C added
  [media] cxd2841er: fix switch-case for DVB-C
  [media] cxd2841er: fix signal strength scale for ISDB-T
  [media] cxd2841er: adjust the dB scale for DVB-C
  [media] cxd2841er: provide signal strength for DVB-C
  [media] cxd2841er: fix BER report via DVBv5 stats API
  [media] mb86a20s: apply mask to val after checking for read failure
  [media] airspy: fix error logic during device register
  [media] s5p-cec/TODO: add TODO item
  [media] cec/TODO: drop comment about sphinx documentation
  ...

Signed-off-by: Mauro Carvalho Chehab &lt;mchehab@s-opensource.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[media] doc-rst: Fix issues with RC documentation</title>
<updated>2016-07-17T17:02:43+00:00</updated>
<author>
<name>Mauro Carvalho Chehab</name>
<email>mchehab@s-opensource.com</email>
</author>
<published>2016-07-17T12:16:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=5b6137dc84f627e8497e554890ae02378c54f9f0'/>
<id>5b6137dc84f627e8497e554890ae02378c54f9f0</id>
<content type='text'>
The kernel-doc script is now broken if it doesn't find all
exported symbols documented.

Signed-off-by: Mauro Carvalho Chehab &lt;mchehab@s-opensource.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The kernel-doc script is now broken if it doesn't find all
exported symbols documented.

Signed-off-by: Mauro Carvalho Chehab &lt;mchehab@s-opensource.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[media] redrat3: make hardware timeout configurable</title>
<updated>2016-07-15T15:01:46+00:00</updated>
<author>
<name>Sean Young</name>
<email>sean@mess.org</email>
</author>
<published>2016-07-10T16:34:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=4f253cecf8cb59816d53267170440efa3e1df018'/>
<id>4f253cecf8cb59816d53267170440efa3e1df018</id>
<content type='text'>
Instead of hardcoding a timeout, let userspace change it dynamically
by adding a s_timeout ops.

Signed-off-by: Sean Young &lt;sean@mess.org&gt;
Signed-off-by: Mauro Carvalho Chehab &lt;mchehab@s-opensource.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Instead of hardcoding a timeout, let userspace change it dynamically
by adding a s_timeout ops.

Signed-off-by: Sean Young &lt;sean@mess.org&gt;
Signed-off-by: Mauro Carvalho Chehab &lt;mchehab@s-opensource.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[media] media: rc: reduce size of struct ir_raw_event</title>
<updated>2016-05-07T13:34:17+00:00</updated>
<author>
<name>Heiner Kallweit</name>
<email>hkallweit1@gmail.com</email>
</author>
<published>2016-03-17T19:39:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=5f61ff86116cf637ae926f44c1857716ec89e9fb'/>
<id>5f61ff86116cf637ae926f44c1857716ec89e9fb</id>
<content type='text'>
struct ir_raw_event currently has a size of 12 bytes on most (all?)
architectures. This can be reduced to 8 bytes whilst maintaining
full backwards compatibility.
This saves 2KB in size of struct ir_raw_event_ctrl (as element
kfifo is reduced by 512 * 4 bytes) and it allows to copy the
full struct ir_raw_event with a single 64 bit operation.

Successfully tested with the Nuvoton driver and successfully
compile-tested with the ene_ir driver (as it uses the carrier /
duty_cycle elements).

Signed-off-by: Heiner Kallweit &lt;hkallweit1@gmail.com&gt;
Signed-off-by: Mauro Carvalho Chehab &lt;mchehab@osg.samsung.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
struct ir_raw_event currently has a size of 12 bytes on most (all?)
architectures. This can be reduced to 8 bytes whilst maintaining
full backwards compatibility.
This saves 2KB in size of struct ir_raw_event_ctrl (as element
kfifo is reduced by 512 * 4 bytes) and it allows to copy the
full struct ir_raw_event with a single 64 bit operation.

Successfully tested with the Nuvoton driver and successfully
compile-tested with the ene_ir driver (as it uses the carrier /
duty_cycle elements).

Signed-off-by: Heiner Kallweit &lt;hkallweit1@gmail.com&gt;
Signed-off-by: Mauro Carvalho Chehab &lt;mchehab@osg.samsung.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[media] rc-core: allow calling rc_open with device not initialized</title>
<updated>2016-03-03T09:16:14+00:00</updated>
<author>
<name>Mauro Carvalho Chehab</name>
<email>mchehab@osg.samsung.com</email>
</author>
<published>2016-03-02T11:00:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=078600f514a12fd763ac84c86af68ef5b5267563'/>
<id>078600f514a12fd763ac84c86af68ef5b5267563</id>
<content type='text'>
The device initialization completes only after calling
input_register_device(). However, rc_open() can be called while
the device is being registered by the input/evdev core. So, we
can't expect that rc_dev-&gt;initialized to be true.

Change the logic to don't require initialized == true at rc_open
and change the type of initialized to be atomic.

this way, we can check for it earlier where it is really needed,
without needing to lock the mutex just for testing it.

Tested with nuvoton_cir driver on a NUC5i7RYB with CIR integrated on it.

Reported-by: Heiner Kallweit &lt;hkallweit1@gmail.com&gt;
Signed-off-by: Mauro Carvalho Chehab &lt;mchehab@osg.samsung.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The device initialization completes only after calling
input_register_device(). However, rc_open() can be called while
the device is being registered by the input/evdev core. So, we
can't expect that rc_dev-&gt;initialized to be true.

Change the logic to don't require initialized == true at rc_open
and change the type of initialized to be atomic.

this way, we can check for it earlier where it is really needed,
without needing to lock the mutex just for testing it.

Tested with nuvoton_cir driver on a NUC5i7RYB with CIR integrated on it.

Reported-by: Heiner Kallweit &lt;hkallweit1@gmail.com&gt;
Signed-off-by: Mauro Carvalho Chehab &lt;mchehab@osg.samsung.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[media] rc-core: don't lock device at rc_register_device()</title>
<updated>2016-02-16T10:40:41+00:00</updated>
<author>
<name>Mauro Carvalho Chehab</name>
<email>mchehab@osg.samsung.com</email>
</author>
<published>2016-02-11T12:33:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=c73bbaa4ec3eb225ffe468f80d45724d0496bf03'/>
<id>c73bbaa4ec3eb225ffe468f80d45724d0496bf03</id>
<content type='text'>
The mutex lock at rc_register_device() was added by commit 08aeb7c9a42a
("[media] rc: add locking to fix register/show race").

It is meant to avoid race issues when trying to open a sysfs file while
the RC register didn't complete.

Adding a lock there causes troubles, as detected by the Kernel lock
debug instrumentation at the Kernel:

    ======================================================
    [ INFO: possible circular locking dependency detected ]
    4.5.0-rc3+ #46 Not tainted
    -------------------------------------------------------
    systemd-udevd/2681 is trying to acquire lock:
     (s_active#171){++++.+}, at: [&lt;ffffffff8171a115&gt;] kernfs_remove_by_name_ns+0x45/0xa0

    but task is already holding lock:
     (&amp;dev-&gt;lock){+.+.+.}, at: [&lt;ffffffffa0724def&gt;] rc_register_device+0xb2f/0x1450 [rc_core]

    which lock already depends on the new lock.

    the existing dependency chain (in reverse order) is:

    -&gt; #1 (&amp;dev-&gt;lock){+.+.+.}:
           [&lt;ffffffff8124817d&gt;] lock_acquire+0x13d/0x320
           [&lt;ffffffff822de966&gt;] mutex_lock_nested+0xb6/0x860
           [&lt;ffffffffa0721f2b&gt;] show_protocols+0x3b/0x3f0 [rc_core]
           [&lt;ffffffff81cdaba5&gt;] dev_attr_show+0x45/0xc0
           [&lt;ffffffff8171f1b3&gt;] sysfs_kf_seq_show+0x203/0x3c0
           [&lt;ffffffff8171a6a1&gt;] kernfs_seq_show+0x121/0x1b0
           [&lt;ffffffff81617c71&gt;] seq_read+0x2f1/0x1160
           [&lt;ffffffff8171c911&gt;] kernfs_fop_read+0x321/0x460
           [&lt;ffffffff815abc20&gt;] __vfs_read+0xe0/0x3d0
           [&lt;ffffffff815ae90e&gt;] vfs_read+0xde/0x2d0
           [&lt;ffffffff815b1d01&gt;] SyS_read+0x111/0x230
           [&lt;ffffffff822e8636&gt;] entry_SYSCALL_64_fastpath+0x16/0x76

    -&gt; #0 (s_active#171){++++.+}:
           [&lt;ffffffff81244f24&gt;] __lock_acquire+0x4304/0x5990
           [&lt;ffffffff8124817d&gt;] lock_acquire+0x13d/0x320
           [&lt;ffffffff81717d3a&gt;] __kernfs_remove+0x58a/0x810
           [&lt;ffffffff8171a115&gt;] kernfs_remove_by_name_ns+0x45/0xa0
           [&lt;ffffffff81721592&gt;] remove_files.isra.0+0x72/0x190
           [&lt;ffffffff8172174b&gt;] sysfs_remove_group+0x9b/0x150
           [&lt;ffffffff81721854&gt;] sysfs_remove_groups+0x54/0xa0
           [&lt;ffffffff81cd97d0&gt;] device_remove_attrs+0xb0/0x140
           [&lt;ffffffff81cdb27c&gt;] device_del+0x38c/0x6b0
           [&lt;ffffffffa0724b8b&gt;] rc_register_device+0x8cb/0x1450 [rc_core]
           [&lt;ffffffffa1326a7b&gt;] dvb_usb_remote_init+0x66b/0x14d0 [dvb_usb]
           [&lt;ffffffffa1321c81&gt;] dvb_usb_device_init+0xf21/0x1860 [dvb_usb]
           [&lt;ffffffffa13517dc&gt;] dib0700_probe+0x14c/0x410 [dvb_usb_dib0700]
           [&lt;ffffffff81dbb1dd&gt;] usb_probe_interface+0x45d/0x940
           [&lt;ffffffff81ce7e7a&gt;] driver_probe_device+0x21a/0xc30
           [&lt;ffffffff81ce89b1&gt;] __driver_attach+0x121/0x160
           [&lt;ffffffff81ce21bf&gt;] bus_for_each_dev+0x11f/0x1a0
           [&lt;ffffffff81ce6cdd&gt;] driver_attach+0x3d/0x50
           [&lt;ffffffff81ce5df9&gt;] bus_add_driver+0x4c9/0x770
           [&lt;ffffffff81cea39c&gt;] driver_register+0x18c/0x3b0
           [&lt;ffffffff81db6e98&gt;] usb_register_driver+0x1f8/0x440
           [&lt;ffffffffa074001e&gt;] dib0700_driver_init+0x1e/0x1000 [dvb_usb_dib0700]
           [&lt;ffffffff810021b1&gt;] do_one_initcall+0x141/0x300
           [&lt;ffffffff8144d8eb&gt;] do_init_module+0x1d0/0x5ad
           [&lt;ffffffff812f27b6&gt;] load_module+0x6666/0x9ba0
           [&lt;ffffffff812f5fe8&gt;] SyS_finit_module+0x108/0x130
           [&lt;ffffffff822e8636&gt;] entry_SYSCALL_64_fastpath+0x16/0x76

    other info that might help us debug this:

     Possible unsafe locking scenario:

           CPU0                    CPU1
           ----                    ----
      lock(&amp;dev-&gt;lock);
                                   lock(s_active#171);
                                   lock(&amp;dev-&gt;lock);
      lock(s_active#171);

     *** DEADLOCK ***

    3 locks held by systemd-udevd/2681:
     #0:  (&amp;dev-&gt;mutex){......}, at: [&lt;ffffffff81ce8933&gt;] __driver_attach+0xa3/0x160
     #1:  (&amp;dev-&gt;mutex){......}, at: [&lt;ffffffff81ce8941&gt;] __driver_attach+0xb1/0x160
     #2:  (&amp;dev-&gt;lock){+.+.+.}, at: [&lt;ffffffffa0724def&gt;] rc_register_device+0xb2f/0x1450 [rc_core]

In this specific case, some error happened during device init,
causing IR to be disabled.

Let's fix it by adding a var that will tell when the device is
initialized. Any calls before that will return a -EINVAL.

That should prevent the race issues.

Signed-off-by: Mauro Carvalho Chehab &lt;mchehab@osg.samsung.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The mutex lock at rc_register_device() was added by commit 08aeb7c9a42a
("[media] rc: add locking to fix register/show race").

It is meant to avoid race issues when trying to open a sysfs file while
the RC register didn't complete.

Adding a lock there causes troubles, as detected by the Kernel lock
debug instrumentation at the Kernel:

    ======================================================
    [ INFO: possible circular locking dependency detected ]
    4.5.0-rc3+ #46 Not tainted
    -------------------------------------------------------
    systemd-udevd/2681 is trying to acquire lock:
     (s_active#171){++++.+}, at: [&lt;ffffffff8171a115&gt;] kernfs_remove_by_name_ns+0x45/0xa0

    but task is already holding lock:
     (&amp;dev-&gt;lock){+.+.+.}, at: [&lt;ffffffffa0724def&gt;] rc_register_device+0xb2f/0x1450 [rc_core]

    which lock already depends on the new lock.

    the existing dependency chain (in reverse order) is:

    -&gt; #1 (&amp;dev-&gt;lock){+.+.+.}:
           [&lt;ffffffff8124817d&gt;] lock_acquire+0x13d/0x320
           [&lt;ffffffff822de966&gt;] mutex_lock_nested+0xb6/0x860
           [&lt;ffffffffa0721f2b&gt;] show_protocols+0x3b/0x3f0 [rc_core]
           [&lt;ffffffff81cdaba5&gt;] dev_attr_show+0x45/0xc0
           [&lt;ffffffff8171f1b3&gt;] sysfs_kf_seq_show+0x203/0x3c0
           [&lt;ffffffff8171a6a1&gt;] kernfs_seq_show+0x121/0x1b0
           [&lt;ffffffff81617c71&gt;] seq_read+0x2f1/0x1160
           [&lt;ffffffff8171c911&gt;] kernfs_fop_read+0x321/0x460
           [&lt;ffffffff815abc20&gt;] __vfs_read+0xe0/0x3d0
           [&lt;ffffffff815ae90e&gt;] vfs_read+0xde/0x2d0
           [&lt;ffffffff815b1d01&gt;] SyS_read+0x111/0x230
           [&lt;ffffffff822e8636&gt;] entry_SYSCALL_64_fastpath+0x16/0x76

    -&gt; #0 (s_active#171){++++.+}:
           [&lt;ffffffff81244f24&gt;] __lock_acquire+0x4304/0x5990
           [&lt;ffffffff8124817d&gt;] lock_acquire+0x13d/0x320
           [&lt;ffffffff81717d3a&gt;] __kernfs_remove+0x58a/0x810
           [&lt;ffffffff8171a115&gt;] kernfs_remove_by_name_ns+0x45/0xa0
           [&lt;ffffffff81721592&gt;] remove_files.isra.0+0x72/0x190
           [&lt;ffffffff8172174b&gt;] sysfs_remove_group+0x9b/0x150
           [&lt;ffffffff81721854&gt;] sysfs_remove_groups+0x54/0xa0
           [&lt;ffffffff81cd97d0&gt;] device_remove_attrs+0xb0/0x140
           [&lt;ffffffff81cdb27c&gt;] device_del+0x38c/0x6b0
           [&lt;ffffffffa0724b8b&gt;] rc_register_device+0x8cb/0x1450 [rc_core]
           [&lt;ffffffffa1326a7b&gt;] dvb_usb_remote_init+0x66b/0x14d0 [dvb_usb]
           [&lt;ffffffffa1321c81&gt;] dvb_usb_device_init+0xf21/0x1860 [dvb_usb]
           [&lt;ffffffffa13517dc&gt;] dib0700_probe+0x14c/0x410 [dvb_usb_dib0700]
           [&lt;ffffffff81dbb1dd&gt;] usb_probe_interface+0x45d/0x940
           [&lt;ffffffff81ce7e7a&gt;] driver_probe_device+0x21a/0xc30
           [&lt;ffffffff81ce89b1&gt;] __driver_attach+0x121/0x160
           [&lt;ffffffff81ce21bf&gt;] bus_for_each_dev+0x11f/0x1a0
           [&lt;ffffffff81ce6cdd&gt;] driver_attach+0x3d/0x50
           [&lt;ffffffff81ce5df9&gt;] bus_add_driver+0x4c9/0x770
           [&lt;ffffffff81cea39c&gt;] driver_register+0x18c/0x3b0
           [&lt;ffffffff81db6e98&gt;] usb_register_driver+0x1f8/0x440
           [&lt;ffffffffa074001e&gt;] dib0700_driver_init+0x1e/0x1000 [dvb_usb_dib0700]
           [&lt;ffffffff810021b1&gt;] do_one_initcall+0x141/0x300
           [&lt;ffffffff8144d8eb&gt;] do_init_module+0x1d0/0x5ad
           [&lt;ffffffff812f27b6&gt;] load_module+0x6666/0x9ba0
           [&lt;ffffffff812f5fe8&gt;] SyS_finit_module+0x108/0x130
           [&lt;ffffffff822e8636&gt;] entry_SYSCALL_64_fastpath+0x16/0x76

    other info that might help us debug this:

     Possible unsafe locking scenario:

           CPU0                    CPU1
           ----                    ----
      lock(&amp;dev-&gt;lock);
                                   lock(s_active#171);
                                   lock(&amp;dev-&gt;lock);
      lock(s_active#171);

     *** DEADLOCK ***

    3 locks held by systemd-udevd/2681:
     #0:  (&amp;dev-&gt;mutex){......}, at: [&lt;ffffffff81ce8933&gt;] __driver_attach+0xa3/0x160
     #1:  (&amp;dev-&gt;mutex){......}, at: [&lt;ffffffff81ce8941&gt;] __driver_attach+0xb1/0x160
     #2:  (&amp;dev-&gt;lock){+.+.+.}, at: [&lt;ffffffffa0724def&gt;] rc_register_device+0xb2f/0x1450 [rc_core]

In this specific case, some error happened during device init,
causing IR to be disabled.

Let's fix it by adding a var that will tell when the device is
initialized. Any calls before that will return a -EINVAL.

That should prevent the race issues.

Signed-off-by: Mauro Carvalho Chehab &lt;mchehab@osg.samsung.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[media] rc-core: define a default timeout for drivers</title>
<updated>2015-11-19T08:50:59+00:00</updated>
<author>
<name>Eric Nelson</name>
<email>eric@nelint.com</email>
</author>
<published>2015-10-03T15:18:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=c8e1bbc52d259a07a81b0f845191ee901ff44e01'/>
<id>c8e1bbc52d259a07a81b0f845191ee901ff44e01</id>
<content type='text'>
A default timeout value of 125 ms should work for all decoders.

Declare a constant to help standardize its' use.

Signed-off-by: Eric Nelson &lt;eric@nelint.com&gt;
Signed-off-by: Mauro Carvalho Chehab &lt;mchehab@osg.samsung.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
A default timeout value of 125 ms should work for all decoders.

Declare a constant to help standardize its' use.

Signed-off-by: Eric Nelson &lt;eric@nelint.com&gt;
Signed-off-by: Mauro Carvalho Chehab &lt;mchehab@osg.samsung.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge tag 'media/v4.3-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media</title>
<updated>2015-09-06T01:21:14+00:00</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2015-09-06T01:21:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=9cfcc658da9693f65e7224e8329e40ada2f3c699'/>
<id>9cfcc658da9693f65e7224e8329e40ada2f3c699</id>
<content type='text'>
Pull media updates from Mauro Carvalho Chehab:
 - new DVB frontend drivers: ascot2e, cxd2841er, horus3a, lnbh25
 - new HDMI capture driver: tc358743
 - new driver for NetUP DVB new boards (netup_unidvb)
 - IR support for DVBSky cards (smipcie-ir)
 - Coda driver has gain macroblock tiling support
 - Renesas R-Car gains JPEG codec driver
 - new DVB platform driver for STi boards: c8sectpfe
 - added documentation for the media core kABI to device-drivers DocBook
 - lots of driver fixups, cleanups and improvements

* tag 'media/v4.3-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (297 commits)
  [media] c8sectpfe: Remove select on undefined LIBELF_32
  [media] i2c: fix platform_no_drv_owner.cocci warnings
  [media] cx231xx: Use wake_up_interruptible() instead of wake_up_interruptible_nr()
  [media] tc358743: only queue subdev notifications if devnode is set
  [media] tc358743: add missing Kconfig dependency/select
  [media] c8sectpfe: Use %pad to print 'dma_addr_t'
  [media] DocBook media: Fix typo "the the" in xml files
  [media] tc358743: make reset gpio optional
  [media] tc358743: set direction of reset gpio using devm_gpiod_get
  [media] dvbdev: document most of the functions/data structs
  [media] dvb_frontend.h: document the struct dvb_frontend
  [media] dvb-frontend.h: document struct dtv_frontend_properties
  [media] dvb-frontend.h: document struct dvb_frontend_ops
  [media] dvb: Use DVBFE_ALGO_HW where applicable
  [media] dvb_frontend.h: document struct analog_demod_ops
  [media] dvb_frontend.h: Document struct dvb_tuner_ops
  [media] Docbook: Document struct analog_parameters
  [media] dvb_frontend.h: get rid of dvbfe_modcod
  [media] add documentation for struct dvb_tuner_info
  [media] dvb_frontend: document dvb_frontend_tune_settings
  ...
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Pull media updates from Mauro Carvalho Chehab:
 - new DVB frontend drivers: ascot2e, cxd2841er, horus3a, lnbh25
 - new HDMI capture driver: tc358743
 - new driver for NetUP DVB new boards (netup_unidvb)
 - IR support for DVBSky cards (smipcie-ir)
 - Coda driver has gain macroblock tiling support
 - Renesas R-Car gains JPEG codec driver
 - new DVB platform driver for STi boards: c8sectpfe
 - added documentation for the media core kABI to device-drivers DocBook
 - lots of driver fixups, cleanups and improvements

* tag 'media/v4.3-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (297 commits)
  [media] c8sectpfe: Remove select on undefined LIBELF_32
  [media] i2c: fix platform_no_drv_owner.cocci warnings
  [media] cx231xx: Use wake_up_interruptible() instead of wake_up_interruptible_nr()
  [media] tc358743: only queue subdev notifications if devnode is set
  [media] tc358743: add missing Kconfig dependency/select
  [media] c8sectpfe: Use %pad to print 'dma_addr_t'
  [media] DocBook media: Fix typo "the the" in xml files
  [media] tc358743: make reset gpio optional
  [media] tc358743: set direction of reset gpio using devm_gpiod_get
  [media] dvbdev: document most of the functions/data structs
  [media] dvb_frontend.h: document the struct dvb_frontend
  [media] dvb-frontend.h: document struct dtv_frontend_properties
  [media] dvb-frontend.h: document struct dvb_frontend_ops
  [media] dvb: Use DVBFE_ALGO_HW where applicable
  [media] dvb_frontend.h: document struct analog_demod_ops
  [media] dvb_frontend.h: Document struct dvb_tuner_ops
  [media] Docbook: Document struct analog_parameters
  [media] dvb_frontend.h: get rid of dvbfe_modcod
  [media] add documentation for struct dvb_tuner_info
  [media] dvb_frontend: document dvb_frontend_tune_settings
  ...
</pre>
</div>
</content>
</entry>
<entry>
<title>[media] Docbook: Fix s_rx_carrier_range parameter description</title>
<updated>2015-08-22T08:25:45+00:00</updated>
<author>
<name>Mauro Carvalho Chehab</name>
<email>mchehab@osg.samsung.com</email>
</author>
<published>2015-08-22T08:25:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=fa810845efc4d3c0f159a3e7a35f009e0249c857'/>
<id>fa810845efc4d3c0f159a3e7a35f009e0249c857</id>
<content type='text'>
Warning(.//include/media/rc-core.h:178): No description found for parameter 's_rx_carrier_range'
Warning(.//include/media/rc-core.h:178): Excess struct/union/enum/typedef member 's_rx_carrier' description in 'rc_dev'

Signed-off-by: Mauro Carvalho Chehab &lt;mchehab@osg.samsung.com&gt;
Acked-by: Jonathan Corbet &lt;corbet@lwn.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Warning(.//include/media/rc-core.h:178): No description found for parameter 's_rx_carrier_range'
Warning(.//include/media/rc-core.h:178): Excess struct/union/enum/typedef member 's_rx_carrier' description in 'rc_dev'

Signed-off-by: Mauro Carvalho Chehab &lt;mchehab@osg.samsung.com&gt;
Acked-by: Jonathan Corbet &lt;corbet@lwn.net&gt;
</pre>
</div>
</content>
</entry>
</feed>
