1. 22 9月, 2016 1 次提交
    • H
      [media] media: rc: fix deadlock when module ir_lirc_codec is removed · 033919e0
      Heiner Kallweit 提交于
      When removing module ir_lirc_codec I got this deadlock warning.
      Fix this by introducing a separate mutex to protect access
      to available_protocols instead of using ir_raw_handler_lock
      for this purpose.
      
      ======================================================
      [ INFO: possible circular locking dependency detected ]
      4.7.0-next-20160729 #1 Not tainted
      -------------------------------------------------------
      rmmod/2542 is trying to acquire lock:
       (&dev->lock){+.+.+.}, at: [<ffffffffa03b1267>]
      			ir_raw_handler_unregister+0x77/0xd0 [rc_core]
      
      but task is already holding lock:
       (ir_raw_handler_lock){+.+.+.}, at: [<ffffffffa03b1212>]
      			ir_raw_handler_unregister+0x22/0xd0 [rc_core]
      
      which lock already depends on the new lock.
      
      the existing dependency chain (in reverse order) is:
      
      -> #1 (ir_raw_handler_lock){+.+.+.}:
             [<ffffffff810ab1f2>] lock_acquire+0xb2/0x1e0
             [<ffffffff815c087f>] mutex_lock_nested+0x5f/0x360
             [<ffffffffa03b1403>] ir_raw_get_allowed_protocols+0x13/0x30 [rc_core]
             [<ffffffffa03af8ea>] store_protocols+0x2fa/0x480 [rc_core]
             [<ffffffff8143e143>] dev_attr_store+0x13/0x20
             [<ffffffff81213c50>] sysfs_kf_write+0x40/0x50
             [<ffffffff81212f60>] kernfs_fop_write+0x150/0x1e0
             [<ffffffff81197613>] __vfs_write+0x23/0x120
             [<ffffffff81198740>] vfs_write+0xb0/0x190
             [<ffffffff81199a34>] SyS_write+0x44/0xa0
             [<ffffffff815c55a5>] entry_SYSCALL_64_fastpath+0x18/0xa8
      
      -> #0 (&dev->lock){+.+.+.}:
             [<ffffffff810aac8c>] __lock_acquire+0x10fc/0x1270
             [<ffffffff810ab1f2>] lock_acquire+0xb2/0x1e0
             [<ffffffff815c087f>] mutex_lock_nested+0x5f/0x360
             [<ffffffffa03b1267>] ir_raw_handler_unregister+0x77/0xd0 [rc_core]
             [<ffffffffa03c8c05>] ir_lirc_codec_exit+0x10/0x12 [ir_lirc_codec]
             [<ffffffff810e1b88>] SyS_delete_module+0x168/0x220
             [<ffffffff815c55a5>] entry_SYSCALL_64_fastpath+0x18/0xa8
      
      other info that might help us debug this:
      
       Possible unsafe locking scenario:
      
             CPU0                    CPU1
             ----                    ----
        lock(ir_raw_handler_lock);
                                     lock(&dev->lock);
                                     lock(ir_raw_handler_lock);
        lock(&dev->lock);
      
       *** DEADLOCK ***
      
      1 lock held by rmmod/2542:
       #0:  (ir_raw_handler_lock){+.+.+.}, at: [<ffffffffa03b1212>]
      			ir_raw_handler_unregister+0x22/0xd0 [rc_core]
      
      stack backtrace:
      CPU: 0 PID: 2542 Comm: rmmod Not tainted 4.7.0-next-20160729 #1
      Hardware name: ZOTAC ZBOX-CI321NANO/ZBOX-CI321NANO, BIOS B246P105 06/01/2015
       0000000000000000 ffff88006e607cc0 ffffffff812715f5 ffffffff8232b230
       ffffffff8232b230 ffff88006e607d00 ffffffff810a846e 00000000790107f0
       ffff880079010818 ffff8800790107f0 1efeb9f4f0dd2e6f ffff880079010000
      Call Trace:
       [<ffffffff812715f5>] dump_stack+0x68/0x93
       [<ffffffff810a846e>] print_circular_bug+0x1be/0x210
       [<ffffffff810aac8c>] __lock_acquire+0x10fc/0x1270
       [<ffffffff810bcead>] ? debug_lockdep_rcu_enabled+0x1d/0x20
       [<ffffffff810ab1f2>] lock_acquire+0xb2/0x1e0
       [<ffffffffa03b1267>] ? ir_raw_handler_unregister+0x77/0xd0 [rc_core]
       [<ffffffff815c087f>] mutex_lock_nested+0x5f/0x360
       [<ffffffffa03b1267>] ? ir_raw_handler_unregister+0x77/0xd0 [rc_core]
       [<ffffffff810a980e>] ? trace_hardirqs_on_caller+0xee/0x1b0
       [<ffffffffa03b1267>] ir_raw_handler_unregister+0x77/0xd0 [rc_core]
       [<ffffffffa03c8c05>] ir_lirc_codec_exit+0x10/0x12 [ir_lirc_codec]
       [<ffffffff810e1b88>] SyS_delete_module+0x168/0x220
       [<ffffffff815c55a5>] entry_SYSCALL_64_fastpath+0x18/0xa8
      Signed-off-by: NHeiner Kallweit <hkallweit1@gmail.com>
      Signed-off-by: NMauro Carvalho Chehab <mchehab@s-opensource.com>
      033919e0
  2. 25 1月, 2016 1 次提交
    • H
      [media] media: rc: raw: improve FIFO handling · 464254e5
      Heiner Kallweit 提交于
      The FIFO is used for ir_raw_event records, however for some historic
      reason the FIFO is used on a per byte basis. IMHO this adds unneeded
      complexity. Therefore set up the FIFO for ir_raw_event records.
      
      This also allows to define the FIFO statically as part of
      ir_raw_event_ctrl instead of having to allocate the FIFO dynamically.
      In addition:
      
      - When writing into the FIFO and it's full return ENOSPC instead of
        ENOMEM thus making it easier to tell between "FIFO full" and
        "Dynamic memory allocation failed" when the error is propagated to
        a higher level.
        Also add an error message.
      
      - When reading from the FIFO check whether it's empty.
        This is not strictly needed here but kfifo_out is annotated
        "must check" anyway.
      
      Successfully tested it with the nuvoton-cir driver.
      Signed-off-by: NHeiner Kallweit <hkallweit1@gmail.com>
      Signed-off-by: NMauro Carvalho Chehab <mchehab@osg.samsung.com>
      464254e5
  3. 04 12月, 2015 1 次提交
  4. 19 11月, 2015 3 次提交
  5. 19 8月, 2015 3 次提交
  6. 06 7月, 2015 1 次提交
  7. 15 5月, 2015 3 次提交
  8. 30 10月, 2014 1 次提交
  9. 27 7月, 2014 1 次提交
  10. 26 7月, 2014 2 次提交
  11. 24 7月, 2014 1 次提交
  12. 12 3月, 2014 1 次提交
  13. 07 2月, 2014 1 次提交
  14. 06 2月, 2014 1 次提交
  15. 23 3月, 2013 1 次提交
  16. 28 12月, 2012 1 次提交
  17. 14 8月, 2012 1 次提交
  18. 11 4月, 2012 1 次提交
    • S
      [media] [3.3.0] ir-raw: remove BUG_ON in ir_raw_event_thread · 004ac388
      Srinivas Kandagatla 提交于
      This patch removes BUG_ON in ir_raw_event_thread which IMO is a
      over-kill, and this kills the ir_raw_event_thread too. With a bit of
      additional logic in this patch, we nomore need to kill this thread.
      Other disadvantage of having a BUG-ON is,
      wake_up_process(dev->raw->thread) called on dead thread via
      ir_raw_event_handle will result in total lockup in SMP system.
      
      Advantage of this patch is ir-raw event thread is left in a usable state
      even if the fifo does not have enough bytes.
      
      This patch sets the thread into TASK_INTERRUPTIBLE if raw-fifo has less
      then sizeof(struct ir_raw_event) bytes.
      Signed-off-by: NSrinivas Kandagatla <srinivas.kandagatla@st.com>
      Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
      004ac388
  19. 24 11月, 2011 1 次提交
  20. 01 11月, 2011 2 次提交
  21. 28 7月, 2011 1 次提交
    • J
      [media] rc-core support for Microsoft IR keyboard/mouse · f5f2cc64
      Jarod Wilson 提交于
      This is a custom IR protocol decoder, for the RC-6-ish protocol used by
      the Microsoft Remote Keyboard, apparently developed internally at
      Microsoft, and officially dubbed MCIR-2, per their March 2011 remote and
      transceiver requirements and specifications document, which also touches
      on this IR keyboard/mouse device.
      
      Its a standard keyboard with embedded thumb stick mouse pointer and
      mouse buttons, along with a number of media keys. The media keys are
      standard RC-6, identical to the signals from the stock MCE remotes, and
      will be handled as such. The keyboard and mouse signals will be decoded
      and delivered to the system by an input device registered specifically
      by this driver.
      
      Successfully tested with multiple mceusb-driven transceivers, as well as
      with fintek-cir and redrat3 hardware. Essentially, any raw IR hardware
      with enough sampling resolution should be able to use this decoder,
      nothing about it is at all receiver-hardware-specific.
      
      This work is inspired by lirc_mod_mce:
      
      The documentation there and code aided in understanding and decoding the
      protocol, but the bulk of the code is actually borrowed more from the
      existing in-kernel decoders than anything. I did recycle the keyboard
      keycode table, a few defines, and some of the keyboard and mouse data
      parsing bits from lirc_mod_mce though.
      
      Special thanks to James Meyer for providing the hardware, and being
      patient with me as I took forever to get around to writing this.
      
      callback routine to ensure we don't get any stuck keys, and used
      symbolic names for the keytable. Also cc'ing Florian this time, who I
      believe is the original mod-mce author...
      
      CC: Florian Demski <fdemski@users.sourceforge.net>
      Signed-off-by: NJarod Wilson <jarod@redhat.com>
      Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
      f5f2cc64
  22. 02 7月, 2011 1 次提交
    • J
      [media] rc: fix ghost keypresses with certain hw · 3f5c4c73
      Jarod Wilson 提交于
      With hardware that has to use ir_raw_event_store_edge to collect IR
      sample durations, we were not doing an event reset unless
      IR_MAX_DURATION had passed. That's around 4 seconds. So if someone
      presses up, then down, with less than 4 seconds in between, they'd get
      the initial up, then up and down upon pressing down.
      
      To fix this, I've lowered the "send a reset event" logic's threshold to
      the input device's REP_DELAY (defaults to 500ms), and with an
      saa7134-based GPIO-driven IR receiver in a Hauppauge HVR-1150, I get
      *much* better behavior out of the remote now. Special thanks to Devin
      for providing the hardware to investigate this issue.
      
      CC: stable@kernel.org
      CC: Devin Heitmueller <dheitmueller@kernellabs.com>
      Signed-off-by: NJarod Wilson <jarod@redhat.com>
      Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
      3f5c4c73
  23. 31 3月, 2011 1 次提交
  24. 02 2月, 2011 1 次提交
  25. 19 1月, 2011 1 次提交
  26. 29 12月, 2010 6 次提交
  27. 21 10月, 2010 1 次提交