Commit Graph

84 Commits (46ec8598fde74ba59703575c22a6fb0b6b151bb6)

Author SHA1 Message Date
Alexey Dobriyan 99b7623380 proc 2/2: remove struct proc_dir_entry::owner
Setting ->owner as done currently (pde->owner = THIS_MODULE) is racy
as correctly noted at bug #12454. Someone can lookup entry with NULL
->owner, thus not pinning enything, and release it later resulting
in module refcount underflow.

We can keep ->owner and supply it at registration time like ->proc_fops
and ->data.

But this leaves ->owner as easy-manipulative field (just one C assignment)
and somebody will forget to unpin previous/pin current module when
switching ->owner. ->proc_fops is declared as "const" which should give
some thoughts.

->read_proc/->write_proc were just fixed to not require ->owner for
protection.

rmmod'ed directories will be empty and return "." and ".." -- no harm.
And directories with tricky enough readdir and lookup shouldn't be modular.
We definitely don't want such modular code.

Removing ->owner will also make PDE smaller.

So, let's nuke it.

Kudos to Jeff Layton for reminding about this, let's say, oversight.

http://bugzilla.kernel.org/show_bug.cgi?id=12454

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
2009-03-31 01:14:44 +04:00
Kay Sievers a6c2490f01 Input: struct device - replace bus_id with dev_name(), dev_set_name()
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2008-10-30 09:29:05 -04:00
Dmitry Torokhov 908cf4b925 Merge master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6 into next 2008-07-21 00:55:14 -04:00
Dmitry Torokhov c981228281 Input: don't reset sync flag when ignoring event
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2008-06-30 09:35:18 -04:00
Jonathan Corbet 2edbf8537e Input: cdev lock_kernel() pushdown
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
2008-06-20 14:05:47 -06:00
Denis V. Lunev c7705f3449 drivers: use non-racy method for proc entries creation (2)
Use proc_create()/proc_create_data() to make sure that ->proc_fops and ->data
be setup before gluing PDE to main tree.

Signed-off-by: Denis V. Lunev <den@openvz.org>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Peter Osterlund <petero2@telia.com>
Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Cc: Dmitry Torokhov <dtor@mail.ru>
Cc: Neil Brown <neilb@suse.de>
Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
Cc: Bjorn Helgaas <bjorn.helgaas@hp.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-29 08:06:22 -07:00
Alexey Dobriyan 9c37066d88 proc: remove proc_bus
Remove proc_bus export and variable itself. Using pathnames works fine
and is slightly more understandable and greppable.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-29 08:06:18 -07:00
Jan Engelhardt cec69c376b Input: constify function pointer tables (seq_operations)
Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2008-01-31 00:43:32 -05:00
Dmitry Torokhov 0c1efd3653 Input: remove cdev from input_dev structure
Cdev field was obsolete and provided only for backward compatibility
since conversion of input core from class devices to regular devices.
It is time to remove it.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2008-01-21 01:11:08 -05:00
Dmitry Torokhov f4f37c8ec7 Input: Add proper locking when changing device's keymap
Take dev->event_lock to make sure that we don't race with input_event() and
also force key up event when removing a key from keymap table.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2008-01-21 01:11:06 -05:00
Richard Purdie ed2fa4dd41 Input: pass EV_PWR events to event handlers
input_handle_event() used to pass EV_PWR events to event handlers
but no longer does so in 2.6.23. Modules to trigger power management
events based on input power events exist but rely on the EV_PWR events
being passed to the input event handlers.

Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2008-01-03 10:46:21 -05:00
Dmitry Baryshkov 22d1c398e8 Input: Handle EV_PWR type of input caps in input_set_capability.
Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2007-12-14 01:21:03 -05:00
Jiri Slaby 7b19ada2ed get rid of input BIT* duplicate defines
get rid of input BIT* duplicate defines

use newly global defined macros for input layer. Also remove includes of
input.h from non-input sources only for BIT macro definiton. Define the
macro temporarily in local manner, all those local definitons will be
removed further in this patchset (to not break bisecting).
BIT macro will be globally defined (1<<x)

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Cc: <dtor@mail.ru>
Acked-by: Jiri Kosina <jkosina@suse.cz>
Cc: <lenb@kernel.org>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Cc: <perex@suse.cz>
Acked-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Cc: <vernux@us.ibm.com>
Cc: <malattia@linux.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-10-19 11:53:42 -07:00
Dmitry Torokhov 82ba56c273 Input: use full RCU API
RT guys alerted me to the fact that in their tree spinlocks
are preemptible and it is better to use full RCU API
(rcu_read_lock()/rcu_read_unlock()) to be safe.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2007-10-13 15:46:55 -04:00
Dmitry Torokhov b981d8b3f5 Merge master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6
Conflicts:

	drivers/macintosh/adbhid.c
2007-10-12 21:27:47 -04:00
Kay Sievers 7eff2e7a8b Driver core: change add_uevent_var to use a struct
This changes the uevent buffer functions to use a struct instead of a
long list of parameters. It does no longer require the caller to do the
proper buffer termination and size accounting, which is currently wrong
in some places. It fixes a known bug where parts of the uevent
environment are overwritten because of wrong index calculations.

Many thanks to Mathieu Desnoyers for finding bugs and improving the
error handling.

Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Cc: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-10-12 14:51:01 -07:00
Dmitry Torokhov 8006479c9b Input: implement proper locking in input core
Also add some kerneldoc documentation to input.h

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2007-08-30 00:22:11 -04:00
Pavel Emelianov ad5d972cda Input: switch to using seq_list_xxx helpers
This is essentially just a renaming of the existing functions
as copies of seq_list_start() and seq_list_next() already existed
in the input.c.

Signed-off-by: Pavel Emelianov <xemul@openvz.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2007-07-18 00:38:32 -04:00
Dmitry Torokhov 9657d75c5f Input: convert from class devices to standard devices
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2007-07-10 00:35:17 -04:00
Randy Dunlap e63340ae6b header cleaning: don't include smp_lock.h when not used
Remove includes of <linux/smp_lock.h> where it is not used/needed.
Suggested by Al Viro.

Builds cleanly on x86_64, i386, alpha, ia64, powerpc, sparc,
sparc64, and arm (all 59 defconfigs).

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-05-08 11:15:07 -07:00
Dmitry Torokhov 534565f254 Input: add input_set_capability() helper
Add input_set_capability() helper used to indicate that an input
device supports a certain event without need to manipulate bitmaps
directly.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2007-04-25 00:53:18 -04:00
Dmitry Torokhov 88a447a030 Input: prepare to switching to struct device
In preparation to switching to struct device and class device
going away provide an alias to allow drivers that create devices
to use either input_dev->cdev.dev or input_dev->dev.parent to
put them into sysfs tree. The former will go away once conversion
to struct device is complete.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2007-04-12 01:34:47 -04:00
Dmitry Torokhov 5b2a08262a Input: rework handle creation code
- consolidate code for binding handlers to a device
 - return error codes from handlers connect() methods back to input
   core and log failures

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2007-04-12 01:29:46 -04:00
Dmitry Torokhov 54f9e36cb8 Input: simplify input_free_device()
Now that sysfs attributes that were marked for deletion can't access
their devices we do not need to set name, phys and uniq to NULL.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2007-03-16 00:57:25 -04:00
Marvin Raaijmakers c8e4c77277 Input: add getkeycode and setkeycode methods
Allow drivers to implement their own get and set keycode methods. This
will allow drivers to change their keymaps without allocating huge
tables covering entire range of possible scancodes.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2007-03-14 22:50:42 -04:00
Dmitry Torokhov cb9def4dff Input: let driver core create class device attribute groups
Rely on device core to create attribute groups for input devices
instead of open-coding it.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2007-03-07 23:20:26 -05:00
Dmitry Torokhov 15e03ae811 Input: export 'uniq' in /proc/bus/input/devices
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2007-03-07 23:20:17 -05:00
Dmitry Torokhov 1efa770f8e Input: do not lock device when showing name, phys and uniq
Now that sysfs attributes return -ENODEV once driver requests their
removal we do not need to handle scenario when data is deleted from
under our feet and can simplify the code.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2007-02-18 01:40:37 -05:00
Tim Schmielau cd354f1ae7 [PATCH] remove many unneeded #includes of sched.h
After Al Viro (finally) succeeded in removing the sched.h #include in module.h
recently, it makes sense again to remove other superfluous sched.h includes.
There are quite a lot of files which include it but don't actually need
anything defined in there.  Presumably these includes were once needed for
macros that used to live in sched.h, but moved to other header files in the
course of cleaning it up.

To ease the pain, this time I did not fiddle with any header files and only
removed #includes from .c-files, which tend to cause less trouble.

Compile tested against 2.6.20-rc2 and 2.6.20-rc2-mm2 (with offsets) on alpha,
arm, i386, ia64, mips, powerpc, and x86_64 with allnoconfig, defconfig,
allmodconfig, and allyesconfig as well as a few randconfigs on x86_64 and all
configs in arch/arm/configs on arm.  I also checked that no new warnings were
introduced by the patch (actually, some warnings are removed that were emitted
by unnecessarily included header files).

Signed-off-by: Tim Schmielau <tim@physik3.uni-rostock.de>
Acked-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-02-14 08:09:54 -08:00
Arjan van de Ven 2b8693c061 [PATCH] mark struct file_operations const 3
Many struct file_operations in the kernel can be "const".  Marking them const
moves these to the .rodata section, which avoids false sharing with potential
dirty data.  In addition it'll catch accidental writes at compile time to
these shared resources.

Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-02-12 09:48:45 -08:00
Dmitry Torokhov 1447190e39 Input: add comments to input_{allocate|free}_device()
Hopefully this will stop people from using input_free_device()
incorrectly.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2006-11-02 23:26:55 -05:00
Dmitry Torokhov 4263cf0fac Input: make input_register_handler() return error codes
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2006-09-14 01:32:39 -04:00
Dmitry Torokhov 68c2a1607c Input: remove cruft that was needed for transition to sysfs
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2006-09-14 01:32:28 -04:00
Dmitry Torokhov 655816e498 Input: fix input module refcounting
Now that input_free_device is basically an alias for input_put_device
we need to acquire a reference to input module right when we allocate
device because input_dev_release releases reference to input module
unconditionally.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2006-09-14 01:32:14 -04:00
Dmitry Torokhov 66e6611883 Input: constify input core
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2006-09-14 01:31:59 -04:00
Dmitry Torokhov 6d2750c167 Input: send key up events at disconnect
Emit key up events for all pressed keys/buttons when disconnecting
an input device. Cures "stuck" enter key effect when unloading
keyboard module.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2006-09-10 21:56:06 -04:00
Anssi Hannula 509ca1a938 Input: implement new force feedback interface
Implement a new force feedback interface, in which all non-driver-specific
operations are separated to a common module. This includes handling effect
type validations, locking, etc.

The effects are now file descriptor specific instead of the previous strange
half-process half-fd specific behaviour. The effect memory of devices is not
emptied if the root user opens and closes the device while another user is
using effects. This is a minor change and most likely no force feedback
aware programs are affected by this negatively.

Otherwise the userspace interface is left unaltered.

Signed-off-by: Anssi Hannula <anssi.hannula@gmail.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2006-07-19 01:40:22 -04:00
Dmitry Torokhov b6d786dbe6 Input: add missing handler->start() call
The start() method need to be called every time we create
a new handle. This includes not only registering new devices
but also when registering new handlers.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2006-07-19 01:08:51 -04:00
Andrew Morton a2b2ed2ce2 Input: fix list iteration in input_release_device()
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2006-07-15 01:17:38 -04:00
Dmitry Torokhov 0e739d2876 Input: introduce input_inject_event() function
Create input_inject_event() function which is to be used by input
handlers as opposed to input_event() which is reserved for drivers
implementing input devices. The difference is that if device is
"grabbed" by some process input_inject_event() will ignore events
unless sent from the handle that is currently owns the device.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2006-07-06 00:22:43 -04:00
Dmitry Torokhov c7e8dc6ee6 Input: add start() method to input handlers
The new start() method is called immediately after connect() and also
when "grabbed" device is released by its owner. This will allow input
handlers to re-synchronize state of once-grabbed device with the rest
of devices.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2006-07-06 00:21:03 -04:00
Dmitry Torokhov e9c8862f19 Input: remove accept method from input_dev
This method used to enforce exclusive access to iforce devices,
but presenlty there are no known users of this method.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2006-07-06 00:20:47 -04:00
Dmitry Torokhov e7374e4800 Input: fix resetting name, phys and uniq when unregistering device
It should be done before calling class_device_unregister() because
it will destroy the device and free memory if there are no other
references to the device.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-06-27 14:05:06 -07:00
Dmitry Torokhov ca56fe07f4 Input: rearrange exports
New style is to mark symbol as exported right after its definition.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2006-06-26 01:49:21 -04:00
Dmitry Torokhov 1e0afb288e Input: fix formatting to better follow CodingStyle
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2006-06-26 01:48:47 -04:00
Dmitry Torokhov f60d2b111c Input: reset name, phys and uniq when unregistering
Name, phys and uniq are quite often constant strings in moules implementing
particular input device. If a module unregisters input device and then gets
unloaded, the device could still be present in memory (pinned via sysfs),
but aforementioned members would point to some random memory. Set them all
to NULL when unregistering so sysfs handlers won't try dereferencing them.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2006-06-26 01:48:36 -04:00
Richard Purdie 8a3cf456ad Input: return correct size when reading modalias attribute
Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2006-06-26 01:48:21 -04:00
Dmitry Torokhov 8fdc19486f Input: make EVIOCGSND return meaningful data
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2006-04-29 01:13:48 -04:00
Dmitry Torokhov ddc5d34145 Input: move input_device_id to mod_devicetable.h
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2006-04-26 00:14:19 -04:00
Dmitry Torokhov ac648a6a70 Input: make modalias code respect allowed buffer size
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2006-04-02 00:09:51 -05:00