1. 24 Jul, 2012 1 commit
  2. 23 Jul, 2012 1 commit
  3. 22 Jul, 2012 1 commit
  4. 20 Jul, 2012 10 commits
    • David Herrmann's avatar
      HID: Allow drivers to be their own listener · 4bc19f62
      David Herrmann authored
      hid-picolcd and hid-wiimote do not allow any of hidinput, hiddev or hidraw
      to claim the device but still want to remain on the bus. Hence, if a
      driver uses the raw_event callback but no other listener claimed the
      device, we still leave it on the bus as the driver handles everything by
      itself. It thus becomes its own listener.
      
      Under some circumstances (eg., hidinput_connect() fails and raw_event set)
      a device may be left on the bus even though it requires external
      listeners. But then if hidinput_connect() fails there are bigger issues
      than a device that is left unhandled. So we can safely use this heuristic
      to avoid adding another flag for special devices like hid-picolcd and
      hid-wiimote.
      
      This also removes the ugly hack from hid-picolcd as this is no longer
      required.
      Signed-off-by: default avatarDavid Herrmann <dh.herrmann@googlemail.com>
      Acked-by: default avatarHenrik Rydberg <rydberg@euromail.se>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      4bc19f62
    • Alan Stern's avatar
      HID: usbhid: fix error paths in suspend · eb055fd0
      Alan Stern authored
      This patch (as1597) fixes some of the error paths in usbhid's suspend
      routine.  The driver was not careful to restart everything that might
      have been stopped, in cases where a suspend failed.
      
      For example, once the HID_SUSPENDED flag is set, an output report
      submission would not restart the corresponding URB queue.  If a
      suspend fails, it's therefore necessary to check whether the queues
      need to be restarted.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      CC: Oliver Neukum <oliver@neukum.org>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      eb055fd0
    • Alan Stern's avatar
      HID: usbhid: check for suspend or reset before restarting · d4150c8f
      Alan Stern authored
      This patch (as1596) improves the queue-restart logic in usbhid by
      checking to see if the device is suspended or a reset is about to
      occur.  There's no point submitting an URB if either of those is
      true.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      CC: Oliver Neukum <oliver@neukum.org>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      d4150c8f
    • Alan Stern's avatar
      HID: usbhid: replace HID_REPORTED_IDLE with HID_SUSPENDED · f2b5264d
      Alan Stern authored
      This patch (as1595) improves the usbhid driver by using the
      HID_SUSPENDED bitflag to indicate that the device is suspended rather
      than using HID_REPORTED_IDLE, which the patch removes.
      
      Since HID_SUSPENDED was not being used for anything, and since the
      name "HID_REPORTED_IDLE" doesn't convey much meaning, the end result
      is easier to read and understand.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      CC: Oliver Neukum <oliver@neukum.org>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      f2b5264d
    • Alan Stern's avatar
      HID: usbhid: inline some simple routines · 93101af3
      Alan Stern authored
      This patch (as1594) simplifies the usbhid driver by inlining a couple
      of routines.  As a result of an earlier patch, irq_out_pump_restart()
      and ctrl_pump_restart() are each used in only one place.  Since they
      don't really do what their names say, and since they each involve only
      about two lines of actual code, there's no reason to keep them as
      separate functions.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      CC: Oliver Neukum <oliver@neukum.org>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      93101af3
    • Alan Stern's avatar
      HID: usbhid: fix autosuspend calls · 01a7c984
      Alan Stern authored
      This patch (as1593) fixes some logic errors in the usbhid driver
      relating to runtime PM.  The driver does not balance its calls to
      usb_autopm_get_interface_async() and usb_autopm_put_interface_async().
      
      For example, when the control queue is restarted the driver does a
      _get.  But the resume won't happen immediately, so the driver leaves
      the queue stopped.  When the resume does occur, the queue is restarted
      and a second _get occurs, with no balancing _put.
      
      The patch fixes the problem by rearranging the logic for restarting
      the queues.  All the _get/_put calls and bitflag settings in
      __usbhid_submit_report() are moved into the queue-restart routines.  A
      balancing _put call is added for the case where the queue is still
      suspended.  A call to irq_out_pump_restart(), which doesn't take all
      the right actions for restarting the irq-OUT queue, is replaced by a
      call to usbhid_restart_out_queue(), which does.  Similarly for
      ctrl_pump_restart().
      
      Finally, new code is added to prevent an autosuspend from happening
      every time an URB is cancelled, and the comments explaining what
      happens when an URB needs to be cancelled are expanded and clarified.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      CC: Oliver Neukum <oliver@neukum.org>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      01a7c984
    • Alan Stern's avatar
      HID: usbhid: fix use-after-free bug · 668160e5
      Alan Stern authored
      This patch (as1592) fixes an obscure problem in the usbhid driver.
      Under some circumstances, a control or interrupt-OUT URB can be
      submitted twice.  This will happen if the first submission fails; the
      queue pointers aren't updated, so the next time the queue is restarted
      the same URB will be submitted again.
      
      The problem is that raw_report gets deallocated during the first
      submission.  The second submission will then dereference and try to
      free an already-freed region of memory.  The patch fixes the problem
      by setting raw_report to NULL when it is deallocated and checking for
      NULL before dereferencing it.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      CC: Oliver Neukum <oliver@neukum.org>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      668160e5
    • Matthieu CASTET's avatar
      HID: hid-core: optimize in case of hidraw · b94e3c94
      Matthieu CASTET authored
      When using hidraw, hid buffer can be big and take lot's of
      time to process (interrupt) kernel context.
      Don't try to parse report if we are only interrested in hidraw.
      
      Also don't prepare data for debug stuff if no debugfs file
      are opened.
      Signed-off-by: default avatarMatthieu CASTET <matthieu.castet@parrot.com>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      b94e3c94
    • Matthieu CASTET's avatar
      HID: hidraw: fix list->buffer memleak · 4c7b417e
      Matthieu CASTET authored
      If we don't read fast enough hidraw device, hidraw_report_event
      will cycle and we will leak list->buffer.
      Also list->buffer are not free on release.
      After this patch, kmemleak report nothing.
      Signed-off-by: default avatarMatthieu CASTET <matthieu.castet@parrot.com>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      4c7b417e
    • Stefan Achatz's avatar
      HID: roccat: added sensor sysfs attribute for Savu · 11a5c818
      Stefan Achatz authored
      The sensor attr can be used to tweak the optical sensor of the Savu.
      Signed-off-by: default avatarStefan Achatz <erazor_de@users.sourceforge.net>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      11a5c818
  5. 19 Jul, 2012 7 commits
  6. 18 Jul, 2012 17 commits
  7. 17 Jul, 2012 3 commits
    • Linus Torvalds's avatar
      Merge branch 'akpm' (Andrew's patch-bomb) · de74646c
      Linus Torvalds authored
      Merge Andrew's remaining patches for 3.5:
       "Nine fixes"
      
      * Merge emailed patches from Andrew Morton <akpm@linux-foundation.org>: (9 commits)
        mm: fix lost kswapd wakeup in kswapd_stop()
        m32r: make memset() global for CONFIG_KERNEL_BZIP2=y
        m32r: add memcpy() for CONFIG_KERNEL_GZIP=y
        m32r: consistently use "suffix-$(...)"
        m32r: fix 'fix breakage from "m32r: use generic ptrace_resume code"' fallout
        m32r: fix pull clearing RESTORE_SIGMASK into block_sigmask() fallout
        m32r: remove duplicate definition of PTRACE_O_TRACESYSGOOD
        mn10300: fix "pull clearing RESTORE_SIGMASK into block_sigmask()" fallout
        bootmem: make ___alloc_bootmem_node_nopanic() really nopanic
      de74646c
    • Aaditya Kumar's avatar
      mm: fix lost kswapd wakeup in kswapd_stop() · 1c7e7f6c
      Aaditya Kumar authored
      Offlining memory may block forever, waiting for kswapd() to wake up
      because kswapd() does not check the event kthread->should_stop before
      sleeping.
      
      The proper pattern, from Documentation/memory-barriers.txt, is:
      
         ---  waker  ---
         event_indicated = 1;
         wake_up_process(event_daemon);
      
         ---  sleeper  ---
         for (;;) {
            set_current_state(TASK_UNINTERRUPTIBLE);
            if (event_indicated)
               break;
            schedule();
         }
      
         set_current_state() may be wrapped by:
            prepare_to_wait();
      
      In the kswapd() case, event_indicated is kthread->should_stop.
      
        === offlining memory (waker) ===
         kswapd_stop()
            kthread_stop()
               kthread->should_stop = 1
               wake_up_process()
               wait_for_completion()
      
        ===  kswapd_try_to_sleep (sleeper) ===
         kswapd_try_to_sleep()
            prepare_to_wait()
                 .
                 .
            schedule()
                 .
                 .
            finish_wait()
      
      The schedule() needs to be protected by a test of kthread->should_stop,
      which is wrapped by kthread_should_stop().
      
      Reproducer:
         Do heavy file I/O in background.
         Do a memory offline/online in a tight loop
      Signed-off-by: default avatarAaditya Kumar <aaditya.kumar@ap.sony.com>
      Acked-by: default avatarKOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
      Reviewed-by: default avatarMinchan Kim <minchan@kernel.org>
      Acked-by: default avatarMel Gorman <mel@csn.ul.ie>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      1c7e7f6c
    • Geert Uytterhoeven's avatar
      m32r: make memset() global for CONFIG_KERNEL_BZIP2=y · 9a75c6e5
      Geert Uytterhoeven authored
      Fix the m32r compile error:
      
        arch/m32r/boot/compressed/misc.c:31:14: error: static declaration of 'memset' follows non-static declaration
        make[5]: *** [arch/m32r/boot/compressed/misc.o] Error 1
        make[4]: *** [arch/m32r/boot/compressed/vmlinux] Error 2
      
      by removing the static keyword.
      Signed-off-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
      Cc: Hirokazu Takata <takata@linux-m32r.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      9a75c6e5