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: 19995 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2303940wru; Mon, 14 Nov 2022 10:44:34 -0800 (PST) X-Google-Smtp-Source: AA0mqf6zs/G+QGJTc3S07V2IFV7DXU6brlU4I+/+iUYtQVE7S1IvZ4nP90MBckKUEL1cYrvpjaBc X-Received: by 2002:a63:8f48:0:b0:455:8333:d8e with SMTP id r8-20020a638f48000000b0045583330d8emr12453060pgn.380.1668451474205; Mon, 14 Nov 2022 10:44:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668451474; cv=none; d=google.com; s=arc-20160816; b=xRVcR56YEJxBd6ebLd9jyNwRHrcdu2vrd3Yv57B69rE1cautBJPblHqzvI/SZGKVc3 Hh0EcB36zTdJVNB8SuDVXb7yvvWP7O0ArV2TqLjyTUml0xyKRK/YG4+qxTJlIyh9UYhn oLxfu8skhSUkuLMk9BvqENG7UQRRImYCSmqLuQ8E0VEINEDxpvgJGghsT4+0tEGj8Ovt 7a8rfY2rYGDovA641M4qU2nIOLWvej4oIySq2p4GiI5567mWvfkxJUAFV71nxhQjgj6F dfT//A2C4cTxf6kZXKb42BNvawb9DLhH3YXk7iCKQpa1MzCR1dXrh2KBGia+iRAL95Np XjGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-disposition :mime-version:message-id:subject:cc:to:from:date:dkim-signature; bh=CpTIatzX4u0/HTzbO8qsPMYL1u0QJMJqvc+Ay+4dShg=; b=VR/cgk+845pA8UoTLZndiKlcqVOY9Qo9tfELy+j7vtiPXbNcfiChggXJG4r2ykE0Of FAU9KtwjhUXjFBA2EYt/2Qeg+S8c2wN6dlY9c7Kaq5o8D21EteYF8Q1RMqKX8fObhyiF p9LEl4A7Jo9WyKneQOXVBKhyGk7rMuy6fOqHXWiYK6/OkPWi1bI0AsBOFuMQE1IiXw1n QN04mRfAeXUp+Dh2G6+zh4jx3i4AIZwGrxhfhsMJ/z5++bgWkkZeZWlqcejzCHO249G1 hUt5cfXiEFHibIOutgry756CLgKO314Kbr+m5mBKdEToCZbNHv9UdcudW93FQfAQducn S+Cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=oN+4b9T+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e23-20020a62aa17000000b0056cb8f6f027si8851647pff.357.2022.11.14.10.44.21; Mon, 14 Nov 2022 10:44:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=oN+4b9T+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236444AbiKNSmd (ORCPT + 99 others); Mon, 14 Nov 2022 13:42:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236525AbiKNSma (ORCPT ); Mon, 14 Nov 2022 13:42:30 -0500 Received: from mail-pf1-x434.google.com (mail-pf1-x434.google.com [IPv6:2607:f8b0:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E35C27FC5; Mon, 14 Nov 2022 10:42:30 -0800 (PST) Received: by mail-pf1-x434.google.com with SMTP id q9so11844796pfg.5; 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=PWjVhRwK93z1sfbUGrVCszWERm5yzrXND/qrM+m7cWcbgabi+X76SzxH8rLx461wXf KwNwJFR3g5g/RoQ/swYdjfa/Z69NWsvRQiI4qmrUK9y5NptpQnqUQ+Iegn+HG1nZuB66 tG+tHsPiSiv3S0ObuoNZmRaiX+Dd8NTez85c54pTqwXeKlogvzEIDcfF7ZumoyS5vM1q wi/CjMjwCHKRUrQGUIZuY61zS0FlPBtCubsO3iY+49SZSHDK6JsujYGsvJQETq4yrW4g eypcklchk0DPJMl+UGy9pnFBlzXdSKmynBa6RBRu2q9SQHfK7OBV40mkoiewqa5Gfn4d dt3A== X-Gm-Message-State: ANoB5plzvqZZWLZ4R1yfk5u5y+taTRz4gxuWkO185Ne7A2sC6ucaEyGX xL2QaHaj9VGgCaFt2+A8VRO6Rc1acXk= 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-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749498173029961326?= X-GMAIL-MSGID: =?utf-8?q?1749498173029961326?= 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);