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

pinctrl: sh-pfc: Improve core and user API separation

The Renesas Pin Function Controller uses two header files:
- sh_pfc.h, for use by both core code and SoC-specific drivers,
- core.h, for internal use by the core code only.

Several SoC-specific drivers include core.h, as they need the sh_pfc
structure, which is passed explicitly to the various SoC-specific
callbacks, and used there.

Hence move its definition from core.h to sh_pfc.h, and remove the
inclusion of core.h from all SoC-specific files.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Linus Walleij <linus.walleij@linaro.org>

+30 -39
-33
drivers/pinctrl/sh-pfc/core.h
··· 10 10 #ifndef __SH_PFC_CORE_H__ 11 11 #define __SH_PFC_CORE_H__ 12 12 13 - #include <linux/compiler.h> 14 - #include <linux/spinlock.h> 15 13 #include <linux/types.h> 16 14 17 15 #include "sh_pfc.h" 18 16 19 - struct sh_pfc_window { 20 - phys_addr_t phys; 21 - void __iomem *virt; 22 - unsigned long size; 23 - }; 24 - 25 - struct sh_pfc_chip; 26 - struct sh_pfc_pinctrl; 27 - 28 17 struct sh_pfc_pin_range { 29 18 u16 start; 30 19 u16 end; 31 - }; 32 - 33 - struct sh_pfc { 34 - struct device *dev; 35 - const struct sh_pfc_soc_info *info; 36 - spinlock_t lock; 37 - 38 - unsigned int num_windows; 39 - struct sh_pfc_window *windows; 40 - unsigned int num_irqs; 41 - unsigned int *irqs; 42 - 43 - struct sh_pfc_pin_range *ranges; 44 - unsigned int nr_ranges; 45 - 46 - unsigned int nr_gpio_pins; 47 - 48 - struct sh_pfc_chip *gpio; 49 - #ifdef CONFIG_SUPERH 50 - struct sh_pfc_chip *func; 51 - #endif 52 - 53 20 }; 54 21 55 22 int sh_pfc_register_gpiochip(struct sh_pfc *pfc);
-1
drivers/pinctrl/sh-pfc/pfc-r8a73a4.c
··· 21 21 #include <linux/kernel.h> 22 22 #include <linux/pinctrl/pinconf-generic.h> 23 23 24 - #include "core.h" 25 24 #include "sh_pfc.h" 26 25 27 26 #define CPU_ALL_PORT(fn, pfx, sfx) \
-1
drivers/pinctrl/sh-pfc/pfc-r8a7740.c
··· 22 22 #include <linux/kernel.h> 23 23 #include <linux/pinctrl/pinconf-generic.h> 24 24 25 - #include "core.h" 26 25 #include "sh_pfc.h" 27 26 28 27 #define CPU_ALL_PORT(fn, pfx, sfx) \
+1 -1
drivers/pinctrl/sh-pfc/pfc-r8a7778.c
··· 23 23 #include <linux/io.h> 24 24 #include <linux/kernel.h> 25 25 #include <linux/pinctrl/pinconf-generic.h> 26 - #include "core.h" 26 + 27 27 #include "sh_pfc.h" 28 28 29 29 #define PORT_GP_PUP_1(bank, pin, fn, sfx) \
-1
drivers/pinctrl/sh-pfc/pfc-r8a7790.c
··· 24 24 #include <linux/io.h> 25 25 #include <linux/kernel.h> 26 26 27 - #include "core.h" 28 27 #include "sh_pfc.h" 29 28 30 29 /*
-1
drivers/pinctrl/sh-pfc/pfc-r8a7791.c
··· 11 11 12 12 #include <linux/kernel.h> 13 13 14 - #include "core.h" 15 14 #include "sh_pfc.h" 16 15 17 16 #define CPU_ALL_PORT(fn, sfx) \
+29 -1
drivers/pinctrl/sh-pfc/sh_pfc.h
··· 13 13 14 14 #include <linux/bug.h> 15 15 #include <linux/pinctrl/pinconf-generic.h> 16 + #include <linux/spinlock.h> 16 17 #include <linux/stringify.h> 17 18 18 19 enum { ··· 183 182 u16 force; 184 183 }; 185 184 186 - struct sh_pfc; 185 + struct sh_pfc_window { 186 + phys_addr_t phys; 187 + void __iomem *virt; 188 + unsigned long size; 189 + }; 190 + 191 + struct sh_pfc_pin_range; 192 + 193 + struct sh_pfc { 194 + struct device *dev; 195 + const struct sh_pfc_soc_info *info; 196 + spinlock_t lock; 197 + 198 + unsigned int num_windows; 199 + struct sh_pfc_window *windows; 200 + unsigned int num_irqs; 201 + unsigned int *irqs; 202 + 203 + struct sh_pfc_pin_range *ranges; 204 + unsigned int nr_ranges; 205 + 206 + unsigned int nr_gpio_pins; 207 + 208 + struct sh_pfc_chip *gpio; 209 + #ifdef CONFIG_SUPERH 210 + struct sh_pfc_chip *func; 211 + #endif 212 + }; 187 213 188 214 struct sh_pfc_soc_operations { 189 215 int (*init)(struct sh_pfc *pfc);