[v1,01/17] pinctrl: intel: Introduce INTEL_COMMUNITY_*() to unify community macros

Message ID 20221219122643.3513-1-andriy.shevchenko@linux.intel.com
State New
Headers
Series [v1,01/17] pinctrl: intel: Introduce INTEL_COMMUNITY_*() to unify community macros |

Commit Message

Andy Shevchenko Dec. 19, 2022, 12:26 p.m. UTC
  Now it becomes visible that we can deduplicate SoC specific
*_COMMUNITY() macros across the Intel pin control drivers.
For that, introduce a common INTEL_COMMUNITY_GPPS() and
INTEL_COMMUNITY_SIZE() macros in the pinctrl-intel.h.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/pinctrl/intel/pinctrl-intel.h | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
  

Comments

Mika Westerberg Dec. 19, 2022, 2:32 p.m. UTC | #1
Hi Andy,

On Mon, Dec 19, 2022 at 02:26:27PM +0200, Andy Shevchenko wrote:
> Now it becomes visible that we can deduplicate SoC specific
> *_COMMUNITY() macros across the Intel pin control drivers.
> For that, introduce a common INTEL_COMMUNITY_GPPS() and
> INTEL_COMMUNITY_SIZE() macros in the pinctrl-intel.h.

You should really start learning how to use --cover-letter option with
git format-patch because for anything more than one patch pretty much
requires such. Here I would really like to see how much lines this
series ends up removing :)

The series looks good to me, though.
  
Andy Shevchenko Dec. 19, 2022, 2:38 p.m. UTC | #2
On Mon, Dec 19, 2022 at 04:32:55PM +0200, Mika Westerberg wrote:
> On Mon, Dec 19, 2022 at 02:26:27PM +0200, Andy Shevchenko wrote:
> > Now it becomes visible that we can deduplicate SoC specific
> > *_COMMUNITY() macros across the Intel pin control drivers.
> > For that, introduce a common INTEL_COMMUNITY_GPPS() and
> > INTEL_COMMUNITY_SIZE() macros in the pinctrl-intel.h.
> 
> You should really start learning how to use --cover-letter option with
> git format-patch because for anything more than one patch pretty much
> requires such.

Oh, indeed.

> Here I would really like to see how much lines this
> series ends up removing :)

drivers/pinctrl/intel/pinctrl-alderlake.c    | 18 ++----------------
drivers/pinctrl/intel/pinctrl-broxton.c      | 31 +++++++++++--------------------
drivers/pinctrl/intel/pinctrl-cannonlake.c   | 31 +++++++++++--------------------
drivers/pinctrl/intel/pinctrl-cedarfork.c    | 13 +------------
drivers/pinctrl/intel/pinctrl-denverton.c    | 13 +------------
drivers/pinctrl/intel/pinctrl-elkhartlake.c  | 24 +++++++-----------------
drivers/pinctrl/intel/pinctrl-emmitsburg.c   | 13 +------------
drivers/pinctrl/intel/pinctrl-geminilake.c   | 21 ++++++---------------
drivers/pinctrl/intel/pinctrl-icelake.c      | 35 +++++++++++++----------------------
drivers/pinctrl/intel/pinctrl-intel.c        |  9 +--------
drivers/pinctrl/intel/pinctrl-intel.h        | 35 +++++++++++++++++++++++++++++------
drivers/pinctrl/intel/pinctrl-jasperlake.c   | 13 +------------
drivers/pinctrl/intel/pinctrl-lakefield.c    | 13 +------------
drivers/pinctrl/intel/pinctrl-lewisburg.c    | 12 +-----------
drivers/pinctrl/intel/pinctrl-meteorlake.c   | 23 ++++++-----------------
drivers/pinctrl/intel/pinctrl-sunrisepoint.c | 37 +++++++++++++------------------------
drivers/pinctrl/intel/pinctrl-tigerlake.c    | 30 ++++++++++--------------------
17 files changed, 115 insertions(+), 256 deletions(-)

> The series looks good to me, though.

Thank you!
  
Andy Shevchenko Dec. 27, 2022, 7:19 p.m. UTC | #3
On Mon, Dec 19, 2022 at 04:32:55PM +0200, Mika Westerberg wrote:
> On Mon, Dec 19, 2022 at 02:26:27PM +0200, Andy Shevchenko wrote:
> > Now it becomes visible that we can deduplicate SoC specific
> > *_COMMUNITY() macros across the Intel pin control drivers.
> > For that, introduce a common INTEL_COMMUNITY_GPPS() and
> > INTEL_COMMUNITY_SIZE() macros in the pinctrl-intel.h.
> 
> You should really start learning how to use --cover-letter option with
> git format-patch because for anything more than one patch pretty much
> requires such. Here I would really like to see how much lines this
> series ends up removing :)
> 
> The series looks good to me, though.

The series has been pushed to my review and testing branch, thanks!

P.S. I dared to convert the above into your Acked-by tag. Tell me if it must
not be the case.
  
Mika Westerberg Dec. 28, 2022, 6:50 a.m. UTC | #4
On Tue, Dec 27, 2022 at 09:19:12PM +0200, Andy Shevchenko wrote:
> On Mon, Dec 19, 2022 at 04:32:55PM +0200, Mika Westerberg wrote:
> > On Mon, Dec 19, 2022 at 02:26:27PM +0200, Andy Shevchenko wrote:
> > > Now it becomes visible that we can deduplicate SoC specific
> > > *_COMMUNITY() macros across the Intel pin control drivers.
> > > For that, introduce a common INTEL_COMMUNITY_GPPS() and
> > > INTEL_COMMUNITY_SIZE() macros in the pinctrl-intel.h.
> > 
> > You should really start learning how to use --cover-letter option with
> > git format-patch because for anything more than one patch pretty much
> > requires such. Here I would really like to see how much lines this
> > series ends up removing :)
> > 
> > The series looks good to me, though.
> 
> The series has been pushed to my review and testing branch, thanks!
> 
> P.S. I dared to convert the above into your Acked-by tag. Tell me if it must
> not be the case.

That's fine, forgot to add it myself :)
  

Patch

diff --git a/drivers/pinctrl/intel/pinctrl-intel.h b/drivers/pinctrl/intel/pinctrl-intel.h
index 65628423bf63..b0f2be4c1fd1 100644
--- a/drivers/pinctrl/intel/pinctrl-intel.h
+++ b/drivers/pinctrl/intel/pinctrl-intel.h
@@ -143,6 +143,28 @@  struct intel_community {
 #define PINCTRL_FEATURE_BLINK		BIT(4)
 #define PINCTRL_FEATURE_EXP		BIT(5)
 
+#define __INTEL_COMMUNITY(b, s, e, g, n, gs, gn, soc)		\
+	{							\
+		.barno = (b),					\
+		.padown_offset = soc ## _PAD_OWN,		\
+		.padcfglock_offset = soc ## _PADCFGLOCK,	\
+		.hostown_offset = soc ## _HOSTSW_OWN,		\
+		.is_offset = soc ## _GPI_IS,			\
+		.ie_offset = soc ## _GPI_IE,			\
+		.gpp_size = (gs),				\
+		.gpp_num_padown_regs = (gn),			\
+		.pin_base = (s),				\
+		.npins = ((e) - (s) + 1),			\
+		.gpps = (g),					\
+		.ngpps = (n),					\
+	}
+
+#define INTEL_COMMUNITY_GPPS(b, s, e, g, soc)			\
+	__INTEL_COMMUNITY(b, s, e, g, ARRAY_SIZE(g), 0, 0, soc)
+
+#define INTEL_COMMUNITY_SIZE(b, s, e, gs, gn, soc)		\
+	__INTEL_COMMUNITY(b, s, e, NULL, 0, gs, gn, soc)
+
 /**
  * PIN_GROUP - Declare a pin group
  * @n: Name of the group