From nobody Fri Sep 12 18:30:25 2025 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 88FD6C64ED8 for ; Wed, 8 Feb 2023 17:34:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231976AbjBHReL (ORCPT ); Wed, 8 Feb 2023 12:34:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231650AbjBHRd7 (ORCPT ); Wed, 8 Feb 2023 12:33:59 -0500 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B58393251B; Wed, 8 Feb 2023 09:33:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1675877635; x=1707413635; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=O8wgtjnDDH6goWjAVZmuil9qOihxRC2fM6d0IEYsaVE=; b=aWfLANu8ZRVdMHEUwbT1v02po+ZbSlWksBg6tmsLW7mj63pJymfVGW4o Pi70loo/yzMQ2KiIjqFEQD45Gtc9DDbgvjbKAUvz+cwF54iyY0ozDG9yv IRwvVu0OPJVYuACHMS57hOOkdtCvHfiWKBqu9gPXIwZ9EMneRWRwc8eOM BQIEJ/O0ci342PJ5ZeCgjOojx6G8lwTUCR4SCwErgaXJGG1qjIssjZCYa AsQSWNIB9/Q6p4Cdg7nY4HQyGFlKdBvJd3VVmHwtjqNqRP4C3CRHlu1vI FWfRlvq0wNOn0qHWxi7e2INbcNuDK8qFYYwoqiOZuGspMm7WZ8oT8XrgW w==; X-IronPort-AV: E=McAfee;i="6500,9779,10615"; a="331153826" X-IronPort-AV: E=Sophos;i="5.97,281,1669104000"; d="scan'208";a="331153826" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Feb 2023 09:33:33 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10615"; a="669265866" X-IronPort-AV: E=Sophos;i="5.97,281,1669104000"; d="scan'208";a="669265866" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga007.fm.intel.com with ESMTP; 08 Feb 2023 09:33:26 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 0F0D3380; Wed, 8 Feb 2023 19:33:48 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , Arnd Bergmann , Linus Walleij , Bartosz Golaszewski , Tony Lindgren , Thomas Gleixner , Krzysztof Kozlowski , Geert Uytterhoeven , Michael Ellerman , Christophe Leroy , Vincenzo Palazzo , Devarsh Thakkar , Michael Walle , Dmitry Torokhov , Dipen Patel , Thierry Reding , Stefan Schmidt , Miquel Raynal , Lee Jones , linux-gpio@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc-tw-discuss@lists.sourceforge.net, linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linuxppc-dev@lists.ozlabs.org, linux-sh@vger.kernel.org, linux-acpi@vger.kernel.org, linux-tegra@vger.kernel.org, linux-input@vger.kernel.org, linux-media@vger.kernel.org, linux-wpan@vger.kernel.org, netdev@vger.kernel.org, linux-wireless@vger.kernel.org, brcm80211-dev-list.pdl@broadcom.com, SHA-cyfmac-dev-list@infineon.com, linux-arch@vger.kernel.org, devicetree@vger.kernel.org Cc: Bartosz Golaszewski , Jonathan Corbet , Alex Shi , Yanteng Si , Hu Haowen , Russell King , Aaro Koskinen , Janusz Krzysztofik , Andrew Lunn , Sebastian Hesselbarth , Gregory Clement , Alim Akhtar , Nicholas Piggin , Yoshinori Sato , Rich Felker , Mun Yew Tham , Keerthy , Mika Westerberg , Thierry Reding , Jonathan Hunter , Mauro Carvalho Chehab , Alexander Aring , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Arend van Spriel , Franky Lin , Hante Meuleman , Kalle Valo , Qiang Zhao , Li Yang , Rob Herring , Frank Rowand Subject: [PATCH v4 09/18] gpiolib: remove legacy gpio_export() Date: Wed, 8 Feb 2023 19:33:34 +0200 Message-Id: <20230208173343.37582-10-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230208173343.37582-1-andriy.shevchenko@linux.intel.com> References: <20230208173343.37582-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnd Bergmann There are only a handful of users of gpio_export() and related functions. As these are just wrappers around the modern gpiod_export() helper, remove the wrappers and open-code the gpio_to_desc in all callers to shrink the legacy API. Reviewed-by: Andy Shevchenko Signed-off-by: Arnd Bergmann Reviewed-by: Linus Walleij Signed-off-by: Andy Shevchenko --- Documentation/admin-guide/gpio/sysfs.rst | 2 +- Documentation/driver-api/gpio/legacy.rst | 21 --------------- .../zh_CN/driver-api/gpio/legacy.rst | 19 ------------- Documentation/translations/zh_TW/gpio.txt | 18 ------------- arch/arm/mach-omap2/pdata-quirks.c | 9 ++++--- arch/sh/boards/mach-ap325rxa/setup.c | 7 ++--- drivers/gpio/gpiolib-sysfs.c | 4 +-- drivers/media/pci/sta2x11/sta2x11_vip.c | 10 ++++--- drivers/net/ieee802154/ca8210.c | 3 ++- include/linux/gpio.h | 27 ------------------- 10 files changed, 21 insertions(+), 99 deletions(-) diff --git a/Documentation/admin-guide/gpio/sysfs.rst b/Documentation/admin= -guide/gpio/sysfs.rst index ec09ffd983e7..35171d15f78d 100644 --- a/Documentation/admin-guide/gpio/sysfs.rst +++ b/Documentation/admin-guide/gpio/sysfs.rst @@ -145,7 +145,7 @@ requested using gpio_request():: /* export the GPIO to userspace */ int gpiod_export(struct gpio_desc *desc, bool direction_may_change); =20 - /* reverse gpio_export() */ + /* reverse gpiod_export() */ void gpiod_unexport(struct gpio_desc *desc); =20 /* create a sysfs link to an exported GPIO node */ diff --git a/Documentation/driver-api/gpio/legacy.rst b/Documentation/drive= r-api/gpio/legacy.rst index e0306e78e34b..78372853c6d4 100644 --- a/Documentation/driver-api/gpio/legacy.rst +++ b/Documentation/driver-api/gpio/legacy.rst @@ -714,27 +714,6 @@ gpiochip nodes (possibly in conjunction with schematic= s) to determine the correct GPIO number to use for a given signal. =20 =20 -Exporting from Kernel code --------------------------- -Kernel code can explicitly manage exports of GPIOs which have already been -requested using gpio_request():: - - /* export the GPIO to userspace */ - int gpio_export(unsigned gpio, bool direction_may_change); - - /* reverse gpio_export() */ - void gpio_unexport(); - -After a kernel driver requests a GPIO, it may only be made available in -the sysfs interface by gpio_export(). The driver can control whether the -signal direction may change. This helps drivers prevent userspace code -from accidentally clobbering important system state. - -This explicit exporting can help with debugging (by making some kinds -of experiments easier), or can provide an always-there interface that's -suitable for documenting as part of a board support package. - - API Reference =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =20 diff --git a/Documentation/translations/zh_CN/driver-api/gpio/legacy.rst b/= Documentation/translations/zh_CN/driver-api/gpio/legacy.rst index dee2a0517c1c..84ce2322fdba 100644 --- a/Documentation/translations/zh_CN/driver-api/gpio/legacy.rst +++ b/Documentation/translations/zh_CN/driver-api/gpio/legacy.rst @@ -653,25 +653,6 @@ GPIO =E6=8E=A7=E5=88=B6=E5=99=A8=E7=9A=84=E8=B7=AF=E5= =BE=84=E7=B1=BB=E4=BC=BC /sys/class/gpio/gpiochip42/ (=E5=AF=B9=E4=BA=8E=E4= =BB=8E#42 GPIO =E7=A1=AE=E5=AE=9A=E7=BB=99=E5=AE=9A=E4=BF=A1=E5=8F=B7=E6=89=80=E7=94=A8= =E7=9A=84 GPIO =E7=BC=96=E5=8F=B7=E3=80=82 =20 =20 -=E4=BB=8E=E5=86=85=E6=A0=B8=E4=BB=A3=E7=A0=81=E4=B8=AD=E5=AF=BC=E5=87=BA ----------------- - -=E5=86=85=E6=A0=B8=E4=BB=A3=E7=A0=81=E5=8F=AF=E4=BB=A5=E6=98=8E=E7=A1=AE= =E5=9C=B0=E7=AE=A1=E7=90=86=E9=82=A3=E4=BA=9B=E5=B7=B2=E9=80=9A=E8=BF=87 gp= io_request()=E7=94=B3=E8=AF=B7=E7=9A=84 GPIO =E7=9A=84=E5=AF=BC=E5=87=BA:: - - /* =E5=AF=BC=E5=87=BA GPIO =E5=88=B0=E7=94=A8=E6=88=B7=E7=A9=BA=E9=97=B4 = */ - int gpio_export(unsigned gpio, bool direction_may_change); - - /* gpio_export()=E7=9A=84=E9=80=86=E6=93=8D=E4=BD=9C */ - void gpio_unexport(); - -=E5=9C=A8=E4=B8=80=E4=B8=AA=E5=86=85=E6=A0=B8=E9=A9=B1=E5=8A=A8=E7=94=B3= =E8=AF=B7=E4=B8=80=E4=B8=AA GPIO =E4=B9=8B=E5=90=8E=EF=BC=8C=E5=AE=83=E5=8F= =AF=E4=BB=A5=E9=80=9A=E8=BF=87 gpio_export()=E4=BD=BF=E5=85=B6=E5=9C=A8 sys= fs -=E6=8E=A5=E5=8F=A3=E4=B8=AD=E5=8F=AF=E8=A7=81=E3=80=82=E8=AF=A5=E9=A9=B1= =E5=8A=A8=E5=8F=AF=E4=BB=A5=E6=8E=A7=E5=88=B6=E4=BF=A1=E5=8F=B7=E6=96=B9=E5= =90=91=E6=98=AF=E5=90=A6=E5=8F=AF=E4=BF=AE=E6=94=B9=E3=80=82=E8=BF=99=E6=9C= =89=E5=8A=A9=E4=BA=8E=E9=98=B2=E6=AD=A2=E7=94=A8=E6=88=B7=E7=A9=BA=E9=97=B4= =E4=BB=A3=E7=A0=81=E6=97=A0=E6=84=8F=E9=97=B4 -=E7=A0=B4=E5=9D=8F=E9=87=8D=E8=A6=81=E7=9A=84=E7=B3=BB=E7=BB=9F=E7=8A=B6= =E6=80=81=E3=80=82 - -=E8=BF=99=E4=B8=AA=E6=98=8E=E7=A1=AE=E7=9A=84=E5=AF=BC=E5=87=BA=E6=9C=89= =E5=8A=A9=E4=BA=8E(=E9=80=9A=E8=BF=87=E4=BD=BF=E6=9F=90=E4=BA=9B=E5=AE=9E= =E9=AA=8C=E6=9B=B4=E5=AE=B9=E6=98=93=E6=9D=A5)=E8=B0=83=E8=AF=95=EF=BC=8C= =E4=B9=9F=E5=8F=AF=E4=BB=A5=E6=8F=90=E4=BE=9B=E4=B8=80=E4=B8=AA=E5=A7=8B=E7= =BB=88=E5=AD=98=E5=9C=A8=E7=9A=84=E6=8E=A5=E5=8F=A3=EF=BC=8C -=E4=B8=8E=E6=96=87=E6=A1=A3=E9=85=8D=E5=90=88=E4=BD=9C=E4=B8=BA=E6=9D=BF= =E7=BA=A7=E6=94=AF=E6=8C=81=E5=8C=85=E7=9A=84=E4=B8=80=E9=83=A8=E5=88=86=E3= =80=82 - - API=E5=8F=82=E8=80=83 =3D=3D=3D=3D=3D=3D=3D =20 diff --git a/Documentation/translations/zh_TW/gpio.txt b/Documentation/tran= slations/zh_TW/gpio.txt index dc608358d90a..62e560ffe628 100644 --- a/Documentation/translations/zh_TW/gpio.txt +++ b/Documentation/translations/zh_TW/gpio.txt @@ -614,21 +614,3 @@ GPIO =E6=8E=A7=E5=88=B6=E5=99=A8=E7=9A=84=E8=B7=AF=E5= =BE=91=E9=A1=9E=E4=BC=BC /sys/class/gpio/gpiochip42/ (=E5=B0=8D=E6=96=BC=E5= =BE=9E#42 GPIO =E5=9B=BA=E5=AE=9A=E7=9A=84,=E4=BE=8B=E5=A6=82=E5=9C=A8=E6=93=B4=E5=B1=95= =E5=8D=A1=E4=B8=8A=E7=9A=84 GPIO=E6=9C=83=E6=A0=B9=E6=93=9A=E6=89=80=E4=BD= =BF=E7=94=A8=E7=9A=84=E4=B8=BB=E6=9D=BF=E6=88=96=E6=89=80=E5=9C=A8=E5=A0=86= =E7=96=8A=E6=9E=B6=E6=A7=8B=E4=B8=AD=E5=85=B6=E4=BB=96=E7=9A=84=E6=9D=BF=E5= =AD=90=E8=80=8C =E6=9C=89=E6=89=80=E4=B8=8D=E5=90=8C=E3=80=82=E5=9C=A8=E9=80=99=E7=A8=AE= =E6=83=85=E6=B3=81=E4=B8=8B,=E4=BD=A0=E5=8F=AF=E8=83=BD=E9=9C=80=E8=A6=81= =E4=BD=BF=E7=94=A8 gpiochip =E7=AF=80=E9=BB=9E(=E5=84=98=E5=8F=AF=E8=83=BD= =E5=9C=B0=E7=B5=90=E5=90=88=E9=9B=BB=E8=B7=AF=E5=9C=96)=E4=BE=86 =E7=A2=BA=E5=AE=9A=E7=B5=A6=E5=AE=9A=E4=BF=A1=E8=99=9F=E6=89=80=E7=94=A8= =E7=9A=84 GPIO =E7=B7=A8=E8=99=9F=E3=80=82 - - -=E5=BE=9E=E5=85=A7=E6=A0=B8=E4=BB=A3=E7=A2=BC=E4=B8=AD=E5=B0=8E=E5=87=BA -------------- -=E5=85=A7=E6=A0=B8=E4=BB=A3=E7=A2=BC=E5=8F=AF=E4=BB=A5=E6=98=8E=E7=A2=BA= =E5=9C=B0=E7=AE=A1=E7=90=86=E9=82=A3=E4=BA=9B=E5=B7=B2=E9=80=9A=E9=81=8E gp= io_request()=E7=94=B3=E8=AB=8B=E7=9A=84 GPIO =E7=9A=84=E5=B0=8E=E5=87=BA: - - /* =E5=B0=8E=E5=87=BA GPIO =E5=88=B0=E7=94=A8=E6=88=B6=E7=A9=BA=E9=96=93 = */ - int gpio_export(unsigned gpio, bool direction_may_change); - - /* gpio_export()=E7=9A=84=E9=80=86=E6=93=8D=E4=BD=9C */ - void gpio_unexport(); - -=E5=9C=A8=E4=B8=80=E5=80=8B=E5=85=A7=E6=A0=B8=E9=A9=85=E5=8B=95=E7=94=B3= =E8=AB=8B=E4=B8=80=E5=80=8B GPIO =E4=B9=8B=E5=BE=8C=EF=BC=8C=E5=AE=83=E5=8F= =AF=E4=BB=A5=E9=80=9A=E9=81=8E gpio_export()=E4=BD=BF=E5=85=B6=E5=9C=A8 sys= fs -=E6=8E=A5=E5=8F=A3=E4=B8=AD=E5=8F=AF=E8=A6=8B=E3=80=82=E8=A9=B2=E9=A9=85= =E5=8B=95=E5=8F=AF=E4=BB=A5=E6=8E=A7=E5=88=B6=E4=BF=A1=E8=99=9F=E6=96=B9=E5= =90=91=E6=98=AF=E5=90=A6=E5=8F=AF=E4=BF=AE=E6=94=B9=E3=80=82=E9=80=99=E6=9C= =89=E5=8A=A9=E6=96=BC=E9=98=B2=E6=AD=A2=E7=94=A8=E6=88=B6=E7=A9=BA=E9=96=93= =E4=BB=A3=E7=A2=BC=E7=84=A1=E6=84=8F=E9=96=93 -=E7=A0=B4=E5=A3=9E=E9=87=8D=E8=A6=81=E7=9A=84=E7=B3=BB=E7=B5=B1=E7=8B=80= =E6=85=8B=E3=80=82 - -=E9=80=99=E5=80=8B=E6=98=8E=E7=A2=BA=E7=9A=84=E5=B0=8E=E5=87=BA=E6=9C=89= =E5=8A=A9=E6=96=BC(=E9=80=9A=E9=81=8E=E4=BD=BF=E6=9F=90=E4=BA=9B=E5=AF=A6= =E9=A9=97=E6=9B=B4=E5=AE=B9=E6=98=93=E4=BE=86)=E8=AA=BF=E8=A9=A6=EF=BC=8C= =E4=B9=9F=E5=8F=AF=E4=BB=A5=E6=8F=90=E4=BE=9B=E4=B8=80=E5=80=8B=E5=A7=8B=E7= =B5=82=E5=AD=98=E5=9C=A8=E7=9A=84=E6=8E=A5=E5=8F=A3=EF=BC=8C -=E8=88=87=E6=96=87=E6=AA=94=E9=85=8D=E5=90=88=E4=BD=9C=E7=88=B2=E6=9D=BF= =E7=B4=9A=E6=94=AF=E6=8C=81=E5=8C=85=E7=9A=84=E4=B8=80=E9=83=A8=E5=88=86=E3= =80=82 diff --git a/arch/arm/mach-omap2/pdata-quirks.c b/arch/arm/mach-omap2/pdata= -quirks.c index baba73fd6f11..04208cc52784 100644 --- a/arch/arm/mach-omap2/pdata-quirks.c +++ b/arch/arm/mach-omap2/pdata-quirks.c @@ -6,6 +6,7 @@ */ #include #include +#include #include #include #include @@ -108,7 +109,7 @@ static int omap3_sbc_t3730_twl_callback(struct device *= dev, if (res) return res; =20 - gpio_export(gpio, 0); + gpiod_export(gpio_to_desc(gpio), 0); =20 return 0; } @@ -123,7 +124,7 @@ static void __init omap3_sbc_t3x_usb_hub_init(int gpio,= char *hub_name) return; } =20 - gpio_export(gpio, 0); + gpiod_export(gpio_to_desc(gpio), 0); =20 udelay(10); gpio_set_value(gpio, 1); @@ -200,8 +201,8 @@ static void __init omap3_sbc_t3517_wifi_init(void) return; } =20 - gpio_export(cm_t3517_wlan_gpios[0].gpio, 0); - gpio_export(cm_t3517_wlan_gpios[1].gpio, 0); + gpiod_export(gpio_to_desc(cm_t3517_wlan_gpios[0].gpio), 0); + gpiod_export(gpio_to_desc(cm_t3517_wlan_gpios[1].gpio), 0); =20 msleep(100); gpio_set_value(cm_t3517_wlan_gpios[1].gpio, 0); diff --git a/arch/sh/boards/mach-ap325rxa/setup.c b/arch/sh/boards/mach-ap3= 25rxa/setup.c index c77b5f00a66a..151792162152 100644 --- a/arch/sh/boards/mach-ap325rxa/setup.c +++ b/arch/sh/boards/mach-ap325rxa/setup.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -411,16 +412,16 @@ static int __init ap325rxa_devices_setup(void) /* LD3 and LD4 LEDs */ gpio_request(GPIO_PTX5, NULL); /* RUN */ gpio_direction_output(GPIO_PTX5, 1); - gpio_export(GPIO_PTX5, 0); + gpiod_export(gpio_to_desc(GPIO_PTX5), 0); =20 gpio_request(GPIO_PTX4, NULL); /* INDICATOR */ gpio_direction_output(GPIO_PTX4, 0); - gpio_export(GPIO_PTX4, 0); + gpiod_export(gpio_to_desc(GPIO_PTX4), 0); =20 /* SW1 input */ gpio_request(GPIO_PTF7, NULL); /* MODE */ gpio_direction_input(GPIO_PTF7); - gpio_export(GPIO_PTF7, 0); + gpiod_export(gpio_to_desc(GPIO_PTF7), 0); =20 /* LCDC */ gpio_request(GPIO_FN_LCDD15, NULL); diff --git a/drivers/gpio/gpiolib-sysfs.c b/drivers/gpio/gpiolib-sysfs.c index cd27bf173dec..6e4267944f80 100644 --- a/drivers/gpio/gpiolib-sysfs.c +++ b/drivers/gpio/gpiolib-sysfs.c @@ -491,7 +491,7 @@ static ssize_t unexport_store(struct class *class, goto done; =20 desc =3D gpio_to_desc(gpio); - /* reject bogus commands (gpio_unexport ignores them) */ + /* reject bogus commands (gpiod_unexport() ignores them) */ if (!desc) { pr_warn("%s: invalid GPIO %ld\n", __func__, gpio); return -EINVAL; @@ -790,7 +790,7 @@ static int __init gpiolib_sysfs_init(void) * early (e.g. before the class_register above was called). * * We run before arch_initcall() so chip->dev nodes can have - * registered, and so arch_initcall() can always gpio_export(). + * registered, and so arch_initcall() can always gpiod_export(). */ spin_lock_irqsave(&gpio_lock, flags); list_for_each_entry(gdev, &gpio_devices, list) { diff --git a/drivers/media/pci/sta2x11/sta2x11_vip.c b/drivers/media/pci/st= a2x11/sta2x11_vip.c index 8535e49a4c4f..e4cf9d63e926 100644 --- a/drivers/media/pci/sta2x11/sta2x11_vip.c +++ b/drivers/media/pci/sta2x11/sta2x11_vip.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -889,6 +890,7 @@ static int sta2x11_vip_init_controls(struct sta2x11_vip= *vip) static int vip_gpio_reserve(struct device *dev, int pin, int dir, const char *name) { + struct gpio_desc *desc =3D gpio_to_desc(pin); int ret =3D -ENODEV; =20 if (!gpio_is_valid(pin)) @@ -900,7 +902,7 @@ static int vip_gpio_reserve(struct device *dev, int pin= , int dir, return ret; } =20 - ret =3D gpio_direction_output(pin, dir); + ret =3D gpiod_direction_output(desc, dir); if (ret) { dev_err(dev, "Failed to set direction for pin %d (%s)\n", pin, name); @@ -908,7 +910,7 @@ static int vip_gpio_reserve(struct device *dev, int pin= , int dir, return ret; } =20 - ret =3D gpio_export(pin, false); + ret =3D gpiod_export(desc, false); if (ret) { dev_err(dev, "Failed to export pin %d (%s)\n", pin, name); gpio_free(pin); @@ -928,8 +930,10 @@ static int vip_gpio_reserve(struct device *dev, int pi= n, int dir, static void vip_gpio_release(struct device *dev, int pin, const char *name) { if (gpio_is_valid(pin)) { + struct gpio_desc *desc =3D gpio_to_desc(pin); + dev_dbg(dev, "releasing pin %d (%s)\n", pin, name); - gpio_unexport(pin); + gpiod_unexport(desc); gpio_free(pin); } } diff --git a/drivers/net/ieee802154/ca8210.c b/drivers/net/ieee802154/ca821= 0.c index e1a569b99e4a..5c0be6a3ec5e 100644 --- a/drivers/net/ieee802154/ca8210.c +++ b/drivers/net/ieee802154/ca8210.c @@ -51,6 +51,7 @@ #include #include #include +#include #include #include #include @@ -2853,7 +2854,7 @@ static int ca8210_interrupt_init(struct spi_device *s= pi) ); if (ret) { dev_crit(&spi->dev, "request_irq %d failed\n", pdata->irq_id); - gpio_unexport(pdata->gpio_irq); + gpiod_unexport(gpio_to_desc(pdata->gpio_irq)); gpio_free(pdata->gpio_irq); } =20 diff --git a/include/linux/gpio.h b/include/linux/gpio.h index fc56733e8514..a86953696e47 100644 --- a/include/linux/gpio.h +++ b/include/linux/gpio.h @@ -132,20 +132,6 @@ int gpio_request_one(unsigned gpio, unsigned long flag= s, const char *label); int gpio_request_array(const struct gpio *array, size_t num); void gpio_free_array(const struct gpio *array, size_t num); =20 -/* - * A sysfs interface can be exported by individual drivers if they want, - * but more typically is configured entirely from userspace. - */ -static inline int gpio_export(unsigned gpio, bool direction_may_change) -{ - return gpiod_export(gpio_to_desc(gpio), direction_may_change); -} - -static inline void gpio_unexport(unsigned gpio) -{ - gpiod_unexport(gpio_to_desc(gpio)); -} - /* CONFIG_GPIOLIB: bindings for managed devices that want to request gpios= */ =20 struct device; @@ -242,19 +228,6 @@ static inline void gpio_set_value_cansleep(unsigned gp= io, int value) WARN_ON(1); } =20 -static inline int gpio_export(unsigned gpio, bool direction_may_change) -{ - /* GPIO can never have been requested or set as {in,out}put */ - WARN_ON(1); - return -EINVAL; -} - -static inline void gpio_unexport(unsigned gpio) -{ - /* GPIO can never have been exported */ - WARN_ON(1); -} - static inline int gpio_to_irq(unsigned gpio) { /* GPIO can never have been requested or set as input */ --=20 2.39.1