All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] pinctrl: sh-pfc: Cleanups
@ 2016-06-10 10:05 ` Geert Uytterhoeven
  0 siblings, 0 replies; 14+ messages in thread
From: Geert Uytterhoeven @ 2016-06-10 10:05 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Linus Walleij, Ben Dooks, Laxman Dewangan, linux-renesas-soc,
	linux-sh, linux-gpio, Geert Uytterhoeven

	Hi,

This series contains various cleanups for the Renesas Pin Function
Controller driver subsystem.

This has been tested on r8a7791/koelsch, and compile-tested for other
ARM and SH platforms.

I plan to queue this in sh-pfc-for-v4.8.

Thanks for your comments!

Geert Uytterhoeven (3):
  pinctrl: sh-pfc: Move SoC-specific forward declarations to sh_pfc.h
  pinctrl: sh-pfc: Improve core and user separation
  pinctrl: sh-pfc: Convert to devm_gpiochip_add_data()

 drivers/pinctrl/sh-pfc/core.c        | 10 -------
 drivers/pinctrl/sh-pfc/core.h        | 58 ------------------------------------
 drivers/pinctrl/sh-pfc/gpio.c        | 13 +-------
 drivers/pinctrl/sh-pfc/pfc-r8a73a4.c |  1 -
 drivers/pinctrl/sh-pfc/pfc-r8a7740.c |  1 -
 drivers/pinctrl/sh-pfc/pfc-r8a7778.c |  2 +-
 drivers/pinctrl/sh-pfc/pfc-r8a7790.c |  1 -
 drivers/pinctrl/sh-pfc/pfc-r8a7791.c |  1 -
 drivers/pinctrl/sh-pfc/sh_pfc.h      | 51 ++++++++++++++++++++++++++++++-
 9 files changed, 52 insertions(+), 86 deletions(-)

-- 
1.9.1

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 0/3] pinctrl: sh-pfc: Cleanups
@ 2016-06-10 10:05 ` Geert Uytterhoeven
  0 siblings, 0 replies; 14+ messages in thread
From: Geert Uytterhoeven @ 2016-06-10 10:05 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Linus Walleij, Ben Dooks, Laxman Dewangan, linux-renesas-soc,
	linux-sh, linux-gpio, Geert Uytterhoeven

	Hi,

This series contains various cleanups for the Renesas Pin Function
Controller driver subsystem.

This has been tested on r8a7791/koelsch, and compile-tested for other
ARM and SH platforms.

I plan to queue this in sh-pfc-for-v4.8.

Thanks for your comments!

Geert Uytterhoeven (3):
  pinctrl: sh-pfc: Move SoC-specific forward declarations to sh_pfc.h
  pinctrl: sh-pfc: Improve core and user separation
  pinctrl: sh-pfc: Convert to devm_gpiochip_add_data()

 drivers/pinctrl/sh-pfc/core.c        | 10 -------
 drivers/pinctrl/sh-pfc/core.h        | 58 ------------------------------------
 drivers/pinctrl/sh-pfc/gpio.c        | 13 +-------
 drivers/pinctrl/sh-pfc/pfc-r8a73a4.c |  1 -
 drivers/pinctrl/sh-pfc/pfc-r8a7740.c |  1 -
 drivers/pinctrl/sh-pfc/pfc-r8a7778.c |  2 +-
 drivers/pinctrl/sh-pfc/pfc-r8a7790.c |  1 -
 drivers/pinctrl/sh-pfc/pfc-r8a7791.c |  1 -
 drivers/pinctrl/sh-pfc/sh_pfc.h      | 51 ++++++++++++++++++++++++++++++-
 9 files changed, 52 insertions(+), 86 deletions(-)

-- 
1.9.1

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 1/3] pinctrl: sh-pfc: Move SoC-specific forward declarations to sh_pfc.h
  2016-06-10 10:05 ` Geert Uytterhoeven
@ 2016-06-10 10:05   ` Geert Uytterhoeven
  -1 siblings, 0 replies; 14+ messages in thread
From: Geert Uytterhoeven @ 2016-06-10 10:05 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Linus Walleij, Ben Dooks, Laxman Dewangan, linux-renesas-soc,
	linux-sh, linux-gpio, Geert Uytterhoeven

With C=1:

    drivers/pinctrl/sh-pfc/pfc-emev2.c:1695:30: warning: symbol 'emev2_pinmux_info' was not declared. Should it be static?
    drivers/pinctrl/sh-pfc/pfc-r8a7779.c:3888:30: warning: symbol 'r8a7779_pinmux_info' was not declared. Should it be static?

Note that there are more warnings on SH.

The sh_pfc_soc_info structure is defined in sh_pfc.h, while all forward
declarations for the SoC-specific versions are in core.h.
Move the forward declarations from core.h to sh_pfc.h to fix this.

Reported-by: Ben Dooks <ben.dooks@codethink.co.uk>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/pinctrl/sh-pfc/core.h   | 24 ------------------------
 drivers/pinctrl/sh-pfc/sh_pfc.h | 24 ++++++++++++++++++++++++
 2 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/drivers/pinctrl/sh-pfc/core.h b/drivers/pinctrl/sh-pfc/core.h
index dc1b2adb24c5c588..539ec7dc0b644dbe 100644
--- a/drivers/pinctrl/sh-pfc/core.h
+++ b/drivers/pinctrl/sh-pfc/core.h
@@ -67,28 +67,4 @@ void sh_pfc_write_reg(struct sh_pfc *pfc, u32 reg, unsigned int width,
 int sh_pfc_get_pin_index(struct sh_pfc *pfc, unsigned int pin);
 int sh_pfc_config_mux(struct sh_pfc *pfc, unsigned mark, int pinmux_type);
 
-extern const struct sh_pfc_soc_info emev2_pinmux_info;
-extern const struct sh_pfc_soc_info r8a73a4_pinmux_info;
-extern const struct sh_pfc_soc_info r8a7740_pinmux_info;
-extern const struct sh_pfc_soc_info r8a7778_pinmux_info;
-extern const struct sh_pfc_soc_info r8a7779_pinmux_info;
-extern const struct sh_pfc_soc_info r8a7790_pinmux_info;
-extern const struct sh_pfc_soc_info r8a7791_pinmux_info;
-extern const struct sh_pfc_soc_info r8a7793_pinmux_info;
-extern const struct sh_pfc_soc_info r8a7794_pinmux_info;
-extern const struct sh_pfc_soc_info r8a7795_pinmux_info;
-extern const struct sh_pfc_soc_info sh7203_pinmux_info;
-extern const struct sh_pfc_soc_info sh7264_pinmux_info;
-extern const struct sh_pfc_soc_info sh7269_pinmux_info;
-extern const struct sh_pfc_soc_info sh73a0_pinmux_info;
-extern const struct sh_pfc_soc_info sh7720_pinmux_info;
-extern const struct sh_pfc_soc_info sh7722_pinmux_info;
-extern const struct sh_pfc_soc_info sh7723_pinmux_info;
-extern const struct sh_pfc_soc_info sh7724_pinmux_info;
-extern const struct sh_pfc_soc_info sh7734_pinmux_info;
-extern const struct sh_pfc_soc_info sh7757_pinmux_info;
-extern const struct sh_pfc_soc_info sh7785_pinmux_info;
-extern const struct sh_pfc_soc_info sh7786_pinmux_info;
-extern const struct sh_pfc_soc_info shx3_pinmux_info;
-
 #endif /* __SH_PFC_CORE_H__ */
diff --git a/drivers/pinctrl/sh-pfc/sh_pfc.h b/drivers/pinctrl/sh-pfc/sh_pfc.h
index ea3a527514558add..332d379b302cba70 100644
--- a/drivers/pinctrl/sh-pfc/sh_pfc.h
+++ b/drivers/pinctrl/sh-pfc/sh_pfc.h
@@ -225,6 +225,30 @@ struct sh_pfc_soc_info {
 	u32 unlock_reg;
 };
 
+extern const struct sh_pfc_soc_info emev2_pinmux_info;
+extern const struct sh_pfc_soc_info r8a73a4_pinmux_info;
+extern const struct sh_pfc_soc_info r8a7740_pinmux_info;
+extern const struct sh_pfc_soc_info r8a7778_pinmux_info;
+extern const struct sh_pfc_soc_info r8a7779_pinmux_info;
+extern const struct sh_pfc_soc_info r8a7790_pinmux_info;
+extern const struct sh_pfc_soc_info r8a7791_pinmux_info;
+extern const struct sh_pfc_soc_info r8a7793_pinmux_info;
+extern const struct sh_pfc_soc_info r8a7794_pinmux_info;
+extern const struct sh_pfc_soc_info r8a7795_pinmux_info;
+extern const struct sh_pfc_soc_info sh7203_pinmux_info;
+extern const struct sh_pfc_soc_info sh7264_pinmux_info;
+extern const struct sh_pfc_soc_info sh7269_pinmux_info;
+extern const struct sh_pfc_soc_info sh73a0_pinmux_info;
+extern const struct sh_pfc_soc_info sh7720_pinmux_info;
+extern const struct sh_pfc_soc_info sh7722_pinmux_info;
+extern const struct sh_pfc_soc_info sh7723_pinmux_info;
+extern const struct sh_pfc_soc_info sh7724_pinmux_info;
+extern const struct sh_pfc_soc_info sh7734_pinmux_info;
+extern const struct sh_pfc_soc_info sh7757_pinmux_info;
+extern const struct sh_pfc_soc_info sh7785_pinmux_info;
+extern const struct sh_pfc_soc_info sh7786_pinmux_info;
+extern const struct sh_pfc_soc_info shx3_pinmux_info;
+
 /* -----------------------------------------------------------------------------
  * Helper macros to create pin and port lists
  */
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 1/3] pinctrl: sh-pfc: Move SoC-specific forward declarations to sh_pfc.h
@ 2016-06-10 10:05   ` Geert Uytterhoeven
  0 siblings, 0 replies; 14+ messages in thread
From: Geert Uytterhoeven @ 2016-06-10 10:05 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Linus Walleij, Ben Dooks, Laxman Dewangan, linux-renesas-soc,
	linux-sh, linux-gpio, Geert Uytterhoeven

With C=1:

    drivers/pinctrl/sh-pfc/pfc-emev2.c:1695:30: warning: symbol 'emev2_pinmux_info' was not declared. Should it be static?
    drivers/pinctrl/sh-pfc/pfc-r8a7779.c:3888:30: warning: symbol 'r8a7779_pinmux_info' was not declared. Should it be static?

Note that there are more warnings on SH.

The sh_pfc_soc_info structure is defined in sh_pfc.h, while all forward
declarations for the SoC-specific versions are in core.h.
Move the forward declarations from core.h to sh_pfc.h to fix this.

Reported-by: Ben Dooks <ben.dooks@codethink.co.uk>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/pinctrl/sh-pfc/core.h   | 24 ------------------------
 drivers/pinctrl/sh-pfc/sh_pfc.h | 24 ++++++++++++++++++++++++
 2 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/drivers/pinctrl/sh-pfc/core.h b/drivers/pinctrl/sh-pfc/core.h
index dc1b2adb24c5c588..539ec7dc0b644dbe 100644
--- a/drivers/pinctrl/sh-pfc/core.h
+++ b/drivers/pinctrl/sh-pfc/core.h
@@ -67,28 +67,4 @@ void sh_pfc_write_reg(struct sh_pfc *pfc, u32 reg, unsigned int width,
 int sh_pfc_get_pin_index(struct sh_pfc *pfc, unsigned int pin);
 int sh_pfc_config_mux(struct sh_pfc *pfc, unsigned mark, int pinmux_type);
 
-extern const struct sh_pfc_soc_info emev2_pinmux_info;
-extern const struct sh_pfc_soc_info r8a73a4_pinmux_info;
-extern const struct sh_pfc_soc_info r8a7740_pinmux_info;
-extern const struct sh_pfc_soc_info r8a7778_pinmux_info;
-extern const struct sh_pfc_soc_info r8a7779_pinmux_info;
-extern const struct sh_pfc_soc_info r8a7790_pinmux_info;
-extern const struct sh_pfc_soc_info r8a7791_pinmux_info;
-extern const struct sh_pfc_soc_info r8a7793_pinmux_info;
-extern const struct sh_pfc_soc_info r8a7794_pinmux_info;
-extern const struct sh_pfc_soc_info r8a7795_pinmux_info;
-extern const struct sh_pfc_soc_info sh7203_pinmux_info;
-extern const struct sh_pfc_soc_info sh7264_pinmux_info;
-extern const struct sh_pfc_soc_info sh7269_pinmux_info;
-extern const struct sh_pfc_soc_info sh73a0_pinmux_info;
-extern const struct sh_pfc_soc_info sh7720_pinmux_info;
-extern const struct sh_pfc_soc_info sh7722_pinmux_info;
-extern const struct sh_pfc_soc_info sh7723_pinmux_info;
-extern const struct sh_pfc_soc_info sh7724_pinmux_info;
-extern const struct sh_pfc_soc_info sh7734_pinmux_info;
-extern const struct sh_pfc_soc_info sh7757_pinmux_info;
-extern const struct sh_pfc_soc_info sh7785_pinmux_info;
-extern const struct sh_pfc_soc_info sh7786_pinmux_info;
-extern const struct sh_pfc_soc_info shx3_pinmux_info;
-
 #endif /* __SH_PFC_CORE_H__ */
diff --git a/drivers/pinctrl/sh-pfc/sh_pfc.h b/drivers/pinctrl/sh-pfc/sh_pfc.h
index ea3a527514558add..332d379b302cba70 100644
--- a/drivers/pinctrl/sh-pfc/sh_pfc.h
+++ b/drivers/pinctrl/sh-pfc/sh_pfc.h
@@ -225,6 +225,30 @@ struct sh_pfc_soc_info {
 	u32 unlock_reg;
 };
 
+extern const struct sh_pfc_soc_info emev2_pinmux_info;
+extern const struct sh_pfc_soc_info r8a73a4_pinmux_info;
+extern const struct sh_pfc_soc_info r8a7740_pinmux_info;
+extern const struct sh_pfc_soc_info r8a7778_pinmux_info;
+extern const struct sh_pfc_soc_info r8a7779_pinmux_info;
+extern const struct sh_pfc_soc_info r8a7790_pinmux_info;
+extern const struct sh_pfc_soc_info r8a7791_pinmux_info;
+extern const struct sh_pfc_soc_info r8a7793_pinmux_info;
+extern const struct sh_pfc_soc_info r8a7794_pinmux_info;
+extern const struct sh_pfc_soc_info r8a7795_pinmux_info;
+extern const struct sh_pfc_soc_info sh7203_pinmux_info;
+extern const struct sh_pfc_soc_info sh7264_pinmux_info;
+extern const struct sh_pfc_soc_info sh7269_pinmux_info;
+extern const struct sh_pfc_soc_info sh73a0_pinmux_info;
+extern const struct sh_pfc_soc_info sh7720_pinmux_info;
+extern const struct sh_pfc_soc_info sh7722_pinmux_info;
+extern const struct sh_pfc_soc_info sh7723_pinmux_info;
+extern const struct sh_pfc_soc_info sh7724_pinmux_info;
+extern const struct sh_pfc_soc_info sh7734_pinmux_info;
+extern const struct sh_pfc_soc_info sh7757_pinmux_info;
+extern const struct sh_pfc_soc_info sh7785_pinmux_info;
+extern const struct sh_pfc_soc_info sh7786_pinmux_info;
+extern const struct sh_pfc_soc_info shx3_pinmux_info;
+
 /* -----------------------------------------------------------------------------
  * Helper macros to create pin and port lists
  */
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 2/3] pinctrl: sh-pfc: Improve core and user API separation
  2016-06-10 10:05 ` Geert Uytterhoeven
@ 2016-06-10 10:05   ` Geert Uytterhoeven
  -1 siblings, 0 replies; 14+ messages in thread
From: Geert Uytterhoeven @ 2016-06-10 10:05 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Linus Walleij, Ben Dooks, Laxman Dewangan, linux-renesas-soc,
	linux-sh, linux-gpio, Geert Uytterhoeven

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>
---
 drivers/pinctrl/sh-pfc/core.h        | 33 ---------------------------------
 drivers/pinctrl/sh-pfc/pfc-r8a73a4.c |  1 -
 drivers/pinctrl/sh-pfc/pfc-r8a7740.c |  1 -
 drivers/pinctrl/sh-pfc/pfc-r8a7778.c |  2 +-
 drivers/pinctrl/sh-pfc/pfc-r8a7790.c |  1 -
 drivers/pinctrl/sh-pfc/pfc-r8a7791.c |  1 -
 drivers/pinctrl/sh-pfc/sh_pfc.h      | 30 +++++++++++++++++++++++++++++-
 7 files changed, 30 insertions(+), 39 deletions(-)

diff --git a/drivers/pinctrl/sh-pfc/core.h b/drivers/pinctrl/sh-pfc/core.h
index 539ec7dc0b644dbe..9dde6ea5e28f3a1b 100644
--- a/drivers/pinctrl/sh-pfc/core.h
+++ b/drivers/pinctrl/sh-pfc/core.h
@@ -10,48 +10,15 @@
 #ifndef __SH_PFC_CORE_H__
 #define __SH_PFC_CORE_H__
 
-#include <linux/compiler.h>
-#include <linux/spinlock.h>
 #include <linux/types.h>
 
 #include "sh_pfc.h"
 
-struct sh_pfc_window {
-	phys_addr_t phys;
-	void __iomem *virt;
-	unsigned long size;
-};
-
-struct sh_pfc_chip;
-struct sh_pfc_pinctrl;
-
 struct sh_pfc_pin_range {
 	u16 start;
 	u16 end;
 };
 
-struct sh_pfc {
-	struct device *dev;
-	const struct sh_pfc_soc_info *info;
-	spinlock_t lock;
-
-	unsigned int num_windows;
-	struct sh_pfc_window *windows;
-	unsigned int num_irqs;
-	unsigned int *irqs;
-
-	struct sh_pfc_pin_range *ranges;
-	unsigned int nr_ranges;
-
-	unsigned int nr_gpio_pins;
-
-	struct sh_pfc_chip *gpio;
-#ifdef CONFIG_SUPERH
-	struct sh_pfc_chip *func;
-#endif
-
-};
-
 int sh_pfc_register_gpiochip(struct sh_pfc *pfc);
 int sh_pfc_unregister_gpiochip(struct sh_pfc *pfc);
 
diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a73a4.c b/drivers/pinctrl/sh-pfc/pfc-r8a73a4.c
index d9d9228b15faf6f3..ff5655dee67e5649 100644
--- a/drivers/pinctrl/sh-pfc/pfc-r8a73a4.c
+++ b/drivers/pinctrl/sh-pfc/pfc-r8a73a4.c
@@ -21,7 +21,6 @@
 #include <linux/kernel.h>
 #include <linux/pinctrl/pinconf-generic.h>
 
-#include "core.h"
 #include "sh_pfc.h"
 
 #define CPU_ALL_PORT(fn, pfx, sfx)					\
diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7740.c b/drivers/pinctrl/sh-pfc/pfc-r8a7740.c
index 7f7c8a6e76e88f29..35f436bcb849185a 100644
--- a/drivers/pinctrl/sh-pfc/pfc-r8a7740.c
+++ b/drivers/pinctrl/sh-pfc/pfc-r8a7740.c
@@ -22,7 +22,6 @@
 #include <linux/kernel.h>
 #include <linux/pinctrl/pinconf-generic.h>
 
-#include "core.h"
 #include "sh_pfc.h"
 
 #define CPU_ALL_PORT(fn, pfx, sfx)					\
diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7778.c b/drivers/pinctrl/sh-pfc/pfc-r8a7778.c
index 411d0887ba19bae6..18ef7042b3d1b047 100644
--- a/drivers/pinctrl/sh-pfc/pfc-r8a7778.c
+++ b/drivers/pinctrl/sh-pfc/pfc-r8a7778.c
@@ -23,7 +23,7 @@
 #include <linux/io.h>
 #include <linux/kernel.h>
 #include <linux/pinctrl/pinconf-generic.h>
-#include "core.h"
+
 #include "sh_pfc.h"
 
 #define PORT_GP_PUP_1(bank, pin, fn, sfx)	\
diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7790.c b/drivers/pinctrl/sh-pfc/pfc-r8a7790.c
index 1537a0779399772f..b769c05480da681e 100644
--- a/drivers/pinctrl/sh-pfc/pfc-r8a7790.c
+++ b/drivers/pinctrl/sh-pfc/pfc-r8a7790.c
@@ -24,7 +24,6 @@
 #include <linux/io.h>
 #include <linux/kernel.h>
 
-#include "core.h"
 #include "sh_pfc.h"
 
 /*
diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7791.c b/drivers/pinctrl/sh-pfc/pfc-r8a7791.c
index 01abbd5b4e49a783..0c1a60c9a844c7ee 100644
--- a/drivers/pinctrl/sh-pfc/pfc-r8a7791.c
+++ b/drivers/pinctrl/sh-pfc/pfc-r8a7791.c
@@ -11,7 +11,6 @@
 
 #include <linux/kernel.h>
 
-#include "core.h"
 #include "sh_pfc.h"
 
 #define CPU_ALL_PORT(fn, sfx)						\
diff --git a/drivers/pinctrl/sh-pfc/sh_pfc.h b/drivers/pinctrl/sh-pfc/sh_pfc.h
index 332d379b302cba70..5732752667e2654a 100644
--- a/drivers/pinctrl/sh-pfc/sh_pfc.h
+++ b/drivers/pinctrl/sh-pfc/sh_pfc.h
@@ -13,6 +13,7 @@
 
 #include <linux/bug.h>
 #include <linux/pinctrl/pinconf-generic.h>
+#include <linux/spinlock.h>
 #include <linux/stringify.h>
 
 enum {
@@ -182,7 +183,34 @@ struct pinmux_range {
 	u16 force;
 };
 
-struct sh_pfc;
+struct sh_pfc_window {
+	phys_addr_t phys;
+	void __iomem *virt;
+	unsigned long size;
+};
+
+struct sh_pfc_pin_range;
+
+struct sh_pfc {
+	struct device *dev;
+	const struct sh_pfc_soc_info *info;
+	spinlock_t lock;
+
+	unsigned int num_windows;
+	struct sh_pfc_window *windows;
+	unsigned int num_irqs;
+	unsigned int *irqs;
+
+	struct sh_pfc_pin_range *ranges;
+	unsigned int nr_ranges;
+
+	unsigned int nr_gpio_pins;
+
+	struct sh_pfc_chip *gpio;
+#ifdef CONFIG_SUPERH
+	struct sh_pfc_chip *func;
+#endif
+};
 
 struct sh_pfc_soc_operations {
 	int (*init)(struct sh_pfc *pfc);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 2/3] pinctrl: sh-pfc: Improve core and user API separation
@ 2016-06-10 10:05   ` Geert Uytterhoeven
  0 siblings, 0 replies; 14+ messages in thread
