linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@codeaurora.org>
To: Anirudh Ghayal <aghayal@codeaurora.org>
Cc: linux-input@vger.kernel.org, rtc-linux@googlegroups.com,
	linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
	Trilok Soni <tsoni@codeaurora.org>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>
Subject: Re: [PATCH 2/3] input: pmic8xxx_pwrkey: Add support for power key
Date: Mon, 28 Mar 2011 13:57:21 -0700	[thread overview]
Message-ID: <4D90F631.908@codeaurora.org> (raw)
In-Reply-To: <1301158345-22206-3-git-send-email-aghayal@codeaurora.org>

On 3/26/2011 9:52 AM, Anirudh Ghayal wrote:
> +static void pmic8xxx_pwrkey_timer(unsigned long handle)
> +{
> +	unsigned long flags;
> +	struct pmic8xxx_pwrkey *pwrkey = (struct pmic8xxx_pwrkey *)handle;
> +
> +	spin_lock_irqsave(&pwrkey->lock, flags);
> +	pwrkey->key_pressed = true;
> +
> +	input_report_key(pwrkey->pwr, KEY_POWER, 1);
> +	input_sync(pwrkey->pwr);
> +	spin_unlock_irqrestore(&pwrkey->lock, flags);
> +}
> +
>
[snip]
> +
> +static irqreturn_t pwrkey_release_irq(int irq, void *_pwrkey)
> +{
> +	struct pmic8xxx_pwrkey *pwrkey = _pwrkey;
> +	unsigned long flags;
> +
> +	/* no pwrkey time, means no delay in pwr key reporting */
> +	if (!pwrkey->pdata->pwrkey_time_ms) {
> +		input_report_key(pwrkey->pwr, KEY_POWER, 0);
> +		input_sync(pwrkey->pwr);
> +		return IRQ_HANDLED;
> +	}
> +
> +	spin_lock_irqsave(&pwrkey->lock, flags);
> +	del_timer_sync(&pwrkey->timer);

Can you call del_timer_sync() while holding the lock that your timer
function also acquires? I thought lockdep would have complained loudly
about that but I'm not sure. It looks like a deadlock scenario.

> +static int __devinit pmic8xxx_pwrkey_probe(struct platform_device *pdev)
> +{
>
[snip]
> +
> +	if (pdata->kpd_trigger_delay_us > 62500) {
> +		dev_err(&pdev->dev, "invalid pwr key trigger delay\n");

Nitpick: Can you spell out "power" here instead of pwr? Or use
"kpd_trigger_delay_us" instead.

> +		return -EINVAL;
> +	}
> +
> +	if (pdata->pwrkey_time_ms &&
> +	     (pdata->pwrkey_time_ms < 500 || pdata->pwrkey_time_ms > 1000)) {
> +		dev_err(&pdev->dev, "invalid pwr key time supplied\n");

Ditto

> +
> +	pon_cntl &= ~PON_CNTL_TRIG_DELAY_MASK;
> +	pon_cntl |= (delay & PON_CNTL_TRIG_DELAY_MASK);
> +	pon_cntl |= (pdata->pull_up ? PON_CNTL_PULL_UP : ~PON_CNTL_PULL_UP);

Did you just set a bunch of bits you didn't want to when pdata->pull_up
== false?

-- 
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

  reply	other threads:[~2011-03-28 20:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1301158345-22206-1-git-send-email-aghayal@codeaurora.org>
2011-03-26 16:52 ` [PATCH 2/3] input: pmic8xxx_pwrkey: Add support for power key Anirudh Ghayal
2011-03-28 20:57   ` Stephen Boyd [this message]
2011-04-01  9:23     ` [rtc-linux] " Anirudh Ghayal
2011-03-26 16:52 ` [PATCH 3/3] drivers: rtc: Add support for Qualcomm PMIC8xxx RTC Anirudh Ghayal
2011-03-31 16:48   ` [rtc-linux] " Wan ZongShun
2011-04-01  8:49     ` Anirudh Ghayal

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=4D90F631.908@codeaurora.org \
    --to=sboyd@codeaurora.org \
    --cc=aghayal@codeaurora.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rtc-linux@googlegroups.com \
    --cc=tsoni@codeaurora.org \
    /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).