diff options
author | Josef 'Jeff' Sipek <josef.sipek@nexenta.com> | 2014-05-07 01:27:12 -0400 |
---|---|---|
committer | Richard Lowe <richlowe@richlowe.net> | 2014-05-14 19:37:42 -0400 |
commit | e5815e7afac983d9ae9b2316e5056c8401cf7e5e (patch) | |
tree | fb65781de563050192a996c18b1a976293b60006 /usr/src/uts/common | |
parent | 7c64340fe7f813fbf9b6874c9422f7765bc54eb8 (diff) | |
download | illumos-joyent-e5815e7afac983d9ae9b2316e5056c8401cf7e5e.tar.gz |
4782 usba shouldn't abuse ddi_get_time(9f)
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Hans Rosenfeld <hans.rosenfeld@nexenta.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
Diffstat (limited to 'usr/src/uts/common')
-rw-r--r-- | usr/src/uts/common/io/usb/usba/hubdi.c | 13 | ||||
-rw-r--r-- | usr/src/uts/common/sys/usb/hubd/hubdvar.h | 7 |
2 files changed, 12 insertions, 8 deletions
diff --git a/usr/src/uts/common/io/usb/usba/hubdi.c b/usr/src/uts/common/io/usb/usba/hubdi.c index de454de41c..132b27bb16 100644 --- a/usr/src/uts/common/io/usb/usba/hubdi.c +++ b/usr/src/uts/common/io/usb/usba/hubdi.c @@ -21,6 +21,7 @@ /* * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2012 Garrett D'Amore <garrett@damore.org>. All rights reserved. + * Copyright 2014 Nexenta Systems, Inc. All rights reserved. */ /* @@ -749,7 +750,7 @@ hubd_can_suspend(hubd_t *hubd) * Don't go to lower power if haven't been at full power for enough * time to let hotplug thread kickoff. */ - if (ddi_get_time() < (hubpm->hubp_time_at_full_power + + if (gethrtime() < (hubpm->hubp_time_at_full_power + hubpm->hubp_min_pm_threshold)) { return (USB_FAILURE); @@ -1720,7 +1721,7 @@ hubd_pwrlvl3(hubd_t *hubd) ASSERT(rval == USB_SUCCESS); hubd->h_dev_state = USB_DEV_ONLINE; hubpm->hubp_current_power = USB_DEV_OS_FULL_PWR; - hubpm->hubp_time_at_full_power = ddi_get_time(); + hubpm->hubp_time_at_full_power = gethrtime(); hubd_start_polling(hubd, 0); /* FALLTHRU */ @@ -3712,7 +3713,7 @@ hubd_hotplug_thread(void *arg) /* mark the root hub as full power */ hubpm->hubp_current_power = USB_DEV_OS_FULL_PWR; - hubpm->hubp_time_at_full_power = ddi_get_time(); + hubpm->hubp_time_at_full_power = gethrtime(); mutex_exit(HUBD_MUTEX(hubd)); USB_DPRINTF_L4(DPRINT_MASK_HOTPLUG, hubd->h_log_handle, @@ -7273,8 +7274,8 @@ hubd_create_pm_components(dev_info_t *dip, hubd_t *hubd) hubpm->hubp_hubd = hubd; hubpm->hubp_pm_capabilities = 0; hubpm->hubp_current_power = USB_DEV_OS_FULL_PWR; - hubpm->hubp_time_at_full_power = ddi_get_time(); - hubpm->hubp_min_pm_threshold = hubdi_min_pm_threshold; + hubpm->hubp_time_at_full_power = gethrtime(); + hubpm->hubp_min_pm_threshold = hubdi_min_pm_threshold * NANOSEC; /* alloc memory to save power states of children */ hubpm->hubp_child_pwrstate = (uint8_t *) @@ -8709,7 +8710,7 @@ hubd_reset_thread(void *arg) /* mark the root hub as full power */ hubpm->hubp_current_power = USB_DEV_OS_FULL_PWR; - hubpm->hubp_time_at_full_power = ddi_get_time(); + hubpm->hubp_time_at_full_power = gethrtime(); mutex_exit(HUBD_MUTEX(hubd)); USB_DPRINTF_L3(DPRINT_MASK_HOTPLUG, hubd->h_log_handle, diff --git a/usr/src/uts/common/sys/usb/hubd/hubdvar.h b/usr/src/uts/common/sys/usb/hubd/hubdvar.h index 3c85cefd51..3463ff2a8b 100644 --- a/usr/src/uts/common/sys/usb/hubd/hubdvar.h +++ b/usr/src/uts/common/sys/usb/hubd/hubdvar.h @@ -22,6 +22,9 @@ * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ +/* + * Copyright 2014 Nexenta Systems, Inc. All rights reserved. + */ #ifndef _SYS_USB_HUBDVAR_H #define _SYS_USB_HUBDVAR_H @@ -91,9 +94,9 @@ typedef struct hub_power_struct { uint8_t hubp_current_power; /* current power level */ - time_t hubp_time_at_full_power; /* timestamp 0->3 */ + hrtime_t hubp_time_at_full_power; /* timestamp 0->3 */ - uint8_t hubp_min_pm_threshold; /* in seconds */ + hrtime_t hubp_min_pm_threshold; /* in nanoseconds */ /* power state of all children are tracked here */ uint8_t *hubp_child_pwrstate; |