Beispiel #1
0
/*
 *  ======== cfg_get_exec_file ========
 *  Purpose:
 *      Retreive the default executable, if any, for this board.
 */
dsp_status cfg_get_exec_file(struct cfg_devnode *dev_node_obj, u32 ul_buf_size,
			     OUT char *pstrExecFile)
{
	dsp_status status = DSP_SOK;
	struct drv_data *drv_datap = dev_get_drvdata(bridge);

	if (!dev_node_obj)
		status = -EFAULT;
	else if (!pstrExecFile || !drv_datap)
		status = -EFAULT;

	if (DSP_FAILED(status))
		goto func_end;

	if (!drv_datap->base_img || strlen(drv_datap->base_img) > ul_buf_size)
		status = -EINVAL;

	if (DSP_SUCCEEDED(status))
		strcpy(pstrExecFile, drv_datap->base_img);

	if (DSP_FAILED(status))
		pr_err("%s: Failed, status 0x%x\n", __func__, status);
func_end:
	DBC_ENSURE(((status == DSP_SOK) &&
		    (strlen(pstrExecFile) <= ul_buf_size))
		   || (status != DSP_SOK));
	return status;
}
Beispiel #2
0
/*
 *  ======== cod_get_section ========
 *  Purpose:
 *      Retrieve the starting address and length of a section in the COFF file
 *      given the section name.
 */
int cod_get_section(struct cod_libraryobj *lib, char *str_sect,
			   u32 *addr, u32 *len)
{
	struct cod_manager *cod_mgr_obj;
	int status = 0;

	DBC_REQUIRE(refs > 0);
	DBC_REQUIRE(lib != NULL);
	DBC_REQUIRE(lib->cod_mgr);
	DBC_REQUIRE(str_sect != NULL);
	DBC_REQUIRE(addr != NULL);
	DBC_REQUIRE(len != NULL);

	*addr = 0;
	*len = 0;
	if (lib != NULL) {
		cod_mgr_obj = lib->cod_mgr;
		status = cod_mgr_obj->fxns.get_sect_fxn(lib->dbll_lib, str_sect,
							addr, len);
	} else {
		status = -ESPIPE;
	}

	DBC_ENSURE(!status || ((*addr == 0) && (*len == 0)));

	return status;
}
Beispiel #3
0
/*
 *  ======== dbll_unload ========
 */
void dbll_unload(struct dbll_library_obj *lib, struct dbll_attrs *attrs)
{
	struct dbll_library_obj *zl_lib = (struct dbll_library_obj *)lib;
	s32 err = 0;

	DBC_REQUIRE(refs > 0);
	DBC_REQUIRE(zl_lib);
	DBC_REQUIRE(zl_lib->load_ref > 0);
	dev_dbg(bridge, "%s: lib: %p\n", __func__, lib);
	zl_lib->load_ref--;
	/* Unload only if reference count is 0 */
	if (zl_lib->load_ref != 0)
		goto func_end;

	zl_lib->target_obj->attrs = *attrs;
	if (zl_lib->dload_mod_obj) {
		err = dynamic_unload_module(zl_lib->dload_mod_obj,
					    &zl_lib->symbol.dl_symbol,
					    &zl_lib->allocate.dl_alloc,
					    &zl_lib->init.dl_init);
		if (err != 0) {
			dev_dbg(bridge, "%s: failed: %i\n", __func__, err);
		}
	}
	/* remove symbols from symbol table */
	if (zl_lib->sym_tab != NULL) {
		gh_delete(zl_lib->sym_tab);
		zl_lib->sym_tab = NULL;
	}
	/* delete DOFF desc since it holds *lots* of host OS
	 * resources */
	dof_close(zl_lib);
func_end:
	DBC_ENSURE(zl_lib->load_ref >= 0);
}
Beispiel #4
0
/*
 *  ======== dbll_create ========
 */
int dbll_create(struct dbll_tar_obj **target_obj,
		       struct dbll_attrs *pattrs)
{
	struct dbll_tar_obj *pzl_target;
	int status = 0;

	DBC_REQUIRE(refs > 0);
	DBC_REQUIRE(pattrs != NULL);
	DBC_REQUIRE(target_obj != NULL);

	/* Allocate DBL target object */
	pzl_target = kzalloc(sizeof(struct dbll_tar_obj), GFP_KERNEL);
	if (target_obj != NULL) {
		if (pzl_target == NULL) {
			*target_obj = NULL;
			status = -ENOMEM;
		} else {
			pzl_target->attrs = *pattrs;
			*target_obj = (struct dbll_tar_obj *)pzl_target;
		}
		DBC_ENSURE((DSP_SUCCEEDED(status) && *target_obj) ||
				(DSP_FAILED(status) && *target_obj == NULL));
	}

	return status;
}
Beispiel #5
0
/*
 *  ======== msg_exit ========
 */
void msg_exit(void)
{
	DBC_REQUIRE(refs > 0);
	refs--;

	DBC_ENSURE(refs >= 0);
}
Beispiel #6
0
/*
 *  ======== dev_init ========
 *  Purpose:
 *      Initialize DEV's private state, keeping a reference count on each call.
 */
bool dev_init(void)
{
	bool cmm_ret, dmm_ret, ret = true;

	DBC_REQUIRE(refs >= 0);

	if (refs == 0) {
		cmm_ret = cmm_init();
		dmm_ret = dmm_init();

		ret = cmm_ret && dmm_ret;

		if (!ret) {
			if (cmm_ret)
				cmm_exit();

			if (dmm_ret)
				dmm_exit();

		}
	}

	if (ret)
		refs++;

	DBC_ENSURE((ret && (refs > 0)) || (!ret && (refs >= 0)));

	return ret;
}
Beispiel #7
0
/*
 *  ======== mgr_exit ========
 *      Decrement reference count, and free resources when reference count is
 *      0.
 */
void mgr_exit(void)
{
	DBC_REQUIRE(refs > 0);
	refs--;
	if (refs == 0)
		dcd_exit();

	DBC_ENSURE(refs >= 0);
}
Beispiel #8
0
/*
 *  ======== msg_mod_init ========
 */
bool msg_mod_init(void)
{
	DBC_REQUIRE(refs >= 0);

	refs++;

	DBC_ENSURE(refs >= 0);

	return true;
}
Beispiel #9
0
void ECA_AUDIO_FORMAT::set_sample_endianess(ECA_AUDIO_FORMAT::Sample_endianess v)
{
  update_sample_endianess(v);
  
  /* make sure classes that reimplement set_sample_format
   * see the change in sample endianess */
  set_sample_format_string(format_string());

  DBC_ENSURE(se_rep == se_big || se_rep == se_little);
}
Beispiel #10
0
/*
 *  ======== chnl_create ========
 *  Purpose:
 *      Create a channel manager object, responsible for opening new channels
 *      and closing old ones for a given 'Bridge board.
 */
int chnl_create(OUT struct chnl_mgr **phChnlMgr,
		       struct dev_object *hdev_obj,
		       IN CONST struct chnl_mgrattrs *pMgrAttrs)
{
	int status;
	struct chnl_mgr *hchnl_mgr;
	struct chnl_mgr_ *chnl_mgr_obj = NULL;

	DBC_REQUIRE(refs > 0);
	DBC_REQUIRE(phChnlMgr != NULL);
	DBC_REQUIRE(pMgrAttrs != NULL);

	*phChnlMgr = NULL;

	/* Validate args: */
	if ((0 < pMgrAttrs->max_channels) &&
	    (pMgrAttrs->max_channels <= CHNL_MAXCHANNELS))
		status = 0;
	else if (pMgrAttrs->max_channels == 0)
		status = -EINVAL;
	else
		status = -ECHRNG;

	if (pMgrAttrs->word_size == 0)
		status = -EINVAL;

	if (DSP_SUCCEEDED(status)) {
		status = dev_get_chnl_mgr(hdev_obj, &hchnl_mgr);
		if (DSP_SUCCEEDED(status) && hchnl_mgr != NULL)
			status = -EEXIST;

	}

	if (DSP_SUCCEEDED(status)) {
		struct bridge_drv_interface *intf_fxns;
		dev_get_intf_fxns(hdev_obj, &intf_fxns);
		if (intf_fxns) {
			/* Let WMD channel module finish the create */
			status = (*intf_fxns->pfn_chnl_create)(&hchnl_mgr,
						hdev_obj, pMgrAttrs);
		}
		if (DSP_SUCCEEDED(status)) {
			/* Fill in WCD channel module's fields of the
			 * chnl_mgr structure */
			chnl_mgr_obj = (struct chnl_mgr_ *)hchnl_mgr;
			chnl_mgr_obj->intf_fxns = intf_fxns;
			/* Finally, return the new channel manager handle: */
			*phChnlMgr = hchnl_mgr;
		}
	}

	DBC_ENSURE(DSP_FAILED(status) || chnl_mgr_obj);

	return status;
}
Beispiel #11
0
/**
 * Detaches the current logger implementation.
 */
void ECA_LOGGER::detach_logger(void)
{
  if (ECA_LOGGER::interface_impl_repp != 0) {
    KVU_GUARD_LOCK guard(&ECA_LOGGER::lock_rep);
    if (ECA_LOGGER::interface_impl_repp != 0) {
      delete ECA_LOGGER::interface_impl_repp;
      ECA_LOGGER::interface_impl_repp = 0;
    }
  }
  DBC_ENSURE(ECA_LOGGER::interface_impl_repp == 0);
}
Beispiel #12
0
/*
 *  ======== dbll_exit ========
 *  Discontinue usage of DBL module.
 */
void dbll_exit(void)
{
	DBC_REQUIRE(refs > 0);

	refs--;

	if (refs == 0)
		gh_exit();

	DBC_ENSURE(refs >= 0);
}
Beispiel #13
0
/*
 *  ======== cod_init ========
 *  Purpose:
 *      Initialize the COD module's private state.
 *
 */
bool cod_init(void)
{
	bool ret = true;

	DBC_REQUIRE(refs >= 0);

	if (ret)
		refs++;

	DBC_ENSURE((ret && refs > 0) || (!ret && refs >= 0));
	return ret;
}
Beispiel #14
0
/*
 *  ======== chnl_create ========
 *  Purpose:
 *      Create a channel manager object, responsible for opening new channels
 *      and closing old ones for a given 'Bridge board.
 */
int chnl_create(struct chnl_mgr **channel_mgr,
		       struct dev_object *hdev_obj,
		       const struct chnl_mgrattrs *mgr_attrts)
{
	int status;
	struct chnl_mgr *hchnl_mgr;
	struct chnl_mgr_ *chnl_mgr_obj = NULL;

	DBC_REQUIRE(refs > 0);
	DBC_REQUIRE(channel_mgr != NULL);
	DBC_REQUIRE(mgr_attrts != NULL);

	*channel_mgr = NULL;

	/* Validate args: */
	if ((0 < mgr_attrts->max_channels) &&
	    (mgr_attrts->max_channels <= CHNL_MAXCHANNELS))
		status = 0;
	else if (mgr_attrts->max_channels == 0)
		status = -EINVAL;
	else
		status = -ECHRNG;

	if (mgr_attrts->word_size == 0)
		status = -EINVAL;

	if (!status) {
		status = dev_get_chnl_mgr(hdev_obj, &hchnl_mgr);
		if (!status && hchnl_mgr != NULL)
			status = -EEXIST;

	}

	if (!status) {
		struct bridge_drv_interface *intf_fxns;
		dev_get_intf_fxns(hdev_obj, &intf_fxns);
		/* Let Bridge channel module finish the create: */
		status = (*intf_fxns->pfn_chnl_create) (&hchnl_mgr, hdev_obj,
							mgr_attrts);
		if (!status) {
			/* Fill in DSP API channel module's fields of the
			 * chnl_mgr structure */
			chnl_mgr_obj = (struct chnl_mgr_ *)hchnl_mgr;
			chnl_mgr_obj->intf_fxns = intf_fxns;
			/* Finally, return the new channel manager handle: */
			*channel_mgr = hchnl_mgr;
		}
	}

	DBC_ENSURE(status || chnl_mgr_obj);

	return status;
}
Beispiel #15
0
/*
 *  ======== dev_exit ========
 *  Purpose:
 *      Decrement reference count, and free resources when reference count is
 *      0.
 */
void dev_exit(void)
{
	DBC_REQUIRE(refs > 0);

	refs--;

	if (refs == 0) {
		cmm_exit();
		dmm_exit();
	}

	DBC_ENSURE(refs >= 0);
}
Beispiel #16
0
/*
 *  ======== bridge_chnl_flush_io ========
 *  purpose:
 *      Flushes all the outstanding data requests on a channel.
 */
int bridge_chnl_flush_io(struct chnl_object *chnl_obj, u32 dwTimeOut)
{
	int status = 0;
	struct chnl_object *pchnl = (struct chnl_object *)chnl_obj;
	s8 chnl_mode = -1;
	struct chnl_mgr *chnl_mgr_obj;
	struct chnl_ioc chnl_ioc_obj;
	/* Check args: */
	if (pchnl) {
		if ((dwTimeOut == CHNL_IOCNOWAIT)
		    && CHNL_IS_OUTPUT(pchnl->chnl_mode)) {
			status = -EINVAL;
		} else {
			chnl_mode = pchnl->chnl_mode;
			chnl_mgr_obj = pchnl->chnl_mgr_obj;
		}
	} else {
		status = -EFAULT;
	}
	if (DSP_SUCCEEDED(status)) {
		/* Note: Currently, if another thread continues to add IO
		 * requests to this channel, this function will continue to
		 * flush all such queued IO requests. */
		if (CHNL_IS_OUTPUT(chnl_mode)
		    && (pchnl->chnl_type == CHNL_PCPY)) {
			/* Wait for IO completions, up to the specified
			 * timeout: */
			while (!LST_IS_EMPTY(pchnl->pio_requests) &&
			       DSP_SUCCEEDED(status)) {
				status = bridge_chnl_get_ioc(chnl_obj,
							     dwTimeOut,
							     &chnl_ioc_obj);
				if (DSP_FAILED(status))
					continue;

				if (chnl_ioc_obj.status & CHNL_IOCSTATTIMEOUT)
					status = -ETIMEDOUT;

			}
		} else {
			status = bridge_chnl_cancel_io(chnl_obj);
			/* Now, leave the channel in the ready state: */
			pchnl->dw_state &= ~CHNL_STATECANCEL;
		}
	}
	DBC_ENSURE(DSP_FAILED(status) || LST_IS_EMPTY(pchnl->pio_requests));
	return status;
}
Beispiel #17
0
/*
 *  ======== dev_set_chnl_mgr ========
 *  Purpose:
 *      Set the channel manager for this device.
 */
int dev_set_chnl_mgr(struct dev_object *hdev_obj,
			    struct chnl_mgr *hmgr)
{
	int status = 0;
	struct dev_object *dev_obj = hdev_obj;

	DBC_REQUIRE(refs > 0);

	if (hdev_obj)
		dev_obj->hchnl_mgr = hmgr;
	else
		status = -EFAULT;

	DBC_ENSURE(status || (dev_obj->hchnl_mgr == hmgr));
	return status;
}
Beispiel #18
0
/*
 *  ======== uuid_uuid_to_string ========
 *  Purpose:
 *      Converts a struct dsp_uuid to a string.
 *      Note: snprintf format specifier is:
 *      %[flags] [width] [.precision] [{h | l | I64 | L}]type
 */
void uuid_uuid_to_string(struct dsp_uuid *uuid_obj, char *sz_uuid,
			 s32 size)
{
	s32 i;			/* return result from snprintf. */

	DBC_REQUIRE(uuid_obj && sz_uuid);

	i = snprintf(sz_uuid, size,
		     "%.8X_%.4X_%.4X_%.2X%.2X_%.2X%.2X%.2X%.2X%.2X%.2X",
		     uuid_obj->data1, uuid_obj->data2, uuid_obj->data3,
		     uuid_obj->data4, uuid_obj->data5,
		     uuid_obj->data6[0], uuid_obj->data6[1],
		     uuid_obj->data6[2], uuid_obj->data6[3],
		     uuid_obj->data6[4], uuid_obj->data6[5]);

	DBC_ENSURE(i != -1);
}
Beispiel #19
0
/*
 *  ======== dev_create2 ========
 *  Purpose:
 *      After successful loading of the image from api_init_complete2
 *      (PROC Auto_Start) or proc_load this fxn is called. This creates
 *      the Node Manager and updates the DEV Object.
 */
int dev_create2(struct dev_object *hdev_obj)
{
	int status = 0;
	struct dev_object *dev_obj = hdev_obj;

	DBC_REQUIRE(refs > 0);
	DBC_REQUIRE(hdev_obj);

	/* There can be only one Node Manager per DEV object */
	DBC_ASSERT(!dev_obj->hnode_mgr);
	status = node_create_mgr(&dev_obj->hnode_mgr, hdev_obj);
	if (status)
		dev_obj->hnode_mgr = NULL;

	DBC_ENSURE((!status && dev_obj->hnode_mgr != NULL)
		   || (status && dev_obj->hnode_mgr == NULL));
	return status;
}
Beispiel #20
0
void ECA_LOGGER::attach_logger(ECA_LOGGER_INTERFACE* logger)
{
  int oldloglevel = -1;
  if (interface_impl_repp != 0) {
    oldloglevel = interface_impl_repp->get_log_level_bitmask();
  }
  ECA_LOGGER::detach_logger();
  if (ECA_LOGGER::interface_impl_repp == 0) {
    KVU_GUARD_LOCK guard(&ECA_LOGGER::lock_rep);
    if (ECA_LOGGER::interface_impl_repp == 0) {
      ECA_LOGGER::interface_impl_repp = logger;
      if (oldloglevel != -1) {
	logger->set_log_level_bitmask(oldloglevel);
      }
    }
  }
  DBC_ENSURE(ECA_LOGGER::interface_impl_repp == logger);
}
Beispiel #21
0
/*
 *  ======== mgr_get_dcd_handle ========
 *      Retrieves the MGR handle. Accessor Function.
 */
int mgr_get_dcd_handle(struct mgr_object *mgr_handle,
			      u32 *dcd_handle)
{
	int status = -EPERM;
	struct mgr_object *pmgr_obj = (struct mgr_object *)mgr_handle;

	DBC_REQUIRE(refs > 0);
	DBC_REQUIRE(dcd_handle != NULL);

	*dcd_handle = (u32) NULL;
	if (pmgr_obj) {
		*dcd_handle = (u32) pmgr_obj->dcd_mgr;
		status = 0;
	}
	DBC_ENSURE((!status && *dcd_handle != (u32) NULL) ||
		   (status && *dcd_handle == (u32) NULL));

	return status;
}
Beispiel #22
0
/*
 *  ======== dev_destroy2 ========
 *  Purpose:
 *      Destroys the Node manager for this device.
 */
int dev_destroy2(struct dev_object *hdev_obj)
{
	int status = 0;
	struct dev_object *dev_obj = hdev_obj;

	DBC_REQUIRE(refs > 0);
	DBC_REQUIRE(hdev_obj);

	if (dev_obj->hnode_mgr) {
		if (node_delete_mgr(dev_obj->hnode_mgr))
			status = -EPERM;
		else
			dev_obj->hnode_mgr = NULL;

	}

	DBC_ENSURE((!status && dev_obj->hnode_mgr == NULL) || status);
	return status;
}
Beispiel #23
0
/*
 *  ======== dev_get_dmm_mgr ========
 *  Purpose:
 *      Retrieve the handle to the dynamic memory manager created for this
 *      device.
 */
int dev_get_dmm_mgr(struct dev_object *hdev_obj,
			   struct dmm_object **mgr)
{
	int status = 0;
	struct dev_object *dev_obj = hdev_obj;

	DBC_REQUIRE(refs > 0);
	DBC_REQUIRE(mgr != NULL);

	if (hdev_obj) {
		*mgr = dev_obj->dmm_mgr;
	} else {
		*mgr = NULL;
		status = -EFAULT;
	}

	DBC_ENSURE(!status || (mgr != NULL && *mgr == NULL));
	return status;
}
Beispiel #24
0
/*
 *  ======== dev_get_cod_mgr ========
 *  Purpose:
 *      Retrieve the COD manager create for this device.
 */
int dev_get_cod_mgr(struct dev_object *hdev_obj,
			   struct cod_manager **cod_mgr)
{
	int status = 0;
	struct dev_object *dev_obj = hdev_obj;

	DBC_REQUIRE(refs > 0);
	DBC_REQUIRE(cod_mgr != NULL);

	if (hdev_obj) {
		*cod_mgr = dev_obj->cod_mgr;
	} else {
		*cod_mgr = NULL;
		status = -EFAULT;
	}

	DBC_ENSURE(!status || (cod_mgr != NULL && *cod_mgr == NULL));
	return status;
}
Beispiel #25
0
/*
 *  ======== dev_get_dev_node ========
 *  Purpose:
 *      Retrieve the platform specific device ID for this device.
 */
int dev_get_dev_node(struct dev_object *hdev_obj,
			    struct cfg_devnode **dev_nde)
{
	int status = 0;
	struct dev_object *dev_obj = hdev_obj;

	DBC_REQUIRE(refs > 0);
	DBC_REQUIRE(dev_nde != NULL);

