From patchwork Fri Mar 24 05:27:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vignesh Raghavendra X-Patchwork-Id: 9642279 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7675B602C9 for ; Fri, 24 Mar 2017 05:28:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 65C2C28464 for ; Fri, 24 Mar 2017 05:28:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5824A28474; Fri, 24 Mar 2017 05:28:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CD2CE28464 for ; Fri, 24 Mar 2017 05:28:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=6M6yX0oEdH59yCSCwthhSf2ZT6oHw7YuxJHeBU0vNgQ=; b=J8HyrZu1upkjPA Pv+7+7/cnf43j6+6y4Uv4oOlFKmhpvwXZvx92tNmAr9n9GJS9vCIYfgF43KIxaqJsgcUyDHRgdgkB X/fTh/01epUJoIuNtGEY8fZvOiBN43LAy/rZIvAmA6wzqtiLfSDsZWnOJSztksbQRMIPsgQr7k3t4 zUqn4gvB6Fs2iYPbf10Qu1AYxY6Hj0oJUdzK/6TOYeiUopWZadpXWmw/qKSCDWCR4HzzJtsc73BVm v2BFB8E34gmEiMNaL+6s1ab/8Z4kRpIk+qjLuVSocN4b5dO1xcouqbBByvXRMN0WtUKv2ySRKD4Dm xfxCiH15pL2Ea45Cd+MQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1crHm7-0005Ua-AC; Fri, 24 Mar 2017 05:28:35 +0000 Received: from lelnx193.ext.ti.com ([198.47.27.77]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1crHm3-0005TJ-8M for linux-arm-kernel@lists.infradead.org; Fri, 24 Mar 2017 05:28:32 +0000 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by lelnx193.ext.ti.com (8.15.1/8.15.1) with ESMTP id v2O5S6pB014998; Fri, 24 Mar 2017 00:28:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1490333286; bh=n99v8avWrU3WN400nmjYK4L3/gJHLsvWbZT2/G08jws=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=JfsRiHZk4ljTGbv1e+zPoIXn7qmt7vGPQq1KUiHcJeIYObkzrnnGtI1nlwEfqw3xK JxPWCFVDH41d5bSsQSu9bWE/gQ4+xf7LIEMd0XP23VY2x5Hvd5Bi9wdopsMjPUAsRC 3pSI4ofk/1O2Mejsjrny3gdnGVuzcoLiiajzd9Pg= Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id v2O5S6s8030921; Fri, 24 Mar 2017 00:28:06 -0500 Received: from dlep32.itg.ti.com (157.170.170.100) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.3.294.0; Fri, 24 Mar 2017 00:28:05 -0500 Received: from a0132425.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id v2O5Ru7M028878; Fri, 24 Mar 2017 00:28:02 -0500 From: Vignesh R To: Greg Kroah-Hartman Subject: [PATCH v2 1/2] tty: serial_core: Add name field to uart_port struct Date: Fri, 24 Mar 2017 10:57:59 +0530 Message-ID: <20170324052800.11526-2-vigneshr@ti.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170324052800.11526-1-vigneshr@ti.com> References: <20170324052800.11526-1-vigneshr@ti.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170323_222831_456799_28CE8A4C X-CRM114-Status: UNSURE ( 8.15 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jisheng Zhang , Vignesh R , linux-kernel@vger.kernel.org, Andy Shevchenko , linux-serial@vger.kernel.org, Jiri Slaby , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Introduce a field to store name of uart_port that can be used to easily identify UART port instances on a system that has more than one UART instance. The name is of the form ttyXN(eg. ttyS0, ttyAMA0,..) where N is number that particular UART instance. This field will be useful when printing debug info for a particular port or in register IRQs with unique IRQ name. Port name is populated during uart_add_one_port(). Signed-off-by: Vignesh R Reviewed-by: Andy Shevchenko --- v2: use kasprintf() instead of snprintf() Fix up commit message. drivers/tty/serial/serial_core.c | 7 +++++++ include/linux/serial_core.h | 1 + 2 files changed, 8 insertions(+) diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index 0fb3f7cce62a..f5572e28d16a 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -2744,6 +2744,12 @@ int uart_add_one_port(struct uart_driver *drv, struct uart_port *uport) state->pm_state = UART_PM_STATE_UNDEFINED; uport->cons = drv->cons; uport->minor = drv->tty_driver->minor_start + uport->line; + uport->name = kasprintf(GFP_KERNEL, "%s%d", drv->dev_name, + drv->tty_driver->name_base + uport->line); + if (!uport->name) { + ret = -ENOMEM; + goto out; + } /* * If this port is a console, then the spinlock is already @@ -2861,6 +2867,7 @@ int uart_remove_one_port(struct uart_driver *drv, struct uart_port *uport) if (uport->type != PORT_UNKNOWN && uport->ops->release_port) uport->ops->release_port(uport); kfree(uport->tty_groups); + kfree(uport->name); /* * Indicate that there isn't a port here anymore. diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index 58484fb35cc8..60530678c633 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@ -247,6 +247,7 @@ struct uart_port { unsigned char suspended; unsigned char irq_wake; unsigned char unused[2]; + char *name; /* port name */ struct attribute_group *attr_group; /* port specific attributes */ const struct attribute_group **tty_groups; /* all attributes (serial core use only) */ struct serial_rs485 rs485;