VirtualBox

Ignore:
Timestamp:
Jan 21, 2008 4:51:44 PM (17 years ago)
Author:
vboxsync
Message:

cosmetics on the hrtimer stuff.

Location:
trunk/src/VBox/HostDrivers/Support
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/Support/SUPDRV.h

    r6340 r6418  
    2525 */
    2626
    27 #ifndef __SUPDRV_h__
    28 #define __SUPDRV_h__
     27#ifndef ___SUPDRV_h
     28#define ___SUPDRV_h
    2929
    3030
     
    271271typedef struct timer_list VBOXKTIMER;
    272272# endif
     273typedef VBOXKTIMER       *PVBOXKTIMER;
    273274#endif
    274275
  • trunk/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c

    r6342 r6418  
    4242#include <linux/module.h>
    4343#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
    44 #include <linux/moduleparam.h>
     44# include <linux/moduleparam.h>
    4545#endif
    4646#include <linux/kernel.h>
     
    284284#endif /* !CONFIG_VBOXDRV_AS_MISC */
    285285
    286 /** Module parameter */
     286/** Module parameter.
     287 * Not prefixed because the name is used by macros and the end of this file. */
    287288static int force_async_tsc = 0;
    288289
     
    310311*******************************************************************************/
    311312#ifdef VBOX_HRTIMER
    312 typedef enum hrtimer_restart (*VBOXTIMERFN)(struct hrtimer *);
    313 #else
    314 typedef void (*VBOXTIMERFN)(unsigned long);
     313typedef enum hrtimer_restart (*PFNVBOXKTIMER)(struct hrtimer *);
     314#else
     315typedef void (*PFNVBOXKTIMER)(unsigned long);
    315316#endif
    316317
     
    328329static int      VBoxDrvLinuxTermGip(PSUPDRVDEVEXT pDevExt);
    329330#ifdef VBOX_HRTIMER
    330 static enum hrtimer_restart VBoxDrvLinuxGipTimer(struct hrtimer *timer);
     331static enum hrtimer_restart VBoxDrvLinuxGipTimer(struct hrtimer *pTimer);
    331332#else
    332333static void     VBoxDrvLinuxGipTimer(unsigned long ulUser);
     
    334335#ifdef CONFIG_SMP
    335336# ifdef VBOX_HRTIMER
    336 static enum hrtimer_restart VBoxDrvLinuxGipTimerPerCpu(struct hrtimer *timer);
     337static enum hrtimer_restart VBoxDrvLinuxGipTimerPerCpu(struct hrtimer *pTimer);
    337338# else
    338339static void     VBoxDrvLinuxGipTimerPerCpu(unsigned long ulUser);
     
    370371#endif
    371372
    372 static inline void vbox_ktimer_init(VBOXKTIMER *timer, VBOXTIMERFN function, unsigned long data)
     373static inline void vbox_ktimer_init(PVBOXKTIMER pTimer, PFNVBOXKTIMER pfnFunction, unsigned long ulData)
    373374{
    374375#ifdef VBOX_HRTIMER
    375    hrtimer_init(timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
    376     timer->function = function;
    377 #else
    378     init_timer(timer);
    379     timer->data     = data;
    380     timer->function = function;
    381     timer->expires  = jiffies;
    382 #endif
    383 }
    384 
    385 static inline void vbox_ktimer_start(VBOXKTIMER *timer)
     376    hrtimer_init(pTimer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
     377    pTimer->function = pfnFunction;
     378#else
     379    init_timer(pTimer);
     380    pTimer->data     = ulData;
     381    pTimer->function = pfnFunction;
     382    pTimer->expires  = jiffies;
     383#endif
     384}
     385
     386static inline void vbox_ktimer_start(PVBOXKTIMER pTimer)
    386387{
    387388#ifdef VBOX_HRTIMER
    388     hrtimer_start(timer, ktime_add_ns(ktime_get(), 1000000), HRTIMER_MODE_ABS);
    389 #else
    390     mod_timer(timer, jiffies);
    391 #endif
    392 }
    393 
    394 static inline void vbox_ktimer_stop(VBOXKTIMER *timer)
     389    hrtimer_start(pTimer, ktime_add_ns(ktime_get(), 1000000), HRTIMER_MODE_ABS);
     390#else
     391    mod_timer(pTimer, jiffies);
     392#endif
     393}
     394
     395static inline void vbox_ktimer_stop(PVBOXKTIMER pTimer)
    395396{
    396397#ifdef VBOX_HRTIMER
    397     hrtimer_cancel(timer);
    398 #else
    399     if (timer_pending(timer))
    400         del_timer_sync(timer);
     398    hrtimer_cancel(pTimer);
     399#else
     400    if (timer_pending(pTimer))
     401        del_timer_sync(pTimer);
    401402#endif
    402403}
     
    701702                    printk(KERN_INFO DEVICE_NAME ": TSC mode is %s, kernel timer mode is "
    702703#ifdef VBOX_HRTIMER
    703                             "'high-res'"
    704 #else
    705                             "'normal'"
    706 #endif
    707                             ".\n",
    708                             g_DevExt.pGip->u32Mode == SUPGIPMODE_SYNC_TSC ? "'synchronous'" : "'asynchronous'");
     704                           "'high-res'"
     705#else
     706                           "'normal'"
     707#endif
     708                           ".\n",
     709                           g_DevExt.pGip->u32Mode == SUPGIPMODE_SYNC_TSC ? "'synchronous'" : "'asynchronous'");
    709710                    dprintf(("VBoxDrv::ModuleInit returning %#x\n", rc));
    710711                    printk(KERN_DEBUG DEVICE_NAME ": Successfully loaded version "
     
    11071108 */
    11081109#ifdef VBOX_HRTIMER
    1109 static enum hrtimer_restart VBoxDrvLinuxGipTimer(struct hrtimer* timer)
     1110static enum hrtimer_restart VBoxDrvLinuxGipTimer(struct hrtimer *pTimer)
    11101111#else
    11111112static void VBoxDrvLinuxGipTimer(unsigned long ulUser)
     
    11191120    unsigned long       SavedFlags;
    11201121#ifdef VBOX_HRTIMER
    1121     ktime_t             kNow;
     1122    ktime_t             KtNow;
    11221123#endif
    11231124
     
    11261127    ulNow   = jiffies;
    11271128#ifdef VBOX_HRTIMER
    1128     kNow    = ktime_get();
     1129    KtNow   = ktime_get();
    11291130    pDevExt = &g_DevExt;
    11301131#else
     
    11551156    {
    11561157#ifdef VBOX_HRTIMER
    1157         hrtimer_forward(&g_GipTimer, kNow, ktime_set(0, 1000000));
     1158        hrtimer_forward(&g_GipTimer, KtNow, ktime_set(0, 1000000));
    11581159#else
    11591160        mod_timer(&g_GipTimer, ulNow + ONE_MSEC_IN_JIFFIES);
     
    11761177 */
    11771178#ifdef VBOX_HRTIMER
    1178 static enum hrtimer_restart VBoxDrvLinuxGipTimerPerCpu(struct hrtimer *timer)
     1179static enum hrtimer_restart VBoxDrvLinuxGipTimerPerCpu(struct hrtimer *pTimer)
    11791180#else
    11801181static void VBoxDrvLinuxGipTimerPerCpu(unsigned long iTimerCPU)
     
    11891190# ifdef VBOX_HRTIMER
    11901191    unsigned long       iTimerCPU;
    1191     ktime_t             kNow;
     1192    ktime_t             KtNow;
    11921193# endif
    11931194
     
    12001201# ifdef VBOX_HRTIMER
    12011202    iTimerCPU = iCPU; /* XXX hrtimer does not support a 'data' field */
    1202     kNow    = ktime_get();
     1203    KtNow   = ktime_get();
    12031204# endif
    12041205
     
    12161217            {
    12171218# ifdef VBOX_HRTIMER
    1218                 hrtimer_forward(&pDevExt->aCPUs[iCPU].Timer, kNow, ktime_set(0, 1000000));
     1219                hrtimer_forward(&pDevExt->aCPUs[iCPU].Timer, KtNow, ktime_set(0, 1000000));
    12191220# else
    12201221                mod_timer(&pDevExt->aCPUs[iCPU].Timer, ulNow + ONE_MSEC_IN_JIFFIES);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette