Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp49559rwb; Wed, 7 Dec 2022 14:16:28 -0800 (PST) X-Google-Smtp-Source: AA0mqf4eKINjBA7aqynCSlatf1o0cJij0jtvn6knEb4fIY6+gBnNS5zQrWUVmukMtWyg4HNf0wGb X-Received: by 2002:a17:902:f78c:b0:186:8c13:50b3 with SMTP id q12-20020a170902f78c00b001868c1350b3mr75671190pln.153.1670451388278; Wed, 07 Dec 2022 14:16:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670451388; cv=none; d=google.com; s=arc-20160816; b=I4FILOIM16ippX/6vl1bFDIJnHXP1SY4q1VRePYQR2rZ709v01l1WYHPvaEpLJVpJ/ DhGYgSZhRqVmBiplXi4FTzrkCQT+G+6ElwuwJsHw1y2/lUXqK4ZAXS1ZJHlnRumjf019 mtn/7O4Zq2vwfmwguoliwKlX0Fqqwy+PSFDjWPkYO5PA3b85ZhaROxgaW0pS3y87XiDU hPk4iCGIH1WBkVQmxFWWkBfZG3N+UM027iJdnoiHE94yjaB9oIgXG3TyyHU/2RjKZvpi GusRiwzrtbOdHWbUjv1FDcn/xphJDvdgqfFRVBim77JZF+H6WhRs2wkBV/GG5M0VYQ+M crwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :message-id:subject:cc:to:from:date:dkim-signature; bh=9xqv6Zyvu0qLx5cA8jVU8LnMkDZMpXvCZQXkqAvJ0AQ=; b=G2ytjpHi8ZKb0jj+GS2YO6hLQRFlGZ2HEtFjMf5UM9uuP4niRTpeUBKOS1IdZumbl9 lc7BHVXzxf92aZXvE3RG4rWsKQbgPNPUxt4+iNjwmPcC3ylbmDAEzEH3ONx3gT24TMRI gMFGMii6gjUhr+ansnIjP5PaYhQCHrMrHL+pqAGVd2hCvLSvRbLGgIdnOjOYXEnFjcf5 bSYh8pyRwv5TZ/Tmj3UtdINIgDoYN0HNEJTBrDVM8V0Q4uFuXOIR+GB4+q6fqZSlheAY Qh610irloFH5DlSTerxGDDR2ADP87hH5uJRU+QChqGf2gB7Ymq9ERfr/WhSnwl9bd11D pGFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="kghdk/Yu"; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i13-20020aa78d8d000000b005731d316831si19926653pfr.367.2022.12.07.14.16.18; Wed, 07 Dec 2022 14:16:28 -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=@kernel.org header.s=k20201202 header.b="kghdk/Yu"; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229572AbiLGWJF (ORCPT + 75 others); Wed, 7 Dec 2022 17:09:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229470AbiLGWJE (ORCPT ); Wed, 7 Dec 2022 17:09:04 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 380694E41B; Wed, 7 Dec 2022 14:09:01 -0800 (PST) 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 93BB2B81E65; 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-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 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