From patchwork Mon Sep 3 13:10:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 10585843 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 847A4180E for ; Mon, 3 Sep 2018 13:17:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 74291297C2 for ; Mon, 3 Sep 2018 13:17:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 68641297C8; Mon, 3 Sep 2018 13:17:35 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.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 0372B297C2 for ; Mon, 3 Sep 2018 13:17:34 +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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=BeciVENYA/hEY8gWCaw4tQwCl68w8Jv1zHlgnfqPkbg=; b=himAe8qRQIRqN0WNbWqbj6vM5Z Wmhx4JAOI4R5VJGnXgQNNNay+fiLoIz6hSod0KlaXRa6n1xw+NVpA7dUH803bHZrrDN4bQuLteJVh nk706o5LNWcprSSPLcVJKfNcmvUGe7vVl5opJoZX+ZtYP5iIIngZdDy4iqT+awpu1sj4oKtxBDISB QlZgUDzxdSigY19FXjuAosfY0xsECb2fMuX+mv4LIDrByoccrQr9s+LKYROIH+pFTXc7VrZgJKyQF 8eMbqdIDGTS8CsZkn2/ZAIHUw3WU3dRbSnAhE27yFvBWL/QcqHrlaBZK/WH4AgXgQpZJtRNbsUrVr L1KCoL/w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fwojK-0004ki-CM; Mon, 03 Sep 2018 13:17:22 +0000 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fwodX-0000tO-H3 for linux-arm-kernel@lists.infradead.org; Mon, 03 Sep 2018 13:11:25 +0000 Received: by mail-wr1-x442.google.com with SMTP id w11-v6so628912wrc.5 for ; Mon, 03 Sep 2018 06:11:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monstr-eu.20150623.gappssmtp.com; s=20150623; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=Z6LGPRKD7iph6AElFmO944nmWy5WoOUM5jIDdjq14Tg=; b=1jRsTiShF23PYuhRzWEaltXcNOGNCZIapBNqWuW0bIWC1P4wy6kfJ1ObDmxiFk/E+X 0vLb1O4a4zGlL5F+bR4i+YRuwQVk6EX4PyjtdZFpw2vQL9QqRylV5W9wIbSUyVsBbuN+ Srg6v00FfSaG3Y0VCnTvypa2oW79qCblNr5qMg4Le5vVzbLrv8mylbMOn+d3TDTgT2KH dCoCn+V/G7z+CB8/h3TCWwMtKjmeY8h6B+TXJ/JUHuNrPifoAo1aQLRGrRvrKHkk+8h0 Vo5KgVAC0Ul2gznrCX6zGPVzVlUQ61+sks2D5r55kZuD2qlWzYYL7pIX6K4GJudBc7/8 c5TQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:in-reply-to:references; bh=Z6LGPRKD7iph6AElFmO944nmWy5WoOUM5jIDdjq14Tg=; b=swlrGGjK2FfMQt/i6Zqhpkobi8i+x7fYmC4YBErYYKV7jttWm1ELPta7QBw2rUFDWL 7Xti1yH85VIA1+IFnfw2DzgVbC/uysfUpVd+6ISVCMzdLTKbWMpRKn8iNYMGUmY5aYoU UoWzLBD5/kIXItn6IvTEXrJi/Vpc9Eg8SCKyUg1BkPTJyTzjlsTRKgClNYf4qcyJmVOp 0kpxOd9BEQH0N4eP2I5ZKJrTB0c7PCzBnV45Fb+fRa2DpfGucupSgC4xngK6kfm+M49V 9OdrgozqouFgLqsdXo/3AsorFiOd6XkN1/VH7YOMQOH9OjfnKbo9I9Z8msDiz70h3aqZ iNKQ== X-Gm-Message-State: APzg51CoYsnit6Tf7H/82ZpXpNfMCp5PP++n58gAHs0XylSwHwNvTqCV tF4332NwgOhbC8wQDeilC6jbTw== X-Google-Smtp-Source: ANB0VdYUmVF98/Z0+gpMfEnEeGtMry6eHDA7/D178yIoU5Fs6/sUabI0dwe/FlhkLHKhlGWKPUqJxQ== X-Received: by 2002:adf:8367:: with SMTP id 94-v6mr19025085wrd.258.1535980275285; Mon, 03 Sep 2018 06:11:15 -0700 (PDT) Received: from localhost (nat-35.starnet.cz. [178.255.168.35]) by smtp.gmail.com with ESMTPSA id w18-v6sm38300796wrc.38.2018.09.03.06.11.14 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Mon, 03 Sep 2018 06:11:14 -0700 (PDT) From: Michal Simek To: linux-kernel@vger.kernel.org, monstr@monstr.eu, gnomes@lxorguk.ukuu.org.uk, Alexander Graf , shubhraj@xilinx.com, robh@kernel.org Subject: [PATCH v3 10/10] serial: uartps: Move Port ID to device data structure Date: Mon, 3 Sep 2018 15:10:58 +0200 Message-Id: <9cda66fc3c143cc2055241802300dc12f5571669.1535980253.git.michal.simek@xilinx.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: References: In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180903_061123_603395_1B2A5351 X-CRM114-Status: GOOD ( 16.29 ) 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: Greg Kroah-Hartman , linux-arm-kernel@lists.infradead.org, linux-serial@vger.kernel.org, Jiri Slaby MIME-Version: 1.0 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 Record port ID in device data structure to be have it connected to certain instance. Signed-off-by: Michal Simek --- Changes in v3: - New patch in series Changes in v2: None drivers/tty/serial/xilinx_uartps.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c index d838612eda6f..71c032744dae 100644 --- a/drivers/tty/serial/xilinx_uartps.c +++ b/drivers/tty/serial/xilinx_uartps.c @@ -181,6 +181,7 @@ * @pclk: APB clock * @cdns_uart_driver: Pointer to UART driver * @baud: Current baud rate + * @id: Port ID * @clk_rate_change_nb: Notifier block for clock changes * @quirks: Flags for RXBS support. */ @@ -190,6 +191,7 @@ struct cdns_uart { struct clk *pclk; struct uart_driver *cdns_uart_driver; unsigned int baud; + int id; struct notifier_block clk_rate_change_nb; u32 quirks; }; @@ -1376,7 +1378,7 @@ static int __maybe_unused cdns_runtime_resume(struct device *dev) */ static int cdns_uart_probe(struct platform_device *pdev) { - int rc, id, irq; + int rc, irq; struct uart_port *port; struct resource *res; struct cdns_uart *cdns_uart_data; @@ -1402,18 +1404,18 @@ static int cdns_uart_probe(struct platform_device *pdev) return -ENOMEM; /* Look for a serialN alias */ - id = of_alias_get_id(pdev->dev.of_node, "serial"); - if (id < 0) - id = 0; + cdns_uart_data->id = of_alias_get_id(pdev->dev.of_node, "serial"); + if (cdns_uart_data->id < 0) + cdns_uart_data->id = 0; - if (id >= CDNS_UART_NR_PORTS) { + if (cdns_uart_data->id >= CDNS_UART_NR_PORTS) { dev_err(&pdev->dev, "Cannot get uart_port structure\n"); return -ENODEV; } /* There is a need to use unique driver name */ driver_name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "%s%d", - CDNS_UART_NAME, id); + CDNS_UART_NAME, cdns_uart_data->id); if (!driver_name) return -ENOMEM; @@ -1421,7 +1423,7 @@ static int cdns_uart_probe(struct platform_device *pdev) cdns_uart_uart_driver->driver_name = driver_name; cdns_uart_uart_driver->dev_name = CDNS_UART_TTY_NAME; cdns_uart_uart_driver->major = CDNS_UART_MAJOR; - cdns_uart_uart_driver->minor = id; + cdns_uart_uart_driver->minor = cdns_uart_data->id; cdns_uart_uart_driver->nr = 1; #ifdef CONFIG_SERIAL_XILINX_PS_UART_CONSOLE @@ -1432,7 +1434,7 @@ static int cdns_uart_probe(struct platform_device *pdev) strncpy(cdns_uart_console->name, CDNS_UART_TTY_NAME, sizeof(cdns_uart_console->name)); - cdns_uart_console->index = id; + cdns_uart_console->index = cdns_uart_data->id; cdns_uart_console->write = cdns_uart_console_write; cdns_uart_console->device = uart_console_device; cdns_uart_console->setup = cdns_uart_console_setup; @@ -1454,7 +1456,7 @@ static int cdns_uart_probe(struct platform_device *pdev) * registration because tty_driver structure is not filled. * name_base is 0 by default. */ - cdns_uart_uart_driver->tty_driver->name_base = id; + cdns_uart_uart_driver->tty_driver->name_base = cdns_uart_data->id; match = of_match_node(cdns_uart_of_match, pdev->dev.of_node); if (match && match->data) {