[vbox-dev] Source change for kernels after 2.6.31
Larry Finger
Larry.Finger at lwfinger.net
Sat Jun 20 15:09:30 PDT 2009
When 2.6.30-gitX (pre 2.6.31) kernels are used, there is a warning
printed that says
"Platform driver 'vboxdrv' needs updating - please use dev_pm_ops"
The warning means that the driver will fail to compile in some future
version, perhaps 2.6.32. The fix for this warning is
Index: src/vboxdrv/linux/SUPDrv-linux.c
===================================================================
--- src.orig/vboxdrv/linux/SUPDrv-linux.c
+++ src/vboxdrv/linux/SUPDrv-linux.c
@@ -239,8 +239,13 @@ static int VBoxDrvLinuxIOCtlSlow(struct
static int VBoxDrvLinuxErr2LinuxErr(int);
#ifdef VBOX_WITH_SUSPEND_NOTIFICATION
static int VBoxDrvProbe(struct platform_device *pDev);
+# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 30)
+static int VBoxDrvSuspend(struct device *pDev);
+static int VBoxDrvResume(struct device *pDev);
+#else
static int VBoxDrvSuspend(struct platform_device *pDev, pm_message_t
State);
static int VBoxDrvResume(struct platform_device *pDev);
+#endif
static void VBoxDevRelease(struct device *pDev);
#endif
@@ -273,15 +278,27 @@ static struct miscdevice gMiscDevice =
#ifdef VBOX_WITH_SUSPEND_NOTIFICATION
+# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 30)
+static struct dev_pm_ops vboxdrv_pm_ops = {
+ .suspend = VBoxDrvSuspend,
+ .resume = VBoxDrvResume,
+};
+#endif
+
static struct platform_driver gPlatformDriver =
{
.probe = VBoxDrvProbe,
+# if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 30)
.suspend = VBoxDrvSuspend,
.resume = VBoxDrvResume,
+#endif
/** @todo .shutdown? */
.driver =
{
- .name = "vboxdrv"
+ .name = "vboxdrv",
+# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 30)
+ .pm = &vboxdrv_pm_ops,
+#endif
}
};
@@ -771,7 +788,11 @@ static int VBoxDrvProbe(struct platform_
* @param pDev Pointer to the platform device.
* @param State message type, see
Documentation/power/devices.txt.
*/
+# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 30)
+static int VBoxDrvSuspend(struct device *pDev)
+#else
static int VBoxDrvSuspend(struct platform_device *pDev, pm_message_t
State)
+#endif
{
RTPowerSignalEvent(RTPOWEREVENT_SUSPEND);
return 0;
@@ -782,7 +803,11 @@ static int VBoxDrvSuspend(struct platfor
*
* @param pDev Pointer to the platform device.
*/
+# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 30)
+static int VBoxDrvResume(struct device *pDev)
+#else
static int VBoxDrvResume(struct platform_device *pDev)
+#endif
{
RTPowerSignalEvent(RTPOWEREVENT_RESUME);
return 0;
---
Larry
More information about the vbox-dev
mailing list