Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp344580pxb; Thu, 21 Jan 2021 08:25:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJxNEU1Hp9OSlUIoAue1xSQ5ES3vNyoSg0wxoXeHMLOPLuc0wzieCP6kNdv8tyyy8cY6adjL X-Received: by 2002:a17:906:4bc1:: with SMTP id x1mr150848ejv.509.1611246358391; Thu, 21 Jan 2021 08:25:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611246358; cv=none; d=google.com; s=arc-20160816; b=cO/wJRBXEiESAmwBzflbCQjK/oQFK5n+W8d2VzalBQJXAHiFCnnB3AQW0Z6MKDTJi9 V05rP9nHTfWaaAXTfYJc6Fn6ubqJYsPABhT3asut8TXCo4Lu/yMDv0s+IHxIeANosqtz FZKvd4Wx6LYOstd3NH4fJJsczMye3jz41I7KKczhKSAAwqtbxoQ+4CADpCNOfKyQiUlc nckd59PgZbFfaax9di2uPkNA4x8Oub3qkdkJma0bL0A8vkJsovK1UMzfLyT+aRFzzI9F znPwWQKeNu5UjOhLTaHSSHEhieaDFVWXM4tpMltP4O82VPYbCW1yX9dWsyZEJCaT1LEY rfDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=N8WzT+K23xZY3AviAtqkzTk9uJN/tb/F88Q0xG0v0Ko=; b=rNVARK/XDcspmSd5myU4bLEJjVnwRks14isle4Ko1gxukiH7mhXWiT0bMNz2/k01hr v8+ZypSpl+4odq41GhFip96rU86VNnz06qxvs5syu7W/f/+CumqPczSRmPT7zd/gdTuW dHPeCKu1IZISTttSN5fIdI+IVENk1PfnMjHANrBHJMjx7d3xgTKqklpWIaQyM0IgI5dU LeTd7q2sbSRu2/5eUTkjABbJ7HfXSTyDJDwIMQ7B30sZJsHddmcg39NKbPDK1FLAe2cA RGEgtJW9rqPPSChjOfKiHgvJu/LSLdmh0zINIyjTtyIkE5wjQ9ZcxtLK0GSkNdjCgOwC nlzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=suZIrn0s; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k9si1935126ejx.640.2021.01.21.08.25.29; Thu, 21 Jan 2021 08:25:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=suZIrn0s; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733131AbhAUQYf (ORCPT + 99 others); Thu, 21 Jan 2021 11:24:35 -0500 Received: from mail.kernel.org ([198.145.29.99]:58434 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387763AbhAUQYM (ORCPT ); Thu, 21 Jan 2021 11:24:12 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6DC1C21919; Thu, 21 Jan 2021 16:23:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1611246211; bh=TxPC2i3KodVBMcUvSfNNM7XR6HBVjld0zlamfiLWJnQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=suZIrn0sZe9LWunctXBnZBJmxA9qNDHr7PBhkgdM2BMTFF9PdaFlY0qzKOPauf8Xu 9njbqikLLV3m4lsOwd7Kh3ZkqV6Wzf1JgshZKHCYOwTId/beAo3hD5Tt3AiQN6LFZ5 WUzy0Y/yQy1ImySW9zo+n+QT8HoWY8UsZeofDCITrYL8cwO3yLzlafqlN6CNhUUPEG mWQOxKvlOk+DcrB5gt+PECxEWZP9UAIfUTULp6MuhXWZfe0T0SYoSK19Fy2HKshkMK UM4SxLGzimyEzj38vvF0SQSTGoLOkS6nFjLHPpWDBwykHBVUJ/J9wQdCTxXgImfO6j l6tau4ERZezLQ== Received: by wens.tw (Postfix, from userid 1000) id 9F07D5FBD6; Fri, 22 Jan 2021 00:23:28 +0800 (CST) From: Chen-Yu Tsai To: Shawn Lin , Lorenzo Pieralisi , Bjorn Helgaas , Heiko Stuebner Cc: Chen-Yu Tsai , Rob Herring , Robin Murphy , Johan Jonker , linux-pci@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v4 1/4] PCI: rockchip: Make 'ep-gpios' DT property optional Date: Fri, 22 Jan 2021 00:23:18 +0800 Message-Id: <20210121162321.4538-2-wens@kernel.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210121162321.4538-1-wens@kernel.org> References: <20210121162321.4538-1-wens@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chen-Yu Tsai The Rockchip PCIe controller DT binding clearly states that 'ep-gpios' is an optional property. And indeed there are boards that don't require it. Make the driver follow the binding by using devm_gpiod_get_optional() instead of devm_gpiod_get(). Fixes: e77f847df54c ("PCI: rockchip: Add Rockchip PCIe controller support") Fixes: 956cd99b35a8 ("PCI: rockchip: Separate common code from RC driver") Fixes: 964bac9455be ("PCI: rockchip: Split out rockchip_pcie_parse_dt() to parse DT") Signed-off-by: Chen-Yu Tsai --- Changes since v3: - Directly return dev_err_probe() instead of having a separate return statement Changes since v2: - Fix error message for failed GPIO Changes since v1: - Rewrite subject to match existing convention and reference 'ep-gpios' DT property instead of the 'ep_gpio' field --- drivers/pci/controller/pcie-rockchip.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/pci/controller/pcie-rockchip.c b/drivers/pci/controller/pcie-rockchip.c index 904dec0d3a88..a2ad0b7614a4 100644 --- a/drivers/pci/controller/pcie-rockchip.c +++ b/drivers/pci/controller/pcie-rockchip.c @@ -118,11 +118,10 @@ int rockchip_pcie_parse_dt(struct rockchip_pcie *rockchip) } if (rockchip->is_rc) { - rockchip->ep_gpio = devm_gpiod_get(dev, "ep", GPIOD_OUT_HIGH); - if (IS_ERR(rockchip->ep_gpio)) { - dev_err(dev, "missing ep-gpios property in node\n"); - return PTR_ERR(rockchip->ep_gpio); - } + rockchip->ep_gpio = devm_gpiod_get_optional(dev, "ep", GPIOD_OUT_HIGH); + if (IS_ERR(rockchip->ep_gpio)) + return dev_err_probe(dev, PTR_ERR(rockchip->ep_gpio), + "failed to get ep GPIO\n"); } rockchip->aclk_pcie = devm_clk_get(dev, "aclk"); -- 2.29.2