linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] regmap: irq: Make IRQ type support optional
@ 2018-12-28 11:23 Charles Keepax
  2018-12-28 11:55 ` Charles Keepax
  0 siblings, 1 reply; 4+ messages in thread
From: Charles Keepax @ 2018-12-28 11:23 UTC (permalink / raw)
  To: broonie; +Cc: linux-kernel, patches

Currently only gpio-max77620 is using the type support in regmap IRQ,
but the implementation causes the irq_set_type operation to fail on all
other regmap IRQ chips. Avoid these regressions by skipping the type
handling on any chips that don't define a set of supported types.

Fixes: 1c2928e3e321 ("regmap: regmap-irq/gpio-max77620: add level-irq support")
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---
 drivers/base/regmap/regmap-irq.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/base/regmap/regmap-irq.c b/drivers/base/regmap/regmap-irq.c
index 1bd1145ad8b5e..8c674f1ad0fc8 100644
--- a/drivers/base/regmap/regmap-irq.c
+++ b/drivers/base/regmap/regmap-irq.c
@@ -257,6 +257,9 @@ static int regmap_irq_set_type(struct irq_data *data, unsigned int type)
 	int reg;
 	const struct regmap_irq_type *t = &irq_data->type;
 
+	if (!t->types_supported)
+		return 0;
+
 	if ((t->types_supported & type) != type)
 		return -ENOTSUPP;
 
-- 
2.11.0


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

* Re: [PATCH] regmap: irq: Make IRQ type support optional
  2018-12-28 11:23 [PATCH] regmap: irq: Make IRQ type support optional Charles Keepax
@ 2018-12-28 11:55 ` Charles Keepax
  2018-12-28 12:16   ` Vaittinen, Matti
  0 siblings, 1 reply; 4+ messages in thread
From: Charles Keepax @ 2018-12-28 11:55 UTC (permalink / raw)
  To: broonie, matti.vaittinen; +Cc: linux-kernel, patches

On Fri, Dec 28, 2018 at 11:23:58AM +0000, Charles Keepax wrote:
> Currently only gpio-max77620 is using the type support in regmap IRQ,
> but the implementation causes the irq_set_type operation to fail on all
> other regmap IRQ chips. Avoid these regressions by skipping the type
> handling on any chips that don't define a set of supported types.
> 
> Fixes: 1c2928e3e321 ("regmap: regmap-irq/gpio-max77620: add level-irq support")
> Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
> ---
>  drivers/base/regmap/regmap-irq.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/base/regmap/regmap-irq.c b/drivers/base/regmap/regmap-irq.c
> index 1bd1145ad8b5e..8c674f1ad0fc8 100644
> --- a/drivers/base/regmap/regmap-irq.c
> +++ b/drivers/base/regmap/regmap-irq.c
> @@ -257,6 +257,9 @@ static int regmap_irq_set_type(struct irq_data *data, unsigned int type)
>  	int reg;
>  	const struct regmap_irq_type *t = &irq_data->type;
>  
> +	if (!t->types_supported)
> +		return 0;
> +
>  	if ((t->types_supported & type) != type)
>  		return -ENOTSUPP;
>  
> -- 
> 2.11.0

+ Matti Vaittinen, apologies for forgetting to include you on the
original sending.

Thanks,
Charles

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

* RE: [PATCH] regmap: irq: Make IRQ type support optional
  2018-12-28 11:55 ` Charles Keepax
@ 2018-12-28 12:16   ` Vaittinen, Matti
  2019-01-03 17:22     ` Charles Keepax
  0 siblings, 1 reply; 4+ messages in thread
From: Vaittinen, Matti @ 2018-12-28 12:16 UTC (permalink / raw)
  To: Charles Keepax, broonie; +Cc: linux-kernel, patches

Hello Charles,

Sending this mail form outlook web interface - so I won't inline any code :/

From: Charles Keepax [ckeepax@opensource.cirrus.com]
Sent: Friday, December 28, 2018 1:55 PM

> On Fri, Dec 28, 2018 at 11:23:58AM +0000, Charles Keepax wrote:
> > Currently only gpio-max77620 is using the type support in regmap IRQ,
> > but the implementation causes the irq_set_type operation to fail on all
> > other regmap IRQ chips. Avoid these regressions by skipping the type
> > handling on any chips that don't define a set of supported types.
> >
> > Fixes: 1c2928e3e321 ("regmap: regmap-irq/gpio-max77620: add level-irq support")
> > Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
> > ---
> >  drivers/base/regmap/regmap-irq.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/drivers/base/regmap/regmap-irq.c b/drivers/base/regmap/regmap-irq.c
> > index 1bd1145ad8b5e..8c674f1ad0fc8 100644
> > --- a/drivers/base/regmap/regmap-irq.c
> > +++ b/drivers/base/regmap/regmap-irq.c
> > @@ -257,6 +257,9 @@ static int regmap_irq_set_type(struct irq_data *data, unsigned int type)
> >       int reg;
> >       const struct regmap_irq_type *t = &irq_data->type;
> >
> > +     if (!t->types_supported)
> > +             return 0;
> > +
> >       if ((t->types_supported & type) != type)
> >               return -ENOTSUPP;
> >