From: Geert Uytterhoeven @ 2016-06-10 10:05 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Linus Walleij, Ben Dooks, Laxman Dewangan, linux-renesas-soc,
	linux-sh, linux-gpio, Geert Uytterhoeven

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>
---
 drivers/pinctrl/sh-pfc/core.h        | 33 ---------------------------------
 drivers/pinctrl/sh-pfc/pfc-r8a73a4.c |  1 -
 drivers/pinctrl/sh-pfc/pfc-r8a7740.c |  1 -
 drivers/pinctrl/sh-pfc/pfc-r8a7778.c |  2 +-
 drivers/pinctrl/sh-pfc/pfc-r8a7790.c |  1 -
 drivers/pinctrl/sh-pfc/pfc-r8a7791.c |  1 -
 drivers/pinctrl/sh-pfc/sh_pfc.h      | 30 +++++++++++++++++++++++++++++-
 7 files changed, 30 insertions(+), 39 deletions(-)

diff --git a/drivers/pinctrl/sh-pfc/core.h b/drivers/pinctrl/sh-pfc/core.h
index 539ec7dc0b644dbe..9dde6ea5e28f3a1b 100644
--- a/drivers/pinctrl/sh-pfc/core.h
+++ b/drivers/pinctrl/sh-pfc/core.h
@@ -10,48 +10,15 @@
 #ifndef __SH_PFC_CORE_H__
 #define __SH_PFC_CORE_H__
 
-#include <linux/compiler.h>
-#include <linux/spinlock.h>
 #include <linux/types.h>
 
 #include "sh_pfc.h"
 
-struct sh_pfc_window {
-	phys_addr_t phys;
-	void __iomem *virt;
-	unsigned long size;
-};
-
-struct sh_pfc_chip;
-struct sh_pfc_pinctrl;
-
 struct sh_pfc_pin_range {
 	u16 start;
 	u16 end;
 };
 
-struct sh_pfc {
-	struct device *dev;
-	const struct sh_pfc_soc_info *info;
-	spinlock_t lock;
-
-	unsigned int num_windows;
-	struct sh_pfc_window *windows;
-	unsigned int num_irqs;
-	unsigned int *irqs;
-
-	struct sh_pfc_pin_range *ranges;
-	unsigned int nr_ranges;
-
-	unsigned int nr_gpio_pins;
-
-	struct sh_pfc_chip *gpio;
-#ifdef CONFIG_SUPERH
-	struct sh_pfc_chip *func;
-#endif
-
-};
-
 int sh_pfc_register_gpiochip(struct sh_pfc *pfc);
 int sh_pfc_unregister_gpiochip(struct sh_pfc *pfc);
 
diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a73a4.c b/drivers/pinctrl/sh-pfc/pfc-r8a73a4.c
index d9d9228b15faf6f3..ff5655dee67e5649 100644
--- a/drivers/pinctrl/sh-pfc/pfc-r8a73a4.c
+++ b/drivers/pinctrl/sh-pfc/pfc-r8a73a4.c
@@ -21,7 +21,6 @@
 #include <linux/kernel.h>
 #include <linux/pinctrl/pinconf-generic.h>
 
-#include "core.h"
 #include "sh_pfc.h"
 
 #define CPU_ALL_PORT(fn, pfx, sfx)					\
diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7740.c b/drivers/pinctrl/sh-pfc/pfc-r8a7740.c
index 7f7c8a6e76e88f29..35f436bcb849185a 100644
--- a/drivers/pinctrl/sh-pfc/pfc-r8a7740.c
+++ b/drivers/pinctrl/sh-pfc/pfc-r8a7740.c
@@ -22,7 +22,6 @@
 #include <linux/kernel.h>
 #include <linux/pinctrl/pinconf-generic.h>
 
-#include "core.h"
 #include "sh_pfc.h"
 
 #define CPU_ALL_PORT(fn, pfx, sfx)					\
diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7778.c b/drivers/pinctrl/sh-pfc/pfc-r8a7778.c
index 411d0887ba19bae6..18ef7042b3d1b047 100644
--- a/drivers/pinctrl/sh-pfc/pfc-r8a7778.c
+++ b/drivers/pinctrl/sh-pfc/pfc-r8a7778.c
@@ -23,7 +23,7 @@
 #include <linux/io.h>
 #include <linux/kernel.h>
 #include <linux/pinctrl/pinconf-generic.h>
-#include "core.h"
+
 #include "sh_pfc.h"
 
 #define PORT_GP_PUP_1(bank, pin, fn, sfx)	\
diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7790.c b/drivers/pinctrl/sh-pfc/pfc-r8a7790.c
index 1537a0779399772f..b769c05480da681e 100644
--- a/drivers/pinctrl/sh-pfc/pfc-r8a7790.c
+++ b/drivers/pinctrl/sh-pfc/pfc-r8a7790.c
@@ -24,7 +24,6 @@
 #include <linux/io.h>
 #include <linux/kernel.h>
 
-#include "core.h"
 #include "sh_pfc.h"
 
 /*
diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7791.c b/drivers/pinctrl/sh-pfc/pfc-r8a7791.c
index 01abbd5b4e49a783..0c1a60c9a844c7ee 100644
--- a/drivers/pinctrl/sh-pfc/pfc-r8a7791.c
+++ b/drivers/pinctrl/sh-pfc/pfc-r8a7791.c
@@ -11,7 +11,6 @@
 
 #include <linux/kernel.h>
 
-#include "core.h"
 #include "sh_pfc.h"
 
 #define CPU_ALL_PORT(fn, sfx)						\
diff --git a/drivers/pinctrl/sh-pfc/sh_pfc.h b/drivers/pinctrl/sh-pfc/sh_pfc.h
index 332d379b302cba70..5732752667e2654a 100644
--- a/drivers/pinctrl/sh-pfc/sh_pfc.h
+++ b/drivers/pinctrl/sh-pfc/sh_pfc.h
@@ -13,6 +13,7 @@
 
 #include <linux/bug.h>
 #include <linux/pinctrl/pinconf-generic.h>
+#include <linux/spinlock.h>
 #include <linux/stringify.h>
 
 enum {
@@ -182,7 +183,34 @@ struct pinmux_range {
 	u16 force;
 };
 
-struct sh_pfc;
+struct sh_pfc_window {
+	phys_addr_t phys;
+	void __iomem *virt;
+	unsigned long size;
+};
+
+struct sh_pfc_pin_range;
+
+struct sh_pfc {
+	struct device *dev;
+	const struct sh_pfc_soc_info *info;
+	spinlock_t lock;
+
+	unsigned int num_windows;
+	struct sh_pfc_window *windows;
+	unsigned int num_irqs;
+	unsigned int *irqs;
+
+	struct sh_pfc_pin_range *ranges;
+	unsigned int nr_ranges;
+
+	unsigned int nr_gpio_pins;
+
+	struct sh_pfc_chip *gpio;
+#ifdef CONFIG_SUPERH
+	struct sh_pfc_chip *func;
+#endif
+};
 
 struct sh_pfc_soc_operations {
 	int (*init)(struct sh_pfc *pfc);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 3/3] pinctrl: sh-pfc: Convert to devm_gpiochip_add_data()
  2016-06-10 10:05 ` Geert Uytterhoeven
@ 2016-06-10 10:05   ` Geert Uytterhoeven
  -1 siblings, 0 replies; 14+ messages in thread
From: Geert Uytterhoeven @ 2016-06-10 10:05 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Linus Walleij, Ben Dooks, Laxman Dewangan, linux-renesas-soc,
	linux-sh, linux-gpio, Geert Uytterhoeven

This allows to remove the .remove() callback, and all functions and data
it needed for its own bookkeeping.

Suggested-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/pinctrl/sh-pfc/core.c   | 10 ----------
 drivers/pinctrl/sh-pfc/core.h   |  1 -
 drivers/pinctrl/sh-pfc/gpio.c   | 13 +------------
 drivers/pinctrl/sh-pfc/sh_pfc.h |  3 ---
 4 files changed, 1 insertion(+), 26 deletions(-)

diff --git a/drivers/pinctrl/sh-pfc/core.c b/drivers/pinctrl/sh-pfc/core.c
index 9b9cee06ec59aad3..a3b82041b6a22b13 100644
--- a/drivers/pinctrl/sh-pfc/core.c
+++ b/drivers/pinctrl/sh-pfc/core.c
@@ -598,15 +598,6 @@ static int sh_pfc_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int sh_pfc_remove(struct platform_device *pdev)
-{
-#ifdef CONFIG_PINCTRL_SH_PFC_GPIO
-	sh_pfc_unregister_gpiochip(platform_get_drvdata(pdev));
-#endif
-
-	return 0;
-}
-
 static const struct platform_device_id sh_pfc_id_table[] = {
 #ifdef CONFIG_PINCTRL_PFC_SH7203
 	{ "pfc-sh7203", (kernel_ulong_t)&sh7203_pinmux_info },
@@ -650,7 +641,6 @@ static const struct platform_device_id sh_pfc_id_table[] = {
 
 static struct platform_driver sh_pfc_driver = {
 	.probe		= sh_pfc_probe,
-	.remove		= sh_pfc_remove,
 	.id_table	= sh_pfc_id_table,
 	.driver		= {
 		.name	= DRV_NAME,
diff --git a/drivers/pinctrl/sh-pfc/core.h b/drivers/pinctrl/sh-pfc/core.h
index 9dde6ea5e28f3a1b..0bbdea5849f41713 100644
--- a/drivers/pinctrl/sh-pfc/core.h
+++ b/drivers/pinctrl/sh-pfc/core.h
@@ -20,7 +20,6 @@ struct sh_pfc_pin_range {
 };
 
 int sh_pfc_register_gpiochip(struct sh_pfc *pfc);
-int sh_pfc_unregister_gpiochip(struct sh_pfc *pfc);
 
 int sh_pfc_register_pinctrl(struct sh_pfc *pfc);
 
diff --git a/drivers/pinctrl/sh-pfc/gpio.c b/drivers/pinctrl/sh-pfc/gpio.c
index 97dff6a09ff08115..6b5422766f13d7f8 100644
--- a/drivers/pinctrl/sh-pfc/gpio.c
+++ b/drivers/pinctrl/sh-pfc/gpio.c
@@ -318,7 +318,7 @@ sh_pfc_add_gpiochip(struct sh_pfc *pfc, int(*setup)(struct sh_pfc_chip *),
 	if (ret < 0)
 		return ERR_PTR(ret);
 
-	ret = gpiochip_add_data(&chip->gpio_chip, chip);
+	ret = devm_gpiochip_add_data(pfc->dev, &chip->gpio_chip, chip);
 	if (unlikely(ret < 0))
 		return ERR_PTR(ret);
 
@@ -399,18 +399,7 @@ int sh_pfc_register_gpiochip(struct sh_pfc *pfc)
 	chip = sh_pfc_add_gpiochip(pfc, gpio_function_setup, NULL);
 	if (IS_ERR(chip))
 		return PTR_ERR(chip);
-
-	pfc->func = chip;
 #endif /* CONFIG_SUPERH */
 
 	return 0;
 }
-
-int sh_pfc_unregister_gpiochip(struct sh_pfc *pfc)
-{
-	gpiochip_remove(&pfc->gpio->gpio_chip);
-#ifdef CONFIG_SUPERH
-	gpiochip_remove(&pfc->func->gpio_chip);
-#endif
-	return 0;
-}
diff --git a/drivers/pinctrl/sh-pfc/sh_pfc.h b/drivers/pinctrl/sh-pfc/sh_pfc.h
index 5732752667e2654a..5e966c09434d969c 100644
--- a/drivers/pinctrl/sh-pfc/sh_pfc.h
+++ b/drivers/pinctrl/sh-pfc/sh_pfc.h
@@ -207,9 +207,6 @@ struct sh_pfc {
 	unsigned int nr_gpio_pins;
 
 	struct sh_pfc_chip *gpio;
-#ifdef CONFIG_SUPERH
-	struct sh_pfc_chip *func;
-#endif
 };
 
 struct sh_pfc_soc_operations {
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 3/3] pinctrl: sh-pfc: Convert to devm_gpiochip_add_data()
@ 2016-06-10 10:05   ` Geert Uytterhoeven
  0 siblings, 0 replies; 14+ messages in thread
From: Geert Uytterhoeven @ 2016-06-10 10:05 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Linus Walleij, Ben Dooks, Laxman Dewangan, linux-renesas-soc,
	linux-sh, linux-gpio, Geert Uytterhoeven

This allows to remove the .remove() callback, and all functions and data
it needed for its own bookkeeping.

Suggested-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/pinctrl/sh-pfc/core.c   | 10 ----------
 drivers/pinctrl/sh-pfc/core.h   |  1 -
 drivers/pinctrl/sh-pfc/gpio.c   | 13 +------------
 drivers/pinctrl/sh-pfc/sh_pfc.h |  3 ---
 4 files changed, 1 insertion(+), 26 deletions(-)

diff --git a/drivers/pinctrl/sh-pfc/core.c b/drivers/pinctrl/sh-pfc/core.c
index 9b9cee06ec59aad3..a3b82041b6a22b13 100644
--- a/drivers/pinctrl/sh-pfc/core.c
+++ b/drivers/pinctrl/sh-pfc/core.c
@@ -598,15 +598,6 @@ static int sh_pfc_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int sh_pfc_remove(struct platform_device *pdev)
-{
-#ifdef CONFIG_PINCTRL_SH_PFC_GPIO
-	sh_pfc_unregister_gpiochip(platform_get_drvdata(pdev));
-#endif
-
-	return 0;
-}
-
 static const struct platform_device_id sh_pfc_id_table[] = {
 #ifdef CONFIG_PINCTRL_PFC_SH7203
 	{ "pfc-sh7203", (kernel_ulong_t)&sh7203_pinmux_info },
@@ -650,7 +641,6 @@ static const struct platform_device_id sh_pfc_id_table[] = {
 
 static struct platform_driver sh_pfc_driver = {
 	.probe		= sh_pfc_probe,
-	.remove		= sh_pfc_remove,
 	.id_table	= sh_pfc_id_table,
 	.driver		= {
 		.name	= DRV_NAME,
diff --git a/drivers/pinctrl/sh-pfc/core.h b/drivers/pinctrl/sh-pfc/core.h
index 9dde6ea5e28f3a1b..0bbdea5849f41713 100644
--- a/drivers/pinctrl/sh-pfc/core.h
+++ b/drivers/pinctrl/sh-pfc/core.h
@@ -20,7 +20,6 @@ struct sh_pfc_pin_range {
 };
 
 int sh_pfc_register_gpiochip(struct sh_pfc *pfc);
-int sh_pfc_unregister_gpiochip(struct sh_pfc *pfc);
 
 int sh_pfc_register_pinctrl(struct sh_pfc *pfc);
 
diff --git a/drivers/pinctrl/sh-pfc/gpio.c b/drivers/pinctrl/sh-pfc/gpio.c
index 97dff6a09ff08115..6b5422766f13d7f8 100644
--- a/drivers/pinctrl/sh-pfc/gpio.c
+++ b/drivers/pinctrl/sh-pfc/gpio.c
@@ -318,7 +318,7 @@ sh_pfc_add_gpiochip(struct sh_pfc *pfc, int(*setup)(struct sh_pfc_chip *),
 	if (ret < 0)
 		return ERR_PTR(ret);
 
-	ret = gpiochip_add_data(&chip->gpio_chip, chip);
+	ret = devm_gpiochip_add_data(pfc->dev, &chip->gpio_chip, chip);
 	if (unlikely(ret < 0))
 		return ERR_PTR(ret);
 
@@ -399,18 +399,7 @@ int sh_pfc_register_gpiochip(struct sh_pfc *pfc)
 	chip = sh_pfc_add_gpiochip(pfc, gpio_function_setup, NULL);
 	if (IS_ERR(chip))
 		return PTR_ERR(chip);
-
-	pfc->func = chip;
 #endif /* CONFIG_SUPERH */
 
 	return 0;
 }
-
-int sh_pfc_unregister_gpiochip(struct sh_pfc *pfc)
-{
-	gpiochip_remove(&pfc->gpio->gpio_chip);
-#ifdef CONFIG_SUPERH
-	gpiochip_remove(&pfc->func->gpio_chip);
-#endif
-	return 0;
-}
diff --git a/drivers/pinctrl/sh-pfc/sh_pfc.h b/drivers/pinctrl/sh-pfc/sh_pfc.h
index 5732752667e2654a..5e966c09434d969c 100644
--- a/drivers/pinctrl/sh-pfc/sh_pfc.h
+++ b/drivers/pinctrl/sh-pfc/sh_pfc.h
@@ -207,9 +207,6 @@ struct sh_pfc {
 	unsigned int nr_gpio_pins;
 
 	struct sh_pfc_chip *gpio;
-#ifdef CONFIG_SUPERH
-	struct sh_pfc_chip *func;
-#endif
 };
 
 struct sh_pfc_soc_operations {
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/3] pinctrl: sh-pfc: Improve core and user API separation
  2016-06-10 10:05   ` Geert Uytterhoeven
@ 2016-06-10 12:16     ` Laurent Pinchart
  -1 siblings, 0 replies; 14+ messages in thread
From: Laurent Pinchart @ 2016-06-10 12:16 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Linus Walleij, Ben Dooks, Laxman Dewangan, linux-renesas-soc,
	linux-sh, linux-gpio

Hi Geert,

Thank you for the patch.

On Friday 10 Jun 2016 12:05:02 Geert Uytterhoeven wrote:
> 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.

The idea behind sh_pfc.h is to store all structures and macros needed by the 
SoC drivers to define SoC data, in order to keep core.h clean. It you move 
most of core.h to sh_pfc.h I'd rather merge the two files.

> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
>  drivers/pinctrl/sh-pfc/core.h        | 33 ---------------------------------
>  drivers/pinctrl/sh-pfc/pfc-r8a73a4.c |  1 -
>  drivers/pinctrl/sh-pfc/pfc-r8a7740.c |  1 -
>  drivers/pinctrl/sh-pfc/pfc-r8a7778.c |  2 +-
>  drivers/pinctrl/sh-pfc/pfc-r8a7790.c |  1 -
>  drivers/pinctrl/sh-pfc/pfc-r8a7791.c |  1 -
>  drivers/pinctrl/sh-pfc/sh_pfc.h      | 30 +++++++++++++++++++++++++++++-
>  7 files changed, 30 insertions(+), 39 deletions(-)
> 
> diff --git a/drivers/pinctrl/sh-pfc/core.h b/drivers/pinctrl/sh-pfc/core.h
> index 539ec7dc0b644dbe..9dde6ea5e28f3a1b 100644
> --- a/drivers/pinctrl/sh-pfc/core.h
> +++ b/drivers/pinctrl/sh-pfc/core.h
> @@ -10,48 +10,15 @@
>  #ifndef __SH_PFC_CORE_H__
>  #define __SH_PFC_CORE_H__
> 
> -#include <linux/compiler.h>
> -#include <linux/spinlock.h>
>  #include <linux/types.h>
> 
>  #include "sh_pfc.h"
> 
> -struct sh_pfc_window {
> -	phys_addr_t phys;
> -	void __iomem *virt;
> -	unsigned long size;
> -};
> -
> -struct sh_pfc_chip;
> -struct sh_pfc_pinctrl;
> -
>  struct sh_pfc_pin_range {
>  	u16 start;
>  	u16 end;
>  };
> 
> -struct sh_pfc {
> -	struct device *dev;
> -	const struct sh_pfc_soc_info *info;
> -	spinlock_t lock;
> -
> -	unsigned int num_windows;
> -	struct sh_pfc_window *windows;
> -	unsigned int num_irqs;
> -	unsigned int *irqs;
> -
> -	struct sh_pfc_pin_range *ranges;
> -	unsigned int nr_ranges;
> -
> -	unsigned int nr_gpio_pins;
> -
> -	struct sh_pfc_chip *gpio;
> -#ifdef CONFIG_SUPERH
> -	struct sh_pfc_chip *func;
> -#endif
> -
> -};
> -
>  int sh_pfc_register_gpiochip(struct sh_pfc *pfc);
>  int sh_pfc_unregister_gpiochip(struct sh_pfc *pfc);
> 
> diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a73a4.c
> b/drivers/pinctrl/sh-pfc/pfc-r8a73a4.c index
> d9d9228b15faf6f3..ff5655dee67e5649 100644
> --- a/drivers/pinctrl/sh-pfc/pfc-r8a73a4.c
> +++ b/drivers/pinctrl/sh-pfc/pfc-r8a73a4.c
> @@ -21,7 +21,6 @@
>  #include <linux/kernel.h>
>  #include <linux/pinctrl/pinconf-generic.h>
> 
> -#include "core.h"
>  #include "sh_pfc.h"
> 
>  #define CPU_ALL_PORT(fn, pfx, sfx)					\
> diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7740.c
> b/drivers/pinctrl/sh-pfc/pfc-r8a7740.c index
> 7f7c8a6e76e88f29..35f436bcb849185a 100644
> --- a/drivers/pinctrl/sh-pfc/pfc-r8a7740.c
> +++ b/drivers/pinctrl/sh-pfc/pfc-r8a7740.c
> @@ -22,7 +22,6 @@
>  #include <linux/kernel.h>
>  #include <linux/pinctrl/pinconf-generic.h>
> 
> -#include "core.h"
>  #include "sh_pfc.h"
> 
>  #define CPU_ALL_PORT(fn, pfx, sfx)					\
> diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7778.c
> b/drivers/pinctrl/sh-pfc/pfc-r8a7778.c index
> 411d0887ba19bae6..18ef7042b3d1b047 100644
> --- a/drivers/pinctrl/sh-pfc/pfc-r8a7778.c
> +++ b/drivers/pinctrl/sh-pfc/pfc-r8a7778.c
> @@ -23,7 +23,7 @@
>  #include <linux/io.h>
>  #include <linux/kernel.h>
>  #include <linux/pinctrl/pinconf-generic.h>
> -#include "core.h"
> +
>  #include "sh_pfc.h"
> 
>  #define PORT_GP_PUP_1(bank, pin, fn, sfx)	\
> diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7790.c
> b/drivers/pinctrl/sh-pfc/pfc-r8a7790.c index
> 1537a0779399772f..b769c05480da681e 100644
> --- a/drivers/pinctrl/sh-pfc/pfc-r8a7790.c
> +++ b/drivers/pinctrl/sh-pfc/pfc-r8a7790.c
> @@ -24,7 +24,6 @@
>  #include <linux/io.h>
>  #include <linux/kernel.h>
> 
> -#include "core.h"
>  #include "sh_pfc.h"
> 
>  /*
> diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7791.c
> b/drivers/pinctrl/sh-pfc/pfc-r8a7791.c index
> 01abbd5b4e49a783..0c1a60c9a844c7ee 100644
> --- a/drivers/pinctrl/sh-pfc/pfc-r8a7791.c
> +++ b/drivers/pinctrl/sh-pfc/pfc-r8a7791.c
> @@ -11,7 +11,6 @@
> 
>  #include <linux/kernel.h>
> 
> -#include "core.h"
>  #include "sh_pfc.h"
> 
>  #define CPU_ALL_PORT(fn, sfx)						\
> diff --git a/drivers/pinctrl/sh-pfc/sh_pfc.h
> b/drivers/pinctrl/sh-pfc/sh_pfc.h index 332d379b302cba70..5732752667e2654a
> 100644
> --- a/drivers/pinctrl/sh-pfc/sh_pfc.h
> +++ b/drivers/pinctrl/sh-pfc/sh_pfc.h
> @@ -13,6 +13,7 @@
> 
>  #include <linux/bug.h>
>  #include <linux/pinctrl/pinconf-generic.h>
> +#include <linux/spinlock.h>
>  #include <linux/stringify.h>
> 
>  enum {
> @@ -182,7 +183,34 @@ struct pinmux_range {
>  	u16 force;
>  };
> 
> -struct sh_pfc;
> +struct sh_pfc_window {
> +	phys_addr_t phys;
> +	void __iomem *virt;
> +	unsigned long size;
> +};
> +
> +struct sh_pfc_pin_range;
> +
> +struct sh_pfc {
> +	struct device *dev;
> +	const struct sh_pfc_soc_info *info;
> +	spinlock_t lock;
> +
> +	unsigned int num_windows;
> +	struct sh_pfc_window *windows;
> +	unsigned int num_irqs;
> +	unsigned int *irqs;
> +
> +	struct sh_pfc_pin_range *ranges;
> +	unsigned int nr_ranges;
> +
> +	unsigned int nr_gpio_pins;
> +
> +	struct sh_pfc_chip *gpio;
> +#ifdef CONFIG_SUPERH
> +	struct sh_pfc_chip *func;
> +#endif
> +};
> 
>  struct sh_pfc_soc_operations {
>  	int (*init)(struct sh_pfc *pfc);

-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/3] pinctrl: sh-pfc: Improve core and user API separation
@ 2016-06-10 12:16     ` Laurent Pinchart
  0 siblings, 0 replies; 14+ messages in thread
From: Laurent Pinchart @ 2016-06-10 12:16 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Linus Walleij, Ben Dooks, Laxman Dewangan, linux-renesas-soc,
	linux-sh, linux-gpio

Hi Geert,

Thank you for the patch.

On Friday 10 Jun 2016 12:05:02 Geert Uytterhoeven wrote:
> 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.

The idea behind sh_pfc.h is to store all structures and macros needed by the 
SoC drivers to define SoC data, in order to keep core.h clean. It you move 
most of core.h to sh_pfc.h I'd rather merge the two files.

> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
>  drivers/pinctrl/sh-pfc/core.h        | 33 ---------------------------------
>  drivers/pinctrl/sh-pfc/pfc-r8a73a4.c |  1 -
>  drivers/pinctrl/sh-pfc/pfc-r8a7740.c |  1 -
>  drivers/pinctrl/sh-pfc/pfc-r8a7778.c |  2 +-
>  drivers/pinctrl/sh-pfc/pfc-r8a7790.c |  1 -
>  drivers/pinctrl/sh-pfc/pfc-r8a7791.c |  1 -
>  drivers/pinctrl/sh-pfc/sh_pfc.h      | 30 +++++++++++++++++++++++++++++-
>  7 files changed, 30 insertions(+), 39 deletions(-)
> 
> diff --git a/drivers/pinctrl/sh-pfc/core.h b/drivers/pinctrl/sh-pfc/core.h
> index 539ec7dc0b644dbe..9dde6ea5e28f3a1b 100644
> --- a/drivers/pinctrl/sh-pfc/core.h
> +++ b/drivers/pinctrl/sh-pfc/core.h
> @@ -10,48 +10,15 @@
>  #ifndef __SH_PFC_CORE_H__
>  #define __SH_PFC_CORE_H__
> 
> -#include <linux/compiler.h>
> -#include <linux/spinlock.h>
>  #include <linux/types.h>
> 
>  #include "sh_pfc.h"
> 
> -struct sh_pfc_window {
> -	phys_addr_t phys;
> -	void __iomem *virt;
> -	unsigned long size;
> -};
> -
> -struct sh_pfc_chip;
> -struct sh_pfc_pinctrl;
> -
>  struct sh_pfc_pin_range {
>  	u16 start;
>  	u16 end;
>  };
> 
> -struct sh_pfc {
> -	struct device *dev;
> -	const struct sh_pfc_soc_info *info;
> -	spinlock_t lock;
> -
> -	unsigned int num_windows;
> -	struct sh_pfc_window *windows;
> -	unsigned int num_irqs;
> -	unsigned int *irqs;
> -
> -	struct sh_pfc_pin_range *ranges;
> -	unsigned int nr_ranges;
> -
> -	unsigned int nr_gpio_pins;
> -
> -	struct sh_pfc_chip *gpio;
> -#ifdef CONFIG_SUPERH
> -	struct sh_pfc_chip *func;
> -#endif
> -
> -};
> -
>  int sh_pfc_register_gpiochip(struct sh_pfc *pfc);
>  int sh_pfc_unregister_gpiochip(struct sh_pfc *pfc);
> 
> diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a73a4.c
> b/drivers/pinctrl/sh-pfc/pfc-r8a73a4.c index
> d9d9228b15faf6f3..ff5655dee67e5649 100644
> --- a/drivers/pinctrl/sh-pfc/pfc-r8a73a4.c
> +++ b/drivers/pinctrl/sh-pfc/pfc-r8a73a4.c
> @@ -21,7 +21,6 @@
>  #include <linux/kernel.h>
>  #include <linux/pinctrl/pinconf-generic.h>
> 
> -#include "core.h"
>  #include "sh_pfc.h"
> 
>  #define CPU_ALL_PORT(fn, pfx, sfx)					\
> diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7740.c
> b/drivers/pinctrl/sh-pfc/pfc-r8a7740.c index
> 7f7c8a6e76e88f29..35f436bcb849185a 100644
> --- a/drivers/pinctrl/sh-pfc/pfc-r8a7740.c
> +++ b/drivers/pinctrl/sh-pfc/pfc-r8a7740.c
> @@ -22,7 +22,6 @@
>  #include <linux/kernel.h>
>  #include <linux/pinctrl/pinconf-generic.h>
> 
> -#include "core.h"
>  #include "sh_pfc.h"
> 
>  #define CPU_ALL_PORT(fn, pfx, sfx)					\
> diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7778.c
> b/drivers/pinctrl/sh-pfc/pfc-r8a7778.c index
> 411d0887ba19bae6..18ef7042b3d1b047 100644
> --- a/drivers/pinctrl/sh-pfc/pfc-r8a7778.c
> +++ b/drivers/pinctrl/sh-pfc/pfc-r8a7778.c
> @@ -23,7 +23,7 @@
>  #include <linux/io.h>
>  #include <linux/kernel.h>
>  #include <linux/pinctrl/pinconf-generic.h>
> -#include "core.h"
> +
>  #include "sh_pfc.h"
> 
>  #define PORT_GP_PUP_1(bank, pin, fn, sfx)	\
> diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7790.c
> b/drivers/pinctrl/sh-pfc/pfc-r8a7790.c index
> 1537a0779399772f..b769c05480da681e 100644
> --- a/drivers/pinctrl/sh-pfc/pfc-r8a7790.c
> +++ b/drivers/pinctrl/sh-pfc/pfc-r8a7790.c
> @@ -24,7 +24,6 @@
>  #include <linux/io.h>
>  #include <linux/kernel.h>
> 
> -#include "core.h"
>  #include "sh_pfc.h"
> 
>  /*
> diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7791.c
> b/drivers/pinctrl/sh-pfc/pfc-r8a7791.c index
> 01abbd5b4e49a783..0c1a60c9a844c7ee 100644
> --- a/drivers/pinctrl/sh-pfc/pfc-r8a7791.c
> +++ b/drivers/pinctrl/sh-pfc/pfc-r8a7791.c
> @@ -11,7 +11,6 @@
> 
>  #include <linux/kernel.h>
> 
> -#include "core.h"
>  #include "sh_pfc.h"
> 
>  #define CPU_ALL_PORT(fn, sfx)						\
> diff --git a/drivers/pinctrl/sh-pfc/sh_pfc.h
> b/drivers/pinctrl/sh-pfc/sh_pfc.h index 332d379b302cba70..5732752667e2654a
> 100644
> --- a/drivers/pinctrl/sh-pfc/sh_pfc.h
> +++ b/drivers/pinctrl/sh-pfc/sh_pfc.h
> @@ -13,6 +13,7 @@
> 
>  #include <linux/bug.h>
>  #include <linux/pinctrl/pinconf-generic.h>
> +#include <linux/spinlock.h>
>  #include <linux/stringify.h>
> 
>  enum {
> @@ -182,7 +183,34 @@ struct pinmux_range {
>  	u16 force;
>  };
> 
> -struct sh_pfc;
> +struct sh_pfc_window {
> +	phys_addr_t phys;
> +	void __iomem *virt;
> +	unsigned long size;
> +};
> +
> +struct sh_pfc_pin_range;
> +
> +struct sh_pfc {
> +	struct device *dev;
> +	const struct sh_pfc_soc_info *info;
> +	spinlock_t lock;
> +
> +	unsigned int num_windows;
> +	struct sh_pfc_window *windows;
> +	unsigned int num_irqs;
> +	unsigned int *irqs;
> +
> +	struct sh_pfc_pin_range *ranges;
> +	unsigned int nr_ranges;
> +
> +	unsigned int nr_gpio_pins;
> +
> +	struct sh_pfc_chip *gpio;
> +#ifdef CONFIG_SUPERH
> +	struct sh_pfc_chip *func;
> +#endif
> +};
> 
>  struct sh_pfc_soc_operations {
>  	int (*init)(struct sh_pfc *pfc);

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/3] pinctrl: sh-pfc: Improve core and user API separation
  2016-06-10 12:16     ` Laurent Pinchart
@ 2016-06-10 12:48       ` Geert Uytterhoeven
  -1 siblings, 0 replies; 14+ messages in thread
From: Geert Uytterhoeven @ 2016-06-10 12:48 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Geert Uytterhoeven, Linus Walleij, Ben Dooks, Laxman Dewangan,
	linux-renesas-soc, Linux-sh list, linux-gpio

Hi Laurent,

On Fri, Jun 10, 2016 at 2:16 PM, Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:
> On Friday 10 Jun 2016 12:05:02 Geert Uytterhoeven wrote:
>> 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.
>
> The idea behind sh_pfc.h is to store all structures and macros needed by the
> SoC drivers to define SoC data, in order to keep core.h clean. It you move

So should there be 3 includes:
  1. structures and macros needed by the SoC drivers to define SoC data,
  2. internal API,
  3. API for users (SoC-specific drivers)?

> most of core.h to sh_pfc.h I'd rather merge the two files.

That's the other option...

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/3] pinctrl: sh-pfc: Improve core and user API separation
@ 2016-06-10 12:48       ` Geert Uytterhoeven
  0 siblings, 0 replies; 14+ messages in thread
From: Geert Uytterhoeven @ 2016-06-10 12:48 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Geert Uytterhoeven, Linus Walleij, Ben Dooks, Laxman Dewangan,
	linux-renesas-soc, Linux-sh list, linux-gpio

Hi Laurent,

On Fri, Jun 10, 2016 at 2:16 PM, Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:
> On Friday 10 Jun 2016 12:05:02 Geert Uytterhoeven wrote:
>> 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.
>
> The idea behind sh_pfc.h is to store all structures and macros needed by the
> SoC drivers to define SoC data, in order to keep core.h clean. It you move

So should there be 3 includes:
  1. structures and macros needed by the SoC drivers to define SoC data,
  2. internal API,
  3. API for users (SoC-specific drivers)?

> most of core.h to sh_pfc.h I'd rather merge the two files.

That's the other option...

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 0/3] pinctrl: sh-pfc: Cleanups
  2016-06-10 10:05 ` Geert Uytterhoeven
@ 2016-06-13 12:00   ` Linus Walleij
  -1 siblings, 0 replies; 14+ messages in thread
From: Linus Walleij @ 2016-06-13 12:00 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Laurent Pinchart, Ben Dooks, Laxman Dewangan, linux-renesas-soc,
	linux-sh, linux-gpio

On Fri, Jun 10, 2016 at 12:05 PM, Geert Uytterhoeven
<geert+renesas@glider.be> wrote:

> This series contains various cleanups for the Renesas Pin Function
> Controller driver subsystem.

Acked-by: Linus Walleij <linus.walleij@linaro.org>

I guess I will get them by pull request from you.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 0/3] pinctrl: sh-pfc: Cleanups
@ 2016-06-13 12:00   ` Linus Walleij
  0 siblings, 0 replies; 14+ messages in thread
From: Linus Walleij @ 2016-06-13 12:00 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Laurent Pinchart, Ben Dooks, Laxman Dewangan, linux-renesas-soc,
	linux-sh, linux-gpio

On Fri, Jun 10, 2016 at 12:05 PM, Geert Uytterhoeven
<geert+renesas@glider.be> wrote:

> This series contains various cleanups for the Renesas Pin Function
> Controller driver subsystem.

Acked-by: Linus Walleij <linus.walleij@linaro.org>

I guess I will get them by pull request from you.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2016-06-13 12:00 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-10 10:05 [PATCH 0/3] pinctrl: sh-pfc: Cleanups Geert Uytterhoeven
2016-06-10 10:05 ` Geert Uytterhoeven
2016-06-10 10:05 ` [PATCH 1/3] pinctrl: sh-pfc: Move SoC-specific forward declarations to sh_pfc.h Geert Uytterhoeven
2016-06-10 10:05   ` Geert Uytterhoeven
2016-06-10 10:05 ` [PATCH 2/3] pinctrl: sh-pfc: Improve core and user API separation Geert Uytterhoeven
2016-06-10 10:05   ` Geert Uytterhoeven
2016-06-10 12:16   ` Laurent Pinchart
2016-06-10 12:16     ` Laurent Pinchart
2016-06-10 12:48     ` Geert Uytterhoeven
2016-06-10 12:48       ` Geert Uytterhoeven
2016-06-10 10:05 ` [PATCH 3/3] pinctrl: sh-pfc: Convert to devm_gpiochip_add_data() Geert Uytterhoeven
2016-06-10 10:05   ` Geert Uytterhoeven
2016-06-13 12:00 ` [PATCH 0/3] pinctrl: sh-pfc: Cleanups Linus Walleij
2016-06-13 12:00   ` Linus Walleij

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.