- Missed in previous commit: Fix VideoPortEnable/DisableInterrupt -- they should...
authorStefan Ginsberg <stefanginsberg@gmail.com>
Tue, 10 Nov 2009 23:01:42 +0000 (23:01 +0000)
committerStefan Ginsberg <stefanginsberg@gmail.com>
Tue, 10 Nov 2009 23:01:42 +0000 (23:01 +0000)
svn path=/trunk/; revision=44086

reactos/drivers/video/videoprt/interrupt.c

index 67efe8f..54a5b95 100644 (file)
@@ -106,42 +106,56 @@ IntVideoPortSetupInterrupt(
 /*
  * @implemented
  */
-
-VP_STATUS NTAPI
+VP_STATUS
+NTAPI
 VideoPortEnableInterrupt(IN PVOID HwDeviceExtension)
 {
-   PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
-   BOOLEAN Status;
+    PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
+    BOOLEAN InterruptValid;
+
+    /* Get the device extension */
+    DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
 
-   TRACE_(VIDEOPRT, "VideoPortEnableInterrupt\n");
+    /* Fail if the driver didn't register an ISR */
+    if (!DeviceExtension->DriverExtension->InitializationData.HwInterrupt)
+    {
+        /* No ISR, no interrupts */
+        return ERROR_INVALID_FUNCTION;
+    }
 
-   DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
+    /* Re-enable the interrupt and return */
+    InterruptValid = HalEnableSystemInterrupt(DeviceExtension->InterruptVector,
+                                              0,
+                                              DeviceExtension->InterruptLevel);
 
-   Status = HalEnableSystemInterrupt(
-      DeviceExtension->InterruptVector,
-      0,
-      DeviceExtension->InterruptLevel);
+    /* Make sure the interrupt was valid */
+    ASSERT(InterruptValid == TRUE);
 
-   return Status ? NO_ERROR : ERROR_INVALID_PARAMETER;
+    /* Return to caller */
+    return NO_ERROR;
 }
 
 /*
  * @implemented
  */
-
-VP_STATUS NTAPI
+VP_STATUS
+NTAPI
 VideoPortDisableInterrupt(IN PVOID HwDeviceExtension)
 {
-   PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
-   BOOLEAN Status;
-
-   TRACE_(VIDEOPRT, "VideoPortDisableInterrupt\n");
-
-   DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
-
-   Status = HalDisableSystemInterrupt(
-      DeviceExtension->InterruptVector,
-      0);
-
-   return Status ? NO_ERROR : ERROR_INVALID_PARAMETER;
+    PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
+
+    /* Get the device extension */
+    DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
+
+    /* Fail if the driver didn't register an ISR */
+    if (!DeviceExtension->DriverExtension->InitializationData.HwInterrupt)
+    {
+        /* No ISR, no interrupts */
+        return ERROR_INVALID_FUNCTION;
+    }
+
+    /* Disable the interrupt and return */
+    HalDisableSystemInterrupt(DeviceExtension->InterruptVector,
+                              0);
+    return NO_ERROR;
 }