linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Felipe Balbi <balbi@ti.com>
Cc: Sourav <sourav.poddar@ti.com>, linux-input@vger.kernel.org
Subject: Re: [RFT/PATCH] Input: omap4-keypad - switch to use managed resources
Date: Thu, 25 Oct 2012 11:24:23 -0700	[thread overview]
Message-ID: <20121025182423.GB24594@core.coreip.homeip.net> (raw)
In-Reply-To: <20121025140916.GC16564@arwen.pp.htv.fi>

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:
> > 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

      reply	other threads:[~2012-10-25 18:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-25  7:46 [RFT/PATCH] Input: omap4-keypad - switch to use managed resources Dmitry Torokhov
2012-10-25  8:59 ` Sourav
2012-10-25 12:49   ` Sourav
2012-10-25 13:01 ` Sourav
2012-10-25 14:09   ` Felipe Balbi
2012-10-25 18:24     ` Dmitry Torokhov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121025182423.GB24594@core.coreip.homeip.net \
    --to=dmitry.torokhov@gmail.com \
    --cc=balbi@ti.com \
    --cc=linux-input@vger.kernel.org \
    --cc=sourav.poddar@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).