Changeset 55436 in vbox for trunk/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c
- Timestamp:
- Apr 27, 2015 9:13:02 AM (10 years ago)
- svn:sync-xref-src-repo-rev:
- 99782
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c
r55435 r55436 48 48 # include <iprt/power.h> 49 49 # define VBOX_WITH_SUSPEND_NOTIFICATION 50 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 23)51 # define VBOX_WITH_PRE_SUSPEND_NOTIFICATION52 # endif53 50 #endif 54 51 … … 62 59 #ifdef VBOX_WITH_SUSPEND_NOTIFICATION 63 60 # include <linux/platform_device.h> 64 #endif65 #ifdef VBOX_WITH_PRE_SUSPEND_NOTIFICATION66 # include <linux/suspend.h>67 # include <linux/notifier.h>68 61 #endif 69 62 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28)) && defined(SUPDRV_WITH_MSR_PROBER) … … 129 122 # endif 130 123 static void VBoxDevRelease(struct device *pDev); 131 # ifdef VBOX_WITH_PRE_SUSPEND_NOTIFICATION132 static int VBoxDrvPowerNotificationCallback(struct notifier_block *, unsigned long, void *);133 # endif134 124 #endif 135 125 … … 280 270 } 281 271 }; 282 283 # ifdef VBOX_WITH_PRE_SUSPEND_NOTIFICATION284 static struct notifier_block *g_pNotifier;285 # endif /* VBOX_WITH_PRE_SUSPEND_NOTIFICATION */286 272 #endif /* VBOX_WITH_SUSPEND_NOTIFICATION */ 287 273 … … 432 418 #endif 433 419 { 434 # ifdef VBOX_WITH_PRE_SUSPEND_NOTIFICATION435 size_t const cbNotifier = sizeof(*g_pNotifier);436 g_pNotifier = RTMemAllocZ(cbNotifier);437 if (g_pNotifier)438 {439 g_pNotifier->notifier_call = VBoxDrvPowerNotificationCallback;440 g_pNotifier->priority = 0;441 rc = register_pm_notifier(g_pNotifier);442 if (!rc)443 printk(KERN_INFO "vboxdrv: Successfully registered power notifier\n");444 else445 {446 printk(KERN_INFO "vboxdrv: Failed to register power notifier! rc=%d\n", rc);447 rc = 0;448 }449 }450 else451 printk(KERN_INFO "vboxdrv: Failed to alloc %lu bytes for power notifier\n", cbNotifier);452 # endif453 454 420 printk(KERN_INFO "vboxdrv: TSC mode is %s, tentative frequency %llu Hz\n", 455 421 SUPGetGIPModeName(g_DevExt.pGip), g_DevExt.pGip->u64CpuHz); … … 505 471 platform_device_unregister(&gPlatformDevice); 506 472 platform_driver_unregister(&gPlatformDriver); 507 # ifdef VBOX_WITH_PRE_SUSPEND_NOTIFICATION508 if (g_pNotifier)509 {510 unregister_pm_notifier(g_pNotifier);511 g_pNotifier = NULL;512 }513 # endif514 473 #endif 515 474 … … 675 634 #endif /* VBOX_WITH_SUSPEND_NOTIFICATION */ 676 635 677 678 #ifdef VBOX_WITH_PRE_SUSPEND_NOTIFICATION679 static int VBoxDrvPowerNotificationCallback(struct notifier_block *pNotifier, unsigned long uEvent, void *pvUnused)680 {681 NOREF(pvUnused);682 if (uEvent == PM_SUSPEND_PREPARE)683 RTPowerSignalEvent(RTPOWEREVENT_PRE_SUSPEND);684 /* The remaining events are taken care by VBoxDrvSuspend() and VboxDrvResume() hooks. */685 return NOTIFY_DONE;686 }687 #endif688 636 689 637 /**
Note:
See TracChangeset
for help on using the changeset viewer.