[MTHCA] 1. bugfix: fixed a typo, which caused a loss of IBAL state notifications.
authorleonidk <leonidk@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Sun, 25 Jun 2006 13:58:10 +0000 (13:58 +0000)
committerleonidk <leonidk@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Sun, 25 Jun 2006 13:58:10 +0000 (13:58 +0000)
2. bugfix: in handling device power down request.

git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@392 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

hw/mthca/kernel/hca_pnp.c

index de52708..ef72c38 100644 (file)
@@ -350,8 +350,6 @@ __pnp_notify_target(
                __hca_deregister( p_ext );\r
 \r
                /* Release AL's file object so that it can unload. */\r
-               CL_ASSERT( p_ext->p_al_dev );\r
-               CL_ASSERT( p_ext->p_al_file_obj );\r
                if( p_ext->p_al_file_obj )\r
                {\r
                        ObDereferenceObject( p_ext->p_al_file_obj );\r
@@ -593,7 +591,8 @@ __pnp_notify_ifc(
                        ("__get_ci_interface returned %08x.\n", status));\r
                goto err_reg_hca;\r
        }\r
-\r
+       goto done;\r
+       \r
 err_reg_hca:\r
        IoUnregisterPlugPlayNotification( p_ext->pnp_target_entry );\r
        p_ext->pnp_target_entry = NULL;\r
@@ -1494,6 +1493,18 @@ done:
        return STATUS_MORE_PROCESSING_REQUIRED;\r
 }\r
 \r
+static NTSTATUS __DeviceDownCbCompletion(\r
+       IN                              DEVICE_OBJECT   *p_dev_obj,\r
+       IN                              IRP                             *p_irp,\r
+       IN                              void                            *context )\r
+{\r
+       hca_dev_ext_t  *p_ext  = (hca_dev_ext_t*)p_dev_obj->DeviceExtension;\r
+       UNUSED_PARAM( context );\r
+\r
+       PoStartNextPowerIrp( p_irp );\r
+       IoReleaseRemoveLock( &p_ext->cl_ext.remove_lock, p_irp );\r
+       return STATUS_SUCCESS;\r
+}\r
 \r
 /* Work item callback to handle DevicePowerD3 IRPs at passive level. */\r
 static void\r
@@ -1517,21 +1528,15 @@ __PowerDownCb(
        PoSetPowerState( p_dev_obj, DevicePowerState,\r
                pIoStack->Parameters.Power.State );\r
 \r
-       switch( p_ext->state )\r
-       {\r
-       case HCA_REGISTERED:\r
-               __hca_deregister( p_ext );\r
-\r
-               /* Fall through. */\r
-       case HCA_STARTED:\r
-               /* dequeue HCA  */\r
-               mlnx_hca_remove( &p_ext->hca );\r
-       }\r
+       __hca_deregister( p_ext );\r
+       mthca_remove_one( p_ext );\r
 \r
-       PoStartNextPowerIrp( p_irp );\r
-       IoSkipCurrentIrpStackLocation( p_irp );\r
+       IoCopyCurrentIrpStackLocationToNext( p_irp );\r
+#pragma warning( push, 3 )\r
+       IoSetCompletionRoutine( p_irp, __DeviceDownCbCompletion,\r
+               NULL, TRUE, TRUE, TRUE );\r
+#pragma warning( pop )\r
        PoCallDriver( p_ext->cl_ext.p_next_do, p_irp );\r
-       IoReleaseRemoveLock( &p_ext->cl_ext.remove_lock, p_irp );\r
 \r
        HCA_EXIT( HCA_DBG_PO );\r
 }\r