Skip to contentSkip to conversation

regmap: irq: Make IRQ type support optional

PATCH In review Charles Keepax 2 participants 4 messages Dec 28, 2018 – Jan 3, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 regmap: irq: Make IRQ type support optional

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")
---
 drivers/base/regmap/regmap-irq.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/base/regmap/regmap-irq.c +3 -0
index 1bd1145ad8b5e..8c674f1ad0fc8 100644
@@ -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;
 
Signature · 1 line
2.11.0
#1 lore raw
Quoted 27 lines · Charles Keepax

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")
---
 drivers/base/regmap/regmap-irq.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/base/regmap/regmap-irq.c +3 -0
index 1bd1145ad8b5e..8c674f1ad0fc8 100644
@@ -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;
 
Signature · 1 line
2.11.0

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

Thanks,
Charles

#2 lore raw

Hello Charles,

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

From: Charles Keepax [[email protected]]
Sent: Friday, December 28, 2018 1:55 PM

Quoted 20 lines · Charles Keepax
Quoted 19 lines

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")
---
 drivers/base/regmap/regmap-irq.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/base/regmap/regmap-irq.c +0 -0
index 1bd1145ad8b5e..8c674f1ad0fc8 100644
@@ -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;
 
Quoted 6 lines

drivers/base/regmap/regmap-irq.c static int regmap_irq_set_type(struct irq_data *data, unsigned int type) · line 265

Quoted 6 lines
drivers/base/regmap/regmap-irq.c +3 -0
+     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/[email protected]/

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/[email protected]/

Quoted 2 lines

+ 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 ~~~

#3 lore raw
Quoted 43 lines · Matti

Hello Charles,

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

From: Charles Keepax [[email protected]]
Sent: Friday, December 28, 2018 1:55 PM

Quoted 20 lines · Charles Keepax
Quoted 19 lines

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")
---
 drivers/base/regmap/regmap-irq.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/base/regmap/regmap-irq.c +0 -0
index 1bd1145ad8b5e..8c674f1ad0fc8 100644
@@ -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;
 
Quoted 6 lines

drivers/base/regmap/regmap-irq.c static int regmap_irq_set_type(struct irq_data *data, unsigned int type) · line 265

Quoted 6 lines
drivers/base/regmap/regmap-irq.c +3 -0
+     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/[email protected]/

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!

Quoted 5 lines

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/[email protected]/

Yeah that does look like probably the best solution.

Thanks,
Charles