From patchwork Mon Sep 3 13:10:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 10585833 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 C2729139B for ; Mon, 3 Sep 2018 13:13:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B1031297A5 for ; Mon, 3 Sep 2018 13:13:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A50E1297B3; Mon, 3 Sep 2018 13:13:40 +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 EBF68297A5 for ; Mon, 3 Sep 2018 13:13:39 +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=/9MZ9Ec1sIiZIgTkU2aj7UDFGJJvOorf7w1j9yQC4uM=; b=sAmoUZVeEO7s338/HFyaVr+//P yQaQV24mhJFyDJ1xCYFAGKBSzjyQvO9icuB1K4ba4VENPo0nvl9pBzj61YHHLJoxfN484wqicQDtq zhFP25AA63davnYXgYK1gTGJbK4nmJ5ZBCmD5Abp7OYc68aDpurYdoBBXHqbeRKfQNN2eUChr+uUB dt3HWsOgjcZHEV2dAInuqCaMR5Qvus7aXXKhAmk3E5KDmsfKLNbRf+3iwYbPOXdVG3ayP6oO6+7gi fp+OH0vmylUagedNLIq1ruHFWoGlITrVtNGq5oqqD8HERabRlprz8z6CMysJwzDHTEg2KH872H6Gn L55YBpnw==; 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 1fwofa-0001tG-9L; Mon, 03 Sep 2018 13:13:30 +0000 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fwodN-0000qa-G3 for linux-arm-kernel@lists.infradead.org; Mon, 03 Sep 2018 13:11:17 +0000 Received: by mail-wm0-x241.google.com with SMTP id 207-v6so1088522wme.5 for ; Mon, 03 Sep 2018 06:11:11 -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=bs9NcxnSSv/Ae7hcuKd4ij0d/Px3jNTx8MFPf905skA=; b=P35ow6rB9nb+ALt/PVEJ2Sx/qex/vJsufG8LQll3mBRs/AKIrvi9f6zQmcimn1yGuu nK8TQd5BNvXLnj1JxvLvtoUii87fzBTmxHaysUZj6iY/4tmNcmlX2dPfK3lp9aUHerZd Vk2zAJYmX5iLYAAet4qw4kobVZgUq/iTJIdOoVd9f2ZjO8jHmNiOVBEQb8yVbhGIzAw/ ghTsew/06CGgRuKR/caySeAL9wYYnPQju6xi4NCDGi4KAOvjGZ5lSlXi8OXwG7Zh4W08 cQySlCz603keM46aNv7kWNSMaQqMXsPdz7VW5yFdL9+2+SxdEqnCiuEL6qswLjwp8Kac 7vuw== 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=bs9NcxnSSv/Ae7hcuKd4ij0d/Px3jNTx8MFPf905skA=; b=sD1ghUUzZjd5QZs8KP2r/FRWnNoL4qXoWQ+qilNf1PxUTZ2XQxZsfxww6BJLNT2OvO 4AD86Y/UXB3py9vaz39uw5QB8M1Tx4DvOQaEwmZtMPPzOKmHxgA73L2AOtUi+H28BYS3 Cnl+gWi06myxErPa8X/8YjgobtVtPLXbU/oLSYphazpBRZvZaysXZgROwY9Y9Z8aPri5 JbvpcZPLReghMAOM8Pprbu0hudj1pwSLXDXLZwrqe2JjZTwmbQDdQl40k2kONpjI+z9U hbr3VUuGz8XYsCXPmGW2LspduGtJmQcH5sFVieZuCQnVPhQs6xP181+y2C1+4NL4rl8X hUJw== X-Gm-Message-State: APzg51Aw6bejDvZmIOGck+g4/hM7iOT5ACQoZkH7GtjmQiNr5CULdyzz cH9FBWVp5ZDCNiQHwhdYlwAuUA== X-Google-Smtp-Source: ANB0VdaDP9KScgwZbHeX5mFwsvXi/X9akGQqFAqG4Btknl/lKOnWKKrQ0dQ62LILo5lFmTeS+3gQZw== X-Received: by 2002:a1c:398b:: with SMTP id g133-v6mr4880491wma.5.1535980270735; Mon, 03 Sep 2018 06:11:10 -0700 (PDT) Received: from localhost (nat-35.starnet.cz. [178.255.168.35]) by smtp.gmail.com with ESMTPSA id h17-v6sm17050587wrq.73.2018.09.03.06.11.10 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Mon, 03 Sep 2018 06:11:10 -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 07/10] serial: uartps: Fill struct uart_driver in probe() Date: Mon, 3 Sep 2018 15:10:55 +0200 Message-Id: <9a2f438e7d7e39b1ce965d09cebd9fb799422479.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_061113_579239_9912AB51 X-CRM114-Status: GOOD ( 13.35 ) 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 This is preparation step for dynamic port allocation without CDNS_UART_NR_PORTS macro. Fill the structure only once at probe. Signed-off-by: Michal Simek --- Changes in v3: - s/,/;/ in filling structure - get cdns_uart_uart_driver out of PS_UART_CONSOLE ifdefs Changes in v2: - new patch - it can be sent separately too drivers/tty/serial/xilinx_uartps.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c index 54735a7f9960..61087233f411 100644 --- a/drivers/tty/serial/xilinx_uartps.c +++ b/drivers/tty/serial/xilinx_uartps.c @@ -1099,6 +1099,8 @@ static void cdns_uart_pm(struct uart_port *port, unsigned int state, #endif }; +static struct uart_driver cdns_uart_uart_driver; + #ifdef CONFIG_SERIAL_XILINX_PS_UART_CONSOLE /** * cdns_uart_console_putchar - write the character to the FIFO buffer @@ -1239,8 +1241,6 @@ static int cdns_uart_console_setup(struct console *co, char *options) return uart_set_options(port, co, baud, parity, bits, flow); } -static struct uart_driver cdns_uart_uart_driver; - static struct console cdns_uart_console = { .name = CDNS_UART_TTY_NAME, .write = cdns_uart_console_write, @@ -1252,18 +1252,6 @@ static int cdns_uart_console_setup(struct console *co, char *options) }; #endif /* CONFIG_SERIAL_XILINX_PS_UART_CONSOLE */ -static struct uart_driver cdns_uart_uart_driver = { - .owner = THIS_MODULE, - .driver_name = CDNS_UART_NAME, - .dev_name = CDNS_UART_TTY_NAME, - .major = CDNS_UART_MAJOR, - .minor = CDNS_UART_MINOR, - .nr = CDNS_UART_NR_PORTS, -#ifdef CONFIG_SERIAL_XILINX_PS_UART_CONSOLE - .cons = &cdns_uart_console, -#endif -}; - #ifdef CONFIG_PM_SLEEP /** * cdns_uart_suspend - suspend event @@ -1429,6 +1417,16 @@ static int cdns_uart_probe(struct platform_device *pdev) } if (!cdns_uart_uart_driver.state) { + cdns_uart_uart_driver.owner = THIS_MODULE; + cdns_uart_uart_driver.driver_name = CDNS_UART_NAME; + cdns_uart_uart_driver.dev_name = CDNS_UART_TTY_NAME; + cdns_uart_uart_driver.major = CDNS_UART_MAJOR; + cdns_uart_uart_driver.minor = CDNS_UART_MINOR; + cdns_uart_uart_driver.nr = CDNS_UART_NR_PORTS; +#ifdef CONFIG_SERIAL_XILINX_PS_UART_CONSOLE + cdns_uart_uart_driver.cons = &cdns_uart_console; +#endif + rc = uart_register_driver(&cdns_uart_uart_driver); if (rc < 0) { dev_err(&pdev->dev, "Failed to register driver\n");