From patchwork Wed Aug 24 23:24:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rob Herring \(Arm\)" X-Patchwork-Id: 74640 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp558103qga; Wed, 24 Aug 2016 16:26:25 -0700 (PDT) X-Received: by 10.98.62.144 with SMTP id y16mr10720453pfj.9.1472081184926; Wed, 24 Aug 2016 16:26:24 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m6si11936490pfi.52.2016.08.24.16.26.24; Wed, 24 Aug 2016 16:26:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756182AbcHXX0V (ORCPT + 27 others); Wed, 24 Aug 2016 19:26:21 -0400 Received: from mail-oi0-f66.google.com ([209.85.218.66]:35157 "EHLO mail-oi0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932234AbcHXXYn (ORCPT ); Wed, 24 Aug 2016 19:24:43 -0400 Received: by mail-oi0-f66.google.com with SMTP id e80so3055511oig.2; Wed, 24 Aug 2016 16:24:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=sxl3CJMQaMF8MraYa6hkvMFLDFkyOB96sPejGEirxWk=; b=m3TzfWnrf6W5f1761VI7v5NL6/yxzCev/9Vuxqocix1kGcdvsefBwfxlvjTcjwyRXu agvsIkbkETJnmVQVDeVBS6Ex3j/fBsIrfk7VOVaexJo8iaLyAJoS9+UTPVSPGhsEVbaF kE28zBJfIgNRq8+00h4CvP+AfH3UcvYwqjsDU3gAzkNxquaPZbKWma/jBjbZXdA76x3d pyPCL+DwtN2zhL1EhLUr/6iMPYQB1rMvHs1H0Oh+ee1OolDPQw+VcX4z/W2XI7G0c4Ak QvNeC2mMFJtpmLCl6eiDfS2oiUUqZ+gzDmo3p9TiVXNF2vbJJ29LqdF//4Wd1vZqFvRV Kmgg== X-Gm-Message-State: AE9vXwOkTrxhWQWh0IVEoHsCYCpONNJrExhp9fjX8MLO40uVXsDw+j0XmscA4pIiVSt9rA== X-Received: by 10.157.32.46 with SMTP id n43mr4591849ota.120.1472081082085; Wed, 24 Aug 2016 16:24:42 -0700 (PDT) Received: from rob-hp-laptop.herring.priv (72-48-98-129.dyn.grandenetworks.net. [72.48.98.129]) by smtp.googlemail.com with ESMTPSA id a5sm1322910oii.3.2016.08.24.16.24.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 24 Aug 2016 16:24:41 -0700 (PDT) From: Rob Herring To: Greg Kroah-Hartman , Marcel Holtmann , Jiri Slaby , Sebastian Reichel , Arnd Bergmann , "Dr . H . Nikolaus Schaller" , Alan Cox Cc: Loic Poulain , Pavel Machek , Peter Hurley , NeilBrown , Linus Walleij , linux-bluetooth@vger.kernel.org, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH 1/6] serio: add OF driver binding Date: Wed, 24 Aug 2016 18:24:32 -0500 Message-Id: <20160824232437.9446-3-robh@kernel.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20160824232437.9446-1-robh@kernel.org> References: <20160824232437.9446-1-robh@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Signed-off-by: Rob Herring --- drivers/input/serio/serio.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) -- 2.9.3 diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c index 1ca7f55..6cfa22f 100644 --- a/drivers/input/serio/serio.c +++ b/drivers/input/serio/serio.c @@ -36,6 +36,7 @@ #include #include #include +#include MODULE_AUTHOR("Vojtech Pavlik "); 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) && @@ -107,6 +108,7 @@ static int serio_bind_driver(struct serio *serio, struct serio_driver *drv) { int error; + printk("%s\n", __func__); if (serio_match_port(drv->id_table, serio)) { serio->dev.driver = &drv->driver; @@ -133,6 +135,7 @@ static void serio_find_driver(struct serio *serio) { int error; + printk("%s\n", __func__); error = device_attach(&serio->dev); if (error < 0 && error != -EPROBE_DEFER) dev_warn(&serio->dev, @@ -542,8 +545,12 @@ 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; + printk("%s\n", __func__); + if (parent) { serio_pause_rx(parent); list_add_tail(&serio->child_node, &parent->children); @@ -555,6 +562,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, @@ -570,6 +579,8 @@ static void serio_destroy_port(struct serio *serio) { struct serio *child; + printk("%s\n", __func__); + while ((child = serio_get_pending_child(serio)) != NULL) { serio_remove_pending_events(child); put_device(&child->dev); @@ -791,6 +802,7 @@ static int serio_driver_probe(struct device *dev) struct serio *serio = to_serio_port(dev); struct serio_driver *drv = to_serio_driver(dev->driver); + printk("%s\n", __func__); return serio_connect_driver(serio, drv); } @@ -902,6 +914,12 @@ 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); + printk("%s\n", __func__); + + 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;