diff mbox series

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

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

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

Andy Shevchenko Dec. 27, 2022, 7:19 p.m. UTC | #1
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 | #2
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 :)
diff mbox series

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