Commit Graph

10 Commits (ed391f4ebf8f701d3566423ce8f17e614cde9806)

Author SHA1 Message Date
Samu Onkalo d9c4f84699 Input: polldev can cause crash in case when polling disabled
When polled input device is opened and closed and there are no other
users of polled device, the workqueue is created and destroyed in
every open / close operation. It is probable that at some point
dynamic allocation of internal parts of the workqueue cause changes to the
workqueue.

When a work is queued to the workqueue the work struct contains pointers
to the workqueue data. If the workqueue has been changed and the work
has never been queued to the new workqueue, work-struct contains pointers
to the non-existing workqueue. This will cause crash at the work
cancellation during device close since cancellation of a work assumes
that the workqueue exists.

To prevent that, work struct is cleaned up at device close. This keeps
work struct clean for the next use.

Signed-off-by: Samu Onkalo <samu.p.onkalo@nokia.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2010-02-20 01:23:55 -08:00
Dmitry Torokhov 36203c4f3d Input: add generic support for sparse keymaps
More and more devices choose to reimplement support for sparse keymaps
first introduced by wistron driver. Move it into a library module so it
can be easily used by interested parties.

Reviewed-by: Anisse Astier <anisse@astier.eu>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2009-12-07 09:26:35 -08:00
Samu Onkalo 11bb4cc7c7 Input: polled device - do not start polling if interval is zero
If the poll interval is set to 0 via new sysfs entry and device is
opened after that, polling is started with interval 0. This causes
huge CPU load. Same happens if the rate was 0 when the device was
closed and then reopened.

Signed-off-by: Samu Onkalo <samu.p.onkalo@nokia.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2009-11-23 10:16:09 -08:00
Dmitry Torokhov 381f3f1ccf Input: polled device - schedule first poll immediately
It does not make sense to wait poll_interval before performing first
read after opening the device, schedule the read immediately instead.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2009-11-23 10:15:40 -08:00
Samu Onkalo dad725d089 Input: input-polldev - add sysfs interface for controlling poll interval
Sysfs entry for reading and setting of the polling interval. If the
interval is set to 0, polling is stopped. Polling is restarted when
interval is changed to non-zero.

sysfs entries:
poll = current polling interval in msec (RW)
max = max allowed polling interval (RO)
min = min allowed polling interval (RO)

Minimum and maximum limit for interval can be set while setting up the
device.

Interval can be adjusted even if the input device is not currently open.

[dtor@mail.ru: add kernel doc markup for the new fields]
Signed-off-by: Samu Onkalo <samu.p.onkalo@nokia.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2009-11-20 00:52:09 -08:00
Samu Onkalo b0aba1e66c Input: add open and close methods for polled devices
Optional open and close methods for preparing and closing
the device.

Signed-off-by: Samu Onkalo <samu.p.onkalo@nokia.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2009-10-18 00:46:49 -07:00
Dmitry Torokhov 3797fec171 Input: remove private member from input_dev structure
Everyone should be using input_{get|set}_drvdata() by now.
Alias them to dev_{get|set}_drvdata() and remove ->private.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2008-04-02 00:41:00 -04:00
Stephen Hemminger 374766bc2a Input: implement proper timer rounding for polled devices
Rounding doesn't matter for the first tick, but we want
succeeding ticks to be aligned on second boundary if poll
interval is large enough.

Also: cancel_rearming_delayed_workqueue is marked as obsolete
in workqueue.h so use cancel_delayed_work_sync.

Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Acked-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2008-01-21 01:11:07 -05:00
Stephen Hemminger 14134b31ae Input: polled device power saving
For slow running polling, it saves power to align wakeups on tick boundary.

Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2007-09-26 00:01:25 -04:00
Dmitry Torokhov 893e7c2db0 Input: move input-polldev to drivers/input
To work around deficiences in Kconfig that allows to "select"
a symbol without automatically selecting all dependencies for
that symbol move input-polldev from drivers/input/misc to
drivers/input thus removing extra dependency on CONFIG_INPUT_MISC.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2007-06-13 01:49:58 -04:00