1. 29 5月, 2013 1 次提交
    • D
      HID: Bluetooth: hidp: register HID devices async · 4e713cdf
      David Herrmann 提交于
      While l2cap_user callbacks are running, the whole hci_dev is locked. Even
      if we would add more fine-grained locking to HCI core, it would still be
      called from the non-reentrant rx work-queue and thus block the event
      processing.
      
      However, if we want to perform synchronous I/O during HID device
      registration (eg., to perform device-detection), we need the HCI core
      to be able to dispatch incoming data.
      
      Therefore, we now move device-registration to a separate worker. The HCI
      core can continue running and we add devices asynchronously in another
      kernel thread. Device removal is synchronized and waits for the worker
      to exit before calling the usual device removal functions.
      
      If l2cap_user->remove is called before the thread registered the devices,
      we set "terminate" to true and the thread will skip it. If
      l2cap_user->remove is called after it, we notice this as the device
      is no longer in HIDP_SESSION_PREPARING state and simply unregister the
      device as we did before.
      There is no new deadlock as we now call hidp_session_add_dev() with
      one lock less held (the HCI lock) and it cannot itself call back into
      HCI as it was called with the HCI-lock held before.
      
      One might wonder whether this can block during device unregistration.
      But we set "terminate" to true and wake the HIDP thread up _before_
      unregistering the HID/input devices. Therefore, all pending HID I/O
      operations are canceled. All further I/O attempts will fail with ENODEV
      or EIO. So all latency we can get are few context-switches, but no
      timeouts or blocking I/O waits!
      
      This change also prepares for a long standing HID bug. All HID devices
      that register power_supply devices need to be able to handle callbacks
      during registration (a power_supply oddity that cannot easily be fixed).
      So with this patch available, we can allow HID I/O during registration
      by calling the recently introduced hid_device_io_start/stop helpers,
      which currently are a no-op for bluetooth due to this locking.
      
      Note that we cannot do the same for input devices. input-core doesn't
      allow us to call input_event() asynchronously to input_register_device(),
      which HID-core kindly allows (for good reasons).
      Fixing input-core to allow this isn't as easy as it sounds and is,
      beside simplifying HIDP, not really an improvement. Hence, we still
      register input devices synchronously as we did before. Only HID devices
      are registered asynchronously.
      Signed-off-by: NDavid Herrmann <dh.herrmann@gmail.com>
      Acked-by: NJiri Kosina <jkosina@suse.cz>
      Acked-by: NGustavo Padovan <gustavo.padovan@collabora.co.uk>
      Tested-by: NDaniel Nicoletti <dantti12@gmail.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      4e713cdf
  2. 17 4月, 2013 4 次提交
    • D
      Bluetooth: hidp: remove old session-management · 5205185d
      David Herrmann 提交于
      We have the full new session-management now available so lets switch over
      and remove all the old code. Few semantics changed, so we need to adjust
      the sock.c callers a bit. But this mostly simplifies the logic.
      Signed-off-by: NDavid Herrmann <dh.herrmann@gmail.com>
      Acked-by: NMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: NGustavo Padovan <gustavo.padovan@collabora.co.uk>
      5205185d
    • D
      Bluetooth: hidp: add new session-management helpers · b4f34d8d
      David Herrmann 提交于
      This is a rewrite of the HIDP session management. It implements HIDP as an
      l2cap_user sub-module so we get proper notification when the underlying
      connection goes away.
      
      The helpers are not yet used but only added in this commit. The old
      session management is still used and will be removed in a following patch.
      
      The old session-management was flawed. Hotplugging is horribly broken and
      we have no way of getting notified when the underlying connection goes
      down. The whole idea of removing the HID/input sub-devices from within the
      session itself is broken and suffers from major dead-locks. We never can
      guarantee that the session can unregister itself as long as we use
      synchronous shutdowns. This can only work with asynchronous shutdowns.
      However, in this case we _must_ be able to unregister the session from the
      outside as otherwise the l2cap_conn object might be unlinked before we
      are.
      
      The new session-management is based on l2cap_user. There is only one
      way how to add a session and how to delete a session: "probe" and "remove"
      callbacks from l2cap_user.
      This guarantees that the session can be registered and unregistered at
      _any_ time without any synchronous shutdown.
      On the other hand, much work has been put into proper session-refcounting.
      We can unregister/unlink the session only if we can guarantee that it will
      stay alive. But for asynchronous shutdowns we never know when the last
      user goes away so we must use proper ref-counting.
      
      The old ->conn field has been renamed to ->hconn so we can reuse ->conn in
      the new session management. No other existing HIDP code is modified.
      Signed-off-by: NDavid Herrmann <dh.herrmann@gmail.com>
      Acked-by: NMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: NGustavo Padovan <gustavo.padovan@collabora.co.uk>
      b4f34d8d
    • D
      Bluetooth: hidp: move hidp_schedule() to core.c · 3764eaa9
      David Herrmann 提交于
      There is no reason to keep this helper in the header file. No other file
      depends on it so move it into hidp/core.c where it belongs.
      Signed-off-by: NDavid Herrmann <dh.herrmann@gmail.com>
      Acked-by: NMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: NGustavo Padovan <gustavo.padovan@collabora.co.uk>
      3764eaa9
    • D
      Bluetooth: hidp: remove unused session->state field · dcc07647
      David Herrmann 提交于
      This field is always BT_CONNECTED. Remove it and set it to BT_CONNECTED in
      hidp_copy_session() unconditionally.
      
      Also note that this field is totally bogus. Userspace can query an
      hidp-session for its state. However, whenever user-space queries us, this
      field should be BT_CONNECTED. If it wasn't BT_CONNECTED, then we would be
      currently cleaning up the session and the session itself would exit in the
      next few milliseconds. Hence, there is no reason to let user-space know
      that the session will exit now if they cannot make _any_ use of that.
      
      Thus, remove the field and let user-space think that a session is always
      BT_CONNECTED as long as they can query it.
      Signed-off-by: NDavid Herrmann <dh.herrmann@gmail.com>
      Acked-by: NMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: NGustavo Padovan <gustavo.padovan@collabora.co.uk>
      dcc07647
  3. 01 7月, 2011 1 次提交
    • P
      Bluetooth: Fix hidp disconnect deadlocks and lost wakeup · 7bb59df8
      Peter Hurley 提交于
      Partial revert of commit aabf6f89. When the hidp session thread
      was converted from kernel_thread to kthread, the atomic/wakeups
      were replaced with kthread_stop. kthread_stop has blocking semantics
      which are inappropriate for the hidp session kthread. In addition,
      the kthread signals itself to terminate in hidp_process_hid_control()
      - it cannot do this with kthread_stop().
      
      Lastly, a wakeup can be lost if the wakeup happens between checking
      for the loop exit condition and setting the current state to
      TASK_INTERRUPTIBLE. (Without appropriate synchronization mechanisms,
      the task state should not be changed between the condition test and
      the yield - via schedule() - as this creates a race between the
      wakeup and resetting the state back to interruptible.)
      Signed-off-by: NPeter Hurley <peter@hurleysoftware.com>
      Signed-off-by: NGustavo F. Padovan <padovan@profusion.mobi>
      7bb59df8
  4. 21 4月, 2011 1 次提交
  5. 05 4月, 2011 1 次提交
  6. 01 4月, 2011 1 次提交
  7. 11 2月, 2011 3 次提交
  8. 21 4月, 2010 1 次提交
  9. 06 2月, 2010 1 次提交
  10. 23 8月, 2009 1 次提交
  11. 15 10月, 2008 1 次提交
    • J
      HID: hid, make parsing event driven · c500c971
      Jiri Slaby 提交于
      Next step for complete hid bus, this patch includes:
      - call parser either from probe or from hid-core if there is no probe.
      - add ll_driver structure and centralize some stuff there (open, close...)
      - split and merge usb_hid_configure and hid_probe into several functions
        to allow hooks/fixes between them
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      c500c971
  12. 27 2月, 2007 1 次提交
  13. 11 2月, 2007 1 次提交
  14. 10 2月, 2007 1 次提交
  15. 17 4月, 2005 1 次提交
    • L
      Linux-2.6.12-rc2 · 1da177e4
      Linus Torvalds 提交于
      Initial git repository build. I'm not bothering with the full history,
      even though we have it. We can create a separate "historical" git
      archive of that later if we want to, and in the meantime it's about
      3.2GB when imported into git - space that would just make the early
      git days unnecessarily complicated, when we don't have a lot of good
      infrastructure for it.
      
      Let it rip!
      1da177e4