]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
gpiolib: of: Get rid of <linux/gpio/legacy-of-mm-gpiochip.h>
authorChristophe Leroy <christophe.leroy@csgroup.eu>
Mon, 13 Oct 2025 13:07:15 +0000 (15:07 +0200)
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Thu, 16 Oct 2025 14:47:18 +0000 (16:47 +0200)
Last user of linux/gpio/legacy-of-mm-gpiochip.h is gone.

Remove linux/gpio/legacy-of-mm-gpiochip.h and
CONFIG_OF_GPIO_MM_GPIOCHIP

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
drivers/gpio/Kconfig
drivers/gpio/TODO
drivers/gpio/gpiolib-of.c
include/linux/gpio/legacy-of-mm-gpiochip.h [deleted file]

index 154d31b75070937792920c87e0e0190859d76974..ce237398fa00eddad49afe995accae3abbb4b2cb 100644 (file)
@@ -42,14 +42,6 @@ config GPIOLIB_IRQCHIP
        select IRQ_DOMAIN
        bool
 
-config OF_GPIO_MM_GPIOCHIP
-       bool
-       help
-         This adds support for the legacy 'struct of_mm_gpio_chip' interface
-         from PowerPC. Existing drivers using this interface need to select
-         this symbol, but new drivers should use the generic gpio-regmap
-         infrastructure instead.
-
 config DEBUG_GPIO
        bool "Debug GPIO calls"
        depends on DEBUG_KERNEL
index 8ed74e05903a972e99e0789319ed19ebd8545a1a..5acaeab029ec6e3a1b165209f75bb0355d4fc488 100644 (file)
@@ -86,17 +86,6 @@ Work items:
 
 -------------------------------------------------------------------------------
 
-Get rid of <linux/gpio/legacy-of-mm-gpiochip.h>
-
-Work items:
-
-- Get rid of struct of_mm_gpio_chip altogether: use the generic  MMIO
-  GPIO for all current users (see below). Delete struct of_mm_gpio_chip,
-  to_of_mm_gpio_chip(), of_mm_gpiochip_add_data(), of_mm_gpiochip_remove(),
-  CONFIG_OF_GPIO_MM_GPIOCHIP from the kernel.
-
--------------------------------------------------------------------------------
-
 Collect drivers
 
 Collect GPIO drivers from arch/* and other places that should be placed
index fad4edf9cc5c0c0469795b2069565e73e0d9c9ef..8657379e9165c3184e5ca4e2abe64f6ffd80b1df 100644 (file)
@@ -1031,85 +1031,6 @@ static int of_gpio_threecell_xlate(struct gpio_chip *gc,
        return gpiospec->args[1];
 }
 
-#if IS_ENABLED(CONFIG_OF_GPIO_MM_GPIOCHIP)
-#include <linux/gpio/legacy-of-mm-gpiochip.h>
-/**
- * of_mm_gpiochip_add_data - Add memory mapped GPIO chip (bank)
- * @np:                device node of the GPIO chip
- * @mm_gc:     pointer to the of_mm_gpio_chip allocated structure
- * @data:      driver data to store in the struct gpio_chip
- *
- * To use this function you should allocate and fill mm_gc with:
- *
- * 1) In the gpio_chip structure:
- *    - all the callbacks
- *    - of_gpio_n_cells
- *    - of_xlate callback (optional)
- *
- * 3) In the of_mm_gpio_chip structure:
- *    - save_regs callback (optional)
- *
- * If succeeded, this function will map bank's memory and will
- * do all necessary work for you. Then you'll able to use .regs
- * to manage GPIOs from the callbacks.
- *
- * Returns:
- * 0 on success, or negative errno on failure.
- */
-int of_mm_gpiochip_add_data(struct device_node *np,
-                           struct of_mm_gpio_chip *mm_gc,
-                           void *data)
-{
-       int ret = -ENOMEM;
-       struct gpio_chip *gc = &mm_gc->gc;
-
-       gc->label = kasprintf(GFP_KERNEL, "%pOF", np);
-       if (!gc->label)
-               goto err0;
-
-       mm_gc->regs = of_iomap(np, 0);
-       if (!mm_gc->regs)
-               goto err1;
-
-       gc->base = -1;
-
-       if (mm_gc->save_regs)
-               mm_gc->save_regs(mm_gc);
-
-       fwnode_handle_put(mm_gc->gc.fwnode);
-       mm_gc->gc.fwnode = fwnode_handle_get(of_fwnode_handle(np));
-
-       ret = gpiochip_add_data(gc, data);
-       if (ret)
-               goto err2;
-
-       return 0;
-err2:
-       of_node_put(np);
-       iounmap(mm_gc->regs);
-err1:
-       kfree(gc->label);
-err0:
-       pr_err("%pOF: GPIO chip registration failed with status %d\n", np, ret);
-       return ret;
-}
-EXPORT_SYMBOL_GPL(of_mm_gpiochip_add_data);
-
-/**
- * of_mm_gpiochip_remove - Remove memory mapped GPIO chip (bank)
- * @mm_gc:     pointer to the of_mm_gpio_chip allocated structure
- */
-void of_mm_gpiochip_remove(struct of_mm_gpio_chip *mm_gc)
-{
-       struct gpio_chip *gc = &mm_gc->gc;
-
-       gpiochip_remove(gc);
-       iounmap(mm_gc->regs);
-       kfree(gc->label);
-}
-EXPORT_SYMBOL_GPL(of_mm_gpiochip_remove);
-#endif
-
 #ifdef CONFIG_PINCTRL
 static int of_gpiochip_add_pin_range(struct gpio_chip *chip)
 {
diff --git a/include/linux/gpio/legacy-of-mm-gpiochip.h b/include/linux/gpio/legacy-of-mm-gpiochip.h
deleted file mode 100644 (file)
index 2e2bd3b..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * OF helpers for the old of_mm_gpio_chip, used on ppc32 and nios2,
- * do not use in new code.
- *
- * Copyright (c) 2007-2008  MontaVista Software, Inc.
- *
- * Author: Anton Vorontsov <avorontsov@ru.mvista.com>
- */
-
-#ifndef __LINUX_GPIO_LEGACY_OF_MM_GPIO_CHIP_H
-#define __LINUX_GPIO_LEGACY_OF_MM_GPIO_CHIP_H
-
-#include <linux/gpio/driver.h>
-#include <linux/of.h>
-
-/*
- * OF GPIO chip for memory mapped banks
- */
-struct of_mm_gpio_chip {
-       struct gpio_chip gc;
-       void (*save_regs)(struct of_mm_gpio_chip *mm_gc);
-       void __iomem *regs;
-};
-
-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_mm_gpiochip_add_data(struct device_node *np,
-                                  struct of_mm_gpio_chip *mm_gc,
-                                  void *data);
-extern void of_mm_gpiochip_remove(struct of_mm_gpio_chip *mm_gc);
-
-#endif /* __LINUX_GPIO_LEGACY_OF_MM_GPIO_CHIP_H */