From patchwork Mon Sep 3 13:10:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 10585829 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 DB18F112B for ; Mon, 3 Sep 2018 13:12:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C92982942D for ; Mon, 3 Sep 2018 13:12:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BD54C29796; Mon, 3 Sep 2018 13:12:02 +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 2410C2942D for ; Mon, 3 Sep 2018 13:12:02 +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=YOTy918LP8YeWMGOoZzGhPCC5/NcIYHAcC+ALycxhIs=; b=L/FPABOkR+hgnzxlRutAXi3E01 I9q1AkZJ//gykBLIH3c8WP4/6nuHfM/PXAJ82uoLt93TpxUqNAgcCvP7b6wFYrRKE/XzYVkfps3nu 0toWZnC1gmgXrqXrc8nSEumdxbmfvlQHwJUlobpbsElSKMDvaaZCmu++wlQe+V9tcTn44nJznDpDK 5lES95vvvR6UZ/fQnJ+9sE/tJdG7bh89zzhbius/5UEDyflReHwZIPLfXlhNhWJ7bdT+9Gb079Dfv gEQuqEIWaD5r+7RkqBfOzkC/Hid6HVo1WwW2RWxOQwJt8XbnYm8w9Un5plAimOAsW/38wgzAXGXP6 2Ke4jEcA==; 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 1fwody-00018c-P0; Mon, 03 Sep 2018 13:11:50 +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 1fwodN-0000qU-4M for linux-arm-kernel@lists.infradead.org; Mon, 03 Sep 2018 13:11:15 +0000 Received: by mail-wr1-x442.google.com with SMTP id a108-v6so574552wrc.13 for ; Mon, 03 Sep 2018 06:11:08 -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=28aWEqk5ccUrLG2mIr/fR9GT68w8zaKxoQ9DZA4uMA8=; b=Xs8AVDnn2wmLxjJn/4jfdLQJNXTmnddB0Zqzcy9jcNvnJTTY+xPtDFNWkAN85+ScGm mygipDP2bHfDY9pF/vQPiA1gZny2U2E5Mbx9FTSG2v+gIgqDidOOVGraIoK92v71b4hO U4ZOv9wQbGY4hPsbD1/e15wAd183Tyhj4zvc1O5kg72x4qUAWmBe4uJfrJCTQLor9tCT 89NFkQRq1nUo2wv3x2Nd7Jr8A+4hrehXhtQMog5sOZO/4PlkArF2jVhZ1Y6xt6vTj8BD AKHfP+XxF585ijhqt31S7M5uNJVIrSlXV3gJlHuyZ9G+2/DY4PczWa7YCq+WGigdFfn0 tkPQ== 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=28aWEqk5ccUrLG2mIr/fR9GT68w8zaKxoQ9DZA4uMA8=; b=S0VAZo89QkqftBkVIxFKsa6kV+mYiLdDRtdJWHttu6qbmrAh7IZvU0y2KdxEJNeIr8 I6lBjiHcnxA57RqXT9Ch0fFgRVk7b9IDXTAzVJRPEz319ovhr+ZfVHdAy6gRKYAFZ8Ii BvF2nPyvUX/4AwKfe2C4XPYClPApkzPDCHXMrwuBG7FfjB/10Z1nWVQH7Duz41h0Mm0a gJwa3/dH7/jvC9ZTp46WGkvYbfJYm5vSUYEYlVkVvFaFLE0rxbjwPPHFEb5yII/oW+qf c4GR9lVogMPsx3Gz0iXpfsvPIwGJjE1K2dIBXm+JekkslpRnMF4kQDf97cj0fcCiftUy PXPA== X-Gm-Message-State: APzg51CoCS+/PMifQ6VO4u3+Mbfx2MptyoP6TU9E2iDGq6h57hqFQzIn 8bpuBAfxFU9aJ01jlB6UUoJgzQ== X-Google-Smtp-Source: ANB0VdYH8gASwdpILad2XoC9CvzoT+vRDN9qm8X3G33eUwmt8HH1qqqZAxS/f01Y0dy+XtqdDR2bKA== X-Received: by 2002:adf:e6c2:: with SMTP id y2-v6mr19268788wrm.35.1535980267815; Mon, 03 Sep 2018 06:11:07 -0700 (PDT) Received: from localhost (nat-35.starnet.cz. [178.255.168.35]) by smtp.gmail.com with ESMTPSA id v1-v6sm13362609wrt.34.2018.09.03.06.11.07 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Mon, 03 Sep 2018 06:11:07 -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 05/10] serial: uartps: Move alias reading higher in probe() Date: Mon, 3 Sep 2018 15:10:53 +0200 Message-Id: <56adfce565f2d743d21d80533ce20218514c7466.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_212293_DC45F95B X-CRM114-Status: GOOD ( 14.85 ) 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 cosmetic change is done only for having next patch much easier to read. Moving id setup higher in probe is not affecting any usage of this driver and it also simplify error path. Signed-off-by: Michal Simek --- Changes in v3: None Changes in v2: - new patch - it can be sent separately too drivers/tty/serial/xilinx_uartps.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c index 5bd2b0607df6..a3e97ccb376d 100644 --- a/drivers/tty/serial/xilinx_uartps.c +++ b/drivers/tty/serial/xilinx_uartps.c @@ -1415,6 +1415,16 @@ static int cdns_uart_probe(struct platform_device *pdev) if (!port) return -ENOMEM; + /* Look for a serialN alias */ + id = of_alias_get_id(pdev->dev.of_node, "serial"); + if (id < 0) + id = 0; + + if (id >= CDNS_UART_NR_PORTS) { + dev_err(&pdev->dev, "Cannot get uart_port structure\n"); + return -ENODEV; + } + cdns_uart_data->cdns_uart_driver = &cdns_uart_uart_driver; match = of_match_node(cdns_uart_of_match, pdev->dev.of_node); @@ -1476,16 +1486,6 @@ static int cdns_uart_probe(struct platform_device *pdev) &cdns_uart_data->clk_rate_change_nb)) dev_warn(&pdev->dev, "Unable to register clock notifier.\n"); #endif - /* Look for a serialN alias */ - id = of_alias_get_id(pdev->dev.of_node, "serial"); - if (id < 0) - id = 0; - - if (id >= CDNS_UART_NR_PORTS) { - dev_err(&pdev->dev, "Cannot get uart_port structure\n"); - rc = -ENODEV; - goto err_out_notif_unreg; - } /* At this point, we've got an empty uart_port struct, initialize it */ spin_lock_init(&port->lock); @@ -1544,7 +1544,6 @@ static int cdns_uart_probe(struct platform_device *pdev) pm_runtime_disable(&pdev->dev); pm_runtime_set_suspended(&pdev->dev); pm_runtime_dont_use_autosuspend(&pdev->dev); -err_out_notif_unreg: #ifdef CONFIG_COMMON_CLK clk_notifier_unregister(cdns_uart_data->uartclk, &cdns_uart_data->clk_rate_change_nb);