[ibal] Add g_ to global variables and remove g from local (p_port_mgr). [mlnx: 3372]
authortzachid <tzachid@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Tue, 28 Oct 2008 09:17:11 +0000 (09:17 +0000)
committertzachid <tzachid@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Tue, 28 Oct 2008 09:17:11 +0000 (09:17 +0000)
git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@1698 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

core/bus/kernel/bus_driver.c
core/bus/kernel/bus_driver.h
core/bus/kernel/bus_iou_mgr.c
core/bus/kernel/bus_pnp.c
core/bus/kernel/bus_port_mgr.c

index bf261b0..ddfd116 100644 (file)
@@ -799,10 +799,10 @@ DriverEntry(
        // Mutex to synchronize multiple threads creating & deleting \r
        // control deviceobjects. \r
 \r
-       ExInitializeFastMutex(&ControlMutex);\r
-       bfi_InstanceCount = 0;\r
-       memset(  __out_bcount(sizeof(bus_filters)) (void*)bus_filters, 0,\r
-                       sizeof(bus_filters) );\r
+       ExInitializeFastMutex(&g_ControlMutex);\r
+       g_bfi_InstanceCount = 0;\r
+       memset(  __out_bcount(sizeof(g_bus_filters)) (void*)g_bus_filters, 0,\r
+                       sizeof(g_bus_filters) );\r
 \r
        BUS_EXIT( BUS_DBG_DRV );\r
        return STATUS_SUCCESS;\r
index ecb0e65..12ed47c 100644 (file)
@@ -218,7 +218,7 @@ extern bus_globals_t        bus_globals;
 \r
 /*\r
  * Each instance of a bus filter on an HCA device stack (InfiniBandController)\r
- * populates a bus_filter_t slot in bus_filters[MAX_BUS_FILTERS]; see\r
+ * populates a bus_filter_t slot in g_bus_filters[MAX_BUS_FILTERS]; see\r
  * bus_add_device(). Therefore MAX_BUS_FILTERS represents the MAX number of\r
  * HCA's supported in a single system.\r
  */\r
@@ -253,9 +253,9 @@ typedef struct _bus_filter_instance
 \r
 }      bus_filter_t;\r
 \r
-extern bus_filter_t    bus_filters[MAX_BUS_FILTERS];\r
-extern ULONG bfi_InstanceCount;\r
-extern FAST_MUTEX ControlMutex;        // serializes InstanceCount & bus_filters\r
+extern bus_filter_t    g_bus_filters[MAX_BUS_FILTERS];\r
+extern ULONG g_bfi_InstanceCount;\r
+extern FAST_MUTEX g_ControlMutex;      // serializes InstanceCount & g_bus_filters\r
 \r
 extern bus_filter_t *alloc_bfi( IN DRIVER_OBJECT *, OUT int * );\r
 extern int free_bfi( IN bus_filter_t *p_bfi );\r
