Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp834128pxu; Wed, 6 Jan 2021 05:51:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJy5Sly1SMrFEARnvnwL/qt60y7TMKWY5iznDU8zCHbHqFOvMettcOiloA4o7nWfxhThAh1F X-Received: by 2002:a17:906:934c:: with SMTP id p12mr2989912ejw.361.1609941084251; Wed, 06 Jan 2021 05:51:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609941084; cv=none; d=google.com; s=arc-20160816; b=V3Gx3rKgBPPfqKheVor7jjuZnz8k4OvuAbCsKFhv7Kq8gI4X/SlLB0hDRImjY/R/F2 n8v6jOFZFlvBfP5PFfYwajDUR5vIHZat9fU+4lXHaO4RWrh6922GGIbPVjrENh0I5/GG XFghQMu4zU4N+Fmmy3kHUYKrHq4O6DGgvGON+nAHkUZeUU67RuxzpyL485BfxGYZ+lWH NmN1NBIrKZmG32xbKheOr3nygx7I9XxoKzFpLneQzFPfY8eDq8TgC/ox29bnCy3rCkNH nA3cuPnR9iStBQXlTFDuuBB0u6YuiGcciSRWm1/YLQcIEfuJI81xTSfWOTxISU+hfWXv 4u2Q== 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=0FNdR0Uvo5SYeLpsRvkp5TOUn0kN/WijbelP6kxjbrc=; b=UFC3S0eAE+xqBNYJnesy1jbzkYeRBNseDq/ZDsPntmT1UksxTSkwaIPenEonVJ4u13 ERt/4E848VJeB2110Zm2eFynOdSz+USNUD0uK3wk9/T6DHZ3FQQqtOAmBjkjNBsjLNuq O3bKNKvit358MJ/xAMlGr1d0FtgRe4QZhuYW0b8+VYVmlimsFQwoztsoIfEqlQ9c/s2I MhhIIVL+pE+6iUeuNI60PmPWSmNM4RRy6NCj5obUCvWEsB6dPrWy7oCQXOerUV8XN9fd oGF39SSnE95WSkerZKNtH2JoJk6BGG1B7dTVxS9KpS0dSrfu28W5wR659Wd1zEFzim6r CVGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Tlr6Pvqx; 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 f5si927481ejd.332.2021.01.06.05.50.58; Wed, 06 Jan 2021 05:51:24 -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=Tlr6Pvqx; 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 S1726862AbhAFNrM (ORCPT + 99 others); Wed, 6 Jan 2021 08:47:12 -0500 Received: from mail.kernel.org ([198.145.29.99]:50870 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726287AbhAFNrH (ORCPT ); Wed, 6 Jan 2021 08:47:07 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id A13AC23122; Wed, 6 Jan 2021 13:46:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1609940786; bh=XD4KOQ/rP8RIBZGRRQa+2iWBuRRUBOqeoHg48inz8OI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Tlr6Pvqxj2kK3acALn0W8ypJ/FllP+6V+SUZmRRWiqCXfTUo2U3mO6adiM8P407U+ 1fILbXiuAcbPUSA8YTd6CWZaOlpfGyKSHQDlfP07QDT8ovvvClL/8GEcFDt6bGHIeo gY3OQzHpscGdiFHExP/dgLbqTNpTcdLbEfkg8x5y9nmtcuI/xbnU2SEdx0lhpuCnRs fn+fmr1kTu+xYNn1jGcDZRcuPdgJ3ogSqHAMgVjx5v/Y3JWrQrx3nwn9E1niBBrIJN GuJ2Ly+3SSqlHBCkhPevfflVNEbwrn+DHJ9jsEKJIu1EvvOvWWj3ly6cxgQfGk+0pd pI9RqsZiMqxZg== Received: by wens.tw (Postfix, from userid 1000) id 5C1C55F7EF; Wed, 6 Jan 2021 21:46:24 +0800 (CST) From: Chen-Yu Tsai To: Shawn Lin , Lorenzo Pieralisi , Rob Herring , Bjorn Helgaas , Heiko Stuebner Cc: Chen-Yu Tsai , 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 v3 1/4] PCI: rockchip: Make 'ep-gpios' DT property optional Date: Wed, 6 Jan 2021 21:46:14 +0800 Message-Id: <20210106134617.391-2-wens@kernel.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210106134617.391-1-wens@kernel.org> References: <20210106134617.391-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 --- Heiko, I dropped you reviewed-by due to the error message change 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 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/pci/controller/pcie-rockchip.c b/drivers/pci/controller/pcie-rockchip.c index 904dec0d3a88..90c957e3bc73 100644 --- a/drivers/pci/controller/pcie-rockchip.c +++ b/drivers/pci/controller/pcie-rockchip.c @@ -118,9 +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); + rockchip->ep_gpio = devm_gpiod_get_optional(dev, "ep", GPIOD_OUT_HIGH); if (IS_ERR(rockchip->ep_gpio)) { - dev_err(dev, "missing ep-gpios property in node\n"); + dev_err_probe(dev, PTR_ERR(rockchip->ep_gpio), + "failed to get ep GPIO\n"); return PTR_ERR(rockchip->ep_gpio); } } -- 2.29.2