Commit Graph

48 Commits (1e08ec4a130e2745d96df169e67c58df98a07311)

Author SHA1 Message Date
Alan Stern fde25a9b63 Driver core: driver_find() drops reference before returning
As part of the removal of get_driver()/put_driver(), this patch
(as1510) changes driver_find(); it now drops the reference it acquires
before returning.  The patch also adjusts all the callers of
driver_find() to remove the now unnecessary calls to put_driver().

In addition, the patch adds a warning to driver_find(): Callers must
make sure the driver they are searching for does not get unloaded
while they are using it.  This has always been the case; driver_find()
has never prevented a driver from being unregistered or unloaded.
Hence the patch will not introduce any new bugs.  The existing callers
all seem to be okay in this respect, however I don't understand the
video drivers well enough to be certain about them.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
CC: Dmitry Torokhov <dmitry.torokhov@gmail.com>
CC: Kyungmin Park <kyungmin.park@samsung.com>
CC: Andy Walls <awalls@md.metrocast.net>
CC: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2012-01-24 16:00:34 -08:00
Dmitry Torokhov 1d64b655dc Input: serio/gameport - use 'long' system workqueue
Commit 8ee294cd9d converted serio
subsystem event handling from using a dedicated thread to using
common workqueue. Unfortunately, this regressed our boot times,
due to the fact that serio jobs take long time to execute. While
the new concurrency managed workqueue code manages long-playing
works just fine and schedules additional workers as needed, such
works wreck havoc among remaining users of flush_scheduled_work().

To solve this problem let's move serio/gameport works from system_wq
to system_long_wq which nobody tries to flush.

Reported-and-tested-by: Hernando Torque <pantherchen@versanet.de>
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2011-02-23 08:53:07 -08:00
Duncan Laurie 19e9554153 Input: serio - clear pending rescans after sysfs driver rebind
When rebinding a serio driver via sysfs drvctl interface it is
possible for an interrupt to trigger after the disconnect of the
existing driver and before the binding of the new driver.  This will
cause the serio interrupt handler to queue a rescan event which will
disconnect the new driver immediately after it is attached.

This change removes pending rescans from the serio event queue after
processing the drvctl request but before releasing the serio mutex.

Reproduction involves issuing a rebind of device port from psmouse
driver to serio_raw driver while generating input to trigger
interrupts.  Then checking to see if the corresponding
i8042/serio4/driver is correctly attached to the serio_raw driver
instead of psmouse.

Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2011-02-02 23:01:52 -08:00
Dmitry Torokhov 8ee294cd9d Input: serio - convert to common workqueue instead of a thread
Instead of creating an exclusive thread to handle serio events (which
happen rarely), let's switch to using common workqueue. With the arrival
of concurrency-managed workqueue infrastructure we are not concerned
that our callers or callees also using workqueue (no deadlocks anymore)
and it should reduce total number of threads in the system.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2010-11-18 00:25:45 -08:00
Dmitry Eremin-Solenikov 0982258264 Input: serio - support multiple child devices per single parent
Some (rare) serio devices need to have multiple serio children. One of
the examples is PS/2 multiplexer present on several TQC STKxxx boards,
which connect PS/2 keyboard and mouse to single tty port.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2010-10-13 07:49:28 -07:00
Dmitry Torokhov 53957b56d7 Input: serio - do not include linux/freezer.h
Commit ea486e6811 changed kseriod thread
to become not freezable so we do not need this include anymore.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2010-09-14 00:22:50 -07:00
Dmitry Torokhov 7755726fe9 Merge commit 'v2.6.33-rc5' into next 2010-01-21 23:55:25 -08:00
Dmitry Torokhov cac9169bf7 Input: serio - use pr_xxx() and dev_xxx() helpers
pr_xxx() and dev_xxx() helpers ensure that all messages emitted by the
module have consistent prefixes, so let's use them. Also fix some
formatting issues.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2010-01-06 00:22:41 -08:00
Dmitry Torokhov 4516c81832 Input: serio - use list_first_entry() helper
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2010-01-06 00:22:23 -08:00
Dmitry Torokhov ddf1ffbd40 Input: serio - let device core tell us if device was registered
No need to keep track of it by ourselves.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2010-01-06 00:22:00 -08:00
Dmitry Torokhov 386d877298 Input: serio - use device core to create 'id' attribute group
Instead of creating 'id' sysfs attribute group by ourselves rely on
device core to do that for us.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2010-01-06 00:19:48 -08:00
Dmitry Torokhov ea486e6811 Input: serio - do not mark kseriod freezable anymore
We used to make kseriod freezable to prevent unnecessary attempts at
resuming keyboard and mouse before taking hibernation image when suspend
and hibernation were sharing PM operations. Now that they are separated
and we don't risk resuming during 'thaw' we don't need to freeze kseriod
anymore. This will allow us to start resetting mouse and keyboard a bit
earlier, before rest of the userspace comes back up.

Acked-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2009-12-24 21:43:06 -08:00
Dmitry Torokhov 633aae23ff Input: serio - switch to using dev_pm_ops
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2009-07-26 11:17:01 -07:00
Thadeu Lima de Souza Cascardo ddaa43433d Input: mark serio and i8042 as suspended when hibernating too
Serio ports are not being restarted any longer because resume operations
after hibernate do nothing, since the device has not been marked as
suspended. This happens because suspend is only considering the SUSPEND
event but not the FREEZE event.

Note that this driver has still to migrate to dev_pm_ops, but this fixes
this particular bug now.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2009-07-07 22:46:58 -07:00
Dmitry Torokhov 7e044e056a Input: serio - do not use deprecated dev.power.power_state
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2009-05-09 16:10:18 -07:00
Dmitry Torokhov 89b09b9970 Input: serio - rearrange EXPORT_SYMBOL() markings
Current style calls for placing EXPORT_SYMBOL() markings directly
after exported symbol definition; let's follow it.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2009-04-17 20:37:55 -07: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
Shaohua Li 6aabcdffd1 Input: serio - offload resume to kseriod
When resuming AUX ports psmouse driver calls psmouse_extensions()
to determine if the attached mouse is still the same, which may take
a while to complete for generic mice. Offload the resume process to
kseriod so the rest of the system may continue resuming without
waiting for the mouse.

Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2008-07-23 14:02:04 -04:00
Dmitry Torokhov e8ef434709 Input: serio - remove pending events when unregistering driver
That fixes an opps when driver is repeatedly loaded and unloaded in
a tight loop.

Tested-by: Roland Kletzing <devzero@web.de>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2008-06-02 00:41:57 -04:00
Rafael J. Wysocki e42837bcd3 freezer: introduce freezer-friendly waiting macros
Introduce freezer-friendly wrappers around wait_event_interruptible() and
wait_event_interruptible_timeout(), originally defined in <linux/wait.h>, to
be used in freezable kernel threads.  Make some of the freezable kernel
threads use them.

This is necessary for the freezer to stop sending signals to kernel threads,
which is implemented in the next patch.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@ucw.cz>
Cc: Nigel Cunningham <nigel@nigel.suspend2.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-10-18 14:37:19 -07: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
Rafael J. Wysocki 8314418629 Freezer: make kernel threads nonfreezable by default
Currently, the freezer treats all tasks as freezable, except for the kernel
threads that explicitly set the PF_NOFREEZE flag for themselves.  This
approach is problematic, since it requires every kernel thread to either
set PF_NOFREEZE explicitly, or call try_to_freeze(), even if it doesn't
care for the freezing of tasks at all.

It seems better to only require the kernel threads that want to or need to
be frozen to use some freezer-related code and to remove any
freezer-related code from the other (nonfreezable) kernel threads, which is
done in this patch.

The patch causes all kernel threads to be nonfreezable by default (ie.  to
have PF_NOFREEZE set by default) and introduces the set_freezable()
function that should be called by the freezable kernel threads in order to
unset PF_NOFREEZE.  It also makes all of the currently freezable kernel
threads call set_freezable(), so it shouldn't cause any (intentional)
change of behaviour to appear.  Additionally, it updates documentation to
describe the freezing of tasks more accurately.

[akpm@linux-foundation.org: build fixes]
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Nigel Cunningham <nigel@nigel.suspend2.net>
Cc: Pavel Machek <pavel@ucw.cz>
Cc: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Gautham R Shenoy <ego@in.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-07-17 10:23:02 -07:00
Dmitry Torokhov 33143ea1a3 Input: serio - take drv_mutex in serio_cleanup()
We need to take serio->drv_mutex in serio_cleanup() to prevent the
function from being called while driver is in the middle of attaching
to a serio port. Such situation can happen with i8042 and atkbd drivers
if user rapidly presses Ctrl-Alt-Del during system startup, and leads
to kernel oops.

Reported-by: Dave Young <hidave.darkstar@gmail.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2007-06-29 01:06:35 -04:00
Dmitry Torokhov 70f256fda1 Input: serio - do not touch bus's rwsem
The subsystem rwsem is not used by the driver core at all, so there is
no point in trying to access it.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-04-27 10:57:30 -07:00
Dmitry Torokhov 82dd9eff4b Input: i8042 - let serio bus suspend ports
Let serio subsystem take care of suspending the ports; concentrate
on suspending/resuming the controller itself.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2007-02-18 01:40:30 -05:00
Greg Kroah-Hartman 4b315627e6 SERIO: add the sysfs driver name to all modules
This adds the module name to all SERIO drivers, if they are built into
the kernel or not.  It will show up in /sys/modules/MODULE_NAME/drivers/

Cc: Kay Sievers <kay.sievers@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-02-07 10:37:12 -08:00
Dmitry Torokhov bef986502f Merge rsync://rsync.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Conflicts:

	drivers/usb/input/hid.h
2006-12-08 01:07:56 -05:00
Nigel Cunningham 7dfb71030f [PATCH] Add include/linux/freezer.h and move definitions from sched.h
Move process freezing functions from include/linux/sched.h to freezer.h, so
that modifications to the freezer or the kernel configuration don't require
recompiling just about everything.

[akpm@osdl.org: fix ueagle driver]
Signed-off-by: Nigel Cunningham <nigel@suspend2.net>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-12-07 08:39:27 -08:00
Dmitry Torokhov ed7b1f6d6e Input: serio - make serio_register_driver() return errors
Perform actual driver registration right in serio_register_driver()
instead of offloading it to kseriod and return proper error code to
callers if driver registration fails.

Note that driver <-> port matching is still done by kseriod to
speed up boot process since probing for PS/2 mice and keyboards
is pretty slow.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2006-11-23 23:34:49 -05:00
Dmitry Torokhov 9d92fe17b6 Input: serio - remove serio_unregister_port_delayed()
Now that i8042 reserves IRQs early there are no more users of this
function and it should be removed.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2006-11-17 01:07:39 -05:00
Marton Nemeth 1ea2a69d54 Input: serio - rearrange serio_bus initialization
Initialize serio_bus structure at compile time instead of at runtime
in serio_init().

Signed-off-by: Marton Nemeth <nm127@freemail.hu>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2006-11-02 23:27:21 -05:00
Dmitry Torokhov 0a66045bcf Input: serio core - handle errors returned by device_bind_driver()
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2006-10-12 01:06:23 -04:00
Jiri Kosina 88aa0103e4 Input: serio - add lockdep annotations
Signed-off-by: Jiri Kosina <jikos@jikos.cz>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2006-10-11 01:45:31 -04:00
David Howells 7d12e780e0 IRQ: Maintain regs pointer globally rather than passing to IRQ handlers
Maintain a per-CPU global "struct pt_regs *" variable which can be used instead
of passing regs around manually through all ~1800 interrupt handlers in the
Linux kernel.

The regs pointer is used in few places, but it potentially costs both stack
space and code to pass it around.  On the FRV arch, removing the regs parameter
from all the genirq function results in a 20% speed up of the IRQ exit path
(ie: from leaving timer_interrupt() to leaving do_IRQ()).

Where appropriate, an arch may override the generic storage facility and do
something different with the variable.  On FRV, for instance, the address is
maintained in GR28 at all times inside the kernel as part of general exception
handling.

Having looked over the code, it appears that the parameter may be handed down
through up to twenty or so layers of functions.  Consider a USB character
device attached to a USB hub, attached to a USB controller that posts its
interrupts through a cascaded auxiliary interrupt controller.  A character
device driver may want to pass regs to the sysrq handler through the input
layer which adds another few layers of parameter passing.

I've build this code with allyesconfig for x86_64 and i386.  I've runtested the
main part of the code on FRV and i386, though I can't test most of the drivers.
I've also done partial conversion for powerpc and MIPS - these at least compile
with minimal configurations.

This will affect all archs.  Mostly the changes should be relatively easy.
Take do_IRQ(), store the regs pointer at the beginning, saving the old one:

	struct pt_regs *old_regs = set_irq_regs(regs);

And put the old one back at the end:

	set_irq_regs(old_regs);

Don't pass regs through to generic_handle_irq() or __do_IRQ().

In timer_interrupt(), this sort of change will be necessary:

	-	update_process_times(user_mode(regs));
	-	profile_tick(CPU_PROFILING, regs);
	+	update_process_times(user_mode(get_irq_regs()));
	+	profile_tick(CPU_PROFILING);

I'd like to move update_process_times()'s use of get_irq_regs() into itself,
except that i386, alone of the archs, uses something other than user_mode().

Some notes on the interrupt handling in the drivers:

 (*) input_dev() is now gone entirely.  The regs pointer is no longer stored in
     the input_dev struct.

 (*) finish_unlinks() in drivers/usb/host/ohci-q.c needs checking.  It does
     something different depending on whether it's been supplied with a regs
     pointer or not.

 (*) Various IRQ handler function pointers have been moved to type
     irq_handler_t.

Signed-Off-By: David Howells <dhowells@redhat.com>
(cherry picked from 1b16e7ac850969f38b375e511e3fa2f474a33867 commit)
2006-10-05 15:10:12 +01:00
Randy Dunlap 73b59a3b1c Input: serio/gameport - check whether driver core calls succeeded
Signed-off-by: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2006-07-19 01:14:55 -04:00
Adrian Bunk 9d921116cc Input: serio - fix memory leak
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2006-03-14 00:13:29 -05:00
Dmitry Torokhov 51c38f9bce Input: initialize serio and gameport at subsystem level
Serio and gameport cores do not depend on other drivers and are
used by code living outside of drivers/input/{gameport|serio}.
Registering them at subsystem level guarantees that they are
fully initialized before anyone tries to use them.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2006-02-19 00:22:51 -05:00
Arjan van de Ven c4e32e9faa Input: serio - semaphore to mutex conversion
The conversion was generated via scripts, and the result was validated
automatically via a script as well.

Signed-off-by: Arjan van de Ven <arjan@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2006-02-19 00:21:55 -05:00
Russell King 30226f8199 [PATCH] Add serio bus_type probe and remove methods
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-01-13 11:26:07 -08:00
Kay Sievers 312c004d36 [PATCH] driver core: replace "hotplug" by "uevent"
Leave the overloaded "hotplug" word to susbsystems which are handling
real devices. The driver core does not "plug" anything, it just exports
the state to userspace and generates events.

Signed-off-by: Kay Sievers <kay.sievers@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-01-04 16:18:08 -08:00
Dmitry Torokhov 9e50afd0cb Input: make serio and gameport more swsusp friendly
kseriod and kgameportd used to process all pending events before
checking for freeze condition. This may cause swsusp to time out
while stopping tasks when resuming. Switch to process events one
by one to check freeze status more often.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2005-11-20 00:56:43 -05:00
Dmitry Torokhov ae87dff7ca Input: serio - add modalias attribute and environment variable to
simplify hotplug scripts.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2005-06-30 00:48:34 -05:00
Linus Torvalds 3c803e8e2f Commit the manual part of the input layer merge.
git did actually warn me about the fact that I hadn't actually done an
"update-cache" on these two files, but the warning was at the bottom of
a list of all the files that _did_ change in the merge, so I never
noticed.  My bad.
2005-06-27 17:49:45 -07:00
Christoph Lameter 3e1d1d28d9 [PATCH] Cleanup patch for process freezing
1. Establish a simple API for process freezing defined in linux/include/sched.h:

   frozen(process)		Check for frozen process
   freezing(process)		Check if a process is being frozen
   freeze(process)		Tell a process to freeze (go to refrigerator)
   thaw_process(process)	Restart process
   frozen_process(process)	Process is frozen now

2. Remove all references to PF_FREEZE and PF_FROZEN from all
   kernel sources except sched.h

3. Fix numerous locations where try_to_freeze is manually done by a driver

4. Remove the argument that is no longer necessary from two function calls.

5. Some whitespace cleanup

6. Clear potential race in refrigerator (provides an open window of PF_FREEZE
   cleared before setting PF_FROZEN, recalc_sigpending does not check
   PF_FROZEN).

This patch does not address the problem of freeze_processes() violating the rule
that a task may only modify its own flags by setting PF_FREEZE. This is not clean
in an SMP environment. freeze(process) is therefore not SMP safe!

Signed-off-by: Christoph Lameter <christoph@lameter.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-25 17:10:13 -07:00
Yani Ioannou e404e274f6 [PATCH] Driver Core: drivers/i2c/chips/w83781d.c - drivers/s390/block/dcssblk.c: update device attribute callbacks
Signed-off-by: Yani Ioannou <yani.ioannou@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-06-20 15:15:34 -07:00
Dmitry Torokhov baae956100 [PATCH] serio 'id' attributes
move serio port's id attributes into separate subdirectory:
       ..devices/serioX/id_type  -> ..devices/serioX/id/type
       ..devices/serioX/id_proto -> ..devices/serioX/id/proto

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Cc: Vojtech Pavlik <vojtech@suse.cz>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-17 07:59:10 -07:00
Dmitry Torokhov 0c3f2be423 [PATCH] serio resume fix
serio - do not attempt to immediately disconnect port if resume failed, let
kseriod take care of it.  Otherwise we may attempt to unregister associated
input devices which will generate hotplug events which are not handled well
during swsusp.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Cc: Vojtech Pavlik <vojtech@suse.cz>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-17 07:59:09 -07:00
Linus Torvalds 1da177e4c3 Linux-2.6.12-rc2
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!
2005-04-16 15:20:36 -07:00