Re: [PATCH] Export URB statistics for powertop.

Alan Stern <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
On Wed, 3 Oct 2007, Sarah Sharp wrote:

> powertop currently tracks interrupts generated by uhci and ehci,
> but it has no way of telling which USB device to blame interrupts on.
> This patch exports the number of URBs that complete for a given device.
> Cat the file 'urbnum' in /sys/bus/usb/devices/.../
> 
> Signed-off-by: Sarah Sharp <[email protected]>
> ---
>  drivers/usb/core/driver.c |    1 +
>  drivers/usb/core/hcd.c    |    1 +
>  drivers/usb/core/sysfs.c  |   11 +++++++++++
>  include/linux/usb.h       |    1 +
>  4 files changed, 14 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
> index 63b1243..125406a 100644
> --- a/drivers/usb/core/driver.c
> +++ b/drivers/usb/core/driver.c
> @@ -170,6 +170,7 @@ static int usb_probe_device(struct device *dev)
>  	 * unless the driver suports autosuspend.
>  	 */
>  	udev->pm_usage_cnt = !(udriver->supports_autosuspend);
> +	atomic_set(&udev->urb_cnt, 0);

This line belongs in usb_alloc_dev() in usb.c.  Putting it where you 
did means the field will be used before it is initialized.

Did you have some particular reason for wanting to zero the counter 
by rebinding the device?  If yes, you could keep the line here as well.

Alan Stern


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.