[ofw] [PATCH] IBBUS resolve sins of the past....code cleanup
Smith, Stan
stan.smith at intel.com
Fri Jun 10 15:55:47 PDT 2011
Resolve some of my sins of the past...
Pass the Bus Filter Instance pointer (p_bfi) instead of ca_guid; allows *_get_bus_relations routines to skip bfi lookup by ca_guid as bfi contains the ca_guid...oops.
Signed-off-by: stan smith <stan.smith at intel.com>
--- core/bus/kernel/bus_iou_mgr.h Fri Jun 10 15:38:08 2011
+++ core/bus/kernel/bus_iou_mgr.h Fri Jun 10 15:38:46 2011
@@ -57,11 +57,11 @@
ib_api_status_t
create_iou_mgr(
- IN struct _bus_filter_instance* p_bfi );
+ IN struct _bus_filter_instance* p_bfi );
NTSTATUS
iou_mgr_get_bus_relations(
- IN const net64_t ca_guid,
- IN IRP* const p_irp );
+ IN struct _bus_filter_instance* p_bfi,
+ IN IRP* const p_irp );
#endif
--- core/bus/kernel/bus_iou_mgr.c Fri Jun 10 15:35:29 2011
+++ core/bus/kernel/bus_iou_mgr.c Fri Jun 10 15:36:05 2011
@@ -526,26 +526,25 @@
*/
NTSTATUS
iou_mgr_get_bus_relations(
- IN const net64_t ca_guid,
+ IN bus_filter_t* p_bfi,
IN IRP* const p_irp )
{
NTSTATUS status;
- bus_filter_t *p_bfi;
iou_mgr_t *p_iou_mgr;
DEVICE_RELATIONS *p_rel;
BUS_ENTER( BUS_DBG_PNP );
- BUS_PRINT(BUS_DBG_PNP, ("CA_guid %I64x\n",ca_guid));
+ BUS_PRINT(BUS_DBG_PNP, ("CA_guid %I64x\n",p_bfi->ca_guid));
/* special case guid == 0 - walk all bus filter instances */
- if ( ca_guid == 0ULL ) {
+ if ( p_bfi->ca_guid == 0ULL ) {
for(p_bfi=g_bus_filters; p_bfi < &g_bus_filters[MAX_BUS_FILTERS]; p_bfi++) {
p_iou_mgr = p_bfi->p_iou_mgr;
if ( !p_iou_mgr )
continue;
cl_mutex_acquire( &p_iou_mgr->pdo_mutex );
- status = bus_get_relations( &p_iou_mgr->iou_list, ca_guid, p_irp );
+ status = bus_get_relations( &p_iou_mgr->iou_list, p_bfi->ca_guid, p_irp );
cl_mutex_release( &p_iou_mgr->pdo_mutex );
}
p_rel = (DEVICE_RELATIONS*)p_irp->IoStatus.Information;
@@ -556,21 +555,15 @@
return STATUS_SUCCESS;
}
- p_bfi = get_bfi_by_ca_guid(ca_guid);
- if (p_bfi == NULL) {
- BUS_TRACE_EXIT(BUS_DBG_PNP,
- ("NULL p_bfi from ca_guid %I64x ?\n",ca_guid));
- return STATUS_UNSUCCESSFUL;
- }
p_iou_mgr = p_bfi->p_iou_mgr;
BUS_PRINT(BUS_DBG_PNP, ("%s for ca_guid %I64x iou_mgr %p\n",
- p_bfi->whoami, ca_guid, p_iou_mgr) );
+ p_bfi->whoami, p_bfi->ca_guid, p_iou_mgr) );
if (!p_iou_mgr)
return STATUS_NO_SUCH_DEVICE;
cl_mutex_acquire( &p_iou_mgr->pdo_mutex );
- status = bus_get_relations( &p_iou_mgr->iou_list, ca_guid, p_irp );
+ status = bus_get_relations( &p_iou_mgr->iou_list, p_bfi->ca_guid, p_irp );
cl_mutex_release( &p_iou_mgr->pdo_mutex );
BUS_EXIT( BUS_DBG_PNP );
--- core/bus/kernel/bus_pnp.c Fri Jun 10 15:44:21 2011
+++ core/bus/kernel/bus_pnp.c Fri Jun 10 15:43:38 2011
@@ -818,11 +818,11 @@
}
if ( p_bfi->ca_guid != 0ULL )
{
- status = port_mgr_get_bus_relations( p_bfi->ca_guid, p_irp );
+ status = port_mgr_get_bus_relations( p_bfi, p_irp );
if( status == STATUS_SUCCESS ||
status == STATUS_NO_SUCH_DEVICE )
{
- status = iou_mgr_get_bus_relations( p_bfi->ca_guid, p_irp );
+ status = iou_mgr_get_bus_relations( p_bfi, p_irp );
}
if( status == STATUS_NO_SUCH_DEVICE )
status = STATUS_SUCCESS;
--- core/bus/kernel/bus_port_mgr.h Fri Jun 10 15:39:50 2011
+++ core/bus/kernel/bus_port_mgr.h Fri Jun 10 15:10:20 2011
@@ -57,12 +57,12 @@
ib_api_status_t
create_port_mgr(
- IN struct _bus_filter_instance *p_bfi );
+ IN struct _bus_filter_instance *p_bfi );
NTSTATUS
port_mgr_get_bus_relations(
- IN const net64_t ca_guid,
- IN IRP* const p_irp );
+ IN struct _bus_filter_instance *p_bfi,
+ IN IRP* const p_irp );
#endif
--- core/bus/kernel/bus_port_mgr.c Fri Jun 10 15:40:34 2011
+++ core/bus/kernel/bus_port_mgr.c Fri Jun 10 15:41:42 2011
@@ -520,22 +520,21 @@
*/
NTSTATUS
port_mgr_get_bus_relations(
- IN const net64_t ca_guid,
+ IN bus_filter_t* p_bfi,
IN IRP* const p_irp )
{
NTSTATUS status;
- bus_filter_t *p_bfi;
port_mgr_t *p_port_mgr;
DEVICE_RELATIONS *p_rel;
BUS_ENTER( BUS_DBG_PNP );
- BUS_PRINT(BUS_DBG_PNP, ("CA_guid %I64x\n",ca_guid));
+ BUS_PRINT(BUS_DBG_PNP, ("CA_guid %I64x\n",p_bfi->ca_guid));
/* special case guid == 0 - walk all bus filter instances */
- if ( ca_guid == 0ULL ) {
- BUS_PRINT(BUS_DBG_PNP, ("CA_guid 0\n"));
- for(p_bfi=g_bus_filters; p_bfi < &g_bus_filters[MAX_BUS_FILTERS]; p_bfi++) {
+ if ( p_bfi->ca_guid == 0ULL ) {
+ for(p_bfi=g_bus_filters; p_bfi < &g_bus_filters[MAX_BUS_FILTERS]; p_bfi++)
+ {
p_port_mgr = p_bfi->p_port_mgr;
if ( !p_port_mgr )
continue;
@@ -554,22 +553,15 @@
return STATUS_SUCCESS;
}
- p_bfi = get_bfi_by_ca_guid(ca_guid);
- if (p_bfi == NULL) {
- BUS_PRINT(BUS_DBG_PNP,
- ("Null *p_bfi from ca_guid %I64x\n",ca_guid));
- BUS_EXIT( BUS_DBG_PNP );
- return STATUS_NO_SUCH_DEVICE;
- }
p_port_mgr = p_bfi->p_port_mgr;
BUS_PRINT(BUS_DBG_PNP, ("%s for ca_guid %I64x port_mgr %p\n",
- p_bfi->whoami, ca_guid, p_port_mgr) );
+ p_bfi->whoami, p_bfi->ca_guid, p_port_mgr) );
if (!p_port_mgr)
return STATUS_NO_SUCH_DEVICE;
cl_mutex_acquire( &p_port_mgr->pdo_mutex );
- status = bus_get_relations( &p_port_mgr->port_list, ca_guid, p_irp );
+ status = bus_get_relations( &p_port_mgr->port_list, p_bfi->ca_guid, p_irp );
cl_mutex_release( &p_port_mgr->pdo_mutex );
BUS_EXIT( BUS_DBG_PNP );
More information about the ofw
mailing list