From patchwork Wed Aug 24 23:24:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 74634 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp557609qga; Wed, 24 Aug 2016 16:24:46 -0700 (PDT) X-Received: by 10.66.148.7 with SMTP id to7mr10696759pab.128.1472081084975; Wed, 24 Aug 2016 16:24:44 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c69si11913913pfc.145.2016.08.24.16.24.44; Wed, 24 Aug 2016 16:24:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-serial-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-serial-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-serial-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932727AbcHXXYo (ORCPT + 2 others); Wed, 24 Aug 2016 19:24:44 -0400 Received: from mail-oi0-f68.google.com ([209.85.218.68]:32812 "EHLO mail-oi0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754320AbcHXXYl (ORCPT ); Wed, 24 Aug 2016 19:24:41 -0400 Received: by mail-oi0-f68.google.com with SMTP id s207so3061633oie.0; Wed, 24 Aug 2016 16:24:41 -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=3h66dkxBs42g9xqKWzu7Cxuy+ebdcmfFN2X+loW5/V8=; b=fF5IzwXlhdYjKwBNXrkBDYDk+vyJIvvqz9mz6v3y0YxyD4SFRY4N2jdyJ2J9Zd9SH8 l5GV4Y1IY1P4h4iDw7H4XogOZw6brk5jdT6iKVJibayuPB3gJJTLCMlgJawTVSvYZG5k bAeI6LFj7SBSAvcwzLIF91BgnKmDxZuQbkeyvprWI2QU/7iQBGW6pmIkXXYXzsy2b+h8 0hjpVA1pWd5sAJgUp0l17FPqyefhACVkstax0Qx9YupSXHkFPnID8Zdtw7LRT02+tSoO wn5fOMwtS/lqS8UkStCcxScEV9JX+wtC97yw5tnotrg5pK3QCCcWzYO1dbyL1RNa1wXO 5glg== X-Gm-Message-State: AEkoouvxu3UeDrTLFXvcLWz88w8o1UFjxMHE2TZdjFNeHQM7P8jgMSHYh13+4qkD1VmYuw== X-Received: by 10.157.39.135 with SMTP id c7mr4498879otb.34.1472081081039; Wed, 24 Aug 2016 16:24:41 -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.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 24 Aug 2016 16:24:40 -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 DT driver binding Date: Wed, 24 Aug 2016 18:24:31 -0500 Message-Id: <20160824232437.9446-2-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-serial-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.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 --- drivers/input/serio/serio.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) -- 2.9.3 -- To unsubscribe from this list: send the line "unsubscribe linux-serial" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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 #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) && @@ -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;