Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp2281710rwb; Sun, 4 Sep 2022 12:18:03 -0700 (PDT) X-Google-Smtp-Source: AA6agR56hIpP6f4LI4r1rLIrRCcd74T4bprafqTbtWgXoGGXzWC6lKc1ttXX1f6yuB5JWwEfgRd9 X-Received: by 2002:a17:907:869e:b0:74f:2465:82a8 with SMTP id qa30-20020a170907869e00b0074f246582a8mr9011460ejc.729.1662319083153; Sun, 04 Sep 2022 12:18:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662319083; cv=none; d=google.com; s=arc-20160816; b=NITXwau23LDFbJx3cq0prawPkYswRAS/cdB3jh+uBwk9Sjz1esoPITWnywU6bwbtk6 5pjdRZZYNDq+uiUbUEnELoCKKoQTFJlUM2sYb+1dFqfEUKauyMfXXwnYt7nYcSdTXWbw 0+cEnx10oTaMNXiR0QiChmPzclED0gX0GBnLjIAutDTqTVtDj/r1Ze3aggBBoIQHs1nV kgUxVZt3t+WdCWQzLT9NqcF6QHNMJvs81RTopAJeDMAb7jd8ZF/FPuQV4DjeNweCp6GU /u4PHnNBWe4YTYJe2x4+esYAhpU+BZgGRBc++/Nz2r3RQ+i/iKjKQ+NHgaS4kgjZVTnb +Nlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=jhA2At4C7gUGBD7kmr3qzQXQCJawda4OYdGrtHLP8ok=; b=1IZyvG6RIg+uRdB23lYSRuMwB/rt/kTLD3Nvs4hmXzCutj/+Mv3gOchElB0t9zlgig Ewc4K42dTqXBvIvyVMS1HILRdiGNANl7XchOg0RRC/YYStRjqFminCoOH0j6J1+b5AsS 06T1poV8mlyuMpnuHyiow3TX4l4lvYS0mzwhkC5ANM72zqDneG+ULVxNJt4Li4xEfuZt mYYwNAyrdul22VBhqDAq3SAQ6+o5xdaiPmade4e1Q8luRTpxnSo1sGhOcfgeV6Llnw0Y IXepISO9oCKfkrwAfVS/Oy831LfyQSM66GoOtMDbhbvKcZPrKvHBy5yAh1mwReGAmpJz QHFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=C3eaIRj9; 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 sb12-20020a1709076d8c00b0073d9238714csi6755657ejc.618.2022.09.04.12.17.37; Sun, 04 Sep 2022 12:18:03 -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=C3eaIRj9; 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 S234016AbiIDTBy (ORCPT + 99 others); Sun, 4 Sep 2022 15:01:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229702AbiIDTBv (ORCPT ); Sun, 4 Sep 2022 15:01:51 -0400 Received: from mail-qt1-x82c.google.com (mail-qt1-x82c.google.com [IPv6:2607:f8b0:4864:20::82c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 516952B27C; Sun, 4 Sep 2022 12:01:50 -0700 (PDT) Received: by mail-qt1-x82c.google.com with SMTP id cr9so4919602qtb.13; Sun, 04 Sep 2022 12:01:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=jhA2At4C7gUGBD7kmr3qzQXQCJawda4OYdGrtHLP8ok=; b=C3eaIRj9zJvT1EDOvv5L5DlbNybYy/M/Qfd/Egb3o+on7xrHrenj3L6FKjXzIYxUl8 RbRHQT8KThJ+uxIGHy8CIS4kQiBTJJKOC1B+MmOaessoUlyC3/8kxOA/slS0joWDOBJ7 XTTAS+Ml4SfC+oFJmmWUQEXowbB8JcclEDKdiYkOwHC4Mry+H0uBxm3v2fRzpwa6WkDo idzyXB0/lOSHM3TTiP9QhSlBs/gbxiv8k1roVpS2VBmHaiEpnu4ecWHU0tqP2kz5foRo FmOa6lJCq1MmvFUP6HXTVCp3pkU/c1OnUd5SVc8BzEC5yLjz4UpOL9bpJjxMcnEY3ch4 pMHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=jhA2At4C7gUGBD7kmr3qzQXQCJawda4OYdGrtHLP8ok=; b=IwZcd9AYysv3MBH0VLyTRHaYn7qH+n9p4hXq0RSnytfBLQZ6ucSibxHgGtFM/68T/9 ANFiNuVqmePaSQVFZszKwVdSzw5H9S6FzTIR78DeeetjHh9DKzkyS864eRyPoSgtJzJQ Z7jFGYKiVXKZ1SSuOuZvhK24650tcYopD3FojdspMG1tNSF1rqVT84AYGPhUj/w87dS6 iqrJQkdM2NvYLuus6niNXREHHiMOrp4tQVGej1haLFzMf9P5vPFZaR9NMw0KwnMf/kC7 ahtRBQqSN58+TnLhEEvb+QKTK/QL0da0lQV51vooJtK7hm0SfakvpSkUyvVtFwPUajdn /AqA== X-Gm-Message-State: ACgBeo3YloWnI52/tSOifDWLlcCu+Gmnx2IutjTRRdUd8PZdUgEkeTd/ 898se6QToe+v/myGaEKpWwTj5cgTtLmAPUAxUSo= X-Received: by 2002:a05:622a:40a:b0:343:77ba:727f with SMTP id n10-20020a05622a040a00b0034377ba727fmr37215624qtx.481.1662318108713; Sun, 04 Sep 2022 12:01:48 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Andy Shevchenko Date: Sun, 4 Sep 2022 22:01:12 +0300 Message-ID: Subject: Re: [PATCH] gpiolib: make fwnode_get_named_gpiod() static To: Dmitry Torokhov Cc: Linus Walleij , Bartosz Golaszewski , Andy Shevchenko , "open list:GPIO SUBSYSTEM" , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" 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 On Sun, Sep 4, 2022 at 9:22 AM Dmitry Torokhov wrote: > > There are no external users of fwnode_get_named_gpiod() anymore, so > let's stop exporting it and mark it as static. Agree. Reviewed-by: Andy Shevchenko > Signed-off-by: Dmitry Torokhov > --- > drivers/gpio/gpiolib.c | 132 +++++++++++++++++----------------- > include/linux/gpio/consumer.h | 13 ---- > 2 files changed, 66 insertions(+), 79 deletions(-) > > diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c > index cc9c0a12259e..4756ea08894f 100644 > --- a/drivers/gpio/gpiolib.c > +++ b/drivers/gpio/gpiolib.c > @@ -3798,6 +3798,72 @@ static int platform_gpio_count(struct device *dev, const char *con_id) > return count; > } > > +/** > + * fwnode_get_named_gpiod - obtain a GPIO from firmware node > + * @fwnode: handle of the firmware node > + * @propname: name of the firmware property representing the GPIO > + * @index: index of the GPIO to obtain for the consumer > + * @dflags: GPIO initialization flags > + * @label: label to attach to the requested GPIO > + * > + * This function can be used for drivers that get their configuration > + * from opaque firmware. > + * > + * The function properly finds the corresponding GPIO using whatever is the > + * underlying firmware interface and then makes sure that the GPIO > + * descriptor is requested before it is returned to the caller. > + * > + * Returns: > + * On successful request the GPIO pin is configured in accordance with > + * provided @dflags. > + * > + * In case of error an ERR_PTR() is returned. > + */ > +static struct gpio_desc *fwnode_get_named_gpiod(struct fwnode_handle *fwnode, > + const char *propname, int index, > + enum gpiod_flags dflags, > + const char *label) > +{ > + unsigned long lflags = GPIO_LOOKUP_FLAGS_DEFAULT; > + struct gpio_desc *desc = ERR_PTR(-ENODEV); > + int ret; > + > + if (is_of_node(fwnode)) { > + desc = gpiod_get_from_of_node(to_of_node(fwnode), > + propname, index, > + dflags, > + label); > + return desc; > + } else if (is_acpi_node(fwnode)) { > + struct acpi_gpio_info info; > + > + desc = acpi_node_get_gpiod(fwnode, propname, index, &info); > + if (IS_ERR(desc)) > + return desc; > + > + acpi_gpio_update_gpiod_flags(&dflags, &info); > + acpi_gpio_update_gpiod_lookup_flags(&lflags, &info); > + } else { > + return ERR_PTR(-EINVAL); > + } > + > + /* Currently only ACPI takes this path */ > + ret = gpiod_request(desc, label); > + if (ret) > + return ERR_PTR(ret); > + > + ret = gpiod_configure_flags(desc, propname, lflags, dflags); > + if (ret < 0) { > + gpiod_put(desc); > + return ERR_PTR(ret); > + } > + > + blocking_notifier_call_chain(&desc->gdev->notifier, > + GPIOLINE_CHANGED_REQUESTED, desc); > + > + return desc; > +} > + > /** > * fwnode_gpiod_get_index - obtain a GPIO from firmware node > * @fwnode: handle of the firmware node > @@ -4063,72 +4129,6 @@ struct gpio_desc *__must_check gpiod_get_index(struct device *dev, > } > EXPORT_SYMBOL_GPL(gpiod_get_index); > > -/** > - * fwnode_get_named_gpiod - obtain a GPIO from firmware node > - * @fwnode: handle of the firmware node > - * @propname: name of the firmware property representing the GPIO > - * @index: index of the GPIO to obtain for the consumer > - * @dflags: GPIO initialization flags > - * @label: label to attach to the requested GPIO > - * > - * This function can be used for drivers that get their configuration > - * from opaque firmware. > - * > - * The function properly finds the corresponding GPIO using whatever is the > - * underlying firmware interface and then makes sure that the GPIO > - * descriptor is requested before it is returned to the caller. > - * > - * Returns: > - * On successful request the GPIO pin is configured in accordance with > - * provided @dflags. > - * > - * In case of error an ERR_PTR() is returned. > - */ > -struct gpio_desc *fwnode_get_named_gpiod(struct fwnode_handle *fwnode, > - const char *propname, int index, > - enum gpiod_flags dflags, > - const char *label) > -{ > - unsigned long lflags = GPIO_LOOKUP_FLAGS_DEFAULT; > - struct gpio_desc *desc = ERR_PTR(-ENODEV); > - int ret; > - > - if (is_of_node(fwnode)) { > - desc = gpiod_get_from_of_node(to_of_node(fwnode), > - propname, index, > - dflags, > - label); > - return desc; > - } else if (is_acpi_node(fwnode)) { > - struct acpi_gpio_info info; > - > - desc = acpi_node_get_gpiod(fwnode, propname, index, &info); > - if (IS_ERR(desc)) > - return desc; > - > - acpi_gpio_update_gpiod_flags(&dflags, &info); > - acpi_gpio_update_gpiod_lookup_flags(&lflags, &info); > - } else > - return ERR_PTR(-EINVAL); > - > - /* Currently only ACPI takes this path */ > - ret = gpiod_request(desc, label); > - if (ret) > - return ERR_PTR(ret); > - > - ret = gpiod_configure_flags(desc, propname, lflags, dflags); > - if (ret < 0) { > - gpiod_put(desc); > - return ERR_PTR(ret); > - } > - > - blocking_notifier_call_chain(&desc->gdev->notifier, > - GPIOLINE_CHANGED_REQUESTED, desc); > - > - return desc; > -} > -EXPORT_SYMBOL_GPL(fwnode_get_named_gpiod); > - > /** > * gpiod_get_index_optional - obtain an optional GPIO from a multi-index GPIO > * function > diff --git a/include/linux/gpio/consumer.h b/include/linux/gpio/consumer.h > index 37448ee17e81..cf7d64b0ced3 100644 > --- a/include/linux/gpio/consumer.h > +++ b/include/linux/gpio/consumer.h > @@ -174,10 +174,6 @@ int desc_to_gpio(const struct gpio_desc *desc); > /* Child properties interface */ > struct fwnode_handle; > > -struct gpio_desc *fwnode_get_named_gpiod(struct fwnode_handle *fwnode, > - const char *propname, int index, > - enum gpiod_flags dflags, > - const char *label); > struct gpio_desc *fwnode_gpiod_get_index(struct fwnode_handle *fwnode, > const char *con_id, int index, > enum gpiod_flags flags, > @@ -553,15 +549,6 @@ static inline int desc_to_gpio(const struct gpio_desc *desc) > /* Child properties interface */ > struct fwnode_handle; > > -static inline > -struct gpio_desc *fwnode_get_named_gpiod(struct fwnode_handle *fwnode, > - const char *propname, int index, > - enum gpiod_flags dflags, > - const char *label) > -{ > - return ERR_PTR(-ENOSYS); > -} > - > static inline > struct gpio_desc *fwnode_gpiod_get_index(struct fwnode_handle *fwnode, > const char *con_id, int index, > -- > 2.37.2.789.g6183377224-goog > > > -- > Dmitry -- With Best Regards, Andy Shevchenko