aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/serio
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2014-12-15 23:32:42 -0500
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2014-12-15 23:32:42 -0500
commitf20c86cd75f1c8c728dafd0218645ff3c5e8545d (patch)
treeb9100463df79eeafbef87a0bbbaaba4740313120 /drivers/input/serio
parenta1f9a4072655843fc03186acbad65990cc05dd2d (diff)
parent1d6a01365fd63fbf7c2709a183e2936728c8efad (diff)
Merge branch 'next' into for-linus
Prepare input updates for 3.19.
Diffstat (limited to 'drivers/input/serio')
-rw-r--r--drivers/input/serio/altera_ps2.c81
-rw-r--r--drivers/input/serio/i8042-x86ia64io.h10
-rw-r--r--drivers/input/serio/serio.c4
-rw-r--r--drivers/input/serio/serio_raw.c4
4 files changed, 38 insertions, 61 deletions
diff --git a/drivers/input/serio/altera_ps2.c b/drivers/input/serio/altera_ps2.c
index 58781c8a8aec..f50325a03d4a 100644
--- a/drivers/input/serio/altera_ps2.c
+++ b/drivers/input/serio/altera_ps2.c
@@ -24,9 +24,7 @@
24 24
25struct ps2if { 25struct ps2if {
26 struct serio *io; 26 struct serio *io;
27 struct resource *iomem_res;
28 void __iomem *base; 27 void __iomem *base;
29 unsigned irq;
30}; 28};
31 29
32/* 30/*
@@ -83,16 +81,34 @@ static void altera_ps2_close(struct serio *io)
83static int altera_ps2_probe(struct platform_device *pdev) 81static int altera_ps2_probe(struct platform_device *pdev)
84{ 82{
85 struct ps2if *ps2if; 83 struct ps2if *ps2if;
84 struct resource *res;
86 struct serio *serio; 85 struct serio *serio;
87 int error, irq; 86 int error, irq;
88 87
89 ps2if = kzalloc(sizeof(struct ps2if), GFP_KERNEL); 88 ps2if = devm_kzalloc(&pdev->dev, sizeof(struct ps2if), GFP_KERNEL);
90 serio = kzalloc(sizeof(struct serio), GFP_KERNEL); 89 if (!ps2if)
91 if (!ps2if || !serio) { 90 return -ENOMEM;
92 error = -ENOMEM; 91
93 goto err_free_mem; 92 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
93 ps2if->base = devm_ioremap_resource(&pdev->dev, res);
94 if (IS_ERR(ps2if->base))
95 return PTR_ERR(ps2if->base);
96
97 irq = platform_get_irq(pdev, 0);
98 if (irq < 0)
99 return -ENXIO;
100
101 error = devm_request_irq(&pdev->dev, irq, altera_ps2_rxint, 0,
102 pdev->name, ps2if);
103 if (error) {
104 dev_err(&pdev->dev, "could not request IRQ %d\n", irq);
105 return error;
94 } 106 }
95 107
108 serio = kzalloc(sizeof(struct serio), GFP_KERNEL);
109 if (!serio)
110 return -ENOMEM;
111
96 serio->id.type = SERIO_8042; 112 serio->id.type = SERIO_8042;
97 serio->write = altera_ps2_write; 113 serio->write = altera_ps2_write;
98 serio->open = altera_ps2_open; 114 serio->open = altera_ps2_open;
@@ -103,56 +119,12 @@ static int altera_ps2_probe(struct platform_device *pdev)
103 serio->dev.parent = &pdev->dev; 119 serio->dev.parent = &pdev->dev;
104 ps2if->io = serio; 120 ps2if->io = serio;
105 121
106 ps2if->iomem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 122 dev_info(&pdev->dev, "base %p, irq %d\n", ps2if->base, irq);
107 if (ps2if->iomem_res == NULL) {
108 error = -ENOENT;
109 goto err_free_mem;
110 }
111
112
113 irq = platform_get_irq(pdev, 0);
114 if (irq < 0) {
115 error = -ENXIO;
116 goto err_free_mem;
117 }
118 ps2if->irq = irq;
119
120 if (!request_mem_region(ps2if->iomem_res->start,
121 resource_size(ps2if->iomem_res), pdev->name)) {
122 error = -EBUSY;
123 goto err_free_mem;
124 }
125
126 ps2if->base = ioremap(ps2if->iomem_res->start,
127 resource_size(ps2if->iomem_res));
128 if (!ps2if->base) {
129 error = -ENOMEM;
130 goto err_free_res;
131 }
132
133 error = request_irq(ps2if->irq, altera_ps2_rxint, 0, pdev->name, ps2if);
134 if (error) {
135 dev_err(&pdev->dev, "could not allocate IRQ %d: %d\n",
136 ps2if->irq, error);
137 goto err_unmap;
138 }
139
140 dev_info(&pdev->dev, "base %p, irq %d\n", ps2if->base, ps2if->irq);
141 123
142 serio_register_port(ps2if->io); 124 serio_register_port(ps2if->io);
143 platform_set_drvdata(pdev, ps2if); 125 platform_set_drvdata(pdev, ps2if);
144 126
145 return 0; 127 return 0;
146
147 err_unmap:
148 iounmap(ps2if->base);
149 err_free_res:
150 release_mem_region(ps2if->iomem_res->start,
151 resource_size(ps2if->iomem_res));
152 err_free_mem:
153 kfree(ps2if);
154 kfree(serio);
155 return error;
156} 128}
157 129
158/* 130/*
@@ -163,11 +135,6 @@ static int altera_ps2_remove(struct platform_device *pdev)
163 struct ps2if *ps2if = platform_get_drvdata(pdev); 135 struct ps2if *ps2if = platform_get_drvdata(pdev);
164 136
165 serio_unregister_port(ps2if->io); 137 serio_unregister_port(ps2if->io);
166 free_irq(ps2if->irq, ps2if);
167 iounmap(ps2if->base);
168 release_mem_region(ps2if->iomem_res->start,
169 resource_size(ps2if->iomem_res));
170 kfree(ps2if);
171 138
172 return 0; 139 return 0;
173} 140}
diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h
index faeeb1372462..c66d1b53843e 100644
--- a/drivers/input/serio/i8042-x86ia64io.h
+++ b/drivers/input/serio/i8042-x86ia64io.h
@@ -579,6 +579,16 @@ static const struct dmi_system_id __initconst i8042_dmi_nopnp_table[] = {
579 }, 579 },
580 }, 580 },
581 { 581 {
582 /*
583 * Intel NUC D54250WYK - does not have i8042 controller but
584 * declares PS/2 devices in DSDT.
585 */
586 .matches = {
587 DMI_MATCH(DMI_BOARD_NAME, "D54250WYK"),
588 DMI_MATCH(DMI_BOARD_VENDOR, "Intel Corporation"),
589 },
590 },
591 {
582 /* MSI Wind U-100 */ 592 /* MSI Wind U-100 */
583 .matches = { 593 .matches = {
584 DMI_MATCH(DMI_BOARD_NAME, "U-100"), 594 DMI_MATCH(DMI_BOARD_NAME, "U-100"),
diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c
index d399b8b0f000..a05a5179da32 100644
--- a/drivers/input/serio/serio.c
+++ b/drivers/input/serio/serio.c
@@ -514,7 +514,7 @@ static void serio_release_port(struct device *dev)
514 */ 514 */
515static void serio_init_port(struct serio *serio) 515static void serio_init_port(struct serio *serio)
516{ 516{
517 static atomic_t serio_no = ATOMIC_INIT(0); 517 static atomic_t serio_no = ATOMIC_INIT(-1);
518 518
519 __module_get(THIS_MODULE); 519 __module_get(THIS_MODULE);
520 520
@@ -525,7 +525,7 @@ static void serio_init_port(struct serio *serio)
525 mutex_init(&serio->drv_mutex); 525 mutex_init(&serio->drv_mutex);
526 device_initialize(&serio->dev); 526 device_initialize(&serio->dev);
527 dev_set_name(&serio->dev, "serio%lu", 527 dev_set_name(&serio->dev, "serio%lu",
528 (unsigned long)atomic_inc_return(&serio_no) - 1); 528 (unsigned long)atomic_inc_return(&serio_no));
529 serio->dev.bus = &serio_bus; 529 serio->dev.bus = &serio_bus;
530 serio->dev.release = serio_release_port; 530 serio->dev.release = serio_release_port;
531 serio->dev.groups = serio_device_attr_groups; 531 serio->dev.groups = serio_device_attr_groups;
diff --git a/drivers/input/serio/serio_raw.c b/drivers/input/serio/serio_raw.c
index c9a02fe57576..71ef5d65a0c6 100644
--- a/drivers/input/serio/serio_raw.c
+++ b/drivers/input/serio/serio_raw.c
@@ -292,7 +292,7 @@ static irqreturn_t serio_raw_interrupt(struct serio *serio, unsigned char data,
292 292
293static int serio_raw_connect(struct serio *serio, struct serio_driver *drv) 293static int serio_raw_connect(struct serio *serio, struct serio_driver *drv)
294{ 294{
295 static atomic_t serio_raw_no = ATOMIC_INIT(0); 295 static atomic_t serio_raw_no = ATOMIC_INIT(-1);
296 struct serio_raw *serio_raw; 296 struct serio_raw *serio_raw;
297 int err; 297 int err;
298 298
@@ -303,7 +303,7 @@ static int serio_raw_connect(struct serio *serio, struct serio_driver *drv)
303 } 303 }
304 304
305 snprintf(serio_raw->name, sizeof(serio_raw->name), 305 snprintf(serio_raw->name, sizeof(serio_raw->name),
306 "serio_raw%ld", (long)atomic_inc_return(&serio_raw_no) - 1); 306 "serio_raw%ld", (long)atomic_inc_return(&serio_raw_no));
307 kref_init(&serio_raw->kref); 307 kref_init(&serio_raw->kref);
308 INIT_LIST_HEAD(&serio_raw->client_list); 308 INIT_LIST_HEAD(&serio_raw->client_list);
309 init_waitqueue_head(&serio_raw->wait); 309 init_waitqueue_head(&serio_raw->wait);