From patchwork Wed Jun 6 12:41:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 10450159 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 5831760234 for ; Wed, 6 Jun 2018 12:49:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3F30329DC7 for ; Wed, 6 Jun 2018 12:49:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3DC1629DCE; Wed, 6 Jun 2018 12:49:31 +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 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 A6D9029E6D for ; Wed, 6 Jun 2018 12:43:52 +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=vj8rk6LusYvOx0D+IJqCxo8pP5prxgC/EkCcV0uN11E=; b=KCBBdW3QcITJ63AUVrUukeE6YA 3Q5IA/tY7VrZ8x3VakXZyhc1PhIBSNv7Msn0z4D7rBTu5lo7d45xO88Z6IuDXDUKdyZ9jNeCFYLIk 3NIVjQtRK9ifzUZQdG/8jZ3sh+gMxIilLbJEAo6oZ/0vedsMq0BYHuuErGS7Dxm4HEzALUIYkQzol KM48lkOXQXbH3WEtqsnEysYqe+MrzTm70VeEdQIWZIWWLQDujnPPYG/Pc4pX2DgoV+rdIJ3iKqgyD WWXyP77/fPRg5O6F56ZNCJuNGhdp3kRky917pgYYLtNJjzB+07xFKsE/5QaKoLfP9ECMX/KFeqscT fTiwCwFA==; 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 1fQXmv-0001tW-9N; Wed, 06 Jun 2018 12:43:41 +0000 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fQXlE-0000j8-HQ for linux-arm-kernel@lists.infradead.org; Wed, 06 Jun 2018 12:42:00 +0000 Received: by mail-wm0-x244.google.com with SMTP id q4-v6so22897634wmq.1 for ; Wed, 06 Jun 2018 05:41:51 -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=E5QFCrNXqI8pGgxbc594CGy1jpHhJx44/edMoOZHQfg=; b=QmwlYPkf6oJq12xWO/pZ9huPFJaZb2XdSUNLHjnRWHC8wCDNoZETS8HEM8YC7eo9NB yRZNNI2lh8JuhhrxjEeuHmVYF83sPq24Vgeb8KLRq22lUp2I9+KbBPdtTcY39Z5yO/wO +uAwvlfOkAYo7Nvb6SlvC+Y+gJHAYaCP0RxjZx9RTEh1rEKU1dVx73e59bLpfhe3gR4O +4DqGDPvYF1BP4mIpnJcX2lporut1qxkXcsNfdFdXf1H4yNllNvjsphKR1kww0AbMzOy owyQaCEJnPypQC4xrpvealPo9c/WSBkCQQuOR7obDszh71EzDUiGm5Seg5sEt/W2FmTO 1cxQ== 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=E5QFCrNXqI8pGgxbc594CGy1jpHhJx44/edMoOZHQfg=; b=PzcIH77+FpqqFxqiCOFqoKVcJKSUh1cN0r1cX/muLP+ViSEMX8FNxO/0QwsK8RirxF DCypIe/gaFBLFqIEZeMGB70HKCu5TDrxx5lPMKkottPzLreXAgiKGjndlN5lg1dXelgN ZN0fz66ghquv4KsGozhVoZ1WY6abkzOyFlnjrkRnkhC+x13bzjnN+6e6bgeZlx1YmHqn NVekhZycgnHYfXB9qpLioUSxG9i1pCrD0dHstCmXhChspdV6Ko4wgYIvEWSx3Opui4xE tlxUDRwf3kO2WuMkW5DPxpV7MW9ed8EqUIPVOG4zpfjk6/oZ/ITs71fBGy9BcmEwAWOZ btvg== X-Gm-Message-State: APt69E2IT4mCvYP9iJg2Aw3qyFTLPJhMXVdwRGSx74qraWQU7zcBCBag DpKBQcnOEAU58ilOg8HMvYcCSg== X-Google-Smtp-Source: ADUXVKIcpfehs87UdYvTklG3+X+UGgs0JakPt6KFO95LgO42rq0/v+sIO2klzWMoANiTZ/wIXy4k5Q== X-Received: by 2002:a1c:5c93:: with SMTP id q141-v6mr1618088wmb.77.1528288910603; Wed, 06 Jun 2018 05:41:50 -0700 (PDT) Received: from localhost (nat-35.starnet.cz. [178.255.168.35]) by smtp.gmail.com with ESMTPSA id a203-v6sm5362882wme.46.2018.06.06.05.41.49 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Wed, 06 Jun 2018 05:41:50 -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: [RFC PATCH v2 5/6] serial: uartps: Fill struct uart_driver in probe() Date: Wed, 6 Jun 2018 14:41:38 +0200 Message-Id: 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-20180606_054156_600636_47ED0BCA X-CRM114-Status: GOOD ( 11.55 ) 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 v2: - new patch - it can be sent separately too drivers/tty/serial/xilinx_uartps.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c index b47d7ccbc38d..d76efe8cb3df 100644 --- a/drivers/tty/serial/xilinx_uartps.c +++ b/drivers/tty/serial/xilinx_uartps.c @@ -1260,18 +1260,6 @@ static int __init 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 @@ -1451,6 +1439,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");