15 Sep, 2018

1 commit

  • [ Upstream commit 100294cee9a98bfd4d6cb2d1c8a8aef0e959b0c4 ]

    Some of fuzzers set panic_on_warn=1 so that they can handle WARN()ings
    the same way they handle full-blown kernel crashes. We used WARN() in
    input_alloc_absinfo() to get a better idea where memory allocation
    failed, but since then kmalloc() and friends started dumping call stack on
    memory allocation failures anyway, so we are not getting anything extra
    from WARN().

    Because of the above, let's replace WARN with dev_err(). We use dev_err()
    instead of simply removing message and relying on kcalloc() to give us
    stack dump so that we'd know the instance of hardware device to which we
    were trying to attach input device.

    Reported-by: Dmitry Vyukov
    Acked-by: Dmitry Vyukov
    Signed-off-by: Dmitry Torokhov
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Dmitry Torokhov
     

20 Oct, 2017

2 commits


13 Jul, 2017

1 commit

  • attribute_groups are not supposed to change at runtime. All functions
    working with attribute_groups provided by work with const
    attribute_group. So mark the non-const structs as const.

    File size before:
    text data bss dec hex filename
    17755 1312 16 19083 4a8b drivers/input/input.o

    File size After adding 'const':
    text data bss dec hex filename
    17947 1120 16 19083 4a8b drivers/input/input.o

    Signed-off-by: Arvind Yadav
    Signed-off-by: Dmitry Torokhov

    Arvind Yadav
     

11 May, 2017

3 commits


02 Feb, 2017

1 commit

  • If device is supposed to send absolute events (i.e. EV_ABS bit is set in
    dev->evbit) but dev->absinfo is not allocated, then the driver has done
    something wrong, and we should not register such device. Otherwise we'll
    crash later, when driver tries to send absolute event.

    Reviewed-by: Benjamin Tissoires
    Acked-by: Jiri Kosina
    Signed-off-by: Dmitry Torokhov

    Dmitry Torokhov
     

25 Jan, 2017

1 commit

  • Declare device_type structures as const as they are only stored in the
    type field of a device structure. This field is of type const, so add
    const to declaration of device_type structures.

    File size before:
    text data bss dec hex filename
    17184 1344 80 18608 48b0 drivers/input/input.o

    File size after:
    text data bss dec hex filename
    17248 1280 80 18608 48b0 drivers/input/input.o

    File size before:
    text data bss dec hex filename
    2355 384 8 2747 abb drivers/input/rmi4/rmi_bus.o

    File size after:
    text data bss dec hex filename
    2483 264 8 2755 ac3 drivers/input/rmi4/rmi_bus.o

    Signed-off-by: Bhumika Goyal
    Signed-off-by: Dmitry Torokhov

    Bhumika Goyal
     

20 Jul, 2016

1 commit


20 May, 2016

1 commit

  • Commit 4369c64c79a22 ("Input: Send events one packet at a time")
    significantly reduced amount of entropy input core was feeding to the rest
    of the system, because only the very first event in the event block would
    be used as source of entropy.

    With this change we will be calling add_input_randomness() for every event
    that is not filtered by the input core as a duplicate. In addition, all
    EV_SYN events are ignored.

    Acked-by: Henrik Rydberg
    Acked-by: Benjamin Tissoires
    Acked-by: Jiri Kosina
    Signed-off-by: Dmitry Torokhov

    Dmitry Torokhov
     

26 Mar, 2016

1 commit

  • INPUT_COMPAT_TEST became much simpler after commit f4056b52845283
    ("input: redefine INPUT_COMPAT_TEST as in_compat_syscall()") so we can
    cleanly eliminate it altogether.

    Acked-by: Dmitry Torokhov
    Cc: Andy Lutomirski
    Cc: Andy Lutomirski
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrew Morton
     

14 Oct, 2015

1 commit

  • Add new function input_enable_softrepeat() that allows drivers to
    initialize their own values for input_dev->rep[REP_DELAY] and
    input_dev->rep[REP_PERIOD], but also use the software autorepeat
    functionality from input.c.

    For example, a HID driver could do:

    static void xyz_input_configured(struct hid_device *hid,
    struct hid_input *hidinput)
    {
    input_enable_softrepeat(hidinput->input, 400, 100);
    }

    static struct hid_driver xyz_driver = {
    .input_configured = xyz_input_configured,
    }

    Signed-off-by: Petri Gynther
    Signed-off-by: Dmitry Torokhov

    Petri Gynther
     

08 Aug, 2015

1 commit


26 Jun, 2015

1 commit

  • Instead of iterating over all bits in a bitmap and test them individually
    let's siwtch to for_each_set_bit() which is more compact and is also
    faster.

    Also use bitmap_weight() when counting number of set bits.

    This also fixes INPUT_DO_TOGGLE() implementation as it should have used
    *_CNT as the upper boundary, not *_MAX.

    Signed-off-by: Anshul Garg
    Signed-off-by: Dmitry Torokhov

    Anshul Garg
     

21 May, 2015

1 commit


09 Jan, 2015

2 commits


16 Dec, 2014

1 commit


03 Dec, 2014

1 commit


10 Oct, 2014

1 commit


09 Oct, 2014

1 commit


21 Jul, 2014

1 commit

  • We attempt to remove noise from coordinates reported by devices in
    input_handle_abs_event(), unfortunately, unless we were dropping the
    event altogether, we were ignoring the adjusted value and were passing
    on the original value instead.

    Cc: stable@vger.kernel.org
    Reviewed-by: Andrew de los Reyes
    Reviewed-by: Benson Leung
    Reviewed-by: David Herrmann
    Reviewed-by: Henrik Rydberg
    Signed-off-by: Dmitry Torokhov

    Dmitry Torokhov
     

24 Jan, 2014

1 commit


01 Jan, 2014

1 commit


16 Dec, 2013

1 commit

  • When waking up the platform by pressing a specific key, sending a
    release on that key makes it impossible to react on the event in
    user-space. This is fixed by moving the input_reset_device() call to
    resume instead.

    [dmitry.torokhov@gmail.com: make sure we still restore LED/sound state
    after resume, handle hibernation properly]

    Signed-off-by: Aleksej Makarov
    Signed-off-by: Oskar Andero
    Signed-off-by: Dmitry Torokhov

    Aleksej Makarov
     

15 Nov, 2013

1 commit


31 Oct, 2013

1 commit


06 Oct, 2013

1 commit

  • We want to allow drivers to call input_event() at any time after the
    device got allocated. This means input_event() and input_register_device()
    must be allowed to run in parallel.

    The only conflicting calls in input_register_device() are init_timer() and
    dev_set_name(). Both can safely be moved to device allocation and we're
    good to go.

    Signed-off-by: David Herrmann
    Signed-off-by: Dmitry Torokhov

    David Herrmann
     

10 Jan, 2013

1 commit


09 Nov, 2012

1 commit

  • There is a demand from driver's writers to use managed devices framework
    for their drivers. Unfortunately up to this moment input devices did not
    provide support for managed devices and that lead to mixing two styles
    of resource management which usually introduced more bugs, such as
    manually unregistering input device but relying in devres to free
    interrupt handler which (unless device is properly shut off) can cause
    ISR to reference already freed memory.

    This change introduces devm_input_allocate_device() that will allocate
    managed instance of input device so that driver writers who prefer
    using devm_* framework do not have to mix 2 styles.

    Reviewed-by: Henrik Rydberg
    Reviewed-by: Tejun Heo
    Signed-off-by: Dmitry Torokhov

    Dmitry Torokhov
     

25 Oct, 2012

1 commit


09 Oct, 2012

1 commit

  • Extend the amount of character devices, such as eventX, mouseX and jsX,
    from a hard limit of 32 per input handler to about 1024 shared across
    all handlers.

    To be compatible with legacy installations input handlers will start
    creating char devices with minors in their legacy range, however once
    legacy range is exhausted they will start allocating minors from the
    dynamic range 256-1024.

    Reviewed-by: David Herrmann
    Signed-off-by: Dmitry Torokhov

    Dmitry Torokhov
     

02 Oct, 2012

1 commit


20 Sep, 2012

5 commits

  • On heavy event loads, such as a multitouch driver, the irqsoff latency
    can be as high as 250 us. By accumulating a frame worth of data
    before passing it on, the latency can be dramatically reduced. As a
    side effect, the special EV_SYN handling can be removed, since the
    frame is now atomic.

    This patch adds the events() handler callback and uses it if it
    exists. The latency is improved by 50 us even without the callback.

    Cc: Daniel Kurtz
    Tested-by: Benjamin Tissoires
    Tested-by: Ping Cheng
    Tested-by: Sedat Dilek
    Acked-by: Dmitry Torokhov
    Signed-off-by: Henrik Rydberg

    Henrik Rydberg
     
  • Preparing to split event filtering and event passing, move the
    autorepeat function to the point where the event is actually passed.

    Tested-by: Benjamin Tissoires
    Tested-by: Ping Cheng
    Acked-by: Dmitry Torokhov
    Signed-off-by: Henrik Rydberg

    Henrik Rydberg
     
  • For some EV_KEY types, sending a larger-than-one value causes the
    input state to oscillate. This patch makes sure this cannot happen,
    clearing up the autorepeat bypass logic in the process.

    Tested-by: Benjamin Tissoires
    Tested-by: Ping Cheng
    Acked-by: Dmitry Torokhov
    Signed-off-by: Henrik Rydberg

    Henrik Rydberg
     
  • The events-per-packet estimate has so far been used by MT devices
    only. This patch adjusts the packet buffer size to also accomodate the
    KEY and MSC events. Keyboards normally send one or two keys at a
    time. MT devices normally send a number of button keys along with the
    MT information. The buffer size chosen here covers those cases, and
    matches the default buffer size in evdev. Since the input estimate is
    now preferred, remove the special input-mt estimate.

    Reviewed-and-tested-by: Ping Cheng
    Tested-by: Benjamin Tissoires
    Acked-by: Dmitry Torokhov
    Signed-off-by: Henrik Rydberg

    Henrik Rydberg
     
  • Move all MT-related things to a separate place. This saves some
    bytes for non-mt input devices, and prepares for new MT features.

    Reviewed-and-tested-by: Benjamin Tissoires
    Tested-by: Ping Cheng
    Acked-by: Dmitry Torokhov
    Signed-off-by: Henrik Rydberg

    Henrik Rydberg
     

22 Aug, 2012

1 commit