Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1469793
| From | Rob Herring <robh@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [RFC PATCH 1/6] serio: add DT driver binding |
| Date | 2016-08-25 01:30 +0200 |
| Message-ID | <s9PMn-17y-43@gated-at.bofh.it> (permalink) |
| References | <s9PMm-17y-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
This adds DT driver binding support to the serio bus. The parent of the
serio port device must have a device_node associated with it. Typically,
this would be the UART device node. The slave device must be a child node
of the UART device node.
Signed-off-by: Rob Herring <robh@kernel.org>
---
drivers/input/serio/serio.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c
index 1ca7f55..9e8eb7a 100644
--- a/drivers/input/serio/serio.c
+++ b/drivers/input/serio/serio.c
@@ -36,6 +36,7 @@
#include <linux/slab.h>
#include <linux/workqueue.h>
#include <linux/mutex.h>
+#include <linux/of_device.h>
MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
MODULE_DESCRIPTION("Serio abstraction core");
@@ -88,7 +89,7 @@ static void serio_disconnect_driver(struct serio *serio)
static int serio_match_port(const struct serio_device_id *ids, struct serio *serio)
{
- while (ids->type || ids->proto) {
+ while (ids && (ids->type || ids->proto)) {
if ((ids->type == SERIO_ANY || ids->type == serio->id.type) &&
(ids->proto == SERIO_ANY || ids->proto == serio->id.proto) &&
(ids->extra == SERIO_ANY || ids->extra == serio->id.extra) &&
@@ -542,6 +543,8 @@ static void serio_init_port(struct serio *serio)
static void serio_add_port(struct serio *serio)
{
struct serio *parent = serio->parent;
+ struct device_node *parent_node =
+ serio->dev.parent ? serio->dev.parent->of_node : NULL;
int error;
if (parent) {
@@ -555,6 +558,8 @@ static void serio_add_port(struct serio *serio)
if (serio->start)
serio->start(serio);
+ serio->dev.of_node = of_get_next_available_child(parent_node, NULL);
+
error = device_add(&serio->dev);
if (error)
dev_err(&serio->dev,
@@ -902,6 +907,10 @@ static int serio_bus_match(struct device *dev, struct device_driver *drv)
struct serio *serio = to_serio_port(dev);
struct serio_driver *serio_drv = to_serio_driver(drv);
+ if (of_driver_match_device(dev, drv)) {
+ printk("matched %s\n", dev->of_node->name);
+ return 1;
+ }
if (serio->manual_bind || serio_drv->manual_bind)
return 0;
--
2.9.3
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[RFC PATCH 0/6] UART slave devices using serio Rob Herring <robh@kernel.org> - 2016-08-25 01:30 +0200
[RFC PATCH 5/6] serio: add serial configuration functions Rob Herring <robh@kernel.org> - 2016-08-25 01:30 +0200
[RFC PATCH 4/6] serio: serport: add support for buffered write and receive Rob Herring <robh@kernel.org> - 2016-08-25 01:30 +0200
Re: [RFC PATCH 4/6] serio: serport: add support for buffered write and receive Pavel Machek <pavel@ucw.cz> - 2016-08-26 22:20 +0200
Re: [RFC PATCH 4/6] serio: serport: add support for buffered write and receive Rob Herring <robh@kernel.org> - 2016-08-26 23:40 +0200
Re: [RFC PATCH 4/6] serio: serport: add support for buffered write and receive Pavel Machek <pavel@ucw.cz> - 2016-08-27 00:30 +0200
[RFC PATCH 1/6] serio: add OF driver binding Rob Herring <robh@kernel.org> - 2016-08-25 01:30 +0200
[RFC PATCH 1/6] serio: add DT driver binding Rob Herring <robh@kernel.org> - 2016-08-25 01:30 +0200
Re: [RFC PATCH 1/6] serio: add DT driver binding Pavel Machek <pavel@ucw.cz> - 2016-08-29 12:00 +0200
[RFC PATCH 6/6] bluetooth: hack up ldisc to use serio Rob Herring <robh@kernel.org> - 2016-08-25 01:30 +0200
Re: [RFC PATCH 0/6] UART slave devices using serio Pavel Machek <pavel@ucw.cz> - 2016-08-26 22:10 +0200
Re: [RFC PATCH 0/6] UART slave devices using serio Rob Herring <robh@kernel.org> - 2016-08-26 23:40 +0200
csiph-web