Print this page
4823 don't open-code NSEC2MSEC and MSEC2NSEC


  99  * is reserved for "original" minor.
 100  */
 101 #define POWER_MINOR_TO_CLONE(minor) ((minor) & (POWER_MAX_CLONE - 1))
 102 
 103 /*
 104  * Power Button Abort Delay
 105  */
 106 #define ABORT_INCREMENT_DELAY   10
 107 
 108 /*
 109  * FWARC 2005/687: power device compatible property
 110  */
 111 #define POWER_DEVICE_TYPE "power-device-type"
 112 
 113 /*
 114  * Driver global variables
 115  */
 116 static void *power_state;
 117 static int power_inst = -1;
 118 
 119 static hrtime_t power_button_debounce = NANOSEC/MILLISEC*10;
 120 static hrtime_t power_button_abort_interval = 1.5 * NANOSEC;
 121 static int      power_button_abort_presses = 3;
 122 static int      power_button_abort_enable = 1;
 123 static int      power_button_enable = 1;
 124 
 125 static int      power_button_pressed = 0;
 126 static int      power_button_cancel = 0;
 127 static int      power_button_timeouts = 0;
 128 static int      timeout_cancel = 0;
 129 static int      additional_presses = 0;
 130 
 131 /*
 132  * Function prototypes
 133  */
 134 static int power_attach(dev_info_t *, ddi_attach_cmd_t);
 135 static int power_detach(dev_info_t *, ddi_detach_cmd_t);
 136 static int power_getinfo(dev_info_t *, ddi_info_cmd_t, void *, void **);
 137 static int power_open(dev_t *, int, int, cred_t *);
 138 static int power_close(dev_t, int, int, cred_t *);
 139 static int power_ioctl(dev_t, int, intptr_t, int, cred_t *, int *);




  99  * is reserved for "original" minor.
 100  */
 101 #define POWER_MINOR_TO_CLONE(minor) ((minor) & (POWER_MAX_CLONE - 1))
 102 
 103 /*
 104  * Power Button Abort Delay
 105  */
 106 #define ABORT_INCREMENT_DELAY   10
 107 
 108 /*
 109  * FWARC 2005/687: power device compatible property
 110  */
 111 #define POWER_DEVICE_TYPE "power-device-type"
 112 
 113 /*
 114  * Driver global variables
 115  */
 116 static void *power_state;
 117 static int power_inst = -1;
 118 
 119 static hrtime_t power_button_debounce = MSEC2NSEC(10);
 120 static hrtime_t power_button_abort_interval = 1.5 * NANOSEC;
 121 static int      power_button_abort_presses = 3;
 122 static int      power_button_abort_enable = 1;
 123 static int      power_button_enable = 1;
 124 
 125 static int      power_button_pressed = 0;
 126 static int      power_button_cancel = 0;
 127 static int      power_button_timeouts = 0;
 128 static int      timeout_cancel = 0;
 129 static int      additional_presses = 0;
 130 
 131 /*
 132  * Function prototypes
 133  */
 134 static int power_attach(dev_info_t *, ddi_attach_cmd_t);
 135 static int power_detach(dev_info_t *, ddi_detach_cmd_t);
 136 static int power_getinfo(dev_info_t *, ddi_info_cmd_t, void *, void **);
 137 static int power_open(dev_t *, int, int, cred_t *);
 138 static int power_close(dev_t, int, int, cred_t *);
 139 static int power_ioctl(dev_t, int, intptr_t, int, cred_t *, int *);