Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1449958rwb; Wed, 7 Dec 2022 13:19:12 -0800 (PST) X-Google-Smtp-Source: AA0mqf70GkBkutNW9TqlYWg9l1XT+42FzuQbyHyaYh52I5O23JzrsjWT8v67mPd/wmQyOy+/2pMO X-Received: by 2002:a05:6402:f0b:b0:46c:d007:8642 with SMTP id i11-20020a0564020f0b00b0046cd0078642mr11808927eda.348.1670447951998; Wed, 07 Dec 2022 13:19:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670447951; cv=none; d=google.com; s=arc-20160816; b=AVY7Py81I1Efym3uMXXp6HjX290JqwntY8BHZS5rxKTsuWTUhK81KJUOHN0d71W+Ec iDTCnBp2yUvuHN+68ekn5nWesR1yUEuXKp0VjnJ0SUozjKLuXd8XpCwpLVsciXJjtjcI jAWknfwiG5nqLrJsS8S7bkHJfo4s3mv1AJ92m1dWv2IP4LywgeQoZUntRNZEBywlwOda Tv+cz0kf/K06pBboWGPGL3vhVRPf0CvFJK7ywf53sS6rUWooE+yAxbNgNaj+RVrn0Tol /utJsyr2GQAamoa8349rePUB6JhlWH9AwRgTsQBmpUFHPoGPnaNHv3haFkmMyKohlhAB T6UA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=V995C6MwqtUAmTG71E4cb1Pyxeu/S0wZo/QPEUz5JyI=; b=L6MieoD7m2YQw9UhT/VvsHdrbXCsd70wyaaSYQeGyxeK6nO2XHmIlZaA7NFjqyVddv EqyZMOxX3UXrXkgVqnm3QfDo0HqcGrUPg7VTntszYbXFCzTP6yo8VXLqH2O85gyskWAy XDzfbL4zMKn+r1vp0X/Fe34bIwKjWEKfHOXvfDWdAAzDp4CTfaMcCBs1c2LkhwuyGUFz qbK/JDaCs4KGFiqwT636yg9ALqJx+2XnFsjrqM4lzwQshuAGL7pQrO/YJiw0WA3WwWln qOSyFd71DY4FRXkwm0P3wg2MOhSSi1nNGAC7IKO2yDcQ0S+ftvXjQT0xumTSRiozKhId 7kiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=LpQoDdBW; 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 ft31-20020a170907801f00b007b5dd3e6995si12310104ejc.917.2022.12.07.13.18.54; Wed, 07 Dec 2022 13:19:11 -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=LpQoDdBW; 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 S229835AbiLGVHR (ORCPT + 74 others); Wed, 7 Dec 2022 16:07:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229441AbiLGVHP (ORCPT ); Wed, 7 Dec 2022 16:07:15 -0500 Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0FA27716F5; Wed, 7 Dec 2022 13:07:15 -0800 (PST) Received: by mail-pf1-x436.google.com with SMTP id g1so10532640pfk.2; Wed, 07 Dec 2022 13:07:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=V995C6MwqtUAmTG71E4cb1Pyxeu/S0wZo/QPEUz5JyI=; b=LpQoDdBWH7AjZeARZIav9Ud/rp1eZav/ptYhNkj5zUs0aFgG1QvN3QpxTsdlTLfxQR +U07pkjcNK24yiRBCGfqbHKVQqHgZ59x8Dukmo3jhYItpStJGQjJgkbeY9lg1t8S9HGH yGRbNfl//dN49Tx0QTg8BglhjxBCcorbXlOzpdqMB3sdPYF+NFd1pmGteUpI7OtIWlhA 1+xvxpxN4T+QcploU54kSawaYMNk6EXzxqMI/1E/0ZhlMNFuVXM/C0Y1B1N5MMofO0dx 4jd5ol7KDGkncltwAkp2x7T9KHW1CeEtawu+NB5s9UxB7+BX9lBuaYLLHsGYDBU6fMYI ckew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=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=V995C6MwqtUAmTG71E4cb1Pyxeu/S0wZo/QPEUz5JyI=; b=2aLi7dWWnA9++GHcLTSzoTGnqQOXT/PzoOFK+Cyp4g/OkH+/iNfJNxPnwXz9uEZwNE GQJr5ufWMbpX4UbppzhQs6lTtCs15Qk/f+72WcH/lHCUgUVM8f9enmY9NOvTpURbsM+B vNsVJ+V9m2ZKKAAyHJssmrWTsmyG5pA+pVXH3YdzwLlFTw/18TOgqyDhWIckJAOBgfPc 0OZC2lZumxBFENsgI3Tu2VKFS8tz2KDCBDqpEalEvbbk+TQiy0TkXdWYP4IT4ZKAcog7 C0MztG8DzcqlP9wQFEN51Y86ixOQ7EDzVG7mVFkeE2dCnZftINZ/Sww99tQo8AvssiVM kBlw== X-Gm-Message-State: ANoB5pkuNMkZ6qSKAw6N9Gk82fpCjkN2Vt7A7ZRTKrl17vODiUKMVbtE ywV8Ikls2DbbGdYWU8VrenE= X-Received: by 2002:a63:f5a:0:b0:470:18d4:f18d with SMTP id 26-20020a630f5a000000b0047018d4f18dmr66492091pgp.295.1670447234255; Wed, 07 Dec 2022 13:07:14 -0800 (PST) Received: from google.com ([2620:15c:9d:2:7a61:38c7:d37a:7f43]) by smtp.gmail.com with ESMTPSA id y23-20020a17090264d700b00187197c499asm15102485pli.164.2022.12.07.13.07.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Dec 2022 13:07:13 -0800 (PST) Date: Wed, 7 Dec 2022 13:07:10 -0800 From: Dmitry Torokhov To: Bjorn Helgaas Cc: Thomas Petazzoni , Lorenzo Pieralisi , Pali =?iso-8859-1?Q?Roh=E1r?= , Rob Herring , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v3] PCI: mvebu: switch to using gpiod API Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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 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 --- v3: - add #include to avoid compile errors. This was previously included indirectly via linux/of_gpio.h -> linux/gpio/driver.h v2: - free port->reset_name when reset GPIO is not found (Pali) - remove stray tab (Pali) This is the last user of of_get_named_gpio_flags() in the "next" tree. Thanks! drivers/pci/controller/pci-mvebu.c | 51 ++++++++++-------------------- 1 file changed, 17 insertions(+), 34 deletions(-) diff --git a/drivers/pci/controller/pci-mvebu.c b/drivers/pci/controller/pci-mvebu.c index 73db99035c2b..600964ba174c 100644 --- a/drivers/pci/controller/pci-mvebu.c +++ b/drivers/pci/controller/pci-mvebu.c @@ -11,15 +11,15 @@ #include #include #include -#include +#include #include #include +#include #include #include #include #include #include -#include #include #include @@ -1262,9 +1262,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; @@ -1328,40 +1327,24 @@ 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; + devm_kfree(dev, port->reset_name); + port->reset_name = NULL; } slot_power_limit = of_pci_get_slot_power_limit(child, -- 2.39.0.rc0.267.gcb52ba06e7-goog -- Dmitry