aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/gameport/gameport.c19
-rw-r--r--drivers/input/gameport/lightning.c4
-rw-r--r--drivers/input/input.c25
-rw-r--r--drivers/input/mouse/lifebook.c82
-rw-r--r--drivers/input/mouse/logips2pp.c11
-rw-r--r--drivers/input/mouse/trackpoint.c12
-rw-r--r--drivers/input/serio/i8042.c21
-rw-r--r--drivers/input/serio/serio.c22
-rw-r--r--drivers/input/touchscreen/ads7846.c95
9 files changed, 172 insertions, 119 deletions
diff --git a/drivers/input/gameport/gameport.c b/drivers/input/gameport/gameport.c
index a0af97efe6ac..bba5894fcecd 100644
--- a/drivers/input/gameport/gameport.c
+++ b/drivers/input/gameport/gameport.c
@@ -730,12 +730,6 @@ static int gameport_driver_remove(struct device *dev)
730 return 0; 730 return 0;
731} 731}
732 732
733static struct bus_type gameport_bus = {
734 .name = "gameport",
735 .probe = gameport_driver_probe,
736 .remove = gameport_driver_remove,
737};
738
739static void gameport_add_driver(struct gameport_driver *drv) 733static void gameport_add_driver(struct gameport_driver *drv)
740{ 734{
741 int error; 735 int error;
@@ -781,6 +775,15 @@ static int gameport_bus_match(struct device *dev, struct device_driver *drv)
781 return !gameport_drv->ignore; 775 return !gameport_drv->ignore;
782} 776}
783 777
778static struct bus_type gameport_bus = {
779 .name = "gameport",
780 .dev_attrs = gameport_device_attrs,
781 .drv_attrs = gameport_driver_attrs,
782 .match = gameport_bus_match,
783 .probe = gameport_driver_probe,
784 .remove = gameport_driver_remove,
785};
786
784static void gameport_set_drv(struct gameport *gameport, struct gameport_driver *drv) 787static void gameport_set_drv(struct gameport *gameport, struct gameport_driver *drv)
785{ 788{
786 mutex_lock(&gameport->drv_mutex); 789 mutex_lock(&gameport->drv_mutex);
@@ -790,7 +793,6 @@ static void gameport_set_drv(struct gameport *gameport, struct gameport_driver *
790 793
791int gameport_open(struct gameport *gameport, struct gameport_driver *drv, int mode) 794int gameport_open(struct gameport *gameport, struct gameport_driver *drv, int mode)
792{ 795{
793
794 if (gameport->open) { 796 if (gameport->open) {
795 if (gameport->open(gameport, mode)) { 797 if (gameport->open(gameport, mode)) {
796 return -1; 798 return -1;
@@ -818,9 +820,6 @@ static int __init gameport_init(void)
818{ 820{
819 int error; 821 int error;
820 822
821 gameport_bus.dev_attrs = gameport_device_attrs;
822 gameport_bus.drv_attrs = gameport_driver_attrs;
823 gameport_bus.match = gameport_bus_match;
824 error = bus_register(&gameport_bus); 823 error = bus_register(&gameport_bus);
825 if (error) { 824 if (error) {
826 printk(KERN_ERR "gameport: failed to register gameport bus, error: %d\n", error); 825 printk(KERN_ERR "gameport: failed to register gameport bus, error: %d\n", error);
diff --git a/drivers/input/gameport/lightning.c b/drivers/input/gameport/lightning.c
index d65d81080257..6b4d4561d465 100644
--- a/drivers/input/gameport/lightning.c
+++ b/drivers/input/gameport/lightning.c
@@ -309,7 +309,7 @@ static int __init l4_init(void)
309 int i, cards = 0; 309 int i, cards = 0;
310 310
311 if (!request_region(L4_PORT, 1, "lightning")) 311 if (!request_region(L4_PORT, 1, "lightning"))
312 return -1; 312 return -EBUSY;
313 313
314 for (i = 0; i < 2; i++) 314 for (i = 0; i < 2; i++)
315 if (l4_add_card(i) == 0) 315 if (l4_add_card(i) == 0)
@@ -319,7 +319,7 @@ static int __init l4_init(void)
319 319
320 if (!cards) { 320 if (!cards) {
321 release_region(L4_PORT, 1); 321 release_region(L4_PORT, 1);
322 return -1; 322 return -ENODEV;
323 } 323 }
324 324
325 return 0; 325 return 0;
diff --git a/drivers/input/input.c b/drivers/input/input.c
index 1c8c8a5bc4a9..7cf2b4f603a3 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -37,7 +37,7 @@ static struct input_handler *input_table[8];
37 37
38/** 38/**
39 * input_event() - report new input event 39 * input_event() - report new input event
40 * @handle: device that generated the event 40 * @dev: device that generated the event
41 * @type: type of the event 41 * @type: type of the event
42 * @code: event code 42 * @code: event code
43 * @value: value of the event 43 * @value: value of the event
@@ -900,6 +900,15 @@ struct class input_class = {
900}; 900};
901EXPORT_SYMBOL_GPL(input_class); 901EXPORT_SYMBOL_GPL(input_class);
902 902
903/**
904 * input_allocate_device - allocate memory for new input device
905 *
906 * Returns prepared struct input_dev or NULL.
907 *
908 * NOTE: Use input_free_device() to free devices that have not been
909 * registered; input_unregister_device() should be used for already
910 * registered devices.
911 */
903struct input_dev *input_allocate_device(void) 912struct input_dev *input_allocate_device(void)
904{ 913{
905 struct input_dev *dev; 914 struct input_dev *dev;
@@ -919,6 +928,20 @@ struct input_dev *input_allocate_device(void)
919} 928}
920EXPORT_SYMBOL(input_allocate_device); 929EXPORT_SYMBOL(input_allocate_device);
921 930
931/**
932 * input_free_device - free memory occupied by input_dev structure
933 * @dev: input device to free
934 *
935 * This function should only be used if input_register_device()
936 * was not called yet or if it failed. Once device was registered
937 * use input_unregister_device() and memory will be freed once last
938 * refrence to the device is dropped.
939 *
940 * Device should be allocated by input_allocate_device().
941 *
942 * NOTE: If there are references to the input device then memory
943 * will not be freed until last reference is dropped.
944 */
922void input_free_device(struct input_dev *dev) 945void input_free_device(struct input_dev *dev)
923{ 946{
924 if (dev) { 947 if (dev) {
diff --git a/drivers/input/mouse/lifebook.c b/drivers/input/mouse/lifebook.c
index c57e8853b949..29542f0631cb 100644
--- a/drivers/input/mouse/lifebook.c
+++ b/drivers/input/mouse/lifebook.c
@@ -21,47 +21,51 @@
21#include "lifebook.h" 21#include "lifebook.h"
22 22
23static struct dmi_system_id lifebook_dmi_table[] = { 23static struct dmi_system_id lifebook_dmi_table[] = {
24 { 24 {
25 .ident = "LifeBook B", 25 .ident = "FLORA-ie 55mi",
26 .matches = { 26 .matches = {
27 DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook B Series"), 27 DMI_MATCH(DMI_PRODUCT_NAME, "FLORA-ie 55mi"),
28 }, 28 },
29 }, 29 },
30 { 30 {
31 .ident = "Lifebook B", 31 .ident = "LifeBook B",
32 .matches = { 32 .matches = {
33 DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK B Series"), 33 DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook B Series"),
34 }, 34 },
35 }, 35 },
36 { 36 {
37 .ident = "Lifebook B213x/B2150", 37 .ident = "Lifebook B",
38 .matches = { 38 .matches = {
39 DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook B2131/B2133/B2150"), 39 DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK B Series"),
40 }, 40 },
41 }, 41 },
42 { 42 {
43 .ident = "Zephyr", 43 .ident = "Lifebook B213x/B2150",
44 .matches = { 44 .matches = {
45 DMI_MATCH(DMI_PRODUCT_NAME, "ZEPHYR"), 45 DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook B2131/B2133/B2150"),
46 }, 46 },
47 }, 47 },
48 { 48 {
49 .ident = "CF-18", 49 .ident = "Zephyr",
50 .matches = { 50 .matches = {
51 DMI_MATCH(DMI_PRODUCT_NAME, "CF-18"), 51 DMI_MATCH(DMI_PRODUCT_NAME, "ZEPHYR"),
52 }, 52 },
53 }, 53 },
54 { 54 {
55 .ident = "Lifebook B142", 55 .ident = "CF-18",
56 .matches = { 56 .matches = {
57 DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook B142"), 57 DMI_MATCH(DMI_PRODUCT_NAME, "CF-18"),
58 }, 58 },
59 59 },
60 }, 60 {
61 { } 61 .ident = "Lifebook B142",
62 .matches = {
63 DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook B142"),
64 },
65 },
66 { }
62}; 67};
63 68
64
65static psmouse_ret_t lifebook_process_byte(struct psmouse *psmouse) 69static psmouse_ret_t lifebook_process_byte(struct psmouse *psmouse)
66{ 70{
67 unsigned char *packet = psmouse->packet; 71 unsigned char *packet = psmouse->packet;
diff --git a/drivers/input/mouse/logips2pp.c b/drivers/input/mouse/logips2pp.c
index 8a4f862709e7..d3ddea26b8ca 100644
--- a/drivers/input/mouse/logips2pp.c
+++ b/drivers/input/mouse/logips2pp.c
@@ -328,6 +328,7 @@ int ps2pp_init(struct psmouse *psmouse, int set_properties)
328 unsigned char model, buttons; 328 unsigned char model, buttons;
329 const struct ps2pp_info *model_info; 329 const struct ps2pp_info *model_info;
330 int use_ps2pp = 0; 330 int use_ps2pp = 0;
331 int error;
331 332
332 param[0] = 0; 333 param[0] = 0;
333 ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES); 334 ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES);
@@ -393,8 +394,14 @@ int ps2pp_init(struct psmouse *psmouse, int set_properties)
393 psmouse->set_resolution = ps2pp_set_resolution; 394 psmouse->set_resolution = ps2pp_set_resolution;
394 psmouse->disconnect = ps2pp_disconnect; 395 psmouse->disconnect = ps2pp_disconnect;
395 396
396 device_create_file(&psmouse->ps2dev.serio->dev, 397 error = device_create_file(&psmouse->ps2dev.serio->dev,
397 &psmouse_attr_smartscroll.dattr); 398 &psmouse_attr_smartscroll.dattr);
399 if (error) {
400 printk(KERN_ERR
401 "logips2pp.c: failed to create smartscroll "
402 "sysfs attribute, error: %d\n", error);
403 return -1;
404 }
398 } 405 }
399 } 406 }
400 407
diff --git a/drivers/input/mouse/trackpoint.c b/drivers/input/mouse/trackpoint.c
index ae5871a0e060..9ab5b5ea809d 100644
--- a/drivers/input/mouse/trackpoint.c
+++ b/drivers/input/mouse/trackpoint.c
@@ -293,6 +293,7 @@ int trackpoint_detect(struct psmouse *psmouse, int set_properties)
293 struct ps2dev *ps2dev = &psmouse->ps2dev; 293 struct ps2dev *ps2dev = &psmouse->ps2dev;
294 unsigned char firmware_id; 294 unsigned char firmware_id;
295 unsigned char button_info; 295 unsigned char button_info;
296 int error;
296 297
297 if (trackpoint_start_protocol(psmouse, &firmware_id)) 298 if (trackpoint_start_protocol(psmouse, &firmware_id))
298 return -1; 299 return -1;
@@ -305,7 +306,7 @@ int trackpoint_detect(struct psmouse *psmouse, int set_properties)
305 button_info = 0; 306 button_info = 0;
306 } 307 }
307 308
308 psmouse->private = priv = kcalloc(1, sizeof(struct trackpoint_data), GFP_KERNEL); 309 psmouse->private = priv = kzalloc(sizeof(struct trackpoint_data), GFP_KERNEL);
309 if (!priv) 310 if (!priv)
310 return -1; 311 return -1;
311 312
@@ -318,7 +319,14 @@ int trackpoint_detect(struct psmouse *psmouse, int set_properties)
318 trackpoint_defaults(priv); 319 trackpoint_defaults(priv);
319 trackpoint_sync(psmouse); 320 trackpoint_sync(psmouse);
320 321
321 sysfs_create_group(&ps2dev->serio->dev.kobj, &trackpoint_attr_group); 322 error = sysfs_create_group(&ps2dev->serio->dev.kobj, &trackpoint_attr_group);
323 if (error) {
324 printk(KERN_ERR
325 "trackpoint.c: failed to create sysfs attributes, error: %d\n",
326 error);
327 kfree(priv);
328 return -1;
329 }
322 330
323 printk(KERN_INFO "IBM TrackPoint firmware: 0x%02x, buttons: %d/%d\n", 331 printk(KERN_INFO "IBM TrackPoint firmware: 0x%02x, buttons: %d/%d\n",
324 firmware_id, (button_info & 0xf0) >> 4, button_info & 0x0f); 332 firmware_id, (button_info & 0xf0) >> 4, button_info & 0x0f);
diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
index 7e3141f37e32..d365f227ac56 100644
--- a/drivers/input/serio/i8042.c
+++ b/drivers/input/serio/i8042.c
@@ -255,25 +255,10 @@ static int i8042_kbd_write(struct serio *port, unsigned char c)
255static int i8042_aux_write(struct serio *serio, unsigned char c) 255static int i8042_aux_write(struct serio *serio, unsigned char c)
256{ 256{
257 struct i8042_port *port = serio->port_data; 257 struct i8042_port *port = serio->port_data;
258 int retval;
259
260/*
261 * Send the byte out.
262 */
263
264 if (port->mux == -1)
265 retval = i8042_command(&c, I8042_CMD_AUX_SEND);
266 else
267 retval = i8042_command(&c, I8042_CMD_MUX_SEND + port->mux);
268 258
269/* 259 return i8042_command(&c, port->mux == -1 ?
270 * Make sure the interrupt happens and the character is received even 260 I8042_CMD_AUX_SEND :
271 * in the case the IRQ isn't wired, so that we can receive further 261 I8042_CMD_MUX_SEND + port->mux);
272 * characters later.
273 */
274
275 i8042_interrupt(0, NULL);
276 return retval;
277} 262}
278 263
279/* 264/*
diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c
index 211943f85cb6..3cb99d454ecd 100644
--- a/drivers/input/serio/serio.c
+++ b/drivers/input/serio/serio.c
@@ -784,12 +784,6 @@ static int serio_driver_remove(struct device *dev)
784 return 0; 784 return 0;
785} 785}
786 786
787static struct bus_type serio_bus = {
788 .name = "serio",
789 .probe = serio_driver_probe,
790 .remove = serio_driver_remove,
791};
792
793static void serio_add_driver(struct serio_driver *drv) 787static void serio_add_driver(struct serio_driver *drv)
794{ 788{
795 int error; 789 int error;
@@ -946,15 +940,21 @@ irqreturn_t serio_interrupt(struct serio *serio,
946 return ret; 940 return ret;
947} 941}
948 942
943static struct bus_type serio_bus = {
944 .name = "serio",
945 .dev_attrs = serio_device_attrs,
946 .drv_attrs = serio_driver_attrs,
947 .match = serio_bus_match,
948 .uevent = serio_uevent,
949 .probe = serio_driver_probe,
950 .remove = serio_driver_remove,
951 .resume = serio_resume,
952};
953
949static int __init serio_init(void) 954static int __init serio_init(void)
950{ 955{
951 int error; 956 int error;
952 957
953 serio_bus.dev_attrs = serio_device_attrs;
954 serio_bus.drv_attrs = serio_driver_attrs;
955 serio_bus.match = serio_bus_match;
956 serio_bus.uevent = serio_uevent;
957 serio_bus.resume = serio_resume;
958 error = bus_register(&serio_bus); 958 error = bus_register(&serio_bus);
959 if (error) { 959 if (error) {
960 printk(KERN_ERR "serio: failed to register serio bus, error: %d\n", error); 960 printk(KERN_ERR "serio: failed to register serio bus, error: %d\n", error);
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
index f56d6a0f0624..8f56af8cd7a0 100644
--- a/drivers/input/touchscreen/ads7846.c
+++ b/drivers/input/touchscreen/ads7846.c
@@ -76,6 +76,7 @@ struct ads7846 {
76 char phys[32]; 76 char phys[32];
77 77
78 struct spi_device *spi; 78 struct spi_device *spi;
79 struct attribute_group *attr_group;
79 u16 model; 80 u16 model;
80 u16 vref_delay_usecs; 81 u16 vref_delay_usecs;
81 u16 x_plate_ohms; 82 u16 x_plate_ohms;
@@ -317,6 +318,48 @@ static ssize_t ads7846_disable_store(struct device *dev,
317 318
318static DEVICE_ATTR(disable, 0664, ads7846_disable_show, ads7846_disable_store); 319static DEVICE_ATTR(disable, 0664, ads7846_disable_show, ads7846_disable_store);
319 320
321static struct attribute *ads7846_attributes[] = {
322 &dev_attr_temp0.attr,
323 &dev_attr_temp1.attr,
324 &dev_attr_vbatt.attr,
325 &dev_attr_vaux.attr,
326 &dev_attr_pen_down.attr,
327 &dev_attr_disable.attr,
328 NULL,
329};
330
331static struct attribute_group ads7846_attr_group = {
332 .attrs = ads7846_attributes,
333};
334
335/*
336 * ads7843/7845 don't have temperature sensors, and
337 * use the other sensors a bit differently too
338 */
339
340static struct attribute *ads7843_attributes[] = {
341 &dev_attr_vbatt.attr,
342 &dev_attr_vaux.attr,
343 &dev_attr_pen_down.attr,
344 &dev_attr_disable.attr,
345 NULL,
346};
347
348static struct attribute_group ads7843_attr_group = {
349 .attrs = ads7843_attributes,
350};
351
352static struct attribute *ads7845_attributes[] = {
353 &dev_attr_vaux.attr,
354 &dev_attr_pen_down.attr,
355 &dev_attr_disable.attr,
356 NULL,
357};
358
359static struct attribute_group ads7845_attr_group = {
360 .attrs = ads7845_attributes,
361};
362
320/*--------------------------------------------------------------------------*/ 363/*--------------------------------------------------------------------------*/
321 364
322/* 365/*
@@ -788,38 +831,30 @@ static int __devinit ads7846_probe(struct spi_device *spi)
788 (void) ads7846_read12_ser(&spi->dev, 831 (void) ads7846_read12_ser(&spi->dev,
789 READ_12BIT_SER(vaux) | ADS_PD10_ALL_ON); 832 READ_12BIT_SER(vaux) | ADS_PD10_ALL_ON);
790 833
791 /* ads7843/7845 don't have temperature sensors, and 834 switch (ts->model) {
792 * use the other sensors a bit differently too 835 case 7846:
793 */ 836 ts->attr_group = &ads7846_attr_group;
794 if (ts->model == 7846) { 837 break;
795 device_create_file(&spi->dev, &dev_attr_temp0); 838 case 7845:
796 device_create_file(&spi->dev, &dev_attr_temp1); 839 ts->attr_group = &ads7845_attr_group;
840 break;
841 default:
842 ts->attr_group = &ads7843_attr_group;
843 break;
797 } 844 }
798 if (ts->model != 7845) 845 err = sysfs_create_group(&spi->dev.kobj, ts->attr_group);
799 device_create_file(&spi->dev, &dev_attr_vbatt); 846 if (err)
800 device_create_file(&spi->dev, &dev_attr_vaux); 847 goto err_free_irq;
801
802 device_create_file(&spi->dev, &dev_attr_pen_down);
803
804 device_create_file(&spi->dev, &dev_attr_disable);
805 848
806 err = input_register_device(input_dev); 849 err = input_register_device(input_dev);
807 if (err) 850 if (err)
808 goto err_remove_attr; 851 goto err_remove_attr_group;
809 852
810 return 0; 853 return 0;
811 854
812 err_remove_attr: 855 err_remove_attr_group:
813 device_remove_file(&spi->dev, &dev_attr_disable); 856 sysfs_remove_group(&spi->dev.kobj, ts->attr_group);
814 device_remove_file(&spi->dev, &dev_attr_pen_down); 857 err_free_irq:
815 if (ts->model == 7846) {
816 device_remove_file(&spi->dev, &dev_attr_temp1);
817 device_remove_file(&spi->dev, &dev_attr_temp0);
818 }
819 if (ts->model != 7845)
820 device_remove_file(&spi->dev, &dev_attr_vbatt);
821 device_remove_file(&spi->dev, &dev_attr_vaux);
822
823 free_irq(spi->irq, ts); 858 free_irq(spi->irq, ts);
824 err_free_mem: 859 err_free_mem:
825 input_free_device(input_dev); 860 input_free_device(input_dev);
@@ -835,15 +870,7 @@ static int __devexit ads7846_remove(struct spi_device *spi)
835 870
836 ads7846_suspend(spi, PMSG_SUSPEND); 871 ads7846_suspend(spi, PMSG_SUSPEND);
837 872
838 device_remove_file(&spi->dev, &dev_attr_disable); 873 sysfs_remove_group(&spi->dev.kobj, ts->attr_group);
839 device_remove_file(&spi->dev, &dev_attr_pen_down);
840 if (ts->model == 7846) {
841 device_remove_file(&spi->dev, &dev_attr_temp1);
842 device_remove_file(&spi->dev, &dev_attr_temp0);
843 }
844 if (ts->model != 7845)
845 device_remove_file(&spi->dev, &dev_attr_vbatt);
846 device_remove_file(&spi->dev, &dev_attr_vaux);
847 874
848 free_irq(ts->spi->irq, ts); 875 free_irq(ts->spi->irq, ts);
849 /* suspend left the IRQ disabled */ 876 /* suspend left the IRQ disabled */