I got the bug-report from Geert and sent this patch yesterday:
https://lore.kernel.org/lkml/20181227084443.GA23991@localhost.localdomain/

Looking at these two options, I wonder if we shuld return -ENOTSUPP if we do support type setting, but for example only for edge, not level active IRQs - and if LEVEL_LOW or LEVEL_HIGH is requested? Well, I have no strong opinion and both of these should fix the regressions - sorry for the hassle!

I still wonder whether we should do as I suggested and only set the irq_set_type callback for chips which have non zero type_registers? I suggested that here:
https://lore.kernel.org/lkml/20181228080533.GC2461@localhost.localdomain/

> + Matti Vaittinen, apologies for forgetting to include you on the
> original sending.

No problem. Thanks for adding me now =)

Br,
    Matti Vaittinen

--
Matti Vaittinen
ROHM Semiconductors

~~~ "I don't think so," said Rene Descartes.  Just then, he vanished ~~~

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

* Re: [PATCH] regmap: irq: Make IRQ type support optional
  2018-12-28 12:16   ` Vaittinen, Matti
@ 2019-01-03 17:22     ` Charles Keepax
  0 siblings, 0 replies; 4+ messages in thread
From: Charles Keepax @ 2019-01-03 17:22 UTC (permalink / raw)
  To: Vaittinen, Matti; +Cc: broonie, linux-kernel, patches

On Fri, Dec 28, 2018 at 12:16:17PM +0000, Vaittinen, Matti wrote:
> Hello Charles,
> 
> Sending this mail form outlook web interface - so I won't inline any code :/
> 
> From: Charles Keepax [ckeepax@opensource.cirrus.com]
> Sent: Friday, December 28, 2018 1:55 PM
> 
> > On Fri, Dec 28, 2018 at 11:23:58AM +0000, Charles Keepax wrote:
> > > Currently only gpio-max77620 is using the type support in regmap IRQ,
> > > but the implementation causes the irq_set_type operation to fail on all
> > > other regmap IRQ chips. Avoid these regressions by skipping the type
> > > handling on any chips that don't define a set of supported types.
> > >
> > > Fixes: 1c2928e3e321 ("regmap: regmap-irq/gpio-max77620: add level-irq support")
> > > Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
> > > ---
> > >  drivers/base/regmap/regmap-irq.c | 3 +++
> > >  1 file changed, 3 insertions(+)
> > >
> > > diff --git a/drivers/base/regmap/regmap-irq.c b/drivers/base/regmap/regmap-irq.c
> > > index 1bd1145ad8b5e..8c674f1ad0fc8 100644
> > > --- a/drivers/base/regmap/regmap-irq.c
> > > +++ b/drivers/base/regmap/regmap-irq.c
> > > @@ -257,6 +257,9 @@ static int regmap_irq_set_type(struct irq_data *data, unsigned int type)
> > >       int reg;
> > >       const struct regmap_irq_type *t = &irq_data->type;
> > >
> > > +     if (!t->types_supported)
> > > +             return 0;
> > > +
> > >       if ((t->types_supported & type) != type)
> > >               return -ENOTSUPP;
> > >
> 
> I got the bug-report from Geert and sent this patch yesterday:
> https://lore.kernel.org/lkml/20181227084443.GA23991@localhost.localdomain/
> 
> Looking at these two options, I wonder if we shuld return
> -ENOTSUPP if we do support type setting, but for example
> only for edge, not level active IRQs - and if LEVEL_LOW or
> LEVEL_HIGH is requested? Well, I have no strong opinion and
> both of these should fix the regressions - sorry for the hassle!
> 
> I still wonder whether we should do as I suggested and only
> set the irq_set_type callback for chips which have non zero
> type_registers? I suggested that here:
> https://lore.kernel.org/lkml/20181228080533.GC2461@localhost.localdomain/
> 

Yeah that does look like probably the best solution.

Thanks,
Charles

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

end of thread, other threads:[~2019-01-03 17:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-28 11:23 [PATCH] regmap: irq: Make IRQ type support optional Charles Keepax
2018-12-28 11:55 ` Charles Keepax
2018-12-28 12:16   ` Vaittinen, Matti
2019-01-03 17:22     ` Charles Keepax

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).