From mboxrd@z Thu Jan 1 00:00:00 1970 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 3DBDDC4708D for ; Wed, 7 Dec 2022 22:10:15 +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:In-Reply-To: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:References: List-Owner; bh=qPGyQME+MMaUHf04WXwXlPuJ+E5Hb+jkRyIcl1PLhnI=; b=jhjl+V0Re6w92X hkHAyMFHAPjTgXI+YdLgAuDXW2HHIpbmziBHcJzbByeZ8b6T2NvfjIYoR3NcaT4cR76PYRWNMc60M EN8eewp7Xfx0cBYZK7T6CQ8txkpw6NnkQ6qxxfg5VdANKhmHjA06522N1FPcFDkIQenVXwzkwyVlm 7odm/NsOLYdVPIRzrIndOj/9CNLMXxQJ+VfA/5IrLeLELT9oFjYo5vR05TGVzFxGiyir1ehMrQM/M nII5dTxV1sBDnhVEFzxRZNLu3q0oEicvCBY/CcTJ5VnvMfaM5xBNPE9tzOY6bNDbFSuIjuFC2y4Kg gI9S2fX+Zio63ASnY9yQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p32bB-00DlYs-Us; Wed, 07 Dec 2022 22:09:06 +0000 Received: from ams.source.kernel.org ([145.40.68.75]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1p32b7-00DlRV-KQ for linux-arm-kernel@lists.infradead.org; Wed, 07 Dec 2022 22:09:03 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A91E1B8216D; Wed, 7 Dec 2022 22:08:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 14FCFC433C1; Wed, 7 Dec 2022 22:08:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1670450932; bh=CiqpI/crF3uh/C4PoPa1whlwowTYXxeodgTYpcn99UY=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=kghdk/Yunvzp5xwjQ3Su0WxUsNAqtZY2hrhTRM8GRfc1oO1xDoGUS1ka0d33VvMNp K+YiTHlO6nJZy4ntVCwkfiq5Y4ie7VN7mxyW0v/xDv0RmIe+3ZyxJ0uaWKZQgEu1fN /Fc2HIAAQwaMoXeh3YyS1hC4ZiP0htLZImZR1CV9cqDhWLxosikKLyBJg00ixI4hjz qOQc4k1pBXD52o0HZ35qK9OWxJHlAg4GBk0kru1fC5A9pOPbh8EWrK67UGDSV643pS uvO32MZwAM+d56FgDNhkMpj1mohmGrcp0gPV7rdc++I1LCHLitofcT32nD1VH0Wo3f yd0YJiLCRq2dw== Date: Wed, 7 Dec 2022 16:08:50 -0600 From: Bjorn Helgaas To: Dmitry Torokhov Cc: Bjorn Helgaas , 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: Re: [PATCH v3] PCI: mvebu: switch to using gpiod API Message-ID: <20221207220850.GA1479029@bhelgaas> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221207_140902_006861_4BA99E90 X-CRM114-Status: GOOD ( 26.18 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Dec 07, 2022 at 01:07:10PM -0800, Dmitry Torokhov wrote: > 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 Applied to pci/ctrl/mvebu for v6.2, thanks, Dmitry! > --- > > 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 > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel