drivers: intc: intrc_shared: get client count from SUPPORTS_DEP_ORDS

The intc_shared driver used kconfig to set the number of clients.
This commit changes the driver to determine the number of clients
per instance using supports ordinals information from device tree.

Leave the kconfig symbol for the number of clients, it now only defines
the array size in driver data and therefore an upper limit of how
many clients can be defined in dts.
It will be removed later with changes of driver data struct.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
diff --git a/drivers/interrupt_controller/intc_shared_irq.c b/drivers/interrupt_controller/intc_shared_irq.c
index 4988ac4..ae857a3 100644
--- a/drivers/interrupt_controller/intc_shared_irq.c
+++ b/drivers/interrupt_controller/intc_shared_irq.c
@@ -143,6 +143,15 @@
 	return 0;
 }
 
+/*
+ * INST_SUPPORTS_DEP_ORDS_CNT: Counts the number of "elements" in
+ * DT_SUPPORTS_DEP_ORDS(n). There is a comma after each ordinal(inc. the last)
+ * Hence FOR_EACH adds "+1" once too often which has to be subtracted in the end.
+ */
+#define F1(x) 1
+#define INST_SUPPORTS_DEP_ORDS_CNT(n)  \
+	(FOR_EACH(F1, (+), DT_INST_SUPPORTS_DEP_ORDS(n)) - 1)
+
 #define SHARED_IRQ_CONFIG_FUNC(n)					\
 void shared_irq_config_func_##n(void)					\
 {									\
@@ -159,7 +168,7 @@
 									\
 	const struct shared_irq_config shared_irq_config_##n = {	\
 		.irq_num = DT_INST_IRQN(n),				\
-		.client_count = CONFIG_SHARED_IRQ_NUM_CLIENTS,		\
+		.client_count = INST_SUPPORTS_DEP_ORDS_CNT(n),		\
 		.config = shared_irq_config_func_##n			\
 	};								\
 	DEVICE_DT_INST_DEFINE(n, shared_irq_initialize,			\