Re: How to perform runtime pm for usb hcds? | |
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] | |
On Mon, 19 Nov 2007, jidong xiao wrote:
> Hi,
> I saw usb_hcd_pci_suspend() is stored in several HCD's struct
> pci_driver as suspend, and usb_hcd_pci_resume() is stored as
> resume().From user's perspective, is it possible to call these methods
> manually?I mean,I am using kdb the trace these methods,and I wanna set
> a breakpoint in the point whenever these two methods are invoked.
> That's to say, once either of these two methods are invoked, then the
> system will drop into kdb, so that I can do some analysis on these two
> methods. But the problem is, from user space,what shall I do to
> trigger these two methods?
Here's a patch to create a sysfs file for PCI devices. Writing 1 to
the file will call the device's suspend method, and writing 0 will call
the resume method.
Alan Stern
Index: linux/drivers/pci/pci-sysfs.c
===================================================================
--- linux.orig/drivers/pci/pci-sysfs.c 2007-10-26 09:33:12.000000000 +0800
+++ linux/drivers/pci/pci-sysfs.c 2007-10-26 09:33:27.000000000 +0800
@@ -192,6 +192,22 @@ msi_bus_store(struct device *dev, struct
return count;
}
+static ssize_t
+suspend_store(struct device *dev, struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ int rc;
+
+ if (*buf == '1')
+ rc = dev->bus->suspend(dev, PMSG_SUSPEND);
+ else if (*buf == '0')
+ rc = dev->bus->resume(dev);
+ else
+ rc = -EIO;
+ return (rc < 0 ? rc : count);
+}
+
+
struct device_attribute pci_dev_attrs[] = {
__ATTR_RO(resource),
__ATTR_RO(vendor),
@@ -209,6 +225,7 @@ struct device_attribute pci_dev_attrs[]
__ATTR(broken_parity_status,(S_IRUGO|S_IWUSR),
broken_parity_status_show,broken_parity_status_store),
__ATTR(msi_bus, 0644, msi_bus_show, msi_bus_store),
+ __ATTR(suspend, 0200, NULL, suspend_store),
__ATTR_NULL,
};
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
linux-usb-devel@xxxxxxxxxxxxxxxxxxxxx
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
[Home] [Video for Linux] [Photo] [Yosemite Forum] [Yosemite Photos] [Video Projectors] [PDAs] [Hacking TiVo] [Linux Kernel] [Linux SCSI] [XFree86] [Devices] [Big List of Linux Books] [Free Dating]
![]() |