aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/serio
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2013-12-16 05:04:49 -0500
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2013-12-16 05:04:49 -0500
commit348324c5b10bcba8d9daabdfb85a6927311be34f (patch)
treed06ca3a264407a14a1f36c1b798d6dc0dc1582d8 /drivers/input/serio
parent1e63bd9cc43db5400a1423a7ec8266b4e7c54bd0 (diff)
parent319e2e3f63c348a9b66db4667efa73178e18b17d (diff)
Merge tag 'v3.13-rc4' into next
Synchronize with mainline to bring in the new keycode definitions and new hwmon API.
Diffstat (limited to 'drivers/input/serio')
-rw-r--r--drivers/input/serio/Kconfig2
-rw-r--r--drivers/input/serio/i8042.c25
-rw-r--r--drivers/input/serio/serio.c80
-rw-r--r--drivers/input/serio/xilinx_ps2.c8
4 files changed, 65 insertions, 50 deletions
diff --git a/drivers/input/serio/Kconfig b/drivers/input/serio/Kconfig
index 5a96acb667ea..8541f949778d 100644
--- a/drivers/input/serio/Kconfig
+++ b/drivers/input/serio/Kconfig
@@ -21,7 +21,7 @@ if SERIO
21config SERIO_I8042 21config SERIO_I8042
22 tristate "i8042 PC Keyboard controller" 22 tristate "i8042 PC Keyboard controller"
23 default y 23 default y
24 depends on !PARISC && (!ARM || ARCH_SHARK || FOOTBRIDGE_HOST) && \ 24 depends on !PARISC && (!ARM || FOOTBRIDGE_HOST) && \
25 (!SUPERH || SH_CAYMAN) && !M68K && !BLACKFIN && !S390 && \ 25 (!SUPERH || SH_CAYMAN) && !M68K && !BLACKFIN && !S390 && \
26 !ARC 26 !ARC
27 help 27 help
diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
index 78e4de42efaa..020053fa5aaa 100644
--- a/drivers/input/serio/i8042.c
+++ b/drivers/input/serio/i8042.c
@@ -223,21 +223,26 @@ static int i8042_flush(void)
223{ 223{
224 unsigned long flags; 224 unsigned long flags;
225 unsigned char data, str; 225 unsigned char data, str;
226 int i = 0; 226 int count = 0;
227 int retval = 0;
227 228
228 spin_lock_irqsave(&i8042_lock, flags); 229 spin_lock_irqsave(&i8042_lock, flags);
229 230
230 while (((str = i8042_read_status()) & I8042_STR_OBF) && (i < I8042_BUFFER_SIZE)) { 231 while ((str = i8042_read_status()) & I8042_STR_OBF) {
231 udelay(50); 232 if (count++ < I8042_BUFFER_SIZE) {
232 data = i8042_read_data(); 233 udelay(50);
233 i++; 234 data = i8042_read_data();
234 dbg("%02x <- i8042 (flush, %s)\n", 235 dbg("%02x <- i8042 (flush, %s)\n",
235 data, str & I8042_STR_AUXDATA ? "aux" : "kbd"); 236 data, str & I8042_STR_AUXDATA ? "aux" : "kbd");
237 } else {
238 retval = -EIO;
239 break;
240 }
236 } 241 }
237 242
238 spin_unlock_irqrestore(&i8042_lock, flags); 243 spin_unlock_irqrestore(&i8042_lock, flags);
239 244
240 return i; 245 return retval;
241} 246}
242 247
243/* 248/*
@@ -849,7 +854,7 @@ static int __init i8042_check_aux(void)
849 854
850static int i8042_controller_check(void) 855static int i8042_controller_check(void)
851{ 856{
852 if (i8042_flush() == I8042_BUFFER_SIZE) { 857 if (i8042_flush()) {
853 pr_err("No controller found\n"); 858 pr_err("No controller found\n");
854 return -ENODEV; 859 return -ENODEV;
855 } 860 }
@@ -1031,7 +1036,7 @@ static void i8042_controller_reset(bool force_reset)
1031/* 1036/*
1032 * i8042_panic_blink() will turn the keyboard LEDs on or off and is called 1037 * i8042_panic_blink() will turn the keyboard LEDs on or off and is called
1033 * when kernel panics. Flashing LEDs is useful for users running X who may 1038 * when kernel panics. Flashing LEDs is useful for users running X who may
1034 * not see the console and will help distingushing panics from "real" 1039 * not see the console and will help distinguishing panics from "real"
1035 * lockups. 1040 * lockups.
1036 * 1041 *
1037 * Note that DELAY has a limit of 10ms so we will not get stuck here 1042 * Note that DELAY has a limit of 10ms so we will not get stuck here
diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c
index 2b56855c2c77..8f4c4ab04bc2 100644
--- a/drivers/input/serio/serio.c
+++ b/drivers/input/serio/serio.c
@@ -365,7 +365,7 @@ static ssize_t serio_show_description(struct device *dev, struct device_attribut
365 return sprintf(buf, "%s\n", serio->name); 365 return sprintf(buf, "%s\n", serio->name);
366} 366}
367 367
368static ssize_t serio_show_modalias(struct device *dev, struct device_attribute *attr, char *buf) 368static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, char *buf)
369{ 369{
370 struct serio *serio = to_serio_port(dev); 370 struct serio *serio = to_serio_port(dev);
371 371
@@ -373,54 +373,31 @@ static ssize_t serio_show_modalias(struct device *dev, struct device_attribute *
373 serio->id.type, serio->id.proto, serio->id.id, serio->id.extra); 373 serio->id.type, serio->id.proto, serio->id.id, serio->id.extra);
374} 374}
375 375
376static ssize_t serio_show_id_type(struct device *dev, struct device_attribute *attr, char *buf) 376static ssize_t type_show(struct device *dev, struct device_attribute *attr, char *buf)
377{ 377{
378 struct serio *serio = to_serio_port(dev); 378 struct serio *serio = to_serio_port(dev);
379 return sprintf(buf, "%02x\n", serio->id.type); 379 return sprintf(buf, "%02x\n", serio->id.type);
380} 380}
381 381
382static ssize_t serio_show_id_proto(struct device *dev, struct device_attribute *attr, char *buf) 382static ssize_t proto_show(struct device *dev, struct device_attribute *attr, char *buf)
383{ 383{
384 struct serio *serio = to_serio_port(dev); 384 struct serio *serio = to_serio_port(dev);
385 return sprintf(buf, "%02x\n", serio->id.proto); 385 return sprintf(buf, "%02x\n", serio->id.proto);
386} 386}
387 387
388static ssize_t serio_show_id_id(struct device *dev, struct device_attribute *attr, char *buf) 388static ssize_t id_show(struct device *dev, struct device_attribute *attr, char *buf)
389{ 389{
390 struct serio *serio = to_serio_port(dev); 390 struct serio *serio = to_serio_port(dev);
391 return sprintf(buf, "%02x\n", serio->id.id); 391 return sprintf(buf, "%02x\n", serio->id.id);
392} 392}
393 393
394static ssize_t serio_show_id_extra(struct device *dev, struct device_attribute *attr, char *buf) 394static ssize_t extra_show(struct device *dev, struct device_attribute *attr, char *buf)
395{ 395{
396 struct serio *serio = to_serio_port(dev); 396 struct serio *serio = to_serio_port(dev);
397 return sprintf(buf, "%02x\n", serio->id.extra); 397 return sprintf(buf, "%02x\n", serio->id.extra);
398} 398}
399 399
400static DEVICE_ATTR(type, S_IRUGO, serio_show_id_type, NULL); 400static ssize_t drvctl_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
401static DEVICE_ATTR(proto, S_IRUGO, serio_show_id_proto, NULL);
402static DEVICE_ATTR(id, S_IRUGO, serio_show_id_id, NULL);
403static DEVICE_ATTR(extra, S_IRUGO, serio_show_id_extra, NULL);
404
405static struct attribute *serio_device_id_attrs[] = {
406 &dev_attr_type.attr,
407 &dev_attr_proto.attr,
408 &dev_attr_id.attr,
409 &dev_attr_extra.attr,
410 NULL
411};
412
413static struct attribute_group serio_id_attr_group = {
414 .name = "id",
415 .attrs = serio_device_id_attrs,
416};
417
418static const struct attribute_group *serio_device_attr_groups[] = {
419 &serio_id_attr_group,
420 NULL
421};
422
423static ssize_t serio_rebind_driver(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
424{ 401{
425 struct serio *serio = to_serio_port(dev); 402 struct serio *serio = to_serio_port(dev);
426 struct device_driver *drv; 403 struct device_driver *drv;
@@ -474,14 +451,46 @@ static ssize_t serio_set_bind_mode(struct device *dev, struct device_attribute *
474 return retval; 451 return retval;
475} 452}
476 453
477static struct device_attribute serio_device_attrs[] = { 454static DEVICE_ATTR_RO(type);
478 __ATTR(description, S_IRUGO, serio_show_description, NULL), 455static DEVICE_ATTR_RO(proto);
479 __ATTR(modalias, S_IRUGO, serio_show_modalias, NULL), 456static DEVICE_ATTR_RO(id);
480 __ATTR(drvctl, S_IWUSR, NULL, serio_rebind_driver), 457static DEVICE_ATTR_RO(extra);
481 __ATTR(bind_mode, S_IWUSR | S_IRUGO, serio_show_bind_mode, serio_set_bind_mode), 458
482 __ATTR_NULL 459static struct attribute *serio_device_id_attrs[] = {
460 &dev_attr_type.attr,
461 &dev_attr_proto.attr,
462 &dev_attr_id.attr,
463 &dev_attr_extra.attr,
464 NULL
465};
466
467static struct attribute_group serio_id_attr_group = {
468 .name = "id",
469 .attrs = serio_device_id_attrs,
483}; 470};
484 471
472static DEVICE_ATTR_RO(modalias);
473static DEVICE_ATTR_WO(drvctl);
474static DEVICE_ATTR(description, S_IRUGO, serio_show_description, NULL);
475static DEVICE_ATTR(bind_mode, S_IWUSR | S_IRUGO, serio_show_bind_mode, serio_set_bind_mode);
476
477static struct attribute *serio_device_attrs[] = {
478 &dev_attr_modalias.attr,
479 &dev_attr_description.attr,
480 &dev_attr_drvctl.attr,
481 &dev_attr_bind_mode.attr,
482 NULL
483};
484
485static struct attribute_group serio_device_attr_group = {
486 .attrs = serio_device_attrs,
487};
488
489static const struct attribute_group *serio_device_attr_groups[] = {
490 &serio_id_attr_group,
491 &serio_device_attr_group,
492 NULL
493};
485 494
486static void serio_release_port(struct device *dev) 495static void serio_release_port(struct device *dev)
487{ 496{
@@ -996,7 +1005,6 @@ EXPORT_SYMBOL(serio_interrupt);
996 1005
997static struct bus_type serio_bus = { 1006static struct bus_type serio_bus = {
998 .name = "serio", 1007 .name = "serio",
999 .dev_attrs = serio_device_attrs,
1000 .drv_groups = serio_driver_groups, 1008 .drv_groups = serio_driver_groups,
1001 .match = serio_bus_match, 1009 .match = serio_bus_match,
1002 .uevent = serio_uevent, 1010 .uevent = serio_uevent,
diff --git a/drivers/input/serio/xilinx_ps2.c b/drivers/input/serio/xilinx_ps2.c
index 4b7662a17ae9..dfbcd872f95e 100644
--- a/drivers/input/serio/xilinx_ps2.c
+++ b/drivers/input/serio/xilinx_ps2.c
@@ -25,6 +25,7 @@
25#include <linux/io.h> 25#include <linux/io.h>
26#include <linux/of_address.h> 26#include <linux/of_address.h>
27#include <linux/of_device.h> 27#include <linux/of_device.h>
28#include <linux/of_irq.h>
28#include <linux/of_platform.h> 29#include <linux/of_platform.h>
29 30
30#define DRIVER_NAME "xilinx_ps2" 31#define DRIVER_NAME "xilinx_ps2"
@@ -235,12 +236,12 @@ static void sxps2_close(struct serio *pserio)
235 */ 236 */
236static int xps2_of_probe(struct platform_device *ofdev) 237static int xps2_of_probe(struct platform_device *ofdev)
237{ 238{
238 struct resource r_irq; /* Interrupt resources */
239 struct resource r_mem; /* IO mem resources */ 239 struct resource r_mem; /* IO mem resources */
240 struct xps2data *drvdata; 240 struct xps2data *drvdata;
241 struct serio *serio; 241 struct serio *serio;
242 struct device *dev = &ofdev->dev; 242 struct device *dev = &ofdev->dev;
243 resource_size_t remap_size, phys_addr; 243 resource_size_t remap_size, phys_addr;
244 unsigned int irq;
244 int error; 245 int error;
245 246
246 dev_info(dev, "Device Tree Probing \'%s\'\n", 247 dev_info(dev, "Device Tree Probing \'%s\'\n",
@@ -254,7 +255,8 @@ static int xps2_of_probe(struct platform_device *ofdev)
254 } 255 }
255 256
256 /* Get IRQ for the device */ 257 /* Get IRQ for the device */
257 if (!of_irq_to_resource(ofdev->dev.of_node, 0, &r_irq)) { 258 irq = irq_of_parse_and_map(ofdev->dev.of_node, 0);
259 if (!irq) {
258 dev_err(dev, "no IRQ found\n"); 260 dev_err(dev, "no IRQ found\n");
259 return -ENODEV; 261 return -ENODEV;
260 } 262 }
@@ -267,7 +269,7 @@ static int xps2_of_probe(struct platform_device *ofdev)
267 } 269 }
268 270
269 spin_lock_init(&drvdata->lock); 271 spin_lock_init(&drvdata->lock);
270 drvdata->irq = r_irq.start; 272 drvdata->irq = irq;
271 drvdata->serio = serio; 273 drvdata->serio = serio;
272 drvdata->dev = dev; 274 drvdata->dev = dev;
273 275