	if (hdev_obj) {
		*dev_nde = dev_obj->dev_node_obj;
	} else {
		*dev_nde = NULL;
		status = -EFAULT;
	}

	DBC_ENSURE(!status || (dev_nde != NULL && *dev_nde == NULL));
	return status;
}
Beispiel #26
0
/*
 *  ======== dev_get_intf_fxns ========
 *  Purpose:
 *      Retrieve the Bridge interface function structure for the loaded driver.
 *      if_fxns != NULL.
 */
int dev_get_intf_fxns(struct dev_object *hdev_obj,
			     struct bridge_drv_interface **if_fxns)
{
	int status = 0;
	struct dev_object *dev_obj = hdev_obj;

	DBC_REQUIRE(refs > 0);
	DBC_REQUIRE(if_fxns != NULL);

	if (hdev_obj) {
		*if_fxns = &dev_obj->bridge_interface;
	} else {
		*if_fxns = NULL;
		status = -EFAULT;
	}

	DBC_ENSURE(!status || ((if_fxns != NULL) && (*if_fxns == NULL)));
	return status;
}
Beispiel #27
0
/*
 *  ======== dev_get_node_manager ========
 *  Purpose:
 *      Retrieve the Node Manager Handle
 */
int dev_get_node_manager(struct dev_object *hdev_obj,
				struct node_mgr **node_man)
{
	int status = 0;
	struct dev_object *dev_obj = hdev_obj;

	DBC_REQUIRE(refs > 0);
	DBC_REQUIRE(node_man != NULL);

	if (hdev_obj) {
		*node_man = dev_obj->hnode_mgr;
	} else {
		*node_man = NULL;
		status = -EFAULT;
	}

	DBC_ENSURE(!status || (node_man != NULL && *node_man == NULL));
	return status;
}
Beispiel #28
0
/*
 *  ======== dev_get_wmd_context ========
 *  Purpose:
 *      Retrieve the WMD Context handle, as returned by the WMD_Create fxn.
 */
int dev_get_wmd_context(struct dev_object *hdev_obj,
			       OUT struct wmd_dev_context **phWmdContext)
{
	int status = 0;
	struct dev_object *dev_obj = hdev_obj;

	DBC_REQUIRE(refs > 0);
	DBC_REQUIRE(phWmdContext != NULL);

	if (hdev_obj) {
		*phWmdContext = dev_obj->hwmd_context;
	} else {
		*phWmdContext = NULL;
		status = -EFAULT;
	}

	DBC_ENSURE(DSP_SUCCEEDED(status) || ((phWmdContext != NULL) &&
					     (*phWmdContext == NULL)));
	return status;
}
Beispiel #29
0
/*
 *  ======== cfg_get_auto_start ========
 *  Purpose:
 *      Retreive the autostart mask, if any, for this board.
 */
dsp_status cfg_get_auto_start(struct cfg_devnode *dev_node_obj,
			      OUT u32 *pdwAutoStart)
{
	dsp_status status = DSP_SOK;
	u32 dw_buf_size;
	struct drv_data *drv_datap = dev_get_drvdata(bridge);

	dw_buf_size = sizeof(*pdwAutoStart);
	if (!dev_node_obj)
		status = -EFAULT;
	if (!pdwAutoStart || !drv_datap)
		status = -EFAULT;
	if (DSP_SUCCEEDED(status))
		*pdwAutoStart = (drv_datap->base_img) ? 1 : 0;

	DBC_ENSURE((status == DSP_SOK &&
		    (*pdwAutoStart == 0 || *pdwAutoStart == 1))
		   || status != DSP_SOK);
	return status;
}
Beispiel #30
0
/*
 *  ======== dev_get_bridge_context ========
 *  Purpose:
 *      Retrieve the Bridge Context handle, as returned by the
 *      bridge_dev_create fxn.
 */
int dev_get_bridge_context(struct dev_object *hdev_obj,
			       struct bridge_dev_context **phbridge_context)
{
	int status = 0;
	struct dev_object *dev_obj = hdev_obj;

	DBC_REQUIRE(refs > 0);
	DBC_REQUIRE(phbridge_context != NULL);

	if (hdev_obj) {
		*phbridge_context = dev_obj->hbridge_context;
	} else {
		*phbridge_context = NULL;
		status = -EFAULT;
	}

	DBC_ENSURE(!status || ((phbridge_context != NULL) &&
					     (*phbridge_context == NULL)));
	return status;
}