From: Dmitry Torokhov <dtor_core@ameritech.net>
To: linux-kernel@vger.kernel.org
Cc: Andrew Morton <akpm@osdl.org>, Vojtech Pavlik <vojtech@suse.cz>,
vojtech@ucw.cz
Subject: [PATCH 9/11] serio allow rebinding
Date: Fri, 18 Jun 2004 03:42:39 -0500 [thread overview]
Message-ID: <200406180342.41100.dtor_core@ameritech.net> (raw)
In-Reply-To: <200406180342.11056.dtor_core@ameritech.net>
===================================================================
ChangeSet@1.1798, 2004-06-18 02:31:47-05:00, dtor_core@ameritech.net
Input: allow users manually rebind serio ports, like this:
echo -n "psmouse" > /sys/bus/serio/devices/serio0/driver
echo -n "atkbd" > /sys/bus/serio/devices/serio1/driver
echo -n "none" > /sys/devices/serio1/driver
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
serio.c | 30 +++++++++++++++++++++++++++++-
1 files changed, 29 insertions(+), 1 deletion(-)
===================================================================
diff -Nru a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c
--- a/drivers/input/serio/serio.c 2004-06-18 03:17:30 -05:00
+++ b/drivers/input/serio/serio.c 2004-06-18 03:17:30 -05:00
@@ -257,7 +257,35 @@
{
return sprintf(buf, "%s\n", dev->driver ? dev->driver->name : "(none)");
}
-static DEVICE_ATTR(driver, S_IRUGO, serio_show_driver, NULL);
+
+static ssize_t serio_rebind_driver(struct device *dev, const char *buf, size_t count)
+{
+ struct serio *serio = to_serio_port(dev);
+ struct device_driver *drv;
+ struct kobject *k;
+ int retval;
+
+ retval = down_interruptible(&serio_sem);
+ if (retval)
+ return retval;
+
+ if (!strncmp(buf, "none", count)) {
+ serio_disconnect_port(serio);
+ retval = count;
+ } else if (!(k = kset_find_obj(&serio_bus.drivers, buf))) {
+ retval = -EINVAL;
+ } else {
+ serio_disconnect_port(serio);
+ drv = container_of(k, struct device_driver, kobj);
+ serio_connect_port(serio, to_serio_driver(drv));
+ retval = count;
+ }
+
+ up(&serio_sem);
+
+ return retval;
+}
+static DEVICE_ATTR(driver, S_IWUSR | S_IRUGO, serio_show_driver, serio_rebind_driver);
static void serio_release_port(struct device *dev)
{
next prev parent reply other threads:[~2004-06-18 9:02 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <200406180335.52843.dtor_core@ameritech.net>
2004-06-18 8:37 ` [PATCH 1/11] psmouse resync for KVM users Dmitry Torokhov
2004-06-18 8:37 ` [PATCH 2/11] psmouse state locking Dmitry Torokhov
2004-06-18 8:38 ` [PATCH 3/11] serio connect/disconnect mandatory Dmitry Torokhov
2004-06-18 8:39 ` [PATCH 4/11] serio renames 1 Dmitry Torokhov
2004-06-18 8:39 ` [PATCH 5/11] serio renames 2 Dmitry Torokhov
2004-06-18 8:40 ` [PATCH 6/11] serio dynamic allocation Dmitry Torokhov
2004-06-18 8:41 ` [PATCH 7/11] serio no recursion Dmitry Torokhov
2004-06-18 8:42 ` [PATCH 8/11] serio sysfs integration Dmitry Torokhov
2004-06-18 8:42 ` Dmitry Torokhov [this message]
2004-06-18 8:43 ` [PATCH 10/11] serio manual bind Dmitry Torokhov
2004-06-18 8:43 ` [PATCH 11/11] serio_raw driver Dmitry Torokhov
2004-06-18 9:19 ` [PATCH 9/11] serio allow rebinding Jan-Benedict Glaw
2004-06-18 9:38 ` [PATCH 8/11] serio sysfs integration Andrew Morton
2004-06-18 12:50 ` Dmitry Torokhov
2004-06-18 19:43 ` Andrew Morton
2004-06-20 5:07 ` [PATCH 6/11] serio dynamic allocation Andrew Morton
2004-06-20 5:30 ` Dmitry Torokhov
2004-06-20 6:27 ` Andrew Morton
2004-06-20 6:28 ` Andrew Morton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200406180342.41100.dtor_core@ameritech.net \
--to=dtor_core@ameritech.net \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=vojtech@suse.cz \
--cc=vojtech@ucw.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox