The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Alan Stern <stern@rowland.harvard.edu>, Greg KH <greg@kroah.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Linux PM mailing list <linux-pm@lists.linux-foundation.org>,
	Minchan Kim <minchan.kim@gmail.com>
Subject: Re: [PATCH] PM: Do not create wakeup sysfs files for devices that cannot wake up (v2)
Date: Sun, 6 Feb 2011 19:53:17 +0100	[thread overview]
Message-ID: <201102061953.17433.rjw@sisk.pl> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1102061024150.20379-100000@netrider.rowland.org>

On Sunday, February 06, 2011, Alan Stern wrote:
> On Sun, 6 Feb 2011, Rafael J. Wysocki wrote:
> 
> > Hi,
> > 
> > Below is the next version of the patch changing the PM core to only create
> > wakeup sysfs files for devices that are wakeup-capable.  It contains a change
> > in drivers/usb/core/hub.c that should avoid the problem described in the thread
> > at https://lkml.org/lkml/2011/2/5/108 , but I'm not 100% it's the right
> > approach.  Please have a look.
> 
> Yes, that's right -- in fact, it's exactly the same as what I was going
> to do.  Of course, it should be separated out into a separate patch, to
> be applied before the other wakeup changes.

OK, I'll split it out.

Greg, any objections to me putting the change below into the suspend tree as
a separate commit:

Index: linux-2.6/drivers/usb/core/hub.c
===================================================================
--- linux-2.6.orig/drivers/usb/core/hub.c
+++ linux-2.6/drivers/usb/core/hub.c
@@ -1465,6 +1465,7 @@ void usb_set_device_state(struct usb_dev
                enum usb_device_state new_state)
 {
        unsigned long flags;
+       int wakeup = -1;
 
        spin_lock_irqsave(&device_state_lock, flags);
        if (udev->state == USB_STATE_NOTATTACHED)
@@ -1479,11 +1480,10 @@ void usb_set_device_state(struct usb_dev
                                        || new_state == USB_STATE_SUSPENDED)
                                ;       /* No change to wakeup settings */
                        else if (new_state == USB_STATE_CONFIGURED)
-                               device_set_wakeup_capable(&udev->dev,
-                                       (udev->actconfig->desc.bmAttributes
-                                        & USB_CONFIG_ATT_WAKEUP));
+                               wakeup = udev->actconfig->desc.bmAttributes
+                                        & USB_CONFIG_ATT_WAKEUP;
                        else
-                               device_set_wakeup_capable(&udev->dev, 0);
+                               wakeup = 0;
                }
                if (udev->state == USB_STATE_SUSPENDED &&
                        new_state != USB_STATE_SUSPENDED)
@@ -1495,6 +1495,8 @@ void usb_set_device_state(struct usb_dev
        } else
                recursively_mark_NOTATTACHED(udev);
        spin_unlock_irqrestore(&device_state_lock, flags);
+       if (wakeup >= 0)
+               device_set_wakeup_capable(&udev->dev, wakeup);
 }
 EXPORT_SYMBOL_GPL(usb_set_device_state);

Thanks,
Rafael

  reply	other threads:[~2011-02-06 18:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-06 14:19 [PATCH] PM: Do not create wakeup sysfs files for devices that cannot wake up (v2) Rafael J. Wysocki
2011-02-06 15:29 ` Alan Stern
2011-02-06 18:53   ` Rafael J. Wysocki [this message]
2011-02-06 19:14     ` Greg KH
2011-02-06 20:03       ` Rafael J. Wysocki
2011-02-06 15:50 ` Minchan Kim
2011-02-06 18:54   ` Rafael J. Wysocki
2011-02-06 20:06 ` [PATCH 0/2] PM: Do not create wakeup sysfs files for devices that cannot wake up (v3) Rafael J. Wysocki
2011-02-06 20:07   ` [PATCH 1/2] USB / Hub: Do not call device_set_wakeup_capable() under spinlock Rafael J. Wysocki
2011-02-07 10:10     ` Minchan Kim
2011-02-06 20:08   ` [PATCH 1/2] PM: Do not create wakeup sysfs files for devices that cannot wake up Rafael J. Wysocki

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=201102061953.17433.rjw@sisk.pl \
    --to=rjw@sisk.pl \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=minchan.kim@gmail.com \
    --cc=stern@rowland.harvard.edu \
    /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