From patchwork Mon Sep 3 13:10:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 10585849 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 8B0C613BB for ; Mon, 3 Sep 2018 13:19:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7B4EC2978E for ; Mon, 3 Sep 2018 13:19:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6F62129796; Mon, 3 Sep 2018 13:19:11 +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 EAD342978E for ; Mon, 3 Sep 2018 13:19:10 +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=rSFcPRaWeuDMCw61I5fFcPiaNKZvqpPfEFlGOjfE0qQ=; b=tN+DAa0s48LcOM+kIkxYzXDMlK 4L63tVESw4loEy6WCaapW/hs+P2fDfYB6zDZBV7LowgfU1T7uf0kHphLkodZ2156oxcFKDvTxnBw+ d/AhNAMTOQWNr0JhqPILFGYbJuiB2QnIJNS5gW5+VP16NFCAoSaL9rCseIDqhFftMr6xzDw9WvVsu 5gpKWQuVXUODxE/p9NnPfjOqtMn8cYsZaFr0LQA0TTTjlZwIJGneJEAg2rbdsQZh0q5nekRWWpqn8 uQXihg+Cy64cP3y62hB4Q5uLgHne9uq+6Nic/ARWIqA5tuIgiK6/8sAHczwcRm2+njnhPxmD0yNWa 9MEOgVCA==; 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 1fwoks-0005Np-AZ; Mon, 03 Sep 2018 13:18:58 +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-0000qx-Hg for linux-arm-kernel@lists.infradead.org; Mon, 03 Sep 2018 13:11:27 +0000 Received: by mail-wr1-x442.google.com with SMTP id g33-v6so651534wrd.1 for ; Mon, 03 Sep 2018 06:11:13 -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=IEO3yDjZVgWsh5LL+iyO+h5Gjo8oaKkP6OuPubrdvDI=; b=b72F7YunxZp9VNZw+vhHRA8VxNTCZPReawxwFsgS9Bq6RPbNclo8PlROsNU2UPJqqu ttQ6/qApGaBtl0tzUNLOdjphjhM+B5KAfJtABQDLcrdbx86uZ4NKK7o2SENmb3sKzmDA dBtpVB8I6+kH4p15MpQxl/yGbxHL3oLdeCfpHGFJNSiSFQ2B//Nu2kBSrQjYEBctaIJP bOeHMqautuMHOATUxxRAK+SfuQFknzCwX5rbsy3YNittc5sVNIn4rOcAaU9Cc+hsiUax jXK5HC3R5OYWf9rGG5fJOX8w8TJ3LDSrOP+gXht43hpGwYsoyj5BgN7aG8+Uef55v77M 1xUg== 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=IEO3yDjZVgWsh5LL+iyO+h5Gjo8oaKkP6OuPubrdvDI=; b=E2+OHeSHJgksDmG4hzOKhS/4qOnJyhpqPbu3UhBIPkPUSm+4YZ4VZo5tvE43Qo6tNO 8YpUOQu5jvtt6qhKwcE4A/+TskDPYuT7NmABggEwaRNzwN1enpvpBYv9Lokq1jBDRxNb tUX/MbR2Tg1TN24zqVhoSD0RLoM3iBJz1qe4ekBhmTD6rG9al/5J5x7JS7vKWd2Hu53V lix4Q9xvYKinMCzvoVWhP9dovIHC5MYR157oZ2uBcGuYgOpnoL18cfTJtRed/WFt3OFf MlFBpx4hWZtCZA4eY8s2rFC0sEc4nrApKQTR83a8ZGBO98W3v9QLUxl3RM1Keea3bnPz O+Ww== X-Gm-Message-State: APzg51A5cxzbOxc1NTf8LHP1VmFLC9r+90rvl4FA3sWx8SeRvhV5bYCa QPqUfy1TWTGq2q4zaAtDZ7/ddA== X-Google-Smtp-Source: ANB0VdbbRRV10cJTTFfrFnlVyqpux9vntv7MLfprlRri607PCLGe3WZMv0H7dD3ZDexxpWKF4oMtgg== X-Received: by 2002:adf:fc83:: with SMTP id g3-v6mr19105157wrr.216.1535980272205; Mon, 03 Sep 2018 06:11:12 -0700 (PDT) Received: from localhost (nat-35.starnet.cz. [178.255.168.35]) by smtp.gmail.com with ESMTPSA id e14-v6sm12245995wrv.44.2018.09.03.06.11.11 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Mon, 03 Sep 2018 06:11:11 -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 08/10] serial: uartps: Change logic how console_port is setup Date: Mon, 3 Sep 2018 15:10:56 +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-20180903_061123_715138_45943E2E X-CRM114-Status: GOOD ( 13.87 ) 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 Change logic how console_port is setup by using CON_ENABLED flag instead of index. There will be unique cdns_uart_console() structures that's why code can't use id for console_port assignment. Signed-off-by: Michal Simek --- Changes in v3: - New patch in series Changes in v2: None drivers/tty/serial/xilinx_uartps.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c index 61087233f411..0e578c0a8ce0 100644 --- a/drivers/tty/serial/xilinx_uartps.c +++ b/drivers/tty/serial/xilinx_uartps.c @@ -1532,7 +1532,7 @@ static int cdns_uart_probe(struct platform_device *pdev) * If register_console() don't assign value, then console_port pointer * is cleanup. */ - if (cdns_uart_uart_driver.cons->index == -1) + if (!console_port) console_port = port; #endif @@ -1545,7 +1545,8 @@ static int cdns_uart_probe(struct platform_device *pdev) #ifdef CONFIG_SERIAL_XILINX_PS_UART_CONSOLE /* This is not port which is used for console that's why clean it up */ - if (cdns_uart_uart_driver.cons->index == -1) + if (console_port == port && + !(cdns_uart_uart_driver.cons->flags & CON_ENABLED)) console_port = NULL; #endif @@ -1594,6 +1595,12 @@ static int cdns_uart_remove(struct platform_device *pdev) pm_runtime_disable(&pdev->dev); pm_runtime_set_suspended(&pdev->dev); pm_runtime_dont_use_autosuspend(&pdev->dev); + +#ifdef CONFIG_SERIAL_XILINX_PS_UART_CONSOLE + if (console_port == port) + console_port = NULL; +#endif + if (!--instances) uart_unregister_driver(cdns_uart_data->cdns_uart_driver); return rc;