From patchwork Mon Dec 19 19:20:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 635859 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6C5DBC46467 for ; Mon, 19 Dec 2022 19:22:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232420AbiLSTWM (ORCPT ); Mon, 19 Dec 2022 14:22:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232458AbiLSTVr (ORCPT ); Mon, 19 Dec 2022 14:21:47 -0500 Received: from mail-pl1-x62c.google.com (mail-pl1-x62c.google.com [IPv6:2607:f8b0:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C16331704B; Mon, 19 Dec 2022 11:20:23 -0800 (PST) Received: by mail-pl1-x62c.google.com with SMTP id 4so10007176plj.3; Mon, 19 Dec 2022 11:20:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=VR46xdGbsg8mOM7/UFZLhsN0WuKq4eAgjSK/29pLVdw=; b=aTfRBT+OcrFsAJU2Tq4Bcah4rMnw9eeLl7CBo9nh7WLnaxsF67mHOprqd2fATuQudf mLY2RoXIDjaAT1Hcb8oDn4xSuO/w8d6trTe+82kbnJuTtrF9a3yal4ZpHiIN/vzcTmjz ENzw6qeq9SDxRssTuytMOnAHbulRhF3C24FYzO/YNXhCyRCNDEJk38FNQJeu4rR+ND+x Z4nNDriroEI1nbsFJ146UYHUU/5XgjZOYlPpFxLRDUdAguuEzy4mV5uH/af1XcGfVv2H oYgyi8sMm1bkl+8fOrjMlVljLMxZ2BmTXTZni/NwbfISXhgmtZBW3dYT6XjitND9LOGJ sxww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=VR46xdGbsg8mOM7/UFZLhsN0WuKq4eAgjSK/29pLVdw=; b=OJNl8ZPcpirIVbjx9KhovCSGcu9NWaP3jTGdbPDKpmeqBUwQspgAnGiwHHclTBX7uS tgL66zyPTiwiO0ZLUDX28NIQEVLhqk/oFCnUs+hw6lQXVN3iitdXiK7a7u67yUZ9i1Ex ePzOQV8t3MgvgPZuN5YRTA7vKGQ3b54zWz4W//YV9+kYEoFqpPpgCCB3TynUIj2JMD1I lLRK+xxu0yghwQJlw+5SWdSo+7l8/fkg4/IblSB7P67Qdb4jpsFGJ5GGnYiRunWaD5zb 0o49cm0sau6xie/ZFZdK3dGD9W1M2CZUpZgsHtVm4o7OQ7wVTnBqBaZA6SNJkP8ySoBw QwXA== X-Gm-Message-State: AFqh2kp2AWYAe7tAJW02VnhqRDOt9+W5xxVBq3KRP/iijrkw6GiqBknx JsBpcXGjbgmtXhysY5KGmLhEPpmOdUU= X-Google-Smtp-Source: AMrXdXt9lF1+KsoIgLbpyfUFVSrwW0MHO+N6HPx2iUWtmmib3ZexnjW06+ojln4Y94KOklO1VRO3sw== X-Received: by 2002:a05:6a21:6d93:b0:9d:efbe:2052 with SMTP id wl19-20020a056a216d9300b0009defbe2052mr16503711pzb.8.1671477620884; Mon, 19 Dec 2022 11:20:20 -0800 (PST) Received: from dtor-ws.mtv.corp.google.com ([2620:15c:9d:2:4c62:79e:b4cd:2cbb]) by smtp.gmail.com with ESMTPSA id b6-20020a1709027e0600b001869f2120absm7488342plm.294.2022.12.19.11.20.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Dec 2022 11:20:20 -0800 (PST) From: Dmitry Torokhov To: Linus Walleij , Bartosz Golaszewski Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Andy Shevchenko Subject: [PATCH 1/5] gpiolib: of: remove of_gpio_count() Date: Mon, 19 Dec 2022 11:20:12 -0800 Message-Id: <20221219192016.1396950-1-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.39.0.314.g84b9a713c41-goog MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org There are no more users of of_gpio_count() in the mainline kernel, remove it. Signed-off-by: Dmitry Torokhov --- After 6.2-rc1 there should be no more users of the APIs mentioned in this series. include/linux/of_gpio.h | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/include/linux/of_gpio.h b/include/linux/of_gpio.h index 6db627257a7b..39f16a960565 100644 --- a/include/linux/of_gpio.h +++ b/include/linux/of_gpio.h @@ -105,17 +105,6 @@ static inline int of_gpio_named_count(const struct device_node *np, return of_count_phandle_with_args(np, propname, "#gpio-cells"); } -/** - * of_gpio_count() - Count GPIOs for a device - * @np: device node to count GPIOs for - * - * Same as of_gpio_named_count, but hard coded to use the 'gpios' property - */ -static inline int of_gpio_count(const struct device_node *np) -{ - return of_gpio_named_count(np, "gpios"); -} - static inline int of_get_gpio_flags(const struct device_node *np, int index, enum of_gpio_flags *flags) { From patchwork Mon Dec 19 19:20:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 635303 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1D241C4167B for ; Mon, 19 Dec 2022 19:22:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232320AbiLSTWL (ORCPT ); Mon, 19 Dec 2022 14:22:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232684AbiLSTVr (ORCPT ); Mon, 19 Dec 2022 14:21:47 -0500 Received: from mail-pl1-x634.google.com (mail-pl1-x634.google.com [IPv6:2607:f8b0:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 158511704D; Mon, 19 Dec 2022 11:20:23 -0800 (PST) Received: by mail-pl1-x634.google.com with SMTP id a9so9981215pld.7; Mon, 19 Dec 2022 11:20:23 -0800 (PST) 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 :message-id:reply-to; bh=rTlUHMQAwjLi947gmhUW7QqFF5pDNu/GVVsBTdlEvDc=; b=Z0xpP8n27UOvhgOKqawE8G+NcZ4CkicUeK0lsXh7p3SzVNgwQsyPRfYQ4X61bpP4vO 8XBuLnuBaZTmd+XL1fIymeJ8ad1SZvsdZN/syXaUhoo8zNE0xcqIBWT1XN+nZgwnb0IO Dn+HyrT23P7MoX+9aUkxY5gtiitPdN70VlHKEivWuB5oPYHUcRUSIdifDD73AmQLQFHL zXZk0R6SCyZSgK/fuMkcKeBv7Pky2VgCFxBDPkA3Pq2qDyjqnL1Hpd60BZi8RhbxltFZ yFMpfflLCCPy0LqVyPUQ7T0aCRk6iAeQLte2r4I3hD2GulFh8/vYplW0gcWiSfw+OWcs fe8g== 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:message-id:reply-to; bh=rTlUHMQAwjLi947gmhUW7QqFF5pDNu/GVVsBTdlEvDc=; b=dgrvBiQJU2j0qp/SE0Mlwz8aLkY+y/4G2RV6rkPDeAr2z0rzlm8RWDvvK9qzL3pXOG V5RkqYvoOAaAiNhi/5J7cSQOTzUkTtGqrmb4kQjdG4bdMZweYeQbUKKiM0BDpMgda0fe TOGv/cq3a7/dkMhe+hfk1X/45/OgHn7T68sJLS1gmIQoaoYxEr4UIa3vffiS35ZzvMYb nC8uIOEAOwPqEofKKhBcVsJrPEPebHLS1P3ZMXxoUtqggibmwQNNcR4fx1cre7Za+fCW XaanWxx0qfRxFNGrmqCX/PdBonKZcoG0hbZ2JtgdYZFL2KbNnadWjh6f3jlU06y0Bu8i mKaA== X-Gm-Message-State: ANoB5pnYWB+pD3nxkPBVwS9qxrmnGc4H8Jwp9bXDP6zo1kjCG87J+aQW vRBc8OKbHHXw7HmcPzQsS8I= X-Google-Smtp-Source: AA0mqf6hyHoJs0tsdismLFc929oDySWvIPN25bhkjJVQPPialus8QOaE1vqfbWgN7myXtSMTcizJUg== X-Received: by 2002:a17:902:bc89:b0:18f:8f1e:e69f with SMTP id bb9-20020a170902bc8900b0018f8f1ee69fmr33904903plb.19.1671477622441; Mon, 19 Dec 2022 11:20:22 -0800 (PST) Received: from dtor-ws.mtv.corp.google.com ([2620:15c:9d:2:4c62:79e:b4cd:2cbb]) by smtp.gmail.com with ESMTPSA id b6-20020a1709027e0600b001869f2120absm7488342plm.294.2022.12.19.11.20.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Dec 2022 11:20:21 -0800 (PST) From: Dmitry Torokhov To: Linus Walleij , Bartosz Golaszewski Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Andy Shevchenko Subject: [PATCH 2/5] gpiolib: of: stop exporting of_gpio_named_count() Date: Mon, 19 Dec 2022 11:20:13 -0800 Message-Id: <20221219192016.1396950-2-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.39.0.314.g84b9a713c41-goog In-Reply-To: <20221219192016.1396950-1-dmitry.torokhov@gmail.com> References: <20221219192016.1396950-1-dmitry.torokhov@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org The only user of this function is gpiolib-of.c so move it there. Signed-off-by: Dmitry Torokhov Reviewed-by: Andy Shevchenko --- drivers/gpio/gpiolib-of.c | 26 ++++++++++++++++++++++++++ include/linux/of_gpio.h | 26 -------------------------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c index 4fff7258ee41..6724e375678d 100644 --- a/drivers/gpio/gpiolib-of.c +++ b/drivers/gpio/gpiolib-of.c @@ -23,6 +23,32 @@ #include "gpiolib.h" #include "gpiolib-of.h" +/** + * of_gpio_named_count() - Count GPIOs for a device + * @np: device node to count GPIOs for + * @propname: property name containing gpio specifier(s) + * + * The function returns the count of GPIOs specified for a node. + * Note that the empty GPIO specifiers count too. Returns either + * Number of gpios defined in property, + * -EINVAL for an incorrectly formed gpios property, or + * -ENOENT for a missing gpios property + * + * Example: + * gpios = <0 + * &gpio1 1 2 + * 0 + * &gpio2 3 4>; + * + * The above example defines four GPIOs, two of which are not specified. + * This function will return '4' + */ +static int of_gpio_named_count(const struct device_node *np, + const char *propname) +{ + return of_count_phandle_with_args(np, propname, "#gpio-cells"); +} + /** * of_gpio_spi_cs_get_count() - special GPIO counting for SPI * @dev: Consuming device diff --git a/include/linux/of_gpio.h b/include/linux/of_gpio.h index 39f16a960565..680025c1a55b 100644 --- a/include/linux/of_gpio.h +++ b/include/linux/of_gpio.h @@ -79,32 +79,6 @@ static inline int of_get_named_gpio_flags(const struct device_node *np, #endif /* CONFIG_OF_GPIO */ -/** - * of_gpio_named_count() - Count GPIOs for a device - * @np: device node to count GPIOs for - * @propname: property name containing gpio specifier(s) - * - * The function returns the count of GPIOs specified for a node. - * Note that the empty GPIO specifiers count too. Returns either - * Number of gpios defined in property, - * -EINVAL for an incorrectly formed gpios property, or - * -ENOENT for a missing gpios property - * - * Example: - * gpios = <0 - * &gpio1 1 2 - * 0 - * &gpio2 3 4>; - * - * The above example defines four GPIOs, two of which are not specified. - * This function will return '4' - */ -static inline int of_gpio_named_count(const struct device_node *np, - const char *propname) -{ - return of_count_phandle_with_args(np, propname, "#gpio-cells"); -} - static inline int of_get_gpio_flags(const struct device_node *np, int index, enum of_gpio_flags *flags) { From patchwork Mon Dec 19 19:20:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 635304 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 468B8C10F1B for ; Mon, 19 Dec 2022 19:22:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232490AbiLSTWL (ORCPT ); Mon, 19 Dec 2022 14:22:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232725AbiLSTVp (ORCPT ); Mon, 19 Dec 2022 14:21:45 -0500 Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F7F2167FB; Mon, 19 Dec 2022 11:20:24 -0800 (PST) Received: by mail-pj1-x1032.google.com with SMTP id 3-20020a17090a098300b00219041dcbe9so9811922pjo.3; Mon, 19 Dec 2022 11:20:24 -0800 (PST) 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 :message-id:reply-to; bh=skKyH0pCplF51paW1vc+b7xrSLxnYuoxKxvIMnik6dQ=; b=KNcvtCjac7s9MpKpUwUH3y3B/MIoefQP1vQM/RIQsRIV6qwnNwRujTdsiEoiHnLO9/ NXY93MVJeHNqhWZLqHFW+zAreM14iThMtUayTVKSRP1Cx2F8gh88JOhUvOmoeI+DN1AO aAQxHHHjqT9aJC9G0UN4ubtUsZQUDqh7qfpW/9nRBX92fenN9Tnx0HityOcdK7eBOXqD jcOLzUd7iZxa6xnYRhq96dIJtUektstfd335NJ6Zw007wEu+LBRxv7YY5EO/SpmnteWo WqBp3g4U7Wem7HmeWwLz/80cekxtn9FDRpMjukRP27LznrfLlf1BswdRRXig22Lt2rDl soyA== 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:message-id:reply-to; bh=skKyH0pCplF51paW1vc+b7xrSLxnYuoxKxvIMnik6dQ=; b=n/n2oqbCscdIOp4qi5YFTYYz9ChajYa95Y3bny+4zMEwNSBse0S1ssQeDmkgQKaYd0 RdL7mVNuiCCnnBtopicdRWzfNA0xPtwmO6xHeHMuTjIeZ7u4XuUYnIAw15/z6TjAzdS9 x2VrCyiBG0+0N6FP5OnP1lHjzLHGPY9AWeFWfP51UxVNgNkExFzOBh+nRzenXYZarHeu lTxBUCY/tlY/yM5dnVcCX3lBuBLkFbgGeZ5Pd0yck111togyeOhx0CXR1zHcDjVx/hP3 A5a7B8HN61RYyPH/BvSOfvmDfa9oI8ZNPom+4vahFNtd5XIFUfZRptIVm6ZjWJ41foaj NcoA== X-Gm-Message-State: ANoB5plqc+EQc4RBFrjAnqqZbHEbOxi1jXvpdbTgEJ49PUtbCSKUqUZp hU/zqnuRDnSCI8ZbfDtpJUmz1pwuB3E= X-Google-Smtp-Source: AA0mqf5Nfd1ZEOeAUhIAScWhBp46k0DNVoT/9fISCH6Uff1TuQgri7hPAQ4b4OXun5v/ML30HuriHQ== X-Received: by 2002:a05:6a20:4d92:b0:ac:16ae:f46 with SMTP id gj18-20020a056a204d9200b000ac16ae0f46mr50366952pzb.15.1671477624048; Mon, 19 Dec 2022 11:20:24 -0800 (PST) Received: from dtor-ws.mtv.corp.google.com ([2620:15c:9d:2:4c62:79e:b4cd:2cbb]) by smtp.gmail.com with ESMTPSA id b6-20020a1709027e0600b001869f2120absm7488342plm.294.2022.12.19.11.20.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Dec 2022 11:20:23 -0800 (PST) From: Dmitry Torokhov To: Linus Walleij , Bartosz Golaszewski Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Andy Shevchenko Subject: [PATCH 3/5] gpiolib: of: remove obsolete comment for of_gpio_get_count() Date: Mon, 19 Dec 2022 11:20:14 -0800 Message-Id: <20221219192016.1396950-3-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.39.0.314.g84b9a713c41-goog In-Reply-To: <20221219192016.1396950-1-dmitry.torokhov@gmail.com> References: <20221219192016.1396950-1-dmitry.torokhov@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org The function is only being called form the main gpiolib module, so remove comment saying that it is also used by external callers. Signed-off-by: Dmitry Torokhov Reviewed-by: Andy Shevchenko Reviewed-by: Linus Walleij --- drivers/gpio/gpiolib-of.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c index 6724e375678d..6114c5b3d2ce 100644 --- a/drivers/gpio/gpiolib-of.c +++ b/drivers/gpio/gpiolib-of.c @@ -76,12 +76,6 @@ static int of_gpio_spi_cs_get_count(struct device *dev, const char *con_id) return of_gpio_named_count(np, "gpios"); } -/* - * This is used by external users of of_gpio_count() from - * - * FIXME: get rid of those external users by converting them to GPIO - * descriptors and let them all use gpiod_count() - */ int of_gpio_get_count(struct device *dev, const char *con_id) { int ret; From patchwork Mon Dec 19 19:20:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 635858 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8DDB4C4332F for ; Mon, 19 Dec 2022 19:22:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232616AbiLSTWu (ORCPT ); Mon, 19 Dec 2022 14:22:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232702AbiLSTVw (ORCPT ); Mon, 19 Dec 2022 14:21:52 -0500 Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 959AD167E2; Mon, 19 Dec 2022 11:20:26 -0800 (PST) Received: by mail-pl1-x630.google.com with SMTP id w20so3401892ply.12; Mon, 19 Dec 2022 11:20:26 -0800 (PST) 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 :message-id:reply-to; bh=o3PCQixWV8YBmbSgrRSE0fpiFw7H3KtVnaiI+gLwP+g=; b=OOej/IS6eIu2rSAxZRB3vSyg3etxUrWIxbRZ1Wrjwi6UQjx6bwTkvQX5k26/iS8sNM bSIgq6R8rmcojRVV1hwjU2VVNuiYJmmKSdYSvTCoTV1/s8rZeG/VMaWDYWngb9WZVvFE 3EuhENE9720Sdi6Y0mHVmX1fj+wkOZZAfkReiz9kPIIuK1NEieq1Tktp4wuHGx0cxNPO wa1iirFcwJhs8p6snwr5TO4zUBklaF6jbJCkONFyjeXG8O4YGnvpWYSVKb6d4SRaZt6A ACY2O1P0dShyrF7/+QV9ID9dmUdiioLTRPll+XzWCshikQmqcnbbtP6q67zOO1tk3k1H pjdQ== 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:message-id:reply-to; bh=o3PCQixWV8YBmbSgrRSE0fpiFw7H3KtVnaiI+gLwP+g=; b=nh1Ak+/yZ6wgF2dAz/22+BtWUjiPSzKtfT2IwIUMdpHicYuOyahtZbqdwhDp3dJ5oN 8AGYTHb/SZP/g+d6zhT3d01Sj39an15rd1cS8iZ/QmQ6yBGwWq5feMfT0fAgX+46zCE7 Cpmg6968oyix19kE0/jH6jpQAB5IEaJBEAb+KOZ4jNpdgrHmoG8HIU7vAK7Oeozp5yRf dr1ZQab3vN+KIxsN3XnWKID6ZOhYVNkQVMJ//EC0b8df2doyWH18k3Gn0peAHk/ZiZxF QUbj4W8IlpjuAmuLw/jcxrkS/wASdvvnTHZiLnK2SNzeXINSBiPqvqiBqIwDxG0isZ3s Kk/A== X-Gm-Message-State: ANoB5pkVNQiqbVfH1onXZsrZr41/BjYKqB3cAaa9pbwSufSH5wxRQRYc LX8+fAjXa86ovaM0T0dzqBk= X-Google-Smtp-Source: AA0mqf4GDjtS6YzQM9TM4l+9RITiBbN+Q/X067j+GpWEvax/TwcGr8ymGc2aaEvRcW66Heh5No69Bg== X-Received: by 2002:a17:903:1247:b0:189:acee:7aa4 with SMTP id u7-20020a170903124700b00189acee7aa4mr48097506plh.65.1671477625760; Mon, 19 Dec 2022 11:20:25 -0800 (PST) Received: from dtor-ws.mtv.corp.google.com ([2620:15c:9d:2:4c62:79e:b4cd:2cbb]) by smtp.gmail.com with ESMTPSA id b6-20020a1709027e0600b001869f2120absm7488342plm.294.2022.12.19.11.20.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Dec 2022 11:20:25 -0800 (PST) From: Dmitry Torokhov To: Linus Walleij , Bartosz Golaszewski Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Andy Shevchenko Subject: [PATCH 4/5] gpiolib: of: remove of_get_gpio[_flags]() and of_get_named_gpio_flags() Date: Mon, 19 Dec 2022 11:20:15 -0800 Message-Id: <20221219192016.1396950-4-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.39.0.314.g84b9a713c41-goog In-Reply-To: <20221219192016.1396950-1-dmitry.torokhov@gmail.com> References: <20221219192016.1396950-1-dmitry.torokhov@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org There are no more users of these APIs in the mainline kernel, remove them. This leaves of_get_named_gpio() as the only legacy OF-specific API. Signed-off-by: Dmitry Torokhov --- drivers/gpio/gpiolib-of.c | 17 +++++++++++---- include/linux/of_gpio.h | 45 ++++----------------------------------- 2 files changed, 17 insertions(+), 45 deletions(-) diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c index 6114c5b3d2ce..fdf443310442 100644 --- a/drivers/gpio/gpiolib-of.c +++ b/drivers/gpio/gpiolib-of.c @@ -365,19 +365,28 @@ static struct gpio_desc *of_get_named_gpiod_flags(const struct device_node *np, return desc; } -int of_get_named_gpio_flags(const struct device_node *np, const char *list_name, - int index, enum of_gpio_flags *flags) +/** + * of_get_named_gpio() - Get a GPIO number to use with GPIO API + * @np: device node to get GPIO from + * @propname: Name of property containing gpio specifier(s) + * @index: index of the GPIO + * + * Returns GPIO number to use with Linux generic GPIO API, or one of the errno + * value on the error condition. + */ +int of_get_named_gpio(const struct device_node *np, const char *propname, + int index) { struct gpio_desc *desc; - desc = of_get_named_gpiod_flags(np, list_name, index, flags); + desc = of_get_named_gpiod_flags(np, propname, index, NULL); if (IS_ERR(desc)) return PTR_ERR(desc); else return desc_to_gpio(desc); } -EXPORT_SYMBOL_GPL(of_get_named_gpio_flags); +EXPORT_SYMBOL_GPL(of_get_named_gpio); /* Converts gpio_lookup_flags into bitmask of GPIO_* values */ static unsigned long of_convert_gpio_flags(enum of_gpio_flags flags) diff --git a/include/linux/of_gpio.h b/include/linux/of_gpio.h index 680025c1a55b..e27a9187c0c6 100644 --- a/include/linux/of_gpio.h +++ b/include/linux/of_gpio.h @@ -50,8 +50,8 @@ static inline struct of_mm_gpio_chip *to_of_mm_gpio_chip(struct gpio_chip *gc) return container_of(gc, struct of_mm_gpio_chip, gc); } -extern int of_get_named_gpio_flags(const struct device_node *np, - const char *list_name, int index, enum of_gpio_flags *flags); +extern int of_get_named_gpio(const struct device_node *np, + const char *list_name, int index); extern int of_mm_gpiochip_add_data(struct device_node *np, struct of_mm_gpio_chip *mm_gc, @@ -68,49 +68,12 @@ extern void of_mm_gpiochip_remove(struct of_mm_gpio_chip *mm_gc); #include /* Drivers may not strictly depend on the GPIO support, so let them link. */ -static inline int of_get_named_gpio_flags(const struct device_node *np, - const char *list_name, int index, enum of_gpio_flags *flags) -{ - if (flags) - *flags = 0; - - return -ENOSYS; -} - -#endif /* CONFIG_OF_GPIO */ - -static inline int of_get_gpio_flags(const struct device_node *np, int index, - enum of_gpio_flags *flags) -{ - return of_get_named_gpio_flags(np, "gpios", index, flags); -} - -/** - * of_get_named_gpio() - Get a GPIO number to use with GPIO API - * @np: device node to get GPIO from - * @propname: Name of property containing gpio specifier(s) - * @index: index of the GPIO - * - * Returns GPIO number to use with Linux generic GPIO API, or one of the errno - * value on the error condition. - */ static inline int of_get_named_gpio(const struct device_node *np, const char *propname, int index) { - return of_get_named_gpio_flags(np, propname, index, NULL); + return -ENOSYS; } -/** - * of_get_gpio() - Get a GPIO number to use with GPIO API - * @np: device node to get GPIO from - * @index: index of the GPIO - * - * Returns GPIO number to use with Linux generic GPIO API, or one of the errno - * value on the error condition. - */ -static inline int of_get_gpio(const struct device_node *np, int index) -{ - return of_get_gpio_flags(np, index, NULL); -} +#endif /* CONFIG_OF_GPIO */ #endif /* __LINUX_OF_GPIO_H */ From patchwork Mon Dec 19 19:20:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 635302 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 91BE8C10F1B for ; Mon, 19 Dec 2022 19:22:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232628AbiLSTWv (ORCPT ); Mon, 19 Dec 2022 14:22:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232774AbiLSTV4 (ORCPT ); Mon, 19 Dec 2022 14:21:56 -0500 Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16FBF14010; Mon, 19 Dec 2022 11:20:28 -0800 (PST) Received: by mail-pj1-x1035.google.com with SMTP id w4-20020a17090ac98400b002186f5d7a4cso14182673pjt.0; Mon, 19 Dec 2022 11:20:28 -0800 (PST) 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 :message-id:reply-to; bh=hLB8Nq12CEJ71SF2TAvjGUG3MmgGE6n5sA6fuDsDmSw=; b=XtnkeYl8x/BE5rlQ6u1adz3Oj59Bd5J3uKRVoK4EHRHAtTD+FQ0frG0+xuiO83lDsS 6N03n1DalBQJB8Gix9pwlMjlsv+QuaaKDrE41OvXHnnk0bdIg/GumFwTdhzG7eZbNm25 QmTNurujYPudDIQyM7zIxE5pNAmwPDyYIUGBZ1rX85E9qmAEIb4JFxFZQ203iLtQHR9A i6DOaxFmxkM80n3YS24/SYrOMGTenidI+s19ppg4trBBUQRp9w2nlOYgNDO0FLAaPZYv 6LfSiGJaCfd6iEpNAjWeb/dDTIh7xcKYxFm02T1dq+1u7O0zYHZ7hlR+2XhkKNeT8QkL A5Ng== 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:message-id:reply-to; bh=hLB8Nq12CEJ71SF2TAvjGUG3MmgGE6n5sA6fuDsDmSw=; b=D+rcOPo/YOcEV2SESVsqWLLwFzOp7r7GJAWEKKkhhB2FtjkpeXupUSQYvJY2StOV2c u6aw12ZleyrEnTYgPXib5O0neGsxvbu7/ta4WriDutOBX6eeZOknDZtY8FoEmDqmkEmi pmk64p4pHVd+fp+1LOY/eA/N1XoqJ7uE/8vkzgK6lv3jta3optKEAekMPiU7avyb3NVL fQSecPV0wXkp7OdBT8JH40N6R3WznEw8C5jjRQVHB+vQ5fn+uL4RRfv9qmxg/b/HPDGG xC8RwVJYX05Na+TggPhHYMVwlm+17qzZAWPmREVIUiW7jIjzXzd6MrwXCMYGFGWUDPbF aNYg== X-Gm-Message-State: ANoB5pnrBOXXArdXIhv344aWRCirDN1oGSMtKsdExm9uOnfsg/zf4+26 PYghLfpkDs576I/6+x/fDPg= X-Google-Smtp-Source: AA0mqf4D9dSp5NX+0mHjAf3fAlZwWNepsKNqvYNbbEIwxw2KbFrODynsYQ41mjqZD31IHQphoQod/g== X-Received: by 2002:a17:903:26d3:b0:18d:9214:1ae5 with SMTP id jg19-20020a17090326d300b0018d92141ae5mr39558659plb.23.1671477627454; Mon, 19 Dec 2022 11:20:27 -0800 (PST) Received: from dtor-ws.mtv.corp.google.com ([2620:15c:9d:2:4c62:79e:b4cd:2cbb]) by smtp.gmail.com with ESMTPSA id b6-20020a1709027e0600b001869f2120absm7488342plm.294.2022.12.19.11.20.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Dec 2022 11:20:26 -0800 (PST) From: Dmitry Torokhov To: Linus Walleij , Bartosz Golaszewski Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Andy Shevchenko Subject: [PATCH 5/5] gpiolib: of: remove [devm_]gpiod_get_from_of_node() APIs Date: Mon, 19 Dec 2022 11:20:16 -0800 Message-Id: <20221219192016.1396950-5-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.39.0.314.g84b9a713c41-goog In-Reply-To: <20221219192016.1396950-1-dmitry.torokhov@gmail.com> References: <20221219192016.1396950-1-dmitry.torokhov@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Now that everyone is using [devm_]fwnode_gpiod_get[_index]() APIs, remove OF-specific [devm_]gpiod_get_from_of_node(). Signed-off-by: Dmitry Torokhov Reviewed-by: Andy Shevchenko --- drivers/gpio/gpiolib-devres.c | 55 ----------------------------------- drivers/gpio/gpiolib-of.c | 46 ----------------------------- include/linux/gpio/consumer.h | 48 ------------------------------ 3 files changed, 149 deletions(-) diff --git a/drivers/gpio/gpiolib-devres.c b/drivers/gpio/gpiolib-devres.c index 16a696249229..fe9ce6b19f15 100644 --- a/drivers/gpio/gpiolib-devres.c +++ b/drivers/gpio/gpiolib-devres.c @@ -129,61 +129,6 @@ struct gpio_desc *__must_check devm_gpiod_get_index(struct device *dev, } EXPORT_SYMBOL_GPL(devm_gpiod_get_index); -/** - * devm_gpiod_get_from_of_node() - obtain a GPIO from an OF node - * @dev: device for lifecycle management - * @node: handle of the OF node - * @propname: name of the DT 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 - * - * 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 *devm_gpiod_get_from_of_node(struct device *dev, - const struct device_node *node, - const char *propname, int index, - enum gpiod_flags dflags, - const char *label) -{ - struct gpio_desc **dr; - struct gpio_desc *desc; - - desc = gpiod_get_from_of_node(node, propname, index, dflags, label); - if (IS_ERR(desc)) - return desc; - - /* - * For non-exclusive GPIO descriptors, check if this descriptor is - * already under resource management by this device. - */ - if (dflags & GPIOD_FLAGS_BIT_NONEXCLUSIVE) { - struct devres *dres; - - dres = devres_find(dev, devm_gpiod_release, - devm_gpiod_match, &desc); - if (dres) - return desc; - } - - dr = devres_alloc(devm_gpiod_release, sizeof(struct gpio_desc *), - GFP_KERNEL); - if (!dr) { - gpiod_put(desc); - return ERR_PTR(-ENOMEM); - } - - *dr = desc; - devres_add(dev, dr); - - return desc; -} -EXPORT_SYMBOL_GPL(devm_gpiod_get_from_of_node); - /** * devm_fwnode_gpiod_get_index - get a GPIO descriptor from a given node * @dev: GPIO consumer diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c index fdf443310442..4a47e71782f3 100644 --- a/drivers/gpio/gpiolib-of.c +++ b/drivers/gpio/gpiolib-of.c @@ -418,52 +418,6 @@ static unsigned long of_convert_gpio_flags(enum of_gpio_flags flags) return lflags; } -/** - * gpiod_get_from_of_node() - obtain a GPIO from an OF node - * @node: handle of the OF node - * @propname: name of the DT 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 - * - * 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 *gpiod_get_from_of_node(const struct device_node *node, - const char *propname, int index, - enum gpiod_flags dflags, - const char *label) -{ - unsigned long lflags; - struct gpio_desc *desc; - enum of_gpio_flags of_flags; - int ret; - - desc = of_get_named_gpiod_flags(node, propname, index, &of_flags); - if (!desc || IS_ERR(desc)) - return desc; - - ret = gpiod_request(desc, label); - if (ret == -EBUSY && (dflags & GPIOD_FLAGS_BIT_NONEXCLUSIVE)) - return desc; - if (ret) - return ERR_PTR(ret); - - lflags = of_convert_gpio_flags(of_flags); - - ret = gpiod_configure_flags(desc, propname, lflags, dflags); - if (ret < 0) { - gpiod_put(desc); - return ERR_PTR(ret); - } - - return desc; -} -EXPORT_SYMBOL_GPL(gpiod_get_from_of_node); - static struct gpio_desc *of_find_gpio_rename(struct device_node *np, const char *con_id, unsigned int idx, diff --git a/include/linux/gpio/consumer.h b/include/linux/gpio/consumer.h index 45da8f137fe5..59cb20cfac3d 100644 --- a/include/linux/gpio/consumer.h +++ b/include/linux/gpio/consumer.h @@ -581,54 +581,6 @@ struct gpio_desc *devm_fwnode_gpiod_get(struct device *dev, flags, label); } -#if IS_ENABLED(CONFIG_GPIOLIB) && IS_ENABLED(CONFIG_OF_GPIO) -struct device_node; - -struct gpio_desc *gpiod_get_from_of_node(const struct device_node *node, - const char *propname, int index, - enum gpiod_flags dflags, - const char *label); - -#else /* CONFIG_GPIOLIB && CONFIG_OF_GPIO */ - -struct device_node; - -static inline -struct gpio_desc *gpiod_get_from_of_node(const struct device_node *node, - const char *propname, int index, - enum gpiod_flags dflags, - const char *label) -{ - return ERR_PTR(-ENOSYS); -} - -#endif /* CONFIG_GPIOLIB && CONFIG_OF_GPIO */ - -#ifdef CONFIG_GPIOLIB -struct device_node; - -struct gpio_desc *devm_gpiod_get_from_of_node(struct device *dev, - const struct device_node *node, - const char *propname, int index, - enum gpiod_flags dflags, - const char *label); - -#else /* CONFIG_GPIOLIB */ - -struct device_node; - -static inline -struct gpio_desc *devm_gpiod_get_from_of_node(struct device *dev, - const struct device_node *node, - const char *propname, int index, - enum gpiod_flags dflags, - const char *label) -{ - return ERR_PTR(-ENOSYS); -} - -#endif /* CONFIG_GPIOLIB */ - struct acpi_gpio_params { unsigned int crs_entry_index; unsigned int line_index;