Thread (6 messages) 6 messages, 3 authors, 2012-10-25

Re: [RFT/PATCH] Input: omap4-keypad - switch to use managed resources

flat view

From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date: 2012-10-25 18:24:27

On Thu, Oct 25, 2012 at 05:09:16PM +0300, Felipe Balbi wrote:
Hi,

On Thu, Oct 25, 2012 at 06:31:32PM +0530, Sourav wrote:
quoted
Hi Dmitry,

-       pm_runtime_put_sync(dev);
-
 out:
        pm_runtime_disable(dev);
        return retval;
@@ -387,8 +385,9 @@
                return error;
        }

+       pm_runtime_put_sync(dev);
+
        platform_set_drvdata(pdev, keypad_data);
-       pm_runtime_enable(dev);

        return 0;
 }
This patch seems to solve the warning and keypad functionality is restored.
the driver looks wrong to me. Why are calling pm_runtime_put_sync()
after pm_runtime_disable() ???
No, we should not be doing this...

OK, so the idea was to do everything via managed resources (devm_*) and
not having any gotos :) But I guess we had keypad somewhat alive and it
managed to generate an interrupt while parent(s) was sleeping because we
did pm_runtime_put_sync()/pm_runtime_disable() after reading register.
I wonder if we should have something like:

static void omap4_keypad_inhibit()
{
	kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQENABLE,
			 OMAP4_VAL_IRQDISABLE);
	kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQSTATUS,
			 kbd_read_irqreg(keypad_data,
					 OMAP4_KBD_IRQSTATUS));
}

and call it after reading the revision register.

Either that or we need devm_pm_runtime_enable().

Thanks.

-- 
Dmitry
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help