linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Matthew Garrett <mjg@redhat.com>
Cc: linux-input@vger.kernel.org, rydberg@euromail.se
Subject: Re: [PATCH] input: Fix USB autosuspend on bcm5974
Date: Thu, 6 Oct 2011 15:38:35 -0700	[thread overview]
Message-ID: <20111006223835.GA30738@core.coreip.homeip.net> (raw)
In-Reply-To: <1317936997-20438-1-git-send-email-mjg@redhat.com>

Hi Matthew,

On Thu, Oct 06, 2011 at 05:36:37PM -0400, Matthew Garrett wrote:
> The bcm5974 code takes a USB autosuspend reference on device open but
> only releases it if there's an error. Repeated opens will bump the count,

No, there won't be repeated opens as input core will not issue another
open unless everyone closes the device first (and then bcm5974_close
will drop the reference that is being held).

> which is clearly wrong. It's also unnecessary - the only part of the
> driver operation that is incompatible with autosuspend is the initial
> setup, and after that the device generates appropriate remote wakeups.
> Making the unreference unconditional fixes this.

... and makes counter unbalanced on close. If we change bcm5974_open()
as you are suggesting we need to adjust bcm5974_close() accordingly.

> 
> Signed-off-by: Matthew Garrett <mjg@redhat.com>
> ---
>  drivers/input/mouse/bcm5974.c |    3 +--
>  1 files changed, 1 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/input/mouse/bcm5974.c b/drivers/input/mouse/bcm5974.c
> index 5ec617e..38d0286 100644
> --- a/drivers/input/mouse/bcm5974.c
> +++ b/drivers/input/mouse/bcm5974.c
> @@ -764,8 +764,7 @@ static int bcm5974_open(struct input_dev *input)
>  
>  	mutex_unlock(&dev->pm_mutex);
>  
> -	if (error)
> -		usb_autopm_put_interface(dev->intf);
> +	usb_autopm_put_interface(dev->intf);
>  
>  	return error;
>  }

Thanks.

-- 
Dmitry

  reply	other threads:[~2011-10-06 22:38 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-06 21:36 [PATCH] input: Fix USB autosuspend on bcm5974 Matthew Garrett
2011-10-06 22:38 ` Dmitry Torokhov [this message]
2011-10-06 23:19   ` Matthew Garrett
2011-10-07  6:37     ` Oliver Neukum
2011-10-07 12:36       ` Matthew Garrett
2011-10-07 16:20         ` Dmitry Torokhov
2011-10-07 16:27           ` Matthew Garrett
2011-10-07 17:06             ` Henrik Rydberg
2011-10-07 17:13               ` Matthew Garrett
2011-10-07 17:42                 ` Henrik Rydberg
2011-10-07 17:39                   ` Matthew Garrett
2011-10-07 18:13                     ` Henrik Rydberg
2011-10-07 19:20                       ` Matthew Garrett

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=20111006223835.GA30738@core.coreip.homeip.net \
    --to=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=mjg@redhat.com \
    --cc=rydberg@euromail.se \
    /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).