VirtualBox

Changeset 13934

Show
Ignore:
Timestamp:
11/06/08 21:12:05 (2 months ago)
Author:
vboxsync
Message:

backed out r38943

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c

    r13924 r13934  
    4646#include <iprt/err.h> 
    4747#include <iprt/mem.h> 
    48 #include <iprt/power.h> 
    4948#include <VBox/log.h> 
    5049#include <iprt/mp.h> 
     
    6261#  include <asm/nmi.h> 
    6362# endif 
    64 #endif 
    65 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 23) 
    66 # include <linux/suspend.h> 
    6763#endif 
    6864 
     
    233229static int      VBoxDrvLinuxIOCtlSlow(struct file *pFilp, unsigned int uCmd, unsigned long ulArg); 
    234230static int      VBoxDrvLinuxErr2LinuxErr(int); 
    235 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 23) 
    236 static int      VBoxDrvSuspendNotifier(struct notifier_block *pBlock, unsigned long uEvent, void *dummy); 
    237 #endif 
    238231 
    239232 
     
    265258#endif 
    266259 
    267 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 23) 
    268 /** Suspend/resume notifier. */ 
    269 static struct notifier_block gSuspendNotifierBlock = 
    270 
    271     .notifier_call = VBoxDrvSuspendNotifier, 
    272 }; 
    273 #endif 
     260 
    274261 
    275262 
     
    569556            if (RT_SUCCESS(rc)) 
    570557                rc = supdrvInitDevExt(&g_DevExt); 
    571             if (RT_SUCCESS(rc)
     558            if (!rc
    572559            { 
    573 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 23) 
    574                 /* 
    575                  * Register the suspend/resume notifier. 
    576                  */ 
    577                 rc = register_pm_notifier(&gSuspendNotifierBlock); 
    578                 if (rc == 0) 
    579 #endif 
    580                 { 
    581                     printk(KERN_INFO DEVICE_NAME ": TSC mode is %s, kernel timer mode is " 
     560                printk(KERN_INFO DEVICE_NAME ": TSC mode is %s, kernel timer mode is " 
    582561#ifdef VBOX_HRTIMER 
    583                            "'high-res'" 
     562                       "'high-res'" 
    584563#else 
    585                            "'normal'" 
    586 #endif 
    587                            ".\n", 
    588                            g_DevExt.pGip->u32Mode == SUPGIPMODE_SYNC_TSC ? "'synchronous'" : "'asynchronous'"); 
    589                     LogFlow(("VBoxDrv::ModuleInit returning %#x\n", rc)); 
    590                     printk(KERN_DEBUG DEVICE_NAME ": Successfully loaded version " 
    591                             VBOX_VERSION_STRING " (interface " xstr(SUPDRV_IOC_VERSION) ").\n"); 
    592                     return rc; 
    593                 } 
     564                       "'normal'" 
     565#endif 
     566                       ".\n", 
     567                       g_DevExt.pGip->u32Mode == SUPGIPMODE_SYNC_TSC ? "'synchronous'" : "'asynchronous'"); 
     568                LogFlow(("VBoxDrv::ModuleInit returning %#x\n", rc)); 
     569                printk(KERN_DEBUG DEVICE_NAME ": Successfully loaded version " 
     570                       VBOX_VERSION_STRING " (interface " xstr(SUPDRV_IOC_VERSION) ").\n"); 
     571                return rc; 
    594572            } 
    595573 
     
    627605    NOREF(rc); 
    628606 
    629 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 23) 
    630     /* 
    631      * Unregister the suspend/resume notifier. 
    632      */ 
    633     unregister_pm_notifier(&gSuspendNotifierBlock); 
    634 #endif 
    635  
    636607    /* 
    637608     * I Don't think it's possible to unload a driver which processes have 
     
    641612    rc = misc_deregister(&gMiscDevice); 
    642613    if (rc < 0) 
     614    { 
    643615        dprintf(("misc_deregister failed with rc=%#x\n", rc)); 
     616    } 
    644617#else  /* !CONFIG_VBOXDRV_AS_MISC */ 
    645618# ifdef CONFIG_DEVFS_FS 
     
    716689    return 0; 
    717690} 
    718  
    719  
    720 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 23) 
    721 /** 
    722  * Suspend/resume callback. 
    723  * 
    724  * @param   pNotifier 
    725  * @param   uEvent      event type 
    726  * @param   dummy 
    727  */ 
    728 static int VBoxDrvSuspendNotifier(struct notifier_block *pBlock, unsigned long uEvent, void *dummy) 
    729 { 
    730     switch (uEvent) 
    731     { 
    732         case PM_SUSPEND_PREPARE: 
    733         case PM_POST_SUSPEND: 
    734             RTPowerSignalEvent(uEvent == PM_SUSPEND_PREPARE ? RTPOWEREVENT_SUSPEND 
    735                                                             : RTPOWEREVENT_RESUME); 
    736             break; 
    737     } 
    738     return 0; 
    739 } 
    740 #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 23) */ 
    741691 
    742692 

© 2008 Sun Microsystems, Inc.
ContactPrivacy policy