Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

gpiolib: of: Get rid of <linux/gpio/legacy-of-mm-gpiochip.h>

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>

authored by

Christophe Leroy and committed by
Bartosz Golaszewski
eba11116 8d0d46da

-134
-8
drivers/gpio/Kconfig
··· 42 42 select IRQ_DOMAIN 43 43 bool 44 44 45 - config OF_GPIO_MM_GPIOCHIP 46 - bool 47 - help 48 - This adds support for the legacy 'struct of_mm_gpio_chip' interface 49 - from PowerPC. Existing drivers using this interface need to select 50 - this symbol, but new drivers should use the generic gpio-regmap 51 - infrastructure instead. 52 - 53 45 config DEBUG_GPIO 54 46 bool "Debug GPIO calls" 55 47 depends on DEBUG_KERNEL
-11
drivers/gpio/TODO
··· 86 86 87 87 ------------------------------------------------------------------------------- 88 88 89 - Get rid of <linux/gpio/legacy-of-mm-gpiochip.h> 90 - 91 - Work items: 92 - 93 - - Get rid of struct of_mm_gpio_chip altogether: use the generic MMIO 94 - GPIO for all current users (see below). Delete struct of_mm_gpio_chip, 95 - to_of_mm_gpio_chip(), of_mm_gpiochip_add_data(), of_mm_gpiochip_remove(), 96 - CONFIG_OF_GPIO_MM_GPIOCHIP from the kernel. 97 - 98 - ------------------------------------------------------------------------------- 99 - 100 89 Collect drivers 101 90 102 91 Collect GPIO drivers from arch/* and other places that should be placed
-79
drivers/gpio/gpiolib-of.c
··· 1031 1031 return gpiospec->args[1]; 1032 1032 } 1033 1033 1034 - #if IS_ENABLED(CONFIG_OF_GPIO_MM_GPIOCHIP) 1035 - #include <linux/gpio/legacy-of-mm-gpiochip.h> 1036 - /** 1037 - * of_mm_gpiochip_add_data - Add memory mapped GPIO chip (bank) 1038 - * @np: device node of the GPIO chip 1039 - * @mm_gc: pointer to the of_mm_gpio_chip allocated structure 1040 - * @data: driver data to store in the struct gpio_chip 1041 - * 1042 - * To use this function you should allocate and fill mm_gc with: 1043 - * 1044 - * 1) In the gpio_chip structure: 1045 - * - all the callbacks 1046 - * - of_gpio_n_cells 1047 - * - of_xlate callback (optional) 1048 - * 1049 - * 3) In the of_mm_gpio_chip structure: 1050 - * - save_regs callback (optional) 1051 - * 1052 - * If succeeded, this function will map bank's memory and will 1053 - * do all necessary work for you. Then you'll able to use .regs 1054 - * to manage GPIOs from the callbacks. 1055 - * 1056 - * Returns: 1057 - * 0 on success, or negative errno on failure. 1058 - */ 1059 - int of_mm_gpiochip_add_data(struct device_node *np, 1060 - struct of_mm_gpio_chip *mm_gc, 1061 - void *data) 1062 - { 1063 - int ret = -ENOMEM; 1064 - struct gpio_chip *gc = &mm_gc->gc; 1065 - 1066 - gc->label = kasprintf(GFP_KERNEL, "%pOF", np); 1067 - if (!gc->label) 1068 - goto err0; 1069 - 1070 - mm_gc->regs = of_iomap(np, 0); 1071 - if (!mm_gc->regs) 1072 - goto err1; 1073 - 1074 - gc->base = -1; 1075 - 1076 - if (mm_gc->save_regs) 1077 - mm_gc->save_regs(mm_gc); 1078 - 1079 - fwnode_handle_put(mm_gc->gc.fwnode); 1080 - mm_gc->gc.fwnode = fwnode_handle_get(of_fwnode_handle(np)); 1081 - 1082 - ret = gpiochip_add_data(gc, data); 1083 - if (ret) 1084 - goto err2; 1085 - 1086 - return 0; 1087 - err2: 1088 - of_node_put(np); 1089 - iounmap(mm_gc->regs); 1090 - err1: 1091 - kfree(gc->label); 1092 - err0: 1093 - pr_err("%pOF: GPIO chip registration failed with status %d\n", np, ret); 1094 - return ret; 1095 - } 1096 - EXPORT_SYMBOL_GPL(of_mm_gpiochip_add_data); 1097 - 1098 - /** 1099 - * of_mm_gpiochip_remove - Remove memory mapped GPIO chip (bank) 1100 - * @mm_gc: pointer to the of_mm_gpio_chip allocated structure 1101 - */ 1102 - void of_mm_gpiochip_remove(struct of_mm_gpio_chip *mm_gc) 1103 - { 1104 - struct gpio_chip *gc = &mm_gc->gc; 1105 - 1106 - gpiochip_remove(gc); 1107 - iounmap(mm_gc->regs); 1108 - kfree(gc->label); 1109 - } 1110 - EXPORT_SYMBOL_GPL(of_mm_gpiochip_remove); 1111 - #endif 1112 - 1113 1034 #ifdef CONFIG_PINCTRL 1114 1035 static int of_gpiochip_add_pin_range(struct gpio_chip *chip) 1115 1036 {
-36
include/linux/gpio/legacy-of-mm-gpiochip.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0+ */ 2 - /* 3 - * OF helpers for the old of_mm_gpio_chip, used on ppc32 and nios2, 4 - * do not use in new code. 5 - * 6 - * Copyright (c) 2007-2008 MontaVista Software, Inc. 7 - * 8 - * Author: Anton Vorontsov <avorontsov@ru.mvista.com> 9 - */ 10 - 11 - #ifndef __LINUX_GPIO_LEGACY_OF_MM_GPIO_CHIP_H 12 - #define __LINUX_GPIO_LEGACY_OF_MM_GPIO_CHIP_H 13 - 14 - #include <linux/gpio/driver.h> 15 - #include <linux/of.h> 16 - 17 - /* 18 - * OF GPIO chip for memory mapped banks 19 - */ 20 - struct of_mm_gpio_chip { 21 - struct gpio_chip gc; 22 - void (*save_regs)(struct of_mm_gpio_chip *mm_gc); 23 - void __iomem *regs; 24 - }; 25 - 26 - static inline struct of_mm_gpio_chip *to_of_mm_gpio_chip(struct gpio_chip *gc) 27 - { 28 - return container_of(gc, struct of_mm_gpio_chip, gc); 29 - } 30 - 31 - extern int of_mm_gpiochip_add_data(struct device_node *np, 32 - struct of_mm_gpio_chip *mm_gc, 33 - void *data); 34 - extern void of_mm_gpiochip_remove(struct of_mm_gpio_chip *mm_gc); 35 - 36 - #endif /* __LINUX_GPIO_LEGACY_OF_MM_GPIO_CHIP_H */