From patchwork Fri Jul 21 09:32:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 9856377 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 E01FE601C0 for ; Fri, 21 Jul 2017 09:34:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D3E3728749 for ; Fri, 21 Jul 2017 09:34:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C869228778; Fri, 21 Jul 2017 09:34:13 +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,RCVD_IN_DNSWL_NONE 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 7DD8B28749 for ; Fri, 21 Jul 2017 09:34:13 +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=7lJHKgtygqofWBUX3+wuwnKJo0tkFtOu3/d/iGzBfcI=; b=WV0A/stYAQXo37aE0PUHZCFLWV FZ8UrYwCFTi71D5R0yYkZQ+UOrrBJOECX/44De8ClwHPmP0nO95Jqd4Xn83qCCOThvoEkaHXmym8Y 8aF8aER9NbJoczbW2w7uKd79XaJSFW+xwHlUMFAcOPPpIhLcp/sqSYKgi3wE9NqhF/b1MJse6y1kp sjF3A1h3Quh9dE7bCcWSaCuNFhkVAMWTSEWz31+FGBMVblJIpJu4q2Tm0cZy8ADFmODbDutBy0Ea+ UUH+mau7sNI1a4nhReMffvNoDpAa2Q6e9J0XAqj4V1idSPG0cmxALe21MucoIBMvdNT/Q2jJMBo/b RfHjxEbw==; 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 1dYUK0-0007fh-TW; Fri, 21 Jul 2017 09:34:09 +0000 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dYUIp-00075C-UC for linux-arm-kernel@lists.infradead.org; Fri, 21 Jul 2017 09:32:58 +0000 Received: by mail-wr0-x242.google.com with SMTP id y67so11111138wrb.3 for ; Fri, 21 Jul 2017 02:32:38 -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=mhwXyfSaS5WQobYK48UEVqqCvThv7RSZaxYQ74tYMlw=; b=hghPl8rJlEj3P8GrfCJ6UKRxQT65PJKdfEOIW4eJR1/3V0yf2lbUHBc3nLBv0Cehg1 v8XKvbLXiGlDWc6BHm5W5atmsR4NiRm71hT3IiBmFjKaYFg1UssBQM0eaMunL5S3oSqj OE/kKLp4MYkx5uNDhp6dcDwU8bJ1H8cpGhApcggdXxdONSuVyVbkqO9XUuXPi4j4v7eT YKe637gS777gh9Gvgb34a7EXeTiyaGhDtOaRcqvUmGRhNR5n7RtEf+7BsbkrkasqSW7g q0oTlb4h5RBo2xUpSyIGKWCj7JoPLrV9UwYoS9HvgiWl+7VX/DiMhvlQzcS8aDRrGe+T Nk0A== 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=mhwXyfSaS5WQobYK48UEVqqCvThv7RSZaxYQ74tYMlw=; b=lQGJjpeyCSJC/Qq/cBgRV8Ug6vInJ6eOoBhX9OfwZjU+BrjPCYLVev4+QI83tznewo wqBhr+grHWiZt09wOMysJotC3xLv5ffvRMN4rIbkFPI1L1qR51mTHrB8bAcRXv9OOPSs l1A+x+z5HWCK1fhK8b1kqM3zYKhyl6qjuZgV8bhzQX/eQbWMK40K3pAKjWn28SxO6u6T e+uP305NUJdd3oMOGm/DjxCxDmhkjgPH+PjUmQSi/htTytUJEHrqLZ5Xiq6nVZJ4RTaH zlk6Pmh9qZI0gtjm5TDD6VhDKy/n7GeaijF3u7QA+K+C1mmDQX73uxIs5UR2yf6BCwlg neNQ== X-Gm-Message-State: AIVw111EiBZr4PvPGgqYu5nhBv9S+dIMsH03Gwfs37VUUU5dEEP2H+RN sJRySwSMZnu9W9X7 X-Received: by 10.223.170.75 with SMTP id q11mr9014548wrd.72.1500629556964; Fri, 21 Jul 2017 02:32:36 -0700 (PDT) Received: from localhost (nat-35.starnet.cz. [178.255.168.35]) by smtp.gmail.com with ESMTPSA id o6sm10124501wrc.48.2017.07.21.02.32.36 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Fri, 21 Jul 2017 02:32:36 -0700 (PDT) From: Michal Simek To: linux-kernel@vger.kernel.org, monstr@monstr.eu, Alan Cox Subject: [RFC PATCH 4/4] serial: uartps: Remove static port array Date: Fri, 21 Jul 2017 11:32:27 +0200 Message-Id: <1764822fbab7d1072270436e3b6160353c06c553.1500629544.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-20170721_023256_134717_5B8977D3 X-CRM114-Status: GOOD ( 10.84 ) 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: linux-arm-kernel@lists.infradead.org, Greg Kroah-Hartman , linux-serial@vger.kernel.org, =?UTF-8?q?S=C3=B6ren=20Brinkmann?= , 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 --- 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 4fb74baeae35..1c9ec8c4c2b6 100644 --- a/drivers/tty/serial/xilinx_uartps.c +++ b/drivers/tty/serial/xilinx_uartps.c @@ -1102,8 +1102,6 @@ static void cdns_uart_pm(struct uart_port *port, unsigned int state, #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 @@ -1443,6 +1441,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) { @@ -1508,16 +1509,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 (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;