From patchwork Mon Apr 23 09:51:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 10356547 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 614796019D for ; Mon, 23 Apr 2018 09:57:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 50AF528A01 for ; Mon, 23 Apr 2018 09:57:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4537828A05; Mon, 23 Apr 2018 09:57:34 +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 A1D6E28A01 for ; Mon, 23 Apr 2018 09:57:33 +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=kbWliPBswC7zbWNGVadQTo+3t0zUTwCOKg2lKnevfgw=; b=XK1/MnKf//uFN+w8/SjStuENH2 hUa3Epl9+OP+19Szq2kDpLiWcyzUoo0jRMF0wRSmviYLi6YuNXVG0mOq/nwI2ydZaGBf7iekijzwJ IgNu5vljMeb+HNGWj3MoKnsl3jjCEaM2KXKa11Q7o9BMDVx6SIYSemqcqVW0S+YUKD2Si7AYLyw2i 3ad8gZvjEVKbVZoiSw+cZismUggGhaT3C9jGEwBDuyiJgiVNb7ZMGPBZk/V7X7tr1a1TIIXMb45bE igRi8w8sXQUV0lUq2Th1jlJa1FwpoSeHOH3Jmmob68+yBFL/Vz1p4vs+WVq8k/fKiIZevriH3pxBG I7NH5pHQ==; 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 1fAYDt-0006Ze-Tc; Mon, 23 Apr 2018 09:57:25 +0000 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fAY82-0002nJ-1n for linux-arm-kernel@lists.infradead.org; Mon, 23 Apr 2018 09:51:35 +0000 Received: by mail-wr0-x242.google.com with SMTP id f14-v6so39434172wre.4 for ; Mon, 23 Apr 2018 02:51: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=K33BEwSJyZbBhPr5/+YbR2UtR/1I3R2mkUqKbceItCU=; b=bDEoKHknv9u+nj2cPC0QcqUCpUsy+SS44t3sLyWjY/RVWDSFsgFH7tE9hKBSTGJmmZ H6eiI9PoEwlz94YCyqUdSr0auVOPmDuLdtKOGzw4LhgJh8NWWHYnB8/s2IM3PQOo55VQ bHQ5PbXsqNiA80bpmo1vxTgNV5iLlE/JZDj/D1q69GB9/m0gjIAI6hbCPLl+xc9lddAf c8alcEbQ5UqLk5NegWXnIujIShb31i07fXd0QXcLml6UArqD5qeG7iGKciGipve9M9NG Z3ScrYZJ5ZE6QKAZcaFAz/PUI+inhRUNhhF4sM1VAZFwvomsW9hFcJ7DmB+XwJ5WqRPF we6g== 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=K33BEwSJyZbBhPr5/+YbR2UtR/1I3R2mkUqKbceItCU=; b=TSnolNjlcZACpreHmKjv7t2KsEzX30KHltWbcrbF+klgf3aN9eWZLHgQhc/Gt4dbxD Y0g2lHPFYAGTvdwN8wIzA2KE7hDxZcbNmdxIM5gDOPN9yDzwbgdoZFSLxK7xMbIxnMEj BOP969Grcu10YtAU55OFamLHjVQQ7HcXNzDnKH+rO1LfmMW/e26ZmbQAFkQMQIWuyoUS tKWT47ah+QqEWaK4YtjRKjK6Qs0H+XdC/6wB+JDLnl+Y9pVaGoTx25TEU9dgJiXqDV7L 8kMWuaRr9t6AlU0pnToYwQqBi7L0MIBr/VI1mhrG+KiRjQ0SWq06excwT60/6xjTD8sU s0vg== X-Gm-Message-State: ALQs6tDhKWkOvjJ5j6Gi5wFUYP+QXncgyI3IL+D1Ez7cf9wV/1VwO9Qp L95wwgfKXn4nAEQuQHBrUgZBSw== X-Google-Smtp-Source: AIpwx49wowhP5AyeBtJ63kXt1LxJixW7wJws/QcS5Urk/qTWG8whC/p8gQNSSLFUGMKE2Wx0vp8VCQ== X-Received: by 10.28.171.70 with SMTP id u67mr9207323wme.96.1524477070294; Mon, 23 Apr 2018 02:51:10 -0700 (PDT) Received: from localhost (nat-35.starnet.cz. [178.255.168.35]) by smtp.gmail.com with ESMTPSA id a10-v6sm20107945wri.10.2018.04.23.02.51.09 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Mon, 23 Apr 2018 02:51:09 -0700 (PDT) From: Michal Simek To: linux-kernel@vger.kernel.org, monstr@monstr.eu, Alan Cox , geert+renesas@glider.be Subject: [PATCH 4/4] serial: uartps: Remove static port array Date: Mon, 23 Apr 2018 11:51:03 +0200 Message-Id: X-Mailer: git-send-email 2.17.0 In-Reply-To: References: In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180423_025122_164716_FE88EC4E X-CRM114-Status: GOOD ( 12.66 ) 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 Allocate uart port structure dynamically. Signed-off-by: Michal Simek Reviewed-by: Alan Cox --- drivers/tty/serial/xilinx_uartps.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c index f7d527a1c532..0fc9de20843c 100644 --- a/drivers/tty/serial/xilinx_uartps.c +++ b/drivers/tty/serial/xilinx_uartps.c @@ -1097,8 +1097,6 @@ static const struct uart_ops cdns_uart_ops = { #endif }; -static struct uart_port cdns_uart_port[CDNS_UART_NR_PORTS]; - #ifdef CONFIG_SERIAL_XILINX_PS_UART_CONSOLE /** * cdns_uart_console_wait_tx - Wait for the TX to be full @@ -1438,6 +1436,9 @@ static int cdns_uart_probe(struct platform_device *pdev) GFP_KERNEL); if (!cdns_uart_data) return -ENOMEM; + port = devm_kzalloc(&pdev->dev, sizeof(*port), GFP_KERNEL); + if (!port) + return -ENOMEM; match = of_match_node(cdns_uart_of_match, pdev->dev.of_node); if (match && match->data) { @@ -1503,16 +1504,7 @@ static int cdns_uart_probe(struct platform_device *pdev) if (id < 0) id = 0; - /* Try the given port id if failed use default method */ - if (id < CDNS_UART_NR_PORTS && cdns_uart_port[id].mapbase != 0) { - /* Find the next unused port */ - for (id = 0; id < CDNS_UART_NR_PORTS; id++) - if (cdns_uart_port[id].mapbase == 0) - break; - } - - port = &cdns_uart_port[id]; - if (!port || id >= CDNS_UART_NR_PORTS) { + if (id >= CDNS_UART_NR_PORTS) { dev_err(&pdev->dev, "Cannot get uart_port structure\n"); rc = -ENODEV; goto err_out_notif_unreg;