index de51e1d..e9ff3ff 100644 (file)
@@ -483,13 +483,13 @@ bus_reg_iou_pnp( IN bus_filter_t *p_bfi )
         */\r
        if ( !bus_globals.h_pnp_iou )\r
        {\r
-               ExAcquireFastMutexUnsafe(&ControlMutex);\r
+               ExAcquireFastMutexUnsafe(&g_ControlMutex);\r
                if ( !bus_globals.h_pnp_iou )\r
                {\r
                        bus_globals.h_pnp_iou = (ib_pnp_handle_t)1; /* block others */ \r
                        need_pnp_reg = TRUE;\r
                }\r
-               ExReleaseFastMutexUnsafe(&ControlMutex);\r
+               ExReleaseFastMutexUnsafe(&g_ControlMutex);\r
 \r
                if ( need_pnp_reg )\r
                {\r
@@ -564,7 +564,7 @@ iou_mgr_get_bus_relations(
 \r
        /* special case guid == 0 - walk all bus filter instances */\r
        if ( ca_guid == 0ULL ) {\r
-               for(p_bfi=bus_filters; p_bfi < &bus_filters[MAX_BUS_FILTERS]; p_bfi++) {\r
+               for(p_bfi=g_bus_filters; p_bfi < &g_bus_filters[MAX_BUS_FILTERS]; p_bfi++) {\r
                        gp_iou_mgr = p_bfi->p_iou_mgr;\r
                        if ( !gp_iou_mgr )\r
                                continue;\r
index 0c2fc9e..7eb4481 100644 (file)
@@ -51,9 +51,9 @@
 static UNICODE_STRING  al_ifc_name;\r
 static UNICODE_STRING  ci_ifc_name;\r
 \r
-FAST_MUTEX                             ControlMutex;\r
-ULONG                                  bfi_InstanceCount;\r
-bus_filter_t                   bus_filters[MAX_BUS_FILTERS];\r
+FAST_MUTEX                             g_ControlMutex;\r
+ULONG                                  g_bfi_InstanceCount;\r
+bus_filter_t                   g_bus_filters[MAX_BUS_FILTERS];\r
 \r
 extern ib_al_handle_t  gh_al; // NULL if AL needs init.\r
 \r
@@ -334,7 +334,7 @@ fdo_start(
                return status;\r
        }\r
 \r
-       ExAcquireFastMutexUnsafe(&ControlMutex);\r
+       ExAcquireFastMutexUnsafe(&g_ControlMutex);\r
        if ( !gh_al ) {\r
                /* Initialize AL */\r
                ib_status = al_initialize();\r
@@ -343,12 +343,12 @@ fdo_start(
                        al_cleanup();\r
                        BUS_TRACE_EXIT( BUS_DBG_ERROR, ("al_initialize returned %s.\n",\r
                                                        ib_get_err_str(ib_status)) );\r
-                       ExReleaseFastMutexUnsafe(&ControlMutex);\r
+                       ExReleaseFastMutexUnsafe(&g_ControlMutex);\r
                        return STATUS_UNSUCCESSFUL;\r
                }\r
                AL_init_here = TRUE;\r
        }\r
-       ExReleaseFastMutexUnsafe(&ControlMutex);\r
+       ExReleaseFastMutexUnsafe(&g_ControlMutex);\r
 \r
        /* Initialize the port manager. */\r
        ib_status = create_port_mgr( p_ext->bus_filter, &p_ext->p_port_mgr );\r
@@ -1252,9 +1252,9 @@ get_bfi_by_obj(IN int obj_type, IN cl_obj_t *p_obj )
 \r
        CL_ASSERT((obj_type == BFI_PORT_MGR_OBJ) || (obj_type == BFI_IOU_MGR_OBJ));\r
 \r
-    ExAcquireFastMutexUnsafe(&ControlMutex);\r
+    ExAcquireFastMutexUnsafe(&g_ControlMutex);\r
 \r
-       for(p_bfi=bus_filters; p_bfi < &bus_filters[MAX_BUS_FILTERS]; p_bfi++) {\r
+       for(p_bfi=g_bus_filters; p_bfi < &g_bus_filters[MAX_BUS_FILTERS]; p_bfi++) {\r
 \r
                if ( !p_bfi->p_bus_ext )\r
                        continue;\r
@@ -1272,13 +1272,13 @@ get_bfi_by_obj(IN int obj_type, IN cl_obj_t *p_obj )
                        }\r
                }\r
        }\r
-       ExReleaseFastMutexUnsafe(&ControlMutex);\r
+       ExReleaseFastMutexUnsafe(&g_ControlMutex);\r
 \r
        BUS_PRINT( BUS_DBG_PNP,\r
                                ("%s() cl_obj %p type %s_MGR_OBJ --> bfi[%d] %p\n",\r
                                __FUNCTION__,p_obj,\r
                                (obj_type == BFI_PORT_MGR_OBJ ? "PORT": "IOU"),\r
-                               (matched ? (matched - bus_filters) : (-1)), matched ) );\r
+                               (matched ? (matched - g_bus_filters) : (-1)), matched ) );\r
 \r
        return matched;\r
 }\r
@@ -1295,16 +1295,16 @@ get_bfi_by_ca_guid( IN net64_t ca_guid )
 \r
        if ( ca_guid == 0ULL )\r
        {\r
-               matched = bus_filters;\r
+               matched = g_bus_filters;\r
                BUS_PRINT( BUS_DBG_PNP, ("%s() ERR guid %I64x -> bfi[0] %p\n",\r
                                                                __FUNCTION__, ca_guid, matched) );\r
                CL_ASSERT( ca_guid );\r
                return matched;\r
        }\r
 \r
-       ExAcquireFastMutexUnsafe(&ControlMutex);\r
+       ExAcquireFastMutexUnsafe(&g_ControlMutex);\r
 \r
-       for(p_bfi=bus_filters; p_bfi < &bus_filters[MAX_BUS_FILTERS]; p_bfi++)\r
+       for(p_bfi=g_bus_filters; p_bfi < &g_bus_filters[MAX_BUS_FILTERS]; p_bfi++)\r
        {\r
                if ( !p_bfi->p_bus_ext )\r
                        continue;\r
@@ -1315,7 +1315,7 @@ get_bfi_by_ca_guid( IN net64_t ca_guid )
                        break;\r
                }\r
        }\r
-       ExReleaseFastMutexUnsafe(&ControlMutex);\r
+       ExReleaseFastMutexUnsafe(&g_ControlMutex);\r
 \r
 #if DBG\r
        if ( !matched )\r
@@ -1351,14 +1351,14 @@ get_set_bfi_by_ca_guid( IN net64_t ca_guid )
 \r
        if ( ca_guid == 0ULL )\r
        {\r
-               matched = bus_filters;\r
+               matched = g_bus_filters;\r
                BUS_PRINT( BUS_DBG_PNP, ("%s() ERR guid 0x%I64x -> bfi[0] %p\n",\r
                                        __FUNCTION__, ca_guid, matched) );\r
                CL_ASSERT( ca_guid );\r
                return matched;\r
        }\r
 \r
-       for(p_bfi=bus_filters; p_bfi < &bus_filters[MAX_BUS_FILTERS]; p_bfi++)\r
+       for(p_bfi=g_bus_filters; p_bfi < &g_bus_filters[MAX_BUS_FILTERS]; p_bfi++)\r
        {\r
                if ( !p_bfi->p_bus_ext )\r
                        continue;\r
@@ -1376,9 +1376,9 @@ get_set_bfi_by_ca_guid( IN net64_t ca_guid )
         */\r
        if ( !matched )\r
        {\r
-               ExAcquireFastMutexUnsafe(&ControlMutex);\r
+               ExAcquireFastMutexUnsafe(&g_ControlMutex);\r
 \r
-               for(p_bfi=bus_filters; p_bfi < &bus_filters[MAX_BUS_FILTERS]; p_bfi++)\r
+               for(p_bfi=g_bus_filters; p_bfi < &g_bus_filters[MAX_BUS_FILTERS]; p_bfi++)\r
                {\r
                        if ( !p_bfi->p_bus_ext )\r
                                continue;       // not allocated.\r
@@ -1391,13 +1391,13 @@ get_set_bfi_by_ca_guid( IN net64_t ca_guid )
                                break;\r
                        }\r
                }\r
-               ExReleaseFastMutexUnsafe(&ControlMutex);\r
+               ExReleaseFastMutexUnsafe(&g_ControlMutex);\r
        }\r
 \r
        BUS_PRINT( BUS_DBG_PNP,\r
                                ("%s()%sguid 0x%I64x @ bfi[%d] %p \n",\r
                                __FUNCTION__, (ca_bound ? "SET ":" "), ca_guid,\r
-                               (matched ? (matched - bus_filters) : (-1)), matched ) );\r
+                               (matched ? (matched - g_bus_filters) : (-1)), matched ) );\r
 \r
        return matched;\r
 }\r
@@ -1413,10 +1413,10 @@ alloc_bfi( IN DRIVER_OBJECT  *p_driver_obj, OUT int *p_instance_count )
      * IoCreateDeviceSecure & IoCreateSymbolicLink must be called at\r
      * PASSIVE_LEVEL.\r
         */\r
-       ExAcquireFastMutexUnsafe(&ControlMutex);\r
+       ExAcquireFastMutexUnsafe(&g_ControlMutex);\r
 \r
        // find 1st unused bfi slot.\r
-       for(p_bfi=bus_filters; p_bfi < &bus_filters[MAX_BUS_FILTERS]; p_bfi++)\r
+       for(p_bfi=g_bus_filters; p_bfi < &g_bus_filters[MAX_BUS_FILTERS]; p_bfi++)\r
        {\r
                if ( !p_bfi->p_bus_ext )\r
                {\r
@@ -1426,17 +1426,17 @@ alloc_bfi( IN DRIVER_OBJECT  *p_driver_obj, OUT int *p_instance_count )
                         */\r
                        p_bfi->p_bus_ext = (bus_fdo_ext_t*)p_driver_obj;\r
                        matched = p_bfi;\r
-                       *p_instance_count = ++bfi_InstanceCount; // record in-use\r
+                       *p_instance_count = ++g_bfi_InstanceCount; // record in-use\r
                        break;\r
                }\r
        }\r
-       ExReleaseFastMutexUnsafe(&ControlMutex);\r
+       ExReleaseFastMutexUnsafe(&g_ControlMutex);\r
 \r
 #if DBG\r
        RtlStringCbPrintfA ( p_bfi->whoami,\r
                                                 sizeof(p_bfi->whoami),\r
                                                 "bfi-%d",\r
-                                                (bfi_InstanceCount - 1) );\r
+                                                (g_bfi_InstanceCount - 1) );\r
 \r
        p_bfi->magic = BFI_MAGIC;\r
 #endif\r
@@ -1453,11 +1453,11 @@ free_bfi( IN  bus_filter_t  *p_bfi )
 {\r
        int     remaining;\r
 \r
-       ExAcquireFastMutexUnsafe(&ControlMutex);\r
+       ExAcquireFastMutexUnsafe(&g_ControlMutex);\r
        p_bfi->p_bus_ext = NULL;\r
        p_bfi->ca_guid = 0ULL;\r
-       remaining = --bfi_InstanceCount; // one less bfi in-use\r
-       ExReleaseFastMutexUnsafe(&ControlMutex);\r
+       remaining = --g_bfi_InstanceCount; // one less bfi in-use\r
+       ExReleaseFastMutexUnsafe(&g_ControlMutex);\r
 \r
        return remaining;\r
 }\r
@@ -1467,9 +1467,9 @@ get_bfi_count( void )
 {\r
        int     ic;\r
 \r
-       ExAcquireFastMutexUnsafe(&ControlMutex);\r
-       ic = bfi_InstanceCount;\r
-       ExReleaseFastMutexUnsafe(&ControlMutex);\r
+       ExAcquireFastMutexUnsafe(&g_ControlMutex);\r
+       ic = g_bfi_InstanceCount;\r
+       ExReleaseFastMutexUnsafe(&g_ControlMutex);\r
 \r
        return ic;\r
 }\r
index e0c6b81..fc0fade 100644 (file)
@@ -288,43 +288,43 @@ create_port_mgr(
 {\r
        ib_api_status_t         status;\r
        cl_status_t                     cl_status;\r
-       port_mgr_t                      *gp_port_mgr;\r
+       port_mgr_t                      *p_port_mgr;\r
 \r
        BUS_ENTER( BUS_DBG_PNP );\r
 \r
        CL_ASSERT( p_bfi->p_port_mgr == NULL );\r
 \r
-       gp_port_mgr = cl_zalloc( sizeof( port_mgr_t ) );\r
-       if( !gp_port_mgr )\r
+       p_port_mgr = cl_zalloc( sizeof( port_mgr_t ) );\r
+       if( !p_port_mgr )\r
        {\r
                BUS_TRACE_EXIT( BUS_DBG_ERROR,\r
                        ("Failed to allocate port manager.\n") );\r
                return IB_INSUFFICIENT_MEMORY;\r
        }\r
-       p_bfi->p_port_mgr = gp_port_mgr;\r
+       p_bfi->p_port_mgr = p_port_mgr;\r
 \r
        /* Construct the load service. */\r
-       cl_obj_construct( &gp_port_mgr->obj, AL_OBJ_TYPE_LOADER );\r
-       p_bfi->p_port_mgr_obj = &gp_port_mgr->obj;\r
-       cl_mutex_construct( &gp_port_mgr->pdo_mutex );\r
-       cl_qlist_init( &gp_port_mgr->port_list );\r
+       cl_obj_construct( &p_port_mgr->obj, AL_OBJ_TYPE_LOADER );\r
+       p_bfi->p_port_mgr_obj = &p_port_mgr->obj;\r
+       cl_mutex_construct( &p_port_mgr->pdo_mutex );\r
+       cl_qlist_init( &p_port_mgr->port_list );\r
 \r
-       cl_status = cl_mutex_init( &gp_port_mgr->pdo_mutex );\r
+       cl_status = cl_mutex_init( &p_port_mgr->pdo_mutex );\r
        if( cl_status != CL_SUCCESS )\r
        {\r
-               free_port_mgr( &gp_port_mgr->obj );\r
+               free_port_mgr( &p_port_mgr->obj );\r
                BUS_TRACE_EXIT( BUS_DBG_ERROR,\r
                        ("cl_mutex_init returned %#x.\n", cl_status) );\r
                return ib_convert_cl_status( cl_status );\r
        }\r
 \r
        /* Initialize the load service object. */\r
-       cl_status = cl_obj_init( &gp_port_mgr->obj, CL_DESTROY_SYNC,\r
+       cl_status = cl_obj_init( &p_port_mgr->obj, CL_DESTROY_SYNC,\r
                                                         destroying_port_mgr, NULL, free_port_mgr );\r
 \r
        if( cl_status != CL_SUCCESS )\r
        {\r
-               free_port_mgr( &gp_port_mgr->obj );\r
+               free_port_mgr( &p_port_mgr->obj );\r
                BUS_TRACE_EXIT( BUS_DBG_ERROR,\r
                        ("cl_obj_init returned %#x.\n", cl_status) );\r
                return ib_convert_cl_status( cl_status );\r
@@ -336,11 +336,11 @@ create_port_mgr(
        {\r
                BUS_TRACE_EXIT( BUS_DBG_ERROR,\r
                        ("bus_reg_port_pnp returned %s.\n", ib_get_err_str(status)) );\r
-               free_port_mgr( &gp_port_mgr->obj );\r
+               free_port_mgr( &p_port_mgr->obj );\r
                return status;\r
        }\r
 \r
-       *pp_port_mgr = gp_port_mgr;\r
+       *pp_port_mgr = p_port_mgr;\r
 \r
        BUS_EXIT( BUS_DBG_PNP );\r
        return IB_SUCCESS;\r
@@ -356,7 +356,7 @@ destroying_port_mgr(
 {\r
        ib_api_status_t                 status;\r
        bus_filter_t                    *p_bfi;\r
-       port_mgr_t                              *gp_port_mgr;\r
+       port_mgr_t                              *p_port_mgr;\r
 \r
        BUS_ENTER( BUS_DBG_PNP );\r
 \r
@@ -366,13 +366,13 @@ destroying_port_mgr(
                BUS_PRINT(BUS_DBG_PNP, ("Failed to find p_bfi by obj %p?\n", p_obj));\r
                return;\r
        }\r
-       gp_port_mgr = p_bfi->p_port_mgr;\r
+       p_port_mgr = p_bfi->p_port_mgr;\r
 \r
        BUS_PRINT(BUS_DBG_PNP, ("%s obj %p port_mgr %p port_mgr_obj %p\n",\r
-                       p_bfi->whoami,p_obj,gp_port_mgr, p_bfi->p_port_mgr_obj) );\r
+                       p_bfi->whoami,p_obj,p_port_mgr, p_bfi->p_port_mgr_obj) );\r
 \r
        CL_ASSERT( (void*)p_bfi->p_port_mgr == (void*)p_bfi->p_port_mgr_obj );\r
-       CL_ASSERT( gp_port_mgr == PARENT_STRUCT( p_obj, port_mgr_t, obj ) );\r
+       CL_ASSERT( p_port_mgr == PARENT_STRUCT( p_obj, port_mgr_t, obj ) );\r
 \r
        /* Deregister for port PnP events if this is the last Port manager. */\r
        if ( get_bfi_count() == 1 && bus_globals.h_pnp_port ) {\r
@@ -396,7 +396,7 @@ free_port_mgr(
        bus_pdo_ext_t   *p_ext;\r
        cl_list_item_t  *p_list_item;\r
        bus_filter_t    *p_bfi;\r
-       port_mgr_t              *gp_port_mgr;\r
+       port_mgr_t              *p_port_mgr;\r
 \r
        BUS_ENTER( BUS_DBG_PNP );\r
 \r
@@ -406,15 +406,15 @@ free_port_mgr(
                BUS_PRINT(BUS_DBG_PNP, ("No p_bfi for port obj %p?\n", p_obj));\r
                return;\r
        }\r
-       gp_port_mgr = p_bfi->p_port_mgr;\r
-       if ( !gp_port_mgr ) {\r
+       p_port_mgr = p_bfi->p_port_mgr;\r
+       if ( !p_port_mgr ) {\r
                // if create fails & then free is called, p_bfi->p_port_mgr == NULL\r
                return;\r
        }\r
-       CL_ASSERT( gp_port_mgr == PARENT_STRUCT( p_obj, port_mgr_t, obj ) );\r
+       CL_ASSERT( p_port_mgr == PARENT_STRUCT( p_obj, port_mgr_t, obj ) );\r
 \r
        BUS_PRINT(BUS_DBG_PNP, ("%s obj %p port_mgr %p port_mgr_obj %p\n",\r
-                       p_bfi->whoami, p_obj,gp_port_mgr,\r
+                       p_bfi->whoami, p_obj,p_port_mgr,\r
                        p_bfi->p_port_mgr_obj) );\r
 \r
        BUS_PRINT( BUS_DBG_PNP,\r
@@ -423,11 +423,11 @@ free_port_mgr(
         * Mark all IPoIB PDOs as no longer present.  This will cause them\r
         * to be removed when they process the IRP_MN_REMOVE_DEVICE.\r
         */\r
-       p_list_item = cl_qlist_remove_head( &gp_port_mgr->port_list );\r
-       while( p_list_item != cl_qlist_end( &gp_port_mgr->port_list ) )\r
+       p_list_item = cl_qlist_remove_head( &p_port_mgr->port_list );\r
+       while( p_list_item != cl_qlist_end( &p_port_mgr->port_list ) )\r
        {\r
                p_ext = PARENT_STRUCT( p_list_item, bus_pdo_ext_t, list_item );\r
-               p_list_item = cl_qlist_remove_head( &gp_port_mgr->port_list );\r
+               p_list_item = cl_qlist_remove_head( &p_port_mgr->port_list );\r
                if( p_ext->cl_ext.pnp_state == SurpriseRemoved )\r
                {\r
                        CL_ASSERT( !p_ext->b_present );\r
@@ -456,9 +456,9 @@ free_port_mgr(
                IoDeleteDevice( p_ext->cl_ext.p_self_do );\r
        }\r
 \r
-       cl_mutex_destroy( &gp_port_mgr->pdo_mutex );\r
+       cl_mutex_destroy( &p_port_mgr->pdo_mutex );\r
        cl_obj_deinit( p_obj );\r
-       cl_free( gp_port_mgr );\r
+       cl_free( p_port_mgr );\r
 \r
        p_bfi->p_port_mgr = NULL;\r
        p_bfi->p_port_mgr_obj = NULL;\r
@@ -483,12 +483,12 @@ bus_reg_port_pnp( IN bus_filter_t *p_bfi )
         */\r
        if ( !bus_globals.h_pnp_port )\r
        {\r
-               ExAcquireFastMutexUnsafe(&ControlMutex);\r
+               ExAcquireFastMutexUnsafe(&g_ControlMutex);\r
                if ( !bus_globals.h_pnp_port ) {\r
                        bus_globals.h_pnp_port = (ib_pnp_handle_t)1; /* block others */\r
                        need_pnp_reg = TRUE;\r
                }\r
-               ExReleaseFastMutexUnsafe(&ControlMutex);\r
+               ExReleaseFastMutexUnsafe(&g_ControlMutex);\r
 \r
                if ( need_pnp_reg )\r
                {\r
@@ -555,7 +555,7 @@ port_mgr_get_bus_relations(
 {\r
        NTSTATUS                        status;\r
        bus_filter_t            *p_bfi;\r
-       port_mgr_t                      *gp_port_mgr;\r
+       port_mgr_t                      *p_port_mgr;\r
        DEVICE_RELATIONS        *p_rel;\r
 \r
        BUS_ENTER( BUS_DBG_PNP );\r
@@ -565,15 +565,15 @@ port_mgr_get_bus_relations(
        /* special case guid == 0 - walk all bus filter instances */\r
        if ( ca_guid == 0ULL ) {\r
                BUS_PRINT(BUS_DBG_PNP, ("CA_guid 0\n"));\r
-               for(p_bfi=bus_filters; p_bfi < &bus_filters[MAX_BUS_FILTERS]; p_bfi++) {\r
-                       gp_port_mgr = p_bfi->p_port_mgr;\r
-                       if ( !gp_port_mgr )\r
+               for(p_bfi=g_bus_filters; p_bfi < &g_bus_filters[MAX_BUS_FILTERS]; p_bfi++) {\r
+                       p_port_mgr = p_bfi->p_port_mgr;\r
+                       if ( !p_port_mgr )\r
                                continue;\r
-                       cl_mutex_acquire( &gp_port_mgr->pdo_mutex );\r
-                       status = bus_get_relations( &gp_port_mgr->port_list,\r
+                       cl_mutex_acquire( &p_port_mgr->pdo_mutex );\r
+                       status = bus_get_relations( &p_port_mgr->port_list,\r
                                                                                p_bfi->ca_guid,\r
                                                                                p_irp );\r
-                       cl_mutex_release( &gp_port_mgr->pdo_mutex );\r
+                       cl_mutex_release( &p_port_mgr->pdo_mutex );\r
                }\r
 \r
                p_rel = (DEVICE_RELATIONS*)p_irp->IoStatus.Information;\r
@@ -591,16 +591,16 @@ port_mgr_get_bus_relations(
                BUS_EXIT( BUS_DBG_PNP );\r
                return STATUS_NO_SUCH_DEVICE;\r
        }\r
-       gp_port_mgr = p_bfi->p_port_mgr;\r
+       p_port_mgr = p_bfi->p_port_mgr;\r
 \r
        BUS_PRINT(BUS_DBG_PNP, ("%s for ca_guid %I64x port_mgr %p\n",\r
-                                                       p_bfi->whoami, ca_guid, gp_port_mgr) );\r
-       if (!gp_port_mgr)\r
+                                                       p_bfi->whoami, ca_guid, p_port_mgr) );\r
+       if (!p_port_mgr)\r
                return STATUS_NO_SUCH_DEVICE;\r
 \r
-       cl_mutex_acquire( &gp_port_mgr->pdo_mutex );\r
-       status = bus_get_relations( &gp_port_mgr->port_list, ca_guid, p_irp );\r
-       cl_mutex_release( &gp_port_mgr->pdo_mutex );\r
+       cl_mutex_acquire( &p_port_mgr->pdo_mutex );\r
+       status = bus_get_relations( &p_port_mgr->port_list, ca_guid, p_irp );\r
+       cl_mutex_release( &p_port_mgr->pdo_mutex );\r
 \r
        BUS_EXIT( BUS_DBG_PNP );\r
        return STATUS_SUCCESS;\r
@@ -616,13 +616,13 @@ __port_was_hibernated(
        bus_port_ext_t  *p_port_ext;\r
        bus_pdo_ext_t   *p_pdo_ext = NULL;\r
        size_t                  n_devs = 0;\r
-       port_mgr_t              *gp_port_mgr = p_bfi->p_port_mgr;\r
-       cl_qlist_t              *p_pdo_list = &gp_port_mgr->port_list;\r
+       port_mgr_t              *p_port_mgr = p_bfi->p_port_mgr;\r
+       cl_qlist_t              *p_pdo_list = &p_port_mgr->port_list;\r
        port_pnp_ctx_t  *p_ctx = p_pnp_rec->pnp_rec.context;\r
 \r
        BUS_ENTER( BUS_DBG_PNP );\r
 \r
-       if ( !gp_port_mgr ) {\r
+       if ( !p_port_mgr ) {\r
                // if free_port_mgr has been called , p_bfi->p_port_mgr == NULL \r
                // this will cause crash on cl_mutex_acquire\r
                // (leo) i'm not sure when it happens, but i saw it happened\r
@@ -630,7 +630,7 @@ __port_was_hibernated(
                goto end;\r
        }\r
 \r
-       cl_mutex_acquire( &gp_port_mgr->pdo_mutex );\r
+       cl_mutex_acquire( &p_port_mgr->pdo_mutex );\r
        \r
        /* Count the number of child devices. */\r
        for( p_list_item = cl_qlist_head( p_pdo_list );\r
@@ -692,7 +692,7 @@ __port_was_hibernated(
                status = IB_NOT_FOUND;\r
        }\r
 \r
-       cl_mutex_release( &gp_port_mgr->pdo_mutex );\r
+       cl_mutex_release( &p_port_mgr->pdo_mutex );\r
 \r
 end:\r
        BUS_EXIT( BUS_DBG_PNP );\r
@@ -776,7 +776,7 @@ port_mgr_port_add(
        pkey_conf_t             *cur_conf; \r
        pkey_array_t    *cur_pkeys = NULL;\r
        bus_filter_t    *p_bfi;\r
-       port_mgr_t              *gp_port_mgr;\r
+       port_mgr_t              *p_port_mgr;\r
        port_pnp_ctx_t  *p_ctx = p_pnp_rec->pnp_rec.context;\r
 \r
        BUS_ENTER( BUS_DBG_PNP );\r
@@ -812,7 +812,7 @@ port_mgr_port_add(
                                        p_bfi->whoami, p_bfi->ca_guid, \r
                                        p_pnp_rec->p_port_attr->port_num,p_ctx));\r
        }\r
-       gp_port_mgr = p_bfi->p_port_mgr;\r
+       p_port_mgr = p_bfi->p_port_mgr;\r
 \r
        if( !bus_globals.b_report_port_nic )\r
        {\r
@@ -914,10 +914,10 @@ port_mgr_port_add(
                        p_port_ext->port_guid.pkey = cur_pkeys->pkey_array[num_pdo -1];\r
 \r
                /* Store the device extension in the port vector for future queries. */\r
-               cl_mutex_acquire( &gp_port_mgr->pdo_mutex );\r
-               cl_qlist_insert_tail( &gp_port_mgr->port_list,\r
+               cl_mutex_acquire( &p_port_mgr->pdo_mutex );\r
+               cl_qlist_insert_tail( &p_port_mgr->port_list,\r
                                                          &p_port_ext->pdo.list_item );\r
-               cl_mutex_release( &gp_port_mgr->pdo_mutex );\r
+               cl_mutex_release( &p_port_mgr->pdo_mutex );\r
 \r
                /*\r
                 * Set the context of the PNP event. The context is passed in for future\r
@@ -947,19 +947,19 @@ port_mgr_port_add(
 * return:      cl_status\r
 *************************************************************************************/\r
 cl_status_t _port_mgr_pkey_rem(        IN      pkey_array_t    *pkeys,\r
-                                                               IN      port_mgr_t              *gp_port_mgr )\r
+                                                               IN      port_mgr_t              *p_port_mgr )\r
 {\r
 \r
        uint16_t                        cnt;\r
        cl_list_item_t          *p_list_item;\r
        bus_port_ext_t          *p_port_ext;\r
        bus_pdo_ext_t           *p_pdo_ext = NULL;\r
-       cl_qlist_t*                     p_pdo_list = &gp_port_mgr->port_list;\r
+       cl_qlist_t*                     p_pdo_list = &p_port_mgr->port_list;\r
 \r
        BUS_ENTER( BUS_DBG_PNP );\r
 \r
        p_port_ext = NULL;\r
-       cl_mutex_acquire( &gp_port_mgr->pdo_mutex );\r
+       cl_mutex_acquire( &p_port_mgr->pdo_mutex );\r
        \r
        /* Count the number of child devices. */\r
        for( p_list_item = cl_qlist_head( p_pdo_list );\r
@@ -982,7 +982,7 @@ cl_status_t _port_mgr_pkey_rem(     IN      pkey_array_t    *pkeys,
                        }\r
                }\r
        }\r
-       cl_mutex_release( &gp_port_mgr->pdo_mutex );\r
+       cl_mutex_release( &p_port_mgr->pdo_mutex );\r
 \r
        /* Tell the PnP Manager to rescan for the HCA's bus relations. */\r
        IoInvalidateDeviceRelations(\r
@@ -1000,15 +1000,15 @@ cl_status_t port_mgr_pkey_rem( IN pkey_array_t *pkeys )
        boolean_t               GO;\r
        int                             success_cnt=0;\r
 \r
-       for(p_bfi=&bus_filters[0]; p_bfi < &bus_filters[MAX_BUS_FILTERS]; p_bfi++)\r
+       for(p_bfi=&g_bus_filters[0]; p_bfi < &g_bus_filters[MAX_BUS_FILTERS]; p_bfi++)\r
        {\r
                if ( !p_bfi->p_bus_ext )\r
                        continue;\r
                GO = FALSE;\r
-               ExAcquireFastMutexUnsafe(&ControlMutex);\r
+               ExAcquireFastMutexUnsafe(&g_ControlMutex);\r
                if ( p_bfi->ca_guid && p_bfi->p_port_mgr )\r
                        GO = TRUE;\r
-               ExReleaseFastMutexUnsafe(&ControlMutex);\r
+               ExReleaseFastMutexUnsafe(&g_ControlMutex);\r
                if ( GO == FALSE )\r
                        continue;\r
                status = _port_mgr_pkey_rem( pkeys, p_bfi->p_port_mgr );\r
@@ -1028,20 +1028,20 @@ cl_status_t port_mgr_pkey_rem( IN pkey_array_t *pkeys )
 *************************************************************************************/\r
 cl_status_t _port_mgr_pkey_add( IN     pkey_array_t    *req_pkeys,\r
                                                                IN      bus_filter_t    *p_bfi,\r
-                                                               IN      port_mgr_t              *gp_port_mgr )\r
+                                                               IN      port_mgr_t              *p_port_mgr )\r
 {\r
        uint16_t                        cnt;\r
        NTSTATUS            status;\r
        cl_list_item_t          *p_list_item;\r
        bus_port_ext_t          *p_port_ext, *pkey_port_ext, *pmatched_guid_ext;\r
        DEVICE_OBJECT       *p_pdo[MAX_NUM_PKEY];\r
-       cl_qlist_t*                     p_pdo_list = &gp_port_mgr->port_list;\r
+       cl_qlist_t*                     p_pdo_list = &p_port_mgr->port_list;\r
 \r
        BUS_ENTER( BUS_DBG_PNP );\r
 \r
        pmatched_guid_ext = NULL;\r
        p_port_ext = NULL;\r
-       cl_mutex_acquire( &gp_port_mgr->pdo_mutex );\r
+       cl_mutex_acquire( &p_port_mgr->pdo_mutex );\r
        \r
        /* Count the number of child devices. */\r
        for( p_list_item = cl_qlist_head( p_pdo_list );\r
@@ -1067,7 +1067,7 @@ cl_status_t _port_mgr_pkey_add( IN        pkey_array_t    *req_pkeys,
                                pmatched_guid_ext = p_port_ext;\r
                }\r
        }\r
-       cl_mutex_release( &gp_port_mgr->pdo_mutex );\r
+       cl_mutex_release( &p_port_mgr->pdo_mutex );\r
 \r
        if (!pmatched_guid_ext)\r
        {\r
@@ -1119,10 +1119,10 @@ cl_status_t _port_mgr_pkey_add( IN      pkey_array_t    *req_pkeys,
                pkey_port_ext->port_guid.pkey = req_pkeys->pkey_array[cnt];\r
                pkey_port_ext->pdo.is_partition_pdo = TRUE;\r
                /* Store the device extension in the port vector for future queries. */\r
-               cl_mutex_acquire( &gp_port_mgr->pdo_mutex );\r
-               cl_qlist_insert_tail( &gp_port_mgr->port_list,\r
+               cl_mutex_acquire( &p_port_mgr->pdo_mutex );\r
+               cl_qlist_insert_tail( &p_port_mgr->port_list,\r
                        &pkey_port_ext->pdo.list_item );\r
-               cl_mutex_release( &gp_port_mgr->pdo_mutex );\r
+               cl_mutex_release( &p_port_mgr->pdo_mutex );\r
        }\r
 \r
        /* Tell the PnP Manager to rescan for the HCA's bus relations. */\r
@@ -1144,15 +1144,15 @@ cl_status_t port_mgr_pkey_add(pkey_array_t *pkeys)
        boolean_t               GO;\r
        int                             success_cnt=0;\r
 \r
-       for(p_bfi=&bus_filters[0]; p_bfi < &bus_filters[MAX_BUS_FILTERS]; p_bfi++)\r
+       for(p_bfi=&g_bus_filters[0]; p_bfi < &g_bus_filters[MAX_BUS_FILTERS]; p_bfi++)\r
        {\r
                if ( !p_bfi->p_bus_ext )\r
                        continue;\r
                GO = FALSE;\r
-               ExAcquireFastMutexUnsafe(&ControlMutex);\r
+               ExAcquireFastMutexUnsafe(&g_ControlMutex);\r
                if ( p_bfi->ca_guid && p_bfi->p_port_mgr )\r
                        GO = TRUE;\r
-               ExReleaseFastMutexUnsafe(&ControlMutex);\r
+               ExReleaseFastMutexUnsafe(&g_ControlMutex);\r
                if ( GO == FALSE )\r
                        continue;\r
                status = _port_mgr_pkey_add( pkeys, p_bfi, p_bfi->p_port_mgr );\r
@@ -1168,7 +1168,7 @@ port_mgr_port_remove(
        IN                              ib_pnp_port_rec_t*              p_pnp_rec )\r
 {\r
        bus_pdo_ext_t   *p_ext;\r
-       port_mgr_t              *gp_port_mgr;\r
+       port_mgr_t              *p_port_mgr;\r
        bus_filter_t    *p_bfi;\r
        port_pnp_ctx_t  *p_ctx = p_pnp_rec->pnp_rec.context;\r
 \r
@@ -1199,7 +1199,7 @@ port_mgr_port_remove(
                return;\r
        }\r
 \r
-       gp_port_mgr = p_bfi->p_port_mgr;\r
+       p_port_mgr = p_bfi->p_port_mgr;\r
 \r
        /* Within the PNP record's context is the port extension ptr;\r
         * see port_was_hibernated().\r
@@ -1223,7 +1223,7 @@ port_mgr_port_remove(
        // Don't crash if p_ext->p_parent_ext is NULL\r
        CL_ASSERT((p_ext->p_parent_ext == NULL) || p_bfi == p_ext->p_parent_ext->bus_filter);\r
        \r
-       cl_mutex_acquire( &gp_port_mgr->pdo_mutex );\r
+       cl_mutex_acquire( &p_port_mgr->pdo_mutex );\r
        CL_ASSERT( p_ext->h_ca );\r
 \r
        if( p_ext->b_hibernating )\r
@@ -1258,7 +1258,7 @@ port_mgr_port_remove(
 \r
 hca_deref:\r
        deref_al_obj( &p_ext->h_ca->obj );\r
-       cl_mutex_release( &gp_port_mgr->pdo_mutex );\r
+       cl_mutex_release( &p_port_mgr->pdo_mutex );\r
 \r
        BUS_EXIT( BUS_DBG_PNP );\r
 }\r
@@ -1333,19 +1333,19 @@ port_release_resources(
 {\r
        bus_port_ext_t  *p_ext;\r
        POWER_STATE             po_state;\r
-       port_mgr_t              *gp_port_mgr;\r
+       port_mgr_t              *p_port_mgr;\r
 \r
        BUS_ENTER( BUS_DBG_PNP );\r
 \r
        p_ext = p_dev_obj->DeviceExtension;\r
-       gp_port_mgr = p_ext->pdo.p_parent_ext->bus_filter->p_port_mgr;\r
+       p_port_mgr = p_ext->pdo.p_parent_ext->bus_filter->p_port_mgr;\r
 \r
        /* Remove this PDO from its list. */\r
-       cl_mutex_acquire( &gp_port_mgr->pdo_mutex );\r
+       cl_mutex_acquire( &p_port_mgr->pdo_mutex );\r
        BUS_TRACE( BUS_DBG_PNP, ("Removing port from vector: PDO %p, ext %p\n",\r
                                p_dev_obj, p_ext) );\r
-       cl_qlist_remove_item( &gp_port_mgr->port_list, &p_ext->pdo.list_item );\r
-       cl_mutex_release( &gp_port_mgr->pdo_mutex );\r
+       cl_qlist_remove_item( &p_port_mgr->port_list, &p_ext->pdo.list_item );\r
+       cl_mutex_release( &p_port_mgr->pdo_mutex );\r
        po_state.DeviceState = PowerDeviceD3;\r
        PoSetPowerState( p_ext->pdo.cl_ext.p_pdo, DevicePowerState, po_state );\r
 \r