From: Rob Herring <robh@kernel.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Marcel Holtmann <marcel@holtmann.org>,
Jiri Slaby <jslaby@suse.com>, Sebastian Reichel <sre@kernel.org>,
Arnd Bergmann <arnd@arndb.de>,
"Dr . H . Nikolaus Schaller" <hns@goldelico.com>,
Alan Cox <gnomes@lxorguk.ukuu.org.uk>
Cc: Loic Poulain <loic.poulain@intel.com>,
Pavel Machek <pavel@ucw.cz>,
Peter Hurley <peter@hurleysoftware.com>,
NeilBrown <neil@brown.name>,
Linus Walleij <linus.walleij@linaro.org>,
linux-bluetooth@vger.kernel.org, linux-serial@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [RFC PATCH 1/6] serio: add DT driver binding
Date: Wed, 24 Aug 2016 18:24:31 -0500 [thread overview]
Message-ID: <20160824232437.9446-2-robh@kernel.org> (raw)
In-Reply-To: <20160824232437.9446-1-robh@kernel.org>
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
next prev parent reply other threads:[~2016-08-24 23:24 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-24 23:24 [RFC PATCH 0/6] UART slave devices using serio Rob Herring
2016-08-24 23:24 ` Rob Herring [this message]
2016-08-29 9:57 ` [RFC PATCH 1/6] serio: add DT driver binding Pavel Machek
2016-08-24 23:24 ` [RFC PATCH 1/6] serio: add OF " Rob Herring
2016-08-24 23:24 ` [RFC PATCH 2/6] serio: serport: hacks to get DT probe to work Rob Herring
2016-08-24 23:24 ` [RFC PATCH 3/6] serio: add buffer receive and write functions Rob Herring
2016-08-24 23:24 ` [RFC PATCH 4/6] serio: serport: add support for buffered write and receive Rob Herring
2016-08-26 20:12 ` Pavel Machek
2016-08-26 21:27 ` Rob Herring
2016-08-26 22:24 ` Pavel Machek
2016-08-24 23:24 ` [RFC PATCH 5/6] serio: add serial configuration functions Rob Herring
2016-08-24 23:24 ` [RFC PATCH 6/6] bluetooth: hack up ldisc to use serio Rob Herring
2016-08-26 20:05 ` [RFC PATCH 0/6] UART slave devices using serio Pavel Machek
2016-08-26 21:29 ` Rob Herring
2016-10-25 21:55 ` Sebastian Reichel
2016-10-25 22:02 ` Rob Herring
2016-10-26 2:51 ` Sebastian Reichel
[not found] ` <CAKU3ayV7vLSaNJGzV2MoCyT2GopReS55DCH4MPtSmGiHEUKdXw@mail.gmail.com>
2016-10-31 20:08 ` Peter Hurley
2016-11-01 3:40 ` Rob Herring
2016-11-02 3:49 ` Rob Herring
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=20160824232437.9446-2-robh@kernel.org \
--to=robh@kernel.org \
--cc=arnd@arndb.de \
--cc=gnomes@lxorguk.ukuu.org.uk \
--cc=gregkh@linuxfoundation.org \
--cc=hns@goldelico.com \
--cc=jslaby@suse.com \
--cc=linus.walleij@linaro.org \
--cc=linux-bluetooth@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=loic.poulain@intel.com \
--cc=marcel@holtmann.org \
--cc=neil@brown.name \
--cc=pavel@ucw.cz \
--cc=peter@hurleysoftware.com \
--cc=sre@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;
as well as URLs for NNTP newsgroup(s).