linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pinctrl: rockchip: don't disable clk when irq mask is already set
@ 2016-09-23 18:26 Jacob Chen
  2016-09-24 10:24 ` Shawn Lin
  0 siblings, 1 reply; 5+ messages in thread
From: Jacob Chen @ 2016-09-23 18:26 UTC (permalink / raw)
  To: linux-kernel; +Cc: heiko, linux-rockchip, linux-gpio, linus.walleij, Jacob Chen

From: Jacob Chen <jacob2.chen@rock-chips.com>

In some drivers, disable_irq() call don't be symmetric with enable_irq()
, disable_irq() will be called before call free_irq().

But both disable_irq() and free_irq() will call rockchip_irq_gc_mask_set_bit,
 and clk_disable() will be called more times than clk_enable(), which will
cause bugs.

I think we can correct that by checking of mask.If mask is already set, do nothing.

Change-Id: If19912c7658253e15531c04db6c70fdbffd5960a
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
---
 drivers/pinctrl/pinctrl-rockchip.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c
index c6c04ac..9a8804a 100644
--- a/drivers/pinctrl/pinctrl-rockchip.c
+++ b/drivers/pinctrl/pinctrl-rockchip.c
@@ -2334,8 +2334,12 @@ static void rockchip_irq_gc_mask_clr_bit(struct irq_data *d)
 void rockchip_irq_gc_mask_set_bit(struct irq_data *d)
 {
 	struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
+	struct irq_chip_type *ct = irq_data_get_chip_type(d);
 	struct rockchip_pin_bank *bank = gc->private;

+	if (*ct->mask_cache & d->mask)
+		return;
+
 	irq_gc_mask_set_bit(d);
 	clk_disable(bank->clk);
 }
--
2.7.4


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

end of thread, other threads:[~2016-09-29  7:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-23 18:26 [PATCH] pinctrl: rockchip: don't disable clk when irq mask is already set Jacob Chen
2016-09-24 10:24 ` Shawn Lin
2016-09-24 14:42   ` 陈豪
     [not found]   ` <fb4ec747-fde3-142b-1963-be3b9cfab260-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2016-09-26 22:35     ` Heiko Stuebner
2016-09-29  7:29       ` Shawn Lin

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