From patchwork Wed Jun 6 12:41:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 10450149 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 1359360234 for ; Wed, 6 Jun 2018 12:43:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F293A29F0C for ; Wed, 6 Jun 2018 12:43:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F0F542A2EE; Wed, 6 Jun 2018 12:43:41 +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 D1EC629F0C for ; Wed, 6 Jun 2018 12:42: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=4P3XWfcyKY4UpaVN/4yihHiVugOmtEMMA6CKg+cY5/E=; b=uQFQG1qcnQmSYuxGMCH3obAw6D bH44LzuIptF9VGNdP2lh5XSXmdgl+kg5A+EQuYgsRJpZXTozn6ygcDuoOUFhYhQw9vyjY9q3/ZHsD 7xw/GBFqpchTAZf4+obZSJxUYKGH2q3fnGnk9ZdngAjnnoHLUmbCu3uTSsA3gD7Xmdy6rekX+1IOG 4VjBts4kMpLfg2lMgPlmKsJMlXpWbFDUvPr/VkmDwjD5J5Xf0WBV/PK8yEDcQmtrZaKmI4fSIc4/R TOOFp2N5RuApEfxtP6QQ1mWRzpIYXxS9DkwjdZqt4GH7DGfzFZNWkpWQyceBxcYVcSbj9rH7t5e8h BoyXqpuQ==; 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 1fQXlH-0000mE-Ug; Wed, 06 Jun 2018 12:41:59 +0000 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fQXlD-0000iy-Uy for linux-arm-kernel@lists.infradead.org; Wed, 06 Jun 2018 12:41:57 +0000 Received: by mail-wr0-x241.google.com with SMTP id 94-v6so6134606wrf.5 for ; Wed, 06 Jun 2018 05:41:50 -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=5g2cs3OBOLXq3fZcWLI5faA6qb6L9bFZOzHJKGtz2tE=; b=G6h9Xve/GoRW8BxbME/OGjRlYpd9r1uryUluw9G0zTWPQG1a5IGEc9WGpYn4+wco38 Rwqww6lQEOQmz76cTbo1O7MBE6SWw9AO1/OFiag1a9lWlpo6QjU7rlKCN9bSC05m5EKZ k73SNLeCOFpncPq08+crTO6g4zs+bFJxDA4kRaswhuvcpV2NaMXWL2Vf/UmQX4zIggvG 4VE45paUi0Ztdt/+iKgdnlWt65XxWiGG0r9nMo9dwiNdLK1Avf2YRNxzytK+HwC3tZpy ehlvpRu6gNqXRCsj2FR1E7lBWDUIxfcKan2iWOE2BH7DPGaP8vHEq6x64HMccen0KrQu mZPw== 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=5g2cs3OBOLXq3fZcWLI5faA6qb6L9bFZOzHJKGtz2tE=; b=SzhS/q/t43UgOGRje8gEU2OsrjKwoIPK5sEq9eilIaAjlViDwR3wmI5+mSnJ6JSgbH GeRrBMAghA0HEN/LPum2HLnvbuqCBA4ADvCEvhgmJ8O6Et2AAzwtlyJYsBJ7YZZJeMjB MEi9uSH2UP9OxexG7ucNwf0L+VkRC5Z7rYu6oHn3O8Wg7Ch3NceHtN8UnV0aJuE3aBMU BBZWaGIEeVZYqBSMIvxAkrQVJjHps8Rdh8Nox9E/alQ63eAqZtWQvJbxVVvBKBqKS9rE eVebF8PxwA/Kn0YJqjQQ6d4C4LSm2dfwmpugXntHtETsZmv37h3aHbw0Zpv4NmLpXRk8 263g== X-Gm-Message-State: APt69E2UPcwKJPkrfuFT250Jj84WP6QDdBaCT6u/vVKNbgDtd6dB/PDI 4nW0o8zl/Iy2SpXpAwZwZn+CRw== X-Google-Smtp-Source: ADUXVKKwD78Wt8EzfxtafnP0fQ4dDX18bNsVAbFEu7ukikAgfB+mZZS4ck3oICGoZhHUqSBj11x7vw== X-Received: by 2002:adf:9525:: with SMTP id 34-v6mr2104627wrs.99.1528288909261; Wed, 06 Jun 2018 05:41:49 -0700 (PDT) Received: from localhost (nat-35.starnet.cz. [178.255.168.35]) by smtp.gmail.com with ESMTPSA id q194-v6sm4934625wmd.26.2018.06.06.05.41.48 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Wed, 06 Jun 2018 05:41:48 -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 4/6] serial: uartps: Move alias reading higher in probe() Date: Wed, 6 Jun 2018 14:41:37 +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_019998_487C8A56 X-CRM114-Status: GOOD ( 14.44 ) 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 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 fe96fd950d3a..b47d7ccbc38d 100644 --- a/drivers/tty/serial/xilinx_uartps.c +++ b/drivers/tty/serial/xilinx_uartps.c @@ -1440,6 +1440,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; + } + if (!cdns_uart_uart_driver.state) { rc = uart_register_driver(&cdns_uart_uart_driver); if (rc < 0) { @@ -1509,16 +1519,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); @@ -1577,7 +1577,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);