* [PATCH 1/1] irqchip: stm32-exti: add domain translate function
@ 2019-01-11 13:58 Loic Pallardy
2019-01-11 15:52 ` Marc Zyngier
0 siblings, 1 reply; 3+ messages in thread
From: Loic Pallardy @ 2019-01-11 13:58 UTC (permalink / raw)
To: tglx, jason, marc.zyngier, mcoquelin.stm32, alexandre.torgue
Cc: linux-kernel, linux-stm32, linux-arm-kernel, Loic Pallardy
Domain translate function is needed to recover irq
configuration parameters from DT node
Signed-off-by: Loic Pallardy <loic.pallardy@st.com>
---
drivers/irqchip/irq-stm32-exti.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/drivers/irqchip/irq-stm32-exti.c b/drivers/irqchip/irq-stm32-exti.c
index 6edfd4bfa169..717879028cc4 100644
--- a/drivers/irqchip/irq-stm32-exti.c
+++ b/drivers/irqchip/irq-stm32-exti.c
@@ -819,9 +819,27 @@ static int __init stm32_exti_init(const struct stm32_exti_drv_data *drv_data,
return ret;
}
+static int stm32_exti_h_translate(struct irq_domain *d,
+ struct irq_fwspec *fwspec,
+ unsigned long *out_hwirq,
+ unsigned int *out_type)
+{
+ if (is_of_node(fwspec->fwnode)) {
+ if (fwspec->param_count != 2)
+ return -EINVAL;
+
+ *out_hwirq = fwspec->param[0];
+ *out_type = fwspec->param[1] & IRQ_TYPE_SENSE_MASK;
+ return 0;
+ }
+
+ return -EINVAL;
+}
+
static const struct irq_domain_ops stm32_exti_h_domain_ops = {
.alloc = stm32_exti_h_domain_alloc,
.free = irq_domain_free_irqs_common,
+ .translate = stm32_exti_h_translate,
};
static int
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] irqchip: stm32-exti: add domain translate function
2019-01-11 13:58 [PATCH 1/1] irqchip: stm32-exti: add domain translate function Loic Pallardy
@ 2019-01-11 15:52 ` Marc Zyngier
2019-01-11 17:34 ` Loic PALLARDY
0 siblings, 1 reply; 3+ messages in thread
From: Marc Zyngier @ 2019-01-11 15:52 UTC (permalink / raw)
To: Loic Pallardy, tglx, jason, mcoquelin.stm32, alexandre.torgue
Cc: linux-kernel, linux-stm32, linux-arm-kernel
On 11/01/2019 13:58, Loic Pallardy wrote:
> Domain translate function is needed to recover irq
> configuration parameters from DT node
>
> Signed-off-by: Loic Pallardy <loic.pallardy@st.com>
Surely this fixes something, right? Can you please add a Fixes: tag?
> ---
> drivers/irqchip/irq-stm32-exti.c | 18 ++++++++++++++++++
> 1 file changed, 18 insertions(+)
>
> diff --git a/drivers/irqchip/irq-stm32-exti.c b/drivers/irqchip/irq-stm32-exti.c
> index 6edfd4bfa169..717879028cc4 100644
> --- a/drivers/irqchip/irq-stm32-exti.c
> +++ b/drivers/irqchip/irq-stm32-exti.c
> @@ -819,9 +819,27 @@ static int __init stm32_exti_init(const struct stm32_exti_drv_data *drv_data,
> return ret;
> }
>
> +static int stm32_exti_h_translate(struct irq_domain *d,
> + struct irq_fwspec *fwspec,
> + unsigned long *out_hwirq,
> + unsigned int *out_type)
> +{
> + if (is_of_node(fwspec->fwnode)) {
Is there any case where this wouldn't be true? i.e. an stm32 ACPI system?
> + if (fwspec->param_count != 2)
> + return -EINVAL;
> +
> + *out_hwirq = fwspec->param[0];
> + *out_type = fwspec->param[1] & IRQ_TYPE_SENSE_MASK;
> + return 0;
> + }
> +
> + return -EINVAL;
> +}
Because otherwise, this is exactly what irq_domain_xlate_twocell() does.
> +
> static const struct irq_domain_ops stm32_exti_h_domain_ops = {
> .alloc = stm32_exti_h_domain_alloc,
> .free = irq_domain_free_irqs_common,
> + .translate = stm32_exti_h_translate,
> };
>
> static int
>
Thanks,
M.
--
Jazz is not dead. It just smells funny...
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH 1/1] irqchip: stm32-exti: add domain translate function
2019-01-11 15:52 ` Marc Zyngier
@ 2019-01-11 17:34 ` Loic PALLARDY
0 siblings, 0 replies; 3+ messages in thread
From: Loic PALLARDY @ 2019-01-11 17:34 UTC (permalink / raw)
To: Marc Zyngier, tglx, jason, mcoquelin.stm32, Alexandre TORGUE
Cc: linux-kernel, linux-stm32, linux-arm-kernel
Hi Marc,
Thanks for the review
> -----Original Message-----
> From: Marc Zyngier <marc.zyngier@arm.com>
> Sent: vendredi 11 janvier 2019 16:52
> To: Loic PALLARDY <loic.pallardy@st.com>; tglx@linutronix.de;
> jason@lakedaemon.net; mcoquelin.stm32@gmail.com; Alexandre TORGUE
> <alexandre.torgue@st.com>
> Cc: linux-kernel@vger.kernel.org; linux-stm32@st-md-
> mailman.stormreply.com; linux-arm-kernel@lists.infradead.org
> Subject: Re: [PATCH 1/1] irqchip: stm32-exti: add domain translate function
>
> On 11/01/2019 13:58, Loic Pallardy wrote:
> > Domain translate function is needed to recover irq
> > configuration parameters from DT node
> >
> > Signed-off-by: Loic Pallardy <loic.pallardy@st.com>
>
> Surely this fixes something, right? Can you please add a Fixes: tag?
Yes I will add tag of patch introducing hierarchical domain
>
> > ---
> > drivers/irqchip/irq-stm32-exti.c | 18 ++++++++++++++++++
> > 1 file changed, 18 insertions(+)
> >
> > diff --git a/drivers/irqchip/irq-stm32-exti.c b/drivers/irqchip/irq-stm32-
> exti.c
> > index 6edfd4bfa169..717879028cc4 100644
> > --- a/drivers/irqchip/irq-stm32-exti.c
> > +++ b/drivers/irqchip/irq-stm32-exti.c
> > @@ -819,9 +819,27 @@ static int __init stm32_exti_init(const struct
> stm32_exti_drv_data *drv_data,
> > return ret;
> > }
> >
> > +static int stm32_exti_h_translate(struct irq_domain *d,
> > + struct irq_fwspec *fwspec,
> > + unsigned long *out_hwirq,
> > + unsigned int *out_type)
> > +{
> > + if (is_of_node(fwspec->fwnode)) {
>
> Is there any case where this wouldn't be true? i.e. an stm32 ACPI system?
You're right, no ACPI so check useless
>
> > + if (fwspec->param_count != 2)
> > + return -EINVAL;
> > +
> > + *out_hwirq = fwspec->param[0];
> > + *out_type = fwspec->param[1] & IRQ_TYPE_SENSE_MASK;
> > + return 0;
> > + }
> > +
> > + return -EINVAL;
> > +}
>
> Because otherwise, this is exactly what irq_domain_xlate_twocell() does.
Thanks for pointing me this helper. Indeed no need to duplicate code
I'll send a v2
Regards,
Loic
>
> > +
> > static const struct irq_domain_ops stm32_exti_h_domain_ops = {
> > .alloc = stm32_exti_h_domain_alloc,
> > .free = irq_domain_free_irqs_common,
> > + .translate = stm32_exti_h_translate,
> > };
> >
> > static int
> >
>
> Thanks,
>
> M.
> --
> Jazz is not dead. It just smells funny...
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-01-11 17:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-11 13:58 [PATCH 1/1] irqchip: stm32-exti: add domain translate function Loic Pallardy
2019-01-11 15:52 ` Marc Zyngier
2019-01-11 17:34 ` Loic PALLARDY
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).