Changeset 13934
- Timestamp:
- 11/06/08 21:12:05 (2 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c
r13924 r13934 46 46 #include <iprt/err.h> 47 47 #include <iprt/mem.h> 48 #include <iprt/power.h>49 48 #include <VBox/log.h> 50 49 #include <iprt/mp.h> … … 62 61 # include <asm/nmi.h> 63 62 # endif 64 #endif65 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 23)66 # include <linux/suspend.h>67 63 #endif 68 64 … … 233 229 static int VBoxDrvLinuxIOCtlSlow(struct file *pFilp, unsigned int uCmd, unsigned long ulArg); 234 230 static 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 #endif238 231 239 232 … … 265 258 #endif 266 259 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 274 261 275 262 … … 569 556 if (RT_SUCCESS(rc)) 570 557 rc = supdrvInitDevExt(&g_DevExt); 571 if ( RT_SUCCESS(rc))558 if (!rc) 572 559 { 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 " 582 561 #ifdef VBOX_HRTIMER 583 "'high-res'"562 "'high-res'" 584 563 #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; 594 572 } 595 573 … … 627 605 NOREF(rc); 628 606 629 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 23)630 /*631 * Unregister the suspend/resume notifier.632 */633 unregister_pm_notifier(&gSuspendNotifierBlock);634 #endif635 636 607 /* 637 608 * I Don't think it's possible to unload a driver which processes have … … 641 612 rc = misc_deregister(&gMiscDevice); 642 613 if (rc < 0) 614 { 643 615 dprintf(("misc_deregister failed with rc=%#x\n", rc)); 616 } 644 617 #else /* !CONFIG_VBOXDRV_AS_MISC */ 645 618 # ifdef CONFIG_DEVFS_FS … … 716 689 return 0; 717 690 } 718 719 720 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 23)721 /**722 * Suspend/resume callback.723 *724 * @param pNotifier725 * @param uEvent event type726 * @param dummy727 */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_SUSPEND735 : RTPOWEREVENT_RESUME);736 break;737 }738 return 0;739 }740 #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 23) */741 691 742 692

