Changeset 13924 in vbox for trunk/src/VBox
- Timestamp:
- Nov 6, 2008 3:50:56 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c
r13865 r13924 46 46 #include <iprt/err.h> 47 47 #include <iprt/mem.h> 48 #include <iprt/power.h> 48 49 #include <VBox/log.h> 49 50 #include <iprt/mp.h> … … 61 62 # include <asm/nmi.h> 62 63 # endif 64 #endif 65 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 23) 66 # include <linux/suspend.h> 63 67 #endif 64 68 … … 229 233 static int VBoxDrvLinuxIOCtlSlow(struct file *pFilp, unsigned int uCmd, unsigned long ulArg); 230 234 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 #endif 231 238 232 239 … … 258 265 #endif 259 266 260 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 261 274 262 275 … … 556 569 if (RT_SUCCESS(rc)) 557 570 rc = supdrvInitDevExt(&g_DevExt); 558 if ( !rc)571 if (RT_SUCCESS(rc)) 559 572 { 560 printk(KERN_INFO DEVICE_NAME ": TSC mode is %s, kernel timer mode is " 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 " 561 582 #ifdef VBOX_HRTIMER 562 "'high-res'"583 "'high-res'" 563 584 #else 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; 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 } 572 594 } 573 595 … … 605 627 NOREF(rc); 606 628 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 607 636 /* 608 637 * I Don't think it's possible to unload a driver which processes have … … 612 641 rc = misc_deregister(&gMiscDevice); 613 642 if (rc < 0) 614 {615 643 dprintf(("misc_deregister failed with rc=%#x\n", rc)); 616 }617 644 #else /* !CONFIG_VBOXDRV_AS_MISC */ 618 645 # ifdef CONFIG_DEVFS_FS … … 689 716 return 0; 690 717 } 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) */ 691 741 692 742
Note:
See TracChangeset
for help on using the changeset viewer.