Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp4884312rwb; Tue, 6 Sep 2022 14:30:43 -0700 (PDT) X-Google-Smtp-Source: AA6agR6uXcqyCIurjaScicGu10WusRtBh9ZGz5hz+2BwRanifn6BORVxgyNWJPpM982Bi6sSQ5nc X-Received: by 2002:a17:906:11d:b0:712:abf:3210 with SMTP id 29-20020a170906011d00b007120abf3210mr305286eje.292.1662499842892; Tue, 06 Sep 2022 14:30:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662499842; cv=none; d=google.com; s=arc-20160816; b=zBqiSkJTTfO8rNcfaBLfhrWIPS80uGsvkaJyAUUy+TrO0qUkRB8jVdFysz5iZjDwfV OlHidLLE0M5ezOlb//YcRpiM3Ero0nxUnuEHZ25IJg8zLnVhYG4jwjbkuwJTxJRPYoN7 XWcP0AEbbgUdwG62u5XhTzumQqSCqUk228viSd2Bqd/iiHtDMbLvQz8JMsrlhAV1CX+6 UTJnTu7GMKo3hZ2GshXWdeplkBqQ+appXGS1rnlFQXkXNkqkmvBObRDcV2xUlMAsR0XG sS8T0fT/eXQMY2oNBFbt7m1+p0NiN78xpnx//IeSpcWiACeBS3o1UUv6lzVP/poCTq6o lJSQ== 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=LGZJeMOU/kTBjQcVTon7M5VthpZd4oM1G5QflDMIOBQ=; b=qEi5sXMRvDSwgAqEkLhiCaIO9Azz68mqZQREhE/dkWR/bNL0/pS1I5d63e11mxz9s6 GdrNUC+JEnRmwbNwsvyf+AqQJY97ytGQCmszaRhur5ab+SPYVS5k0ADZVwIiRQ3tTL9n S9yu8xLwB3h9iBxdwy9UhggXDefJhDppFkgSO4F/DpwfpyNuuhsaviV9VyVJbY3ENJFr Rb7QCZfK3l2JlgSdWpCAQQmIe7puYMGB+9EMCsAtgRmuEAKksq+HftGK+9wbDZPHPcEo e4DBm9SWSAHzQX8UYUMMpyJAqkLpbin9ItFwEPC4vLrINo8GviZFuNguiHsio4Vx843z IOHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=fD3UBHqC; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fd23-20020a056402389700b0044eedb5a82dsi1103628edb.476.2022.09.06.14.30.17; Tue, 06 Sep 2022 14:30:42 -0700 (PDT) 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=fD3UBHqC; 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 S230377AbiIFUnL (ORCPT + 99 others); Tue, 6 Sep 2022 16:43:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230215AbiIFUnI (ORCPT ); Tue, 6 Sep 2022 16:43:08 -0400 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 566A08B9AF; Tue, 6 Sep 2022 13:43:07 -0700 (PDT) Received: by mail-pj1-x102f.google.com with SMTP id a5-20020a17090aa50500b002008eeb040eso2990940pjq.1; Tue, 06 Sep 2022 13:43:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=LGZJeMOU/kTBjQcVTon7M5VthpZd4oM1G5QflDMIOBQ=; b=fD3UBHqC6pgBLZfaZsrdOXw+33kE9SoUOutYUEl6EUeEKwU8uoJvvGbhLsC9ZC4e4u 0Y72dgEnu4HpKjNzFM3O8kGnGm+WN6QCCToLiWPk6uM6URU2PYDWIhrMfn1YVfJ6S8MY KyMKtm8ZoaX5Ss1aEdckR1fIF2r+LrAguDdfUh9wT/SIlNsHlMwGGJHuipHHotRSZUkb klDE+f/hG9BmSqiEUtONiiTU3lRxr8DIpKq2kvRSsU1eTW/A5BgnGjAt0u28k7Uwsw7w jd8zM0pjCBJoTCsTNl76FjtCoIYFSvNcnbJzH3VfECWqijdDFkTM1Eihyi3AHBbe+UFO 4weA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=LGZJeMOU/kTBjQcVTon7M5VthpZd4oM1G5QflDMIOBQ=; b=Etc1bI9PYnf2CRJrTiwlFXNGck1RF4XaGjxLBppftpkQPVELnW5Iu+bjOOB+VWFGry big+A/AL+1bmGbUOYOKCSG7eXiVUQvbBYMfycRym28lUv4qWq7VOfmgQT2DnapfhZyZK 71gRpgCLY7EgzVfKfhPi8duEZzEgC/sZhgVbLYaH1B00PRBDwki4/XcigmmQ/9Zw1iW7 oICfqJ3hazTfAwfxZsykqTTzr/k8oGRdnpoU/YC4s/5LIKVXDyMLa7SrxBhbexcHuLxL RPM8nPtGc7rzdWOpW7XNT56v8EcaZH8p+IB9VnzS0qBRx/w8wJoOZ5UU2ykVXcmKJoUd vksQ== X-Gm-Message-State: ACgBeo1mG96d4IhcYFCQ1sBn8bNrTYY3bot4spZs6hlY2Fabh3S6a5Q9 dpSc116k0b+LbPKIAJbkDCs= X-Received: by 2002:a17:90b:254b:b0:200:a860:5bf9 with SMTP id nw11-20020a17090b254b00b00200a8605bf9mr3695228pjb.176.1662496986681; Tue, 06 Sep 2022 13:43:06 -0700 (PDT) Received: from dtor-ws.mtv.corp.google.com ([2620:15c:202:201:abc4:5d24:5a73:a96b]) by smtp.gmail.com with ESMTPSA id u3-20020a170902e80300b0016c57657977sm10359961plg.41.2022.09.06.13.43.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Sep 2022 13:43:06 -0700 (PDT) From: Dmitry Torokhov To: Shawn Guo , Lorenzo Pieralisi , Thomas Petazzoni , =?UTF-8?q?Pali=20Roh=C3=A1r?= , Bjorn Helgaas Cc: Rob Herring , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Linus Walleij , Bartosz Golaszewski , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] PCI: mvebu: switch to using gpiod API Date: Tue, 6 Sep 2022 13:43:01 -0700 Message-Id: <20220906204301.3736813-2-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.37.2.789.g6183377224-goog In-Reply-To: <20220906204301.3736813-1-dmitry.torokhov@gmail.com> References: <20220906204301.3736813-1-dmitry.torokhov@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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,T_SCC_BODY_TEXT_LINE 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 This patch switches the driver away from legacy gpio/of_gpio API to gpiod API, and removes use of of_get_named_gpio_flags() which I want to make private to gpiolib. Signed-off-by: Dmitry Torokhov --- drivers/pci/controller/pci-mvebu.c | 48 +++++++++--------------------- 1 file changed, 14 insertions(+), 34 deletions(-) diff --git a/drivers/pci/controller/pci-mvebu.c b/drivers/pci/controller/pci-mvebu.c index 1ced73726a26..a54beb8f611c 100644 --- a/drivers/pci/controller/pci-mvebu.c +++ b/drivers/pci/controller/pci-mvebu.c @@ -11,14 +11,13 @@ #include #include #include -#include +#include #include #include #include #include #include #include -#include #include #include @@ -1261,9 +1260,8 @@ static int mvebu_pcie_parse_port(struct mvebu_pcie *pcie, struct mvebu_pcie_port *port, struct device_node *child) { struct device *dev = &pcie->pdev->dev; - enum of_gpio_flags flags; u32 slot_power_limit; - int reset_gpio, ret; + int ret; u32 num_lanes; port->pcie = pcie; @@ -1327,40 +1325,22 @@ static int mvebu_pcie_parse_port(struct mvebu_pcie *pcie, port->name, child); } - reset_gpio = of_get_named_gpio_flags(child, "reset-gpios", 0, &flags); - if (reset_gpio == -EPROBE_DEFER) { - ret = reset_gpio; + port->reset_name = devm_kasprintf(dev, GFP_KERNEL, "%s-reset", + port->name); + if (!port->reset_name) { + ret = -ENOMEM; goto err; } - if (gpio_is_valid(reset_gpio)) { - unsigned long gpio_flags; - - port->reset_name = devm_kasprintf(dev, GFP_KERNEL, "%s-reset", - port->name); - if (!port->reset_name) { - ret = -ENOMEM; + port->reset_gpio = devm_fwnode_gpiod_get(dev, of_fwnode_handle(child), + "reset", GPIOD_OUT_HIGH, + port->name); + ret = PTR_ERR_OR_ZERO(port->reset_gpio); + if (ret) { + if (ret != -ENOENT) goto err; - } - - if (flags & OF_GPIO_ACTIVE_LOW) { - dev_info(dev, "%pOF: reset gpio is active low\n", - child); - gpio_flags = GPIOF_ACTIVE_LOW | - GPIOF_OUT_INIT_LOW; - } else { - gpio_flags = GPIOF_OUT_INIT_HIGH; - } - - ret = devm_gpio_request_one(dev, reset_gpio, gpio_flags, - port->reset_name); - if (ret) { - if (ret == -EPROBE_DEFER) - goto err; - goto skip; - } - - port->reset_gpio = gpio_to_desc(reset_gpio); + /* reset gpio is optional */ + port->reset_gpio = NULL; } slot_power_limit = of_pci_get_slot_power_limit(child, -- 2.37.2.789.g6183377224-goog