From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Rafael J. Wysocki" Subject: Re: [PATCH] PM: Acquire device locks on suspend Date: Sun, 6 Jan 2008 20:05:11 +0100 Message-ID: <200801062005.12097.rjw@sisk.pl> References: Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Return-path: Received: from ogre.sisk.pl ([217.79.144.158]:33187 "EHLO ogre.sisk.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752558AbYAFTCw (ORCPT ); Sun, 6 Jan 2008 14:02:52 -0500 In-Reply-To: Content-Disposition: inline Sender: linux-acpi-owner@vger.kernel.org List-Id: linux-acpi@vger.kernel.org To: Alan Stern Cc: Greg KH , Andrew Morton , Len Brown , Ingo Molnar , ACPI Devel Maling List , LKML , pm list On Sunday, 6 of January 2008, Alan Stern wrote: > On Sun, 6 Jan 2008, Rafael J. Wysocki wrote: > > > > If you can figure out a way to disable the warning in device_del() for > > > just the one device being unregistered by > > > device_pm_destroy_suspended(), > > > > Something like this, perhaps: > > > > @@ -905,6 +915,18 @@ void device_del(struct device * dev) > > struct device * parent = dev->parent; > > struct class_interface *class_intf; > > > > + if (down_trylock(&dev->sem)) { > > + if (pm_sleep_lock()) { > > + dev_warn(dev, "Illegal %s during suspend\n", > > + __FUNCTION__); > > + dump_stack(); > > + } else { > > + pm_sleep_unlock(); > > + } > > + } else { > > + up(&dev->sem); > > + } > > + > > if (parent) > > klist_del(&dev->knode_parent); > > if (MAJOR(dev->devt)) > > Bizarre, but it should work. OK Still, shouldn't we fail the removal of the device apart from giving the warning? > Be sure to include plenty of explanatory comments I will. I think that code can be moved to its own function in drivers/base/power/main.c, btw. > -- otherwise nobody will be able to figure it out! :-) Well, I guess so. :-) Thanks, Rafael