From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: "Dasgupta, Romit" <romit@ti.com>,
David Engraf <david.engraf@netcom.eu>, Greg KH <greg@kroah.com>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Linux-pm mailing list <linux-pm@lists.linux-foundation.org>
Subject: Re: [PATCH] [PM] Fixes missing PM entries in sysfs without CONFIG_PM_SLEEP
Date: Mon, 4 Aug 2008 17:03:27 +0200 [thread overview]
Message-ID: <200808041703.28229.rjw@sisk.pl> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0808041041070.2815-100000@iolanthe.rowland.org>
On Monday, 4 of August 2008, Alan Stern wrote:
> On Sun, 3 Aug 2008, Dasgupta, Romit wrote:
>
> > Alan,
> > Here is a patch for you. Tested with
> >
> > 1) CONFIG_SUSPEND, CONFIG_HIBERNATION i.e. with CONFIG_PM_SLEEP
> > 2) without CONFIG_PM_SLEEP but with CONFIG_PM
> > 3) without CONFIG_PM
>
> I'd prefer to use the patch below. Although it's a little longer, the
> end result is slightly less complicated. Also, it fixes two problems:
>
> dpm_sysfs_add/remove should be called whenever CONFIG_PM
> is defined, regardless of CONFIG_PM_SLEEP.
>
> dev->power.status should be initialized to DPM_ON even if
> CONFIG_PM isn't defined.
>
> Can you make sure it compiles properly under all three configurations?
>
> Rafael, any objections?
Hm, well, one thing below.
> Index: usb-2.6/drivers/base/power/power.h
> ===================================================================
> --- usb-2.6.orig/drivers/base/power/power.h
> +++ usb-2.6/drivers/base/power/power.h
> @@ -1,3 +1,8 @@
> +static inline void device_pm_init(struct device *dev)
> +{
> + dev->power.status = DPM_ON;
> +}
> +
> #ifdef CONFIG_PM_SLEEP
>
> /*
> Index: usb-2.6/drivers/base/core.c
> ===================================================================
> --- usb-2.6.orig/drivers/base/core.c
> +++ usb-2.6/drivers/base/core.c
> @@ -542,6 +542,7 @@ void device_initialize(struct device *de
> spin_lock_init(&dev->devres_lock);
> INIT_LIST_HEAD(&dev->devres_head);
> device_init_wakeup(dev, 0);
> + device_pm_init(dev);
> set_dev_node(dev, -1);
> }
>
> @@ -898,6 +899,9 @@ int device_add(struct device *dev)
> error = bus_add_device(dev);
> if (error)
> goto BusError;
> + error = dpm_sysfs_add(dev);
> + if (error)
> + goto DPMError;
> error = device_pm_add(dev);
>
> if (error)
> goto PMError;
> @@ -922,6 +926,8 @@ int device_add(struct device *dev)
> put_device(dev);
> return error;
> PMError:
> + dpm_sysfs_remove(dev);
> + DPMError:
> bus_remove_device(dev);
> BusError:
> if (dev->bus)
> @@ -1008,6 +1014,7 @@ void device_del(struct device *dev)
> struct class_interface *class_intf;
>
> device_pm_remove(dev);
> + dpm_sysfs_remove(dev);
> if (parent)
> klist_del(&dev->knode_parent);
> if (MAJOR(dev->devt)) {
> Index: usb-2.6/drivers/base/power/main.c
> ===================================================================
> --- usb-2.6.orig/drivers/base/power/main.c
> +++ usb-2.6/drivers/base/power/main.c
> @@ -69,7 +69,7 @@ void device_pm_unlock(void)
> */
device_pm_add() can now be void and the error variable in there is not
necessary any more.
> int device_pm_add(struct device *dev)
> {
> - int error;
> + int error = 0;
>
> pr_debug("PM: Adding info for %s:%s\n",
> dev->bus ? dev->bus->name : "No Bus",
> @@ -89,11 +89,8 @@ int device_pm_add(struct device *dev)
> */
> WARN_ON(true);
> }
> - error = dpm_sysfs_add(dev);
> - if (!error) {
> - dev->power.status = DPM_ON;
> - list_add_tail(&dev->power.entry, &dpm_list);
> - }
> +
> + list_add_tail(&dev->power.entry, &dpm_list);
> mutex_unlock(&dpm_list_mtx);
> return error;
> }
> @@ -110,7 +107,6 @@ void device_pm_remove(struct device *dev
> dev->bus ? dev->bus->name : "No Bus",
> kobject_name(&dev->kobj));
> mutex_lock(&dpm_list_mtx);
> - dpm_sysfs_remove(dev);
> list_del_init(&dev->power.entry);
> mutex_unlock(&dpm_list_mtx);
> }
Thanks,
Rafael
next prev parent reply other threads:[~2008-08-04 15:01 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <B85A65D85D7EB246BE421B3FB0FBB593013C91EE00@dbde02.ent.ti.com>
[not found] ` <Pine.LNX.4.44L0.0808021944110.18555-100000@netrider.rowland.org>
2008-08-03 14:12 ` Dasgupta, Romit
2008-08-04 14:45 ` Alan Stern
2008-08-04 15:03 ` Rafael J. Wysocki [this message]
2008-08-04 15:14 ` Alan Stern
2008-08-04 15:24 ` Rafael J. Wysocki
2008-08-04 15:45 ` Alan Stern
2008-08-05 0:19 ` Dasgupta, Romit
2008-08-05 12:58 ` David Engraf
2008-08-05 13:08 ` Dasgupta, Romit
2008-08-05 14:26 ` Alan Stern
2008-08-05 14:45 ` David Engraf
2008-08-05 15:00 ` Alan Stern
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=200808041703.28229.rjw@sisk.pl \
--to=rjw@sisk.pl \
--cc=david.engraf@netcom.eu \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@lists.linux-foundation.org \
--cc=linux-usb@vger.kernel.org \
--cc=romit@ti.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
all inboxes | Powered by JetHome®