From: Greg KH <gregkh@suse.de>
To: linux-kernel@vger.kernel.org
Cc: dtor_core@ameritech.net
Subject: [PATCH] Input: convert sonypi to dynamic input_dev allocation
Date: Thu, 27 Oct 2005 23:30:24 -0700 [thread overview]
Message-ID: <11304810243087@kroah.com> (raw)
In-Reply-To: <11304810242681@kroah.com>
[PATCH] Input: convert sonypi to dynamic input_dev allocation
Input: convert sonypi to dynamic input_dev allocation
This is required for input_dev sysfs integration
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
commit 218e51d8b7c75a09e156696c037e6e3383a7808b
tree 5ac0471cac3b7fe7214d5d94d1017b9be81c0416
parent a7827f4a9186387c432f3c802ea6330396d83eb9
author Dmitry Torokhov <dtor_core@ameritech.net> Thu, 15 Sep 2005 02:01:50 -0500
committer Greg Kroah-Hartman <gregkh@suse.de> Thu, 27 Oct 2005 22:48:04 -0700
drivers/char/sonypi.c | 92 ++++++++++++++++++++++++++++---------------------
1 files changed, 53 insertions(+), 39 deletions(-)
diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c
index 36ae9ad..a487368 100644
--- a/drivers/char/sonypi.c
+++ b/drivers/char/sonypi.c
@@ -424,10 +424,6 @@ static struct sonypi_eventtypes {
#define SONYPI_BUF_SIZE 128
-/* The name of the devices for the input device drivers */
-#define SONYPI_JOG_INPUTNAME "Sony Vaio Jogdial"
-#define SONYPI_KEY_INPUTNAME "Sony Vaio Keys"
-
/* Correspondance table between sonypi events and input layer events */
static struct {
int sonypiev;
@@ -490,8 +486,8 @@ static struct sonypi_device {
struct fasync_struct *fifo_async;
int open_count;
int model;
- struct input_dev input_jog_dev;
- struct input_dev input_key_dev;
+ struct input_dev *input_jog_dev;
+ struct input_dev *input_key_dev;
struct work_struct input_work;
struct kfifo *input_fifo;
spinlock_t input_fifo_lock;
@@ -779,8 +775,8 @@ static void input_keyrelease(void *data)
static void sonypi_report_input_event(u8 event)
{
- struct input_dev *jog_dev = &sonypi_device.input_jog_dev;
- struct input_dev *key_dev = &sonypi_device.input_key_dev;
+ struct input_dev *jog_dev = sonypi_device.input_jog_dev;
+ struct input_dev *key_dev = sonypi_device.input_key_dev;
struct sonypi_keypress kp = { NULL };
int i;
@@ -1203,6 +1199,47 @@ static struct device_driver sonypi_drive
.shutdown = sonypi_shutdown,
};
+static int __devinit sonypi_create_input_devices(void)
+{
+ struct input_dev *jog_dev;
+ struct input_dev *key_dev;
+ int i;
+
+ sonypi_device.input_jog_dev = jog_dev = input_allocate_device();
+ if (!jog_dev)
+ return -ENOMEM;
+
+ jog_dev->name = "Sony Vaio Jogdial";
+ jog_dev->id.bustype = BUS_ISA;
+ jog_dev->id.vendor = PCI_VENDOR_ID_SONY;
+
+ jog_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REL);
+ jog_dev->keybit[LONG(BTN_MOUSE)] = BIT(BTN_MIDDLE);
+ jog_dev->relbit[0] = BIT(REL_WHEEL);
+
+ sonypi_device.input_key_dev = key_dev = input_allocate_device();
+ if (!key_dev) {
+ input_free_device(jog_dev);
+ sonypi_device.input_jog_dev = NULL;
+ return -ENOMEM;
+ }
+
+ key_dev->name = "Sony Vaio Keys";
+ key_dev->id.bustype = BUS_ISA;
+ key_dev->id.vendor = PCI_VENDOR_ID_SONY;
+
+ /* Initialize the Input Drivers: special keys */
+ key_dev->evbit[0] = BIT(EV_KEY);
+ for (i = 0; sonypi_inputkeys[i].sonypiev; i++)
+ if (sonypi_inputkeys[i].inputev)
+ set_bit(sonypi_inputkeys[i].inputev, key_dev->keybit);
+
+ input_register_device(jog_dev);
+ input_register_device(key_dev);
+
+ return 0;
+}
+
static int __devinit sonypi_probe(void)
{
int i, ret;
@@ -1298,34 +1335,10 @@ static int __devinit sonypi_probe(void)
}
if (useinput) {
- /* Initialize the Input Drivers: jogdial */
- int i;
- sonypi_device.input_jog_dev.evbit[0] =
- BIT(EV_KEY) | BIT(EV_REL);
- sonypi_device.input_jog_dev.keybit[LONG(BTN_MOUSE)] =
- BIT(BTN_MIDDLE);
- sonypi_device.input_jog_dev.relbit[0] = BIT(REL_WHEEL);
- sonypi_device.input_jog_dev.name = SONYPI_JOG_INPUTNAME;
- sonypi_device.input_jog_dev.id.bustype = BUS_ISA;
- sonypi_device.input_jog_dev.id.vendor = PCI_VENDOR_ID_SONY;
-
- input_register_device(&sonypi_device.input_jog_dev);
- printk(KERN_INFO "%s input method installed.\n",
- sonypi_device.input_jog_dev.name);
- /* Initialize the Input Drivers: special keys */
- sonypi_device.input_key_dev.evbit[0] = BIT(EV_KEY);
- for (i = 0; sonypi_inputkeys[i].sonypiev; i++)
- if (sonypi_inputkeys[i].inputev)
- set_bit(sonypi_inputkeys[i].inputev,
- sonypi_device.input_key_dev.keybit);
- sonypi_device.input_key_dev.name = SONYPI_KEY_INPUTNAME;
- sonypi_device.input_key_dev.id.bustype = BUS_ISA;
- sonypi_device.input_key_dev.id.vendor = PCI_VENDOR_ID_SONY;
-
- input_register_device(&sonypi_device.input_key_dev);
- printk(KERN_INFO "%s input method installed.\n",
- sonypi_device.input_key_dev.name);
+ ret = sonypi_create_input_devices();
+ if (ret)
+ goto out_inputdevices;
spin_lock_init(&sonypi_device.input_fifo_lock);
sonypi_device.input_fifo =
@@ -1375,8 +1388,9 @@ static int __devinit sonypi_probe(void)
out_platformdev:
kfifo_free(sonypi_device.input_fifo);
out_infifo:
- input_unregister_device(&sonypi_device.input_key_dev);
- input_unregister_device(&sonypi_device.input_jog_dev);
+ input_unregister_device(sonypi_device.input_key_dev);
+ input_unregister_device(sonypi_device.input_jog_dev);
+out_inputdevices:
free_irq(sonypi_device.irq, sonypi_irq);
out_reqirq:
release_region(sonypi_device.ioport1, sonypi_device.region_size);
@@ -1402,8 +1416,8 @@ static void __devexit sonypi_remove(void
platform_device_unregister(sonypi_device.pdev);
if (useinput) {
- input_unregister_device(&sonypi_device.input_key_dev);
- input_unregister_device(&sonypi_device.input_jog_dev);
+ input_unregister_device(sonypi_device.input_key_dev);
+ input_unregister_device(sonypi_device.input_jog_dev);
kfifo_free(sonypi_device.input_fifo);
}
next prev parent reply other threads:[~2005-10-28 6:32 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-10-28 6:29 [GIT PATCH] Driver Core patches for 2.6.14 Greg KH
2005-10-28 6:30 ` [PATCH] aoe: update to version 14 Greg KH
2005-10-28 6:30 ` [PATCH] aoe: use get_unaligned for accesses in ATA id buffer Greg KH
2005-10-28 6:30 ` [PATCH] kobject_uevent.c has a typo in a comment Greg KH
2005-10-28 6:30 ` [PATCH] changes device to driver in porting.txt Greg KH
2005-10-28 6:30 ` [PATCH] kobject: fix gfp flags type Greg KH
2005-10-28 6:30 ` [PATCH] pci device wakeup flags Greg KH
2005-10-28 6:30 ` [PATCH] driver model " Greg KH
2005-10-28 6:30 ` [PATCH] add sysfs support for ide tape Greg KH
2005-10-28 6:30 ` [PATCH] usb device wakeup flags Greg KH
2005-10-28 6:30 ` [PATCH] I2O: Clean up some pretty bad driver model abuses in the i2o code Greg KH
2005-10-28 6:30 ` [PATCH] Driver core: pass interface to class interface methods Greg KH
2005-10-28 6:30 ` [PATCH] Driver core: send hotplug event before adding class interfaces Greg KH
2005-10-28 6:30 ` [PATCH] I2O: remove i2o_device_class Greg KH
2005-10-28 6:30 ` [PATCH] add sysfs attr to re-emit device hotplug event Greg KH
2005-10-28 6:30 ` [PATCH] I2O: remove class interface Greg KH
2005-10-28 6:30 ` [PATCH] Driver Core: add the ability for class_device structures to be nested Greg KH
2005-10-28 6:30 ` [PATCH] Driver Core: fix up all callers of class_device_create() Greg KH
2005-10-28 6:30 ` [PATCH] Input: prepare to sysfs integration Greg KH
2005-10-28 6:30 ` [PATCH] Driver Core: document struct class_device properly Greg KH
2005-10-28 6:30 ` [PATCH] drivers/input/mouse: convert to dynamic input_dev allocation Greg KH
2005-10-28 6:30 ` [PATCH] Input: kill devfs references Greg KH
2005-10-28 6:30 ` Greg KH [this message]
2005-10-28 6:30 ` [PATCH] Input: convert ucb1x00-ts to dynamic input_dev allocation Greg KH
2005-10-28 6:30 ` [PATCH] drivers/input/keyboard: convert " Greg KH
2005-10-28 6:30 ` [PATCH] Input: convert onetouch " Greg KH
2005-10-28 6:30 ` [PATCH] drivers/input/touchscreen: convert " Greg KH
2005-10-28 6:55 ` [PATCH] drivers/input/keyboard: " Jan-Benedict Glaw
2005-10-28 7:05 ` Dmitry Torokhov
2005-10-29 5:59 ` Dmitry Torokhov
2005-10-29 14:37 ` Jan-Benedict Glaw
2005-10-29 15:04 ` Jan-Benedict Glaw
2005-10-29 16:28 ` Dmitry Torokhov
2005-10-29 18:53 ` Jan-Benedict Glaw
2005-10-31 7:02 ` Dmitry Torokhov
2005-10-31 7:20 ` [PATCH] input/lkkbd: misc fixes Jan-Benedict Glaw
2005-10-28 6:54 ` [PATCH] Driver Core: document struct class_device properly Dmitry Torokhov
2005-10-28 19:09 ` Greg KH
2005-10-28 19:18 ` Dmitry Torokhov
2005-11-07 8:00 ` Miles Bader
2005-11-07 17:00 ` Greg KH
2005-10-29 7:55 ` [PATCH] driver model wakeup flags Pavel Machek
2005-11-02 21:59 ` Greg KH
2005-11-04 17:43 ` David Brownell
2005-10-28 10:51 ` [PATCH] pci device " Andrew Morton
2005-10-28 14:31 ` Linus Torvalds
2005-10-28 23:03 ` Benjamin Herrenschmidt
2005-10-28 15:50 ` Greg KH
2005-10-28 19:34 ` Andrew Morton
2005-10-28 19:45 ` Greg KH
2005-10-28 19:47 ` Linus Torvalds
2005-10-28 19:56 ` Russell King
2005-10-28 20:08 ` Greg KH
2005-10-28 20:01 ` Greg KH
2005-10-28 9:21 ` [PATCH] kobject: fix gfp flags type Al Viro
2005-10-28 17:48 ` [GIT PATCH] Driver Core patches for 2.6.14 Greg KH
2005-10-28 18:55 ` Jan-Benedict Glaw
2005-10-28 19:11 ` Greg KH
2005-10-28 19:16 ` Jan-Benedict Glaw
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=11304810243087@kroah.com \
--to=gregkh@suse.de \
--cc=dtor_core@ameritech.net \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
/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