Re: Setting usb autosuspend idle-delay in milliseconds

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am Freitag, 19. Februar 2010 14:19:44 schrieb Torgny Johansson:
> > The original idea was that anything lower than 1s would not 
> > make a significant difference. That however is an assumption 
> > without experimental verification.
> 
> Right, I too doubt that having e.g. 0,5s would make much of a difference
> from 1s but it would be interesting to try.
> 
> > 
> > Shall I understand this as a request for a patch that allows 
> > milisecond resolution?
> 
> If that is possible it would be highly appreciated. We would be very
> happy to test drive such a patch.

This patch changes the "autosuspend" sysfs attribute to miliseconds.
I don't think this makes sense, but if you want it for testing, here it is.

	Regards
		Oliver
From 1ffc7939c355c05fcbd25c02ba0d9f28b7ba386d Mon Sep 17 00:00:00 2001
From: Oliver Neukum <oliver@xxxxxxxxxx>
Date: Fri, 19 Feb 2010 17:57:09 +0100
Subject: [PATCH] usb: change "autosuspend" to miliseconds

EXPERIMENTAL, just for TESTING
---
 drivers/usb/core/sysfs.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c
index 5f3908f..7aca04e 100644
--- a/drivers/usb/core/sysfs.c
+++ b/drivers/usb/core/sysfs.c
@@ -307,7 +307,7 @@ show_autosuspend(struct device *dev, struct device_attribute *attr, char *buf)
 {
 	struct usb_device *udev = to_usb_device(dev);
 
-	return sprintf(buf, "%d\n", udev->autosuspend_delay / HZ);
+	return sprintf(buf, "%d\n", jiffies_to_msecs(udev->autosuspend_delay));
 }
 
 static ssize_t
@@ -317,10 +317,10 @@ set_autosuspend(struct device *dev, struct device_attribute *attr,
 	struct usb_device *udev = to_usb_device(dev);
 	int value;
 
-	if (sscanf(buf, "%d", &value) != 1 || value >= INT_MAX/HZ ||
-			value <= - INT_MAX/HZ)
+	if (sscanf(buf, "%d", &value) != 1 || value >= INT_MAX ||
+			value <= - INT_MAX)
 		return -EINVAL;
-	value *= HZ;
+	value = msecs_to_jiffies(value);
 
 	udev->autosuspend_delay = value;
 	if (value >= 0)
-- 
1.6.4.2


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux