[ros-diffs] [sginsberg] 44086: - Missed in previous commit: Fix VideoPortEnable/DisableInterrupt -- they should only fail if the driver didn't provide an ISR (documented).

sginsberg at svn.reactos.org sginsberg at svn.reactos.org
Wed Nov 11 00:01:42 CET 2009


Author: sginsberg
Date: Wed Nov 11 00:01:42 2009
New Revision: 44086

URL: http://svn.reactos.org/svn/reactos?rev=44086&view=rev
Log:
- Missed in previous commit: Fix VideoPortEnable/DisableInterrupt -- they should only fail if the driver didn't provide an ISR (documented).

Modified:
    trunk/reactos/drivers/video/videoprt/interrupt.c

Modified: trunk/reactos/drivers/video/videoprt/interrupt.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/video/videoprt/interrupt.c?rev=44086&r1=44085&r2=44086&view=diff
==============================================================================
--- trunk/reactos/drivers/video/videoprt/interrupt.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/video/videoprt/interrupt.c [iso-8859-1] Wed Nov 11 00:01:42 2009
@@ -106,42 +106,56 @@
 /*
  * @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;
 
-   TRACE_(VIDEOPRT, "VideoPortEnableInterrupt\n");
+    /* Get the device extension */
+    DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
 
-   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;
+    }
 
-   Status = HalEnableSystemInterrupt(
-      DeviceExtension->InterruptVector,
-      0,
-      DeviceExtension->InterruptLevel);
+    /* Re-enable the interrupt and return */
+    InterruptValid = HalEnableSystemInterrupt(DeviceExtension->InterruptVector,
+                                              0,
+                                              DeviceExtension->InterruptLevel);
 
-   return Status ? NO_ERROR : ERROR_INVALID_PARAMETER;
+    /* Make sure the interrupt was valid */
+    ASSERT(InterruptValid == TRUE);
+
+    /* Return to caller */
+    return NO_ERROR;
 }
 
 /*
  * @implemented
  */
-
-VP_STATUS NTAPI
+VP_STATUS
+NTAPI
 VideoPortDisableInterrupt(IN PVOID HwDeviceExtension)
 {
-   PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
-   BOOLEAN Status;
+    PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
 
-   TRACE_(VIDEOPRT, "VideoPortDisableInterrupt\n");
+    /* Get the device extension */
+    DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
 
-   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;
+    }
 
-   Status = HalDisableSystemInterrupt(
-      DeviceExtension->InterruptVector,
-      0);
-
-   return Status ? NO_ERROR : ERROR_INVALID_PARAMETER;
+    /* Disable the interrupt and return */
+    HalDisableSystemInterrupt(DeviceExtension->InterruptVector,
+                              0);
+    return NO_ERROR;
 }




More information about the Ros-diffs mailing list