From patchwork Fri Jan 6 16:26:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 90201 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp9520062qgi; Fri, 6 Jan 2017 08:28:27 -0800 (PST) X-Received: by 10.99.167.15 with SMTP id d15mr143009704pgf.167.1483720107514; Fri, 06 Jan 2017 08:28:27 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s2si8473577plk.239.2017.01.06.08.28.27; Fri, 06 Jan 2017 08:28:27 -0800 (PST) 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 S1751727AbdAFQ2Y (ORCPT + 2 others); Fri, 6 Jan 2017 11:28:24 -0500 Received: from mail-oi0-f68.google.com ([209.85.218.68]:34727 "EHLO mail-oi0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759192AbdAFQ1F (ORCPT ); Fri, 6 Jan 2017 11:27:05 -0500 Received: by mail-oi0-f68.google.com with SMTP id 3so55158427oih.1; Fri, 06 Jan 2017 08:27:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=xZM6Mg/l2UhLgGBZ2UYbQ2JE2kVFIaaqAaAWYgZBa1s=; b=JGQ/Is7pNbp3vz0s0YFznOhfX6DlLNeMiAG/VLYYCWVXrIxeVO4IrR0RgkiAtubZ1D cwsCilcEy9tItRZBGE1Dp8LFeXCXiyJduHADz5bems72oHcletjPxlLj67jVSqNfj5OF vhh7+tBCitIEvSYCBGfVL/ghLFS8Yifkya10S5v7jKnRIyOpMjWcrFvwPAyQgQ6+f81p EbtqFGS3tUh5bcV6127bLF6fMdzQq2Y3m1gyYNk8akKNHd7Mg0DZtVe+vzU0AGPLg2iP SMMEuAWs2tI58ML2RlOF3IvY3Ls+jpyHhVYcQhe8IQe3jUZn1voKj0L0y9vMXc51H7Sv R1tg== X-Gm-Message-State: AIkVDXIdn5r0tT3S/8YYDfM83DUFtqhnHDZt74DcIKXrtt5GB8tQeZRCzbbQb4OK0BV3tg== X-Received: by 10.157.2.39 with SMTP id 36mr1702503otb.150.1483720024268; Fri, 06 Jan 2017 08:27:04 -0800 (PST) Received: from rob-hp-laptop.herring.priv (50-233-148-156-static.hfc.comcastbusiness.net. [50.233.148.156]) by smtp.googlemail.com with ESMTPSA id i135sm5245809oib.18.2017.01.06.08.27.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Jan 2017 08:27:03 -0800 (PST) From: Rob Herring To: Greg Kroah-Hartman , Marcel Holtmann , Jiri Slaby , Sebastian Reichel , Arnd Bergmann , "Dr . H . Nikolaus Schaller" , Peter Hurley , Andy Shevchenko , Alan Cox Cc: Loic Poulain , Pavel Machek , NeilBrown , Linus Walleij , linux-bluetooth@vger.kernel.org, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 9/9] tty_port: register tty ports with serdev bus Date: Fri, 6 Jan 2017 10:26:35 -0600 Message-Id: <20170106162635.19677-10-robh@kernel.org> X-Mailer: git-send-email 2.10.1 In-Reply-To: <20170106162635.19677-1-robh@kernel.org> References: <20170106162635.19677-1-robh@kernel.org> Sender: linux-serial-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Register a serdev controller with the serdev bus when a tty_port is registered. This creates the serdev controller and create's serdev devices for any DT child nodes of the tty_port's parent (i.e. the UART device). Signed-off-by: Rob Herring --- drivers/tty/tty_port.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) -- 2.10.1 -- 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/tty/tty_port.c b/drivers/tty/tty_port.c index 232a8cbf47bc..032786e5509e 100644 --- a/drivers/tty/tty_port.c +++ b/drivers/tty/tty_port.c @@ -16,6 +16,7 @@ #include #include #include +#include static int tty_port_default_receive_buf(struct tty_port *port, const unsigned char *p, @@ -125,9 +126,17 @@ struct device *tty_port_register_device_attr(struct tty_port *port, struct device *device, void *drvdata, const struct attribute_group **attr_grp) { + struct device *ttydev; + tty_port_link_device(port, driver, index); - return tty_register_device_attr(driver, index, device, drvdata, + ttydev = tty_register_device_attr(driver, index, device, drvdata, attr_grp); + if (!ttydev) + return NULL; + + serdev_tty_port_register(port, device, driver, index); + return ttydev; + } EXPORT_SYMBOL_GPL(tty_port_register_device_attr); @@ -177,6 +186,9 @@ static void tty_port_destructor(struct kref *kref) /* check if last port ref was dropped before tty release */ if (WARN_ON(port->itty)) return; + + serdev_tty_port_unregister(port); + if (port->xmit_buf) free_page((unsigned long)port->xmit_buf); tty_port_destroy(port);