[PATCH 5/6] staging: greybus/loopback: convert to use msecs internally

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

 



The API presented by operation.h expects milliseconds to be passed in.
This patch drops the conversion from user-input microseconds-to-jiffies and
from jiffies-to-milliseconds and instead converts directly from
microseconds-to-milliseconds. The new minimum timeout will be one
millisecond as opposed to one jiffy.

Signed-off-by: Bryan O'Donoghue <pure.logic at nexus-software.ie>
---
 drivers/staging/greybus/loopback.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/greybus/loopback.c b/drivers/staging/greybus/loopback.c
index 3dd26af..de17901 100644
--- a/drivers/staging/greybus/loopback.c
+++ b/drivers/staging/greybus/loopback.c
@@ -95,7 +95,7 @@ struct gb_loopback {
 	u32 requests_completed;
 	u32 requests_timedout;
 	u32 timeout;
-	u32 jiffy_timeout;
+	u32 msec_timeout;
 	u32 timeout_min;
 	u32 timeout_max;
 	u32 outstanding_operations_max;
@@ -113,7 +113,7 @@ static struct class loopback_class = {
 };
 static DEFINE_IDA(loopback_ida);
 
-/* Min/max values in jiffies */
+/* Min/max values in milliseconds */
 #define GB_LOOPBACK_TIMEOUT_MIN				1
 #define GB_LOOPBACK_TIMEOUT_MAX				10000
 
@@ -263,11 +263,11 @@ static void gb_loopback_check_attr(struct gb_loopback *gb)
 	case GB_LOOPBACK_TYPE_PING:
 	case GB_LOOPBACK_TYPE_TRANSFER:
 	case GB_LOOPBACK_TYPE_SINK:
-		gb->jiffy_timeout = usecs_to_jiffies(gb->timeout);
-		if (!gb->jiffy_timeout)
-			gb->jiffy_timeout = GB_LOOPBACK_TIMEOUT_MIN;
-		else if (gb->jiffy_timeout > GB_LOOPBACK_TIMEOUT_MAX)
-			gb->jiffy_timeout = GB_LOOPBACK_TIMEOUT_MAX;
+		gb->msec_timeout = gb->timeout / 1000;
+		if (!gb->msec_timeout)
+			gb->msec_timeout = GB_LOOPBACK_TIMEOUT_MIN;
+		else if (gb->msec_timeout > GB_LOOPBACK_TIMEOUT_MAX)
+			gb->msec_timeout = GB_LOOPBACK_TIMEOUT_MAX;
 		gb_loopback_reset_stats(gb);
 		wake_up(&gb->wq);
 		break;
@@ -525,7 +525,7 @@ static int gb_loopback_async_operation(struct gb_loopback *gb, int type,
 	atomic_inc(&gb->outstanding_operations);
 
 	mutex_lock(&gb->mutex);
-	timeout = jiffies_to_msecs(gb->jiffy_timeout);
+	timeout = gb->msec_timeout;
 	ret = gb_operation_request_send_async_timeout(operation, timeout,
 						      gb_loopback_async_operation_callback,
 						      GFP_KERNEL);
-- 
2.7.4



[Index of Archives]     [Asterisk App Development]     [PJ SIP]     [Gnu Gatekeeper]     [IETF Sipping]     [Info Cyrus]     [ALSA User]     [Fedora Linux Users]     [Linux SCTP]     [DCCP]     [Gimp]     [Yosemite News]     [Deep Creek Hot Springs]     [Yosemite Campsites]     [ISDN Cause Codes]     [Asterisk Books]

  Powered by Linux