From patchwork Mon Nov 14 18:42:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 13042686 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 845EDC4332F for ; Mon, 14 Nov 2022 18:43:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Subject:Cc:To: From:Date:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=94pDwW/2Q6zGo2ncbZ7fuVlh7GhRRl8bzM5PuTD932M=; b=FFxMi06zO6MlN/ NIA5Csfze/EXzvJAYti7PoCDZ+ARgeMlhiWXEma4xKplTkJa6U59bygceU6jehoe7kxrGF4ZIK+Zu tTV2Dpk9j1bYMjQeBkDsWoT8AJdaPkNiVdO8YoH9EBXlpSIHCqDNagozWWsfaCdVUXJTf+wLY5ncC LSvciq/Uu3ap4uSN6s0NSs2QZycIOT2HB24lDL6rrgcgjm2/JvzUqV30Yml/NU1xRkTTc0WE2d7lT jD5XNDp/Vhtf6xYL3JpTcbyrZEyA1keZrautNyd8kpM/af1r9vE9v59GFsJWQ69Py6rQnxOwf4Qq8 Koe08+3d6cdhpnzbrDFg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ouePj-003rYH-5J; Mon, 14 Nov 2022 18:42:35 +0000 Received: from mail-pf1-x435.google.com ([2607:f8b0:4864:20::435]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ouePg-003rV3-PP for linux-arm-kernel@lists.infradead.org; Mon, 14 Nov 2022 18:42:34 +0000 Received: by mail-pf1-x435.google.com with SMTP id g62so11831722pfb.10 for ; Mon, 14 Nov 2022 10:42:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:content-disposition:mime-version :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=CpTIatzX4u0/HTzbO8qsPMYL1u0QJMJqvc+Ay+4dShg=; b=oN+4b9T+Dew1mTgGEMv9v9FGxRc9HQYBG2w0r75hfEZbSYdp48q14k6Pgbs14/03J/ 3g9/jxgfkSV32KvT6B1q7GeWDLFoU5mzEVv7y3kRTsFVn5FLr9PeGNpPBHtM13HG//95 qtBOBxti2sTb4tCSH340vG3TeYxZ22+ImmeokryBGDCUKe0+hAAs9eIw5r6+45QfmzJj ecJ4aoF6+YekNk+Qyq+pIE6pJXFOE9kw5YEnTxomRWo/wvZF5yGN4cvfr/u2MTLUsbtT YzVsmh2/EzQlUWaUJmxe+m94vTHK+/DC3NQibibmwfHuQpb1zIyoMYWxm+FyS9ezqH2Q YwFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:content-disposition:mime-version :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CpTIatzX4u0/HTzbO8qsPMYL1u0QJMJqvc+Ay+4dShg=; b=FjUekfCzVwOnPpHc4Jxtx9Gc6dM2VKw/SAiDSS+L6Org07XwJ/j7BdqtQhvs2LGLhM wwa3u5cMxaBwhfRfU113wdm4saM+YOEYTV6wSC+KJPGriS+3ZfHKUYBUyKAKR1hZzosF +Ii2qG3bD7+/wuYsuve4Li2vQChH9RdbYTERJhRxJ3cpL+bT4EnKPtiVmmUUoi/H9htR mRzx2VFZb8IYc1S1+wfZqEn0bBhKRVY9ci6MsgMZT9KhsXlH1E9b6l7XRtCKhE1yonxe kpgLZrrkxTi20iRhd9iaBgCWR7Re8MMfSZIF1CN5cp/0QCTdsXIXCHheCRArEe8ZeNh7 Uqjg== X-Gm-Message-State: ANoB5pnBVvK/+natI08uhS6eZhFC7uAsA1XbLUk9Ccm22f6fvlfS15F0 PwOYSiufQQvCSE/XvtXzako= X-Google-Smtp-Source: AA0mqf6kHjQZNow4sM/pm272u3Td0bf10ylBH/gZBS3wr5AONc9syi+cyupcpd1CF+jL1Wbc0+OhXg== X-Received: by 2002:a05:6a00:c8b:b0:56e:d7f4:3c49 with SMTP id a11-20020a056a000c8b00b0056ed7f43c49mr15014102pfv.50.1668451349537; Mon, 14 Nov 2022 10:42:29 -0800 (PST) Received: from google.com ([2620:15c:9d:2:5c17:fc5a:f127:5bb5]) by smtp.gmail.com with ESMTPSA id c27-20020a631c5b000000b0046ec7beb53esm6203376pgm.8.2022.11.14.10.42.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Nov 2022 10:42:28 -0800 (PST) Date: Mon, 14 Nov 2022 10:42:25 -0800 From: Dmitry Torokhov To: Thomas Petazzoni , Lorenzo Pieralisi Cc: Pali =?iso-8859-1?q?Roh=E1r?= , Rob Herring , Krzysztof =?utf-8?q?Wilczy=C5=84ski?= , Bjorn Helgaas , linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [v2 PATCH] PCI: aardvark: switch to using devm_gpiod_get_optional() Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221114_104232_842947_F63D98AB X-CRM114-Status: GOOD ( 18.65 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Switch the driver to the generic version of gpiod API (and away from OF-specific variant), so that we can stop exporting devm_gpiod_get_from_of_node(). Acked-by: Pali Rohár Reviewed-by: Linus Walleij Signed-off-by: Dmitry Torokhov --- v2: - collected reviewed-by/acked-by tags - updated commit description to remove incorrect assumption of why devm_gpiod_get_from_of_node() was used in the first place This is the last user of devm_gpiod_get_from_of_node() in the mainline (next), it would be great to have it in so that we can remove the API in the next release cycle. Thanks! drivers/pci/controller/pci-aardvark.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c index ba36bbc5897d..5ecfac23c9fc 100644 --- a/drivers/pci/controller/pci-aardvark.c +++ b/drivers/pci/controller/pci-aardvark.c @@ -1859,20 +1859,19 @@ static int advk_pcie_probe(struct platform_device *pdev) return ret; } - pcie->reset_gpio = devm_gpiod_get_from_of_node(dev, dev->of_node, - "reset-gpios", 0, - GPIOD_OUT_LOW, - "pcie1-reset"); + pcie->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW); ret = PTR_ERR_OR_ZERO(pcie->reset_gpio); if (ret) { - if (ret == -ENOENT) { - pcie->reset_gpio = NULL; - } else { - if (ret != -EPROBE_DEFER) - dev_err(dev, "Failed to get reset-gpio: %i\n", - ret); - return ret; - } + if (ret != -EPROBE_DEFER) + dev_err(dev, "Failed to get reset-gpio: %i\n", + ret); + return ret; + } + + ret = gpiod_set_consumer_name(pcie->reset_gpio, "pcie1-reset"); + if (ret) { + dev_err(dev, "Failed to set reset gpio name: %d\n", ret); + return ret; } ret = of_pci_get_max_link_speed(dev->of_node);