linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 0/5] irqdomain: clean up, add irq_domain_create_legacy()
@ 2020-07-08 16:21 Andy Shevchenko
  2020-07-08 16:21 ` [PATCH v1 1/5] irqdomain: Remove unused of_device_id forward declaration Andy Shevchenko
                   ` (6 more replies)
  0 siblings, 7 replies; 10+ messages in thread
From: Andy Shevchenko @ 2020-07-08 16:21 UTC (permalink / raw)
  To: Mark Brown, linux-kernel, Greg Kroah-Hartman, Rafael J. Wysocki,
	Marc Zyngier, Thomas Gleixner
  Cc: Andy Shevchenko

In order to make users OF independent provide irq_domain_create_legacy() API.
Last patch is an example of such user. First three patches are little cleanups.

Since regmap patch is dependent to what is now in regmap tree, I suggest to
create an immutable branch in IRQ domain tree and Mark can pull it and apply
the last one.

Andy Shevchenko (5):
  irqdomain: Remove unused of_device_id forward declaration
  irqdomain: Add forward declaration of fwnode_handle
  irqdomain: Replace open coded of_node_to_fwnode()
  irqdomain: Introduce irq_domain_create_legacy() API
  regmap: irq: Convert to use fwnode directly

 Documentation/core-api/irq/irq-domain.rst |  6 ++++++
 drivers/base/regmap/regmap-irq.c          | 11 +++++------
 include/linux/irqdomain.h                 |  8 +++++++-
 kernel/irq/irqdomain.c                    | 19 +++++++++++++++----
 4 files changed, 33 insertions(+), 11 deletions(-)

-- 
2.27.0


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

* [PATCH v1 1/5] irqdomain: Remove unused of_device_id forward declaration
  2020-07-08 16:21 [PATCH v1 0/5] irqdomain: clean up, add irq_domain_create_legacy() Andy Shevchenko
@ 2020-07-08 16:21 ` Andy Shevchenko
  2020-07-08 16:21 ` [PATCH v1 2/5] irqdomain: Add forward declaration of fwnode_handle Andy Shevchenko
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Andy Shevchenko @ 2020-07-08 16:21 UTC (permalink / raw)
  To: Mark Brown, linux-kernel, Greg Kroah-Hartman, Rafael J. Wysocki,
	Marc Zyngier, Thomas Gleixner
  Cc: Andy Shevchenko

There is no users of of_device_id in irqdomain.h. Drop it.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 include/linux/irqdomain.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h
index b37350c4fe37..ad6d2335e980 100644
--- a/include/linux/irqdomain.h
+++ b/include/linux/irqdomain.h
@@ -38,7 +38,6 @@
 
 struct device_node;
 struct irq_domain;
-struct of_device_id;
 struct irq_chip;
 struct irq_data;
 struct cpumask;
-- 
2.27.0


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

* [PATCH v1 2/5] irqdomain: Add forward declaration of fwnode_handle
  2020-07-08 16:21 [PATCH v1 0/5] irqdomain: clean up, add irq_domain_create_legacy() Andy Shevchenko
  2020-07-08 16:21 ` [PATCH v1 1/5] irqdomain: Remove unused of_device_id forward declaration Andy Shevchenko
@ 2020-07-08 16:21 ` Andy Shevchenko
  2020-07-08 16:21 ` [PATCH v1 3/5] irqdomain: Replace open coded of_node_to_fwnode() Andy Shevchenko
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Andy Shevchenko @ 2020-07-08 16:21 UTC (permalink / raw)
  To: Mark Brown, linux-kernel, Greg Kroah-Hartman, Rafael J. Wysocki,
	Marc Zyngier, Thomas Gleixner
  Cc: Andy Shevchenko

irqdomain.h is a user of struct fwnode_handle. Add forward declaration of it.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 include/linux/irqdomain.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h
index ad6d2335e980..39bb0c13ac07 100644
--- a/include/linux/irqdomain.h
+++ b/include/linux/irqdomain.h
@@ -37,6 +37,7 @@
 #include <linux/radix-tree.h>
 
 struct device_node;
+struct fwnode_handle;
 struct irq_domain;
 struct irq_chip;
 struct irq_data;
-- 
2.27.0


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

* [PATCH v1 3/5] irqdomain: Replace open coded of_node_to_fwnode()
  2020-07-08 16:21 [PATCH v1 0/5] irqdomain: clean up, add irq_domain_create_legacy() Andy Shevchenko
  2020-07-08 16:21 ` [PATCH v1 1/5] irqdomain: Remove unused of_device_id forward declaration Andy Shevchenko
  2020-07-08 16:21 ` [PATCH v1 2/5] irqdomain: Add forward declaration of fwnode_handle Andy Shevchenko
@ 2020-07-08 16:21 ` Andy Shevchenko
  2020-07-08 16:21 ` [PATCH v1 4/5] irqdomain: Introduce irq_domain_create_legacy() API Andy Shevchenko
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Andy Shevchenko @ 2020-07-08 16:21 UTC (permalink / raw)
  To: Mark Brown, linux-kernel, Greg Kroah-Hartman, Rafael J. Wysocki,
	Marc Zyngier, Thomas Gleixner
  Cc: Andy Shevchenko

We can convert device node to fwnode with of_node_to_fwnode().
Replace open coded variant of it in of_phandle_args_to_fwspec().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 kernel/irq/irqdomain.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
index a4c2c915511d..d7a762cce8e9 100644
--- a/kernel/irq/irqdomain.c
+++ b/kernel/irq/irqdomain.c
@@ -736,7 +736,7 @@ static void of_phandle_args_to_fwspec(struct device_node *np, const u32 *args,
 {
 	int i;
 
-	fwspec->fwnode = np ? &np->fwnode : NULL;
+	fwspec->fwnode = of_node_to_fwnode(np);
 	fwspec->param_count = count;
 
 	for (i = 0; i < count; i++)
-- 
2.27.0


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

* [PATCH v1 4/5] irqdomain: Introduce irq_domain_create_legacy() API
  2020-07-08 16:21 [PATCH v1 0/5] irqdomain: clean up, add irq_domain_create_legacy() Andy Shevchenko
                   ` (2 preceding siblings ...)
  2020-07-08 16:21 ` [PATCH v1 3/5] irqdomain: Replace open coded of_node_to_fwnode() Andy Shevchenko
@ 2020-07-08 16:21 ` Andy Shevchenko
  2020-07-08 16:21 ` [PATCH v1 5/5] regmap: irq: Convert to use fwnode directly Andy Shevchenko
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Andy Shevchenko @ 2020-07-08 16:21 UTC (permalink / raw)
  To: Mark Brown, linux-kernel, Greg Kroah-Hartman, Rafael J. Wysocki,
	Marc Zyngier, Thomas Gleixner
  Cc: Andy Shevchenko

Introduce irq_domain_create_legacy() API which is functional equivalent
to the existing irq_domain_add_legacy(), but takes a pointer to the struct
fwnode_handle as a parameter.

Some users want to use it in non-OF cases.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 Documentation/core-api/irq/irq-domain.rst |  6 ++++++
 include/linux/irqdomain.h                 |  6 ++++++
 kernel/irq/irqdomain.c                    | 17 ++++++++++++++---
 3 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/Documentation/core-api/irq/irq-domain.rst b/Documentation/core-api/irq/irq-domain.rst
index 096db12f32d5..a77c24c27f7b 100644
--- a/Documentation/core-api/irq/irq-domain.rst
+++ b/Documentation/core-api/irq/irq-domain.rst
@@ -147,6 +147,7 @@ Legacy
 	irq_domain_add_simple()
 	irq_domain_add_legacy()
 	irq_domain_add_legacy_isa()
+	irq_domain_create_legacy()
 
 The Legacy mapping is a special case for drivers that already have a
 range of irq_descs allocated for the hwirqs.  It is used when the
@@ -185,6 +186,11 @@ that the driver using the simple domain call irq_create_mapping()
 before any irq_find_mapping() since the latter will actually work
 for the static IRQ assignment case.
 
+irq_domain_add_legacy() and irq_domain_create_legacy() are functionally
+equivalent, except for the first argument is different - the former
+accepts an Open Firmware specific 'struct device_node', while the latter
+accepts a more general abstraction 'struct fwnode_handle'.
+
 Hierarchy IRQ domain
 --------------------
 
diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h
index 39bb0c13ac07..529719f4a034 100644
--- a/include/linux/irqdomain.h
+++ b/include/linux/irqdomain.h
@@ -270,6 +270,12 @@ struct irq_domain *irq_domain_add_legacy(struct device_node *of_node,
 					 irq_hw_number_t first_hwirq,
 					 const struct irq_domain_ops *ops,
 					 void *host_data);
+struct irq_domain *irq_domain_create_legacy(struct fwnode_handle *fwnode,
+					    unsigned int size,
+					    unsigned int first_irq,
+					    irq_hw_number_t first_hwirq,
+					    const struct irq_domain_ops *ops,
+					    void *host_data);
 extern struct irq_domain *irq_find_matching_fwspec(struct irq_fwspec *fwspec,
 						   enum irq_domain_bus_token bus_token);
 extern bool irq_domain_check_msi_remap(void);
diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
index d7a762cce8e9..04936a3eb34e 100644
--- a/kernel/irq/irqdomain.c
+++ b/kernel/irq/irqdomain.c
@@ -349,17 +349,28 @@ struct irq_domain *irq_domain_add_legacy(struct device_node *of_node,
 					 irq_hw_number_t first_hwirq,
 					 const struct irq_domain_ops *ops,
 					 void *host_data)
+{
+	return irq_domain_create_legacy(of_node_to_fwnode(of_node), size,
+					first_irq, first_hwirq, ops, host_data);
+}
+EXPORT_SYMBOL_GPL(irq_domain_add_legacy);
+
+struct irq_domain *irq_domain_create_legacy(struct fwnode_handle *fwnode,
+					 unsigned int size,
+					 unsigned int first_irq,
+					 irq_hw_number_t first_hwirq,
+					 const struct irq_domain_ops *ops,
+					 void *host_data)
 {
 	struct irq_domain *domain;
 
-	domain = __irq_domain_add(of_node_to_fwnode(of_node), first_hwirq + size,
-				  first_hwirq + size, 0, ops, host_data);
+	domain = __irq_domain_add(fwnode, first_hwirq + size, first_hwirq + size, 0, ops, host_data);
 	if (domain)
 		irq_domain_associate_many(domain, first_irq, first_hwirq, size);
 
 	return domain;
 }
-EXPORT_SYMBOL_GPL(irq_domain_add_legacy);
+EXPORT_SYMBOL_GPL(irq_domain_create_legacy);
 
 /**
  * irq_find_matching_fwspec() - Locates a domain for a given fwspec
-- 
2.27.0


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

* [PATCH v1 5/5] regmap: irq: Convert to use fwnode directly
  2020-07-08 16:21 [PATCH v1 0/5] irqdomain: clean up, add irq_domain_create_legacy() Andy Shevchenko
                   ` (3 preceding siblings ...)
  2020-07-08 16:21 ` [PATCH v1 4/5] irqdomain: Introduce irq_domain_create_legacy() API Andy Shevchenko
@ 2020-07-08 16:21 ` Andy Shevchenko
  2020-07-08 16:26   ` Mark Brown
  2020-07-26  9:12 ` [PATCH v1 0/5] irqdomain: clean up, add irq_domain_create_legacy() Andy Shevchenko
  2020-09-16 17:07 ` Andy Shevchenko
  6 siblings, 1 reply; 10+ messages in thread
From: Andy Shevchenko @ 2020-07-08 16:21 UTC (permalink / raw)
  To: Mark Brown, linux-kernel, Greg Kroah-Hartman, Rafael J. Wysocki,
	Marc Zyngier, Thomas Gleixner
  Cc: Andy Shevchenko

Since IRQ domain provides an API to take fwnode as a parameter,
switch regmap IRQ to use that directly instead of be limited
to OF case only.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/base/regmap/regmap-irq.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/base/regmap/regmap-irq.c b/drivers/base/regmap/regmap-irq.c
index 369a57e6f89d..2ecdfdbdfc71 100644
--- a/drivers/base/regmap/regmap-irq.c
+++ b/drivers/base/regmap/regmap-irq.c
@@ -772,13 +772,12 @@ int regmap_add_irq_chip_fwnode(struct fwnode_handle *fwnode,
 	}
 
 	if (irq_base)
-		d->domain = irq_domain_add_legacy(to_of_node(fwnode),
-						  chip->num_irqs, irq_base,
-						  0, &regmap_domain_ops, d);
+		d->domain = irq_domain_create_legacy(fwnode, chip->num_irqs,
+						     irq_base, 0,
+						     &regmap_domain_ops, d);
 	else
-		d->domain = irq_domain_add_linear(to_of_node(fwnode),
-						  chip->num_irqs,
-						  &regmap_domain_ops, d);
+		d->domain = irq_domain_create_linear(fwnode, chip->num_irqs,
+						     &regmap_domain_ops, d);
 	if (!d->domain) {
 		dev_err(map->dev, "Failed to create IRQ domain\n");
 		ret = -ENOMEM;
-- 
2.27.0


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

* Re: [PATCH v1 5/5] regmap: irq: Convert to use fwnode directly
  2020-07-08 16:21 ` [PATCH v1 5/5] regmap: irq: Convert to use fwnode directly Andy Shevchenko
@ 2020-07-08 16:26   ` Mark Brown
  0 siblings, 0 replies; 10+ messages in thread
From: Mark Brown @ 2020-07-08 16:26 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: linux-kernel, Greg Kroah-Hartman, Rafael J. Wysocki,
	Marc Zyngier, Thomas Gleixner

[-- Attachment #1: Type: text/plain, Size: 256 bytes --]

On Wed, Jul 08, 2020 at 07:21:35PM +0300, Andy Shevchenko wrote:
> Since IRQ domain provides an API to take fwnode as a parameter,
> switch regmap IRQ to use that directly instead of be limited
> to OF case only.

Acked-by: Mark Brown <broonie@kernel.org>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH v1 0/5] irqdomain: clean up, add irq_domain_create_legacy()
  2020-07-08 16:21 [PATCH v1 0/5] irqdomain: clean up, add irq_domain_create_legacy() Andy Shevchenko
                   ` (4 preceding siblings ...)
  2020-07-08 16:21 ` [PATCH v1 5/5] regmap: irq: Convert to use fwnode directly Andy Shevchenko
@ 2020-07-26  9:12 ` Andy Shevchenko
  2020-08-27 11:52   ` Andy Shevchenko
  2020-09-16 17:07 ` Andy Shevchenko
  6 siblings, 1 reply; 10+ messages in thread
From: Andy Shevchenko @ 2020-07-26  9:12 UTC (permalink / raw)
  To: Mark Brown, linux-kernel, Greg Kroah-Hartman, Rafael J. Wysocki,
	Marc Zyngier, Thomas Gleixner

On Wed, Jul 08, 2020 at 07:21:30PM +0300, Andy Shevchenko wrote:
> In order to make users OF independent provide irq_domain_create_legacy() API.
> Last patch is an example of such user. First three patches are little cleanups.
> 
> Since regmap patch is dependent to what is now in regmap tree, I suggest to
> create an immutable branch in IRQ domain tree and Mark can pull it and apply
> the last one.

Marc, are you okay with the IRQ domain patches?

> Andy Shevchenko (5):
>   irqdomain: Remove unused of_device_id forward declaration
>   irqdomain: Add forward declaration of fwnode_handle
>   irqdomain: Replace open coded of_node_to_fwnode()
>   irqdomain: Introduce irq_domain_create_legacy() API
>   regmap: irq: Convert to use fwnode directly
> 
>  Documentation/core-api/irq/irq-domain.rst |  6 ++++++
>  drivers/base/regmap/regmap-irq.c          | 11 +++++------
>  include/linux/irqdomain.h                 |  8 +++++++-
>  kernel/irq/irqdomain.c                    | 19 +++++++++++++++----
>  4 files changed, 33 insertions(+), 11 deletions(-)
> 
> -- 
> 2.27.0
> 

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH v1 0/5] irqdomain: clean up, add irq_domain_create_legacy()
  2020-07-26  9:12 ` [PATCH v1 0/5] irqdomain: clean up, add irq_domain_create_legacy() Andy Shevchenko
@ 2020-08-27 11:52   ` Andy Shevchenko
  0 siblings, 0 replies; 10+ messages in thread
From: Andy Shevchenko @ 2020-08-27 11:52 UTC (permalink / raw)
  To: Mark Brown, linux-kernel, Greg Kroah-Hartman, Rafael J. Wysocki,
	Marc Zyngier, Thomas Gleixner

On Sun, Jul 26, 2020 at 12:12:02PM +0300, Andy Shevchenko wrote:
> On Wed, Jul 08, 2020 at 07:21:30PM +0300, Andy Shevchenko wrote:
> > In order to make users OF independent provide irq_domain_create_legacy() API.
> > Last patch is an example of such user. First three patches are little cleanups.
> > 
> > Since regmap patch is dependent to what is now in regmap tree, I suggest to
> > create an immutable branch in IRQ domain tree and Mark can pull it and apply
> > the last one.
> 
> Marc, are you okay with the IRQ domain patches?

Marc, should I resend this? All dependencies are now resolved.

> > Andy Shevchenko (5):
> >   irqdomain: Remove unused of_device_id forward declaration
> >   irqdomain: Add forward declaration of fwnode_handle
> >   irqdomain: Replace open coded of_node_to_fwnode()
> >   irqdomain: Introduce irq_domain_create_legacy() API
> >   regmap: irq: Convert to use fwnode directly
> > 
> >  Documentation/core-api/irq/irq-domain.rst |  6 ++++++
> >  drivers/base/regmap/regmap-irq.c          | 11 +++++------
> >  include/linux/irqdomain.h                 |  8 +++++++-
> >  kernel/irq/irqdomain.c                    | 19 +++++++++++++++----
> >  4 files changed, 33 insertions(+), 11 deletions(-)

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH v1 0/5] irqdomain: clean up, add irq_domain_create_legacy()
  2020-07-08 16:21 [PATCH v1 0/5] irqdomain: clean up, add irq_domain_create_legacy() Andy Shevchenko
                   ` (5 preceding siblings ...)
  2020-07-26  9:12 ` [PATCH v1 0/5] irqdomain: clean up, add irq_domain_create_legacy() Andy Shevchenko
@ 2020-09-16 17:07 ` Andy Shevchenko
  6 siblings, 0 replies; 10+ messages in thread
From: Andy Shevchenko @ 2020-09-16 17:07 UTC (permalink / raw)
  To: Mark Brown, linux-kernel, Greg Kroah-Hartman, Rafael J. Wysocki,
	Marc Zyngier, Thomas Gleixner

On Wed, Jul 08, 2020 at 07:21:30PM +0300, Andy Shevchenko wrote:
> In order to make users OF independent provide irq_domain_create_legacy() API.
> Last patch is an example of such user. First three patches are little cleanups.
> 
> Since regmap patch is dependent to what is now in regmap tree, I suggest to
> create an immutable branch in IRQ domain tree and Mark can pull it and apply
> the last one.

Rafael, can you review this? It seems stuck supposedly b/c of no review tag
given.

> Andy Shevchenko (5):
>   irqdomain: Remove unused of_device_id forward declaration
>   irqdomain: Add forward declaration of fwnode_handle
>   irqdomain: Replace open coded of_node_to_fwnode()
>   irqdomain: Introduce irq_domain_create_legacy() API
>   regmap: irq: Convert to use fwnode directly
> 
>  Documentation/core-api/irq/irq-domain.rst |  6 ++++++
>  drivers/base/regmap/regmap-irq.c          | 11 +++++------
>  include/linux/irqdomain.h                 |  8 +++++++-
>  kernel/irq/irqdomain.c                    | 19 +++++++++++++++----
>  4 files changed, 33 insertions(+), 11 deletions(-)
> 
> -- 
> 2.27.0
> 

-- 
With Best Regards,
Andy Shevchenko



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

end of thread, other threads:[~2020-09-16 20:39 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-08 16:21 [PATCH v1 0/5] irqdomain: clean up, add irq_domain_create_legacy() Andy Shevchenko
2020-07-08 16:21 ` [PATCH v1 1/5] irqdomain: Remove unused of_device_id forward declaration Andy Shevchenko
2020-07-08 16:21 ` [PATCH v1 2/5] irqdomain: Add forward declaration of fwnode_handle Andy Shevchenko
2020-07-08 16:21 ` [PATCH v1 3/5] irqdomain: Replace open coded of_node_to_fwnode() Andy Shevchenko
2020-07-08 16:21 ` [PATCH v1 4/5] irqdomain: Introduce irq_domain_create_legacy() API Andy Shevchenko
2020-07-08 16:21 ` [PATCH v1 5/5] regmap: irq: Convert to use fwnode directly Andy Shevchenko
2020-07-08 16:26   ` Mark Brown
2020-07-26  9:12 ` [PATCH v1 0/5] irqdomain: clean up, add irq_domain_create_legacy() Andy Shevchenko
2020-08-27 11:52   ` Andy Shevchenko
2020-09-16 17:07 ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).