Skip to contentSkip to conversation

staging:ti dspbridge: Remove DSP_FAILED and DSP_SUCCEEDED macros

PATCH In review Ernesto Ramos 2 participants 12 messages Jul 28, 2010 – Jul 30, 2010 Staging

lore
Share & tools
lore
#3 lore raw

PATCH 3/10 staging:ti dspbridge: remove DSP_SUCCEEDED macro from rmgr

In reply to Ernesto Ramos

Since status succeeded is now 0 macro DSP_SUCCEEDED is not necessary anymore.

---
 drivers/staging/tidspbridge/rmgr/dbdcd.c         |   24 ++--
 drivers/staging/tidspbridge/rmgr/disp.c          |   34 +++---
 drivers/staging/tidspbridge/rmgr/drv.c           |   31 ++---
 drivers/staging/tidspbridge/rmgr/drv_interface.c |    2 +-
 drivers/staging/tidspbridge/rmgr/dspdrv.c        |    8 +-
 drivers/staging/tidspbridge/rmgr/mgr.c           |   20 ++--
 drivers/staging/tidspbridge/rmgr/nldr.c          |   93 +++++++-------
 drivers/staging/tidspbridge/rmgr/node.c          |  151 +++++++++++-----------
 drivers/staging/tidspbridge/rmgr/proc.c          |   95 +++++++-------
 drivers/staging/tidspbridge/rmgr/pwr.c           |   18 +--
 drivers/staging/tidspbridge/rmgr/rmm.c           |    8 +-
 drivers/staging/tidspbridge/rmgr/strm.c          |   48 ++++----
 12 files changed, 260 insertions(+), 272 deletions(-)
drivers/staging/tidspbridge/rmgr/dbdcd.c +12 -12
index b96aea7..12d2d41 100644
@@ -156,7 +156,7 @@ int dcd_create_manager(char *sz_zl_dll_name,
 		cod_delete(cod_mgr);
 	}
 
-	DBC_ENSURE((DSP_SUCCEEDED(status)) ||
+	DBC_ENSURE((!status) ||
 			((dcd_mgr_obj == NULL) && (status == -ENOMEM)));
 
 func_end:
@@ -252,7 +252,7 @@ int dcd_enumerate_object(s32 index, enum dsp_dcdobjtype obj_type,
 			}
 		}
 
-		if (DSP_SUCCEEDED(status)) {
+		if (!status) {
 			len = strlen(sz_reg_key);
 			spin_lock(&dbdcd_lock);
 			list_for_each_entry(dcd_key, &reg_key_list, link) {
@@ -269,7 +269,7 @@ int dcd_enumerate_object(s32 index, enum dsp_dcdobjtype obj_type,
 				status = -ENODATA;
 		}
 
-		if (DSP_SUCCEEDED(status)) {
+		if (!status) {
 			/* Create UUID value using string retrieved from
 			 * registry. */
 			uuid_uuid_from_string(sz_value, &dsp_uuid_obj);
@@ -446,7 +446,7 @@ int dcd_get_object_def(struct dcd_manager *hdcd_mgr,
 		/* Retrieve paths from the registry based on struct dsp_uuid */
 		dw_buf_size = DCD_MAXPATHLENGTH;
 	}
-	if (DSP_SUCCEEDED(status)) {
+	if (!status) {
 		spin_lock(&dbdcd_lock);
 		list_for_each_entry(dcd_key, &reg_key_list, link) {
 			if (!strncmp(dcd_key->name, sz_reg_key,
@@ -500,7 +500,7 @@ int dcd_get_object_def(struct dcd_manager *hdcd_mgr,
 #else
 	status = cod_read_section(lib, sz_sect_name, psz_coff_buf, ul_len);
 #endif
-	if (DSP_SUCCEEDED(status)) {
+	if (!status) {
 		/* Compres DSP buffer to conform to PC format. */
 		if (strstr(dcd_key->path, "iva") == NULL) {
 			compress_buf(psz_coff_buf, ul_len, DSPWORDSIZE);
@@ -585,7 +585,7 @@ int dcd_get_objects(struct dcd_manager *hdcd_mgr,
 	status =
 	    cod_read_section(lib, DCD_REGISTER_SECTION, psz_coff_buf, ul_len);
 #endif
-	if (DSP_SUCCEEDED(status)) {
+	if (!status) {
 		/* Compress DSP buffer to conform to PC format. */
 		if (strstr(sz_coff_path, "iva") == NULL) {
 			compress_buf(psz_coff_buf, ul_len, DSPWORDSIZE);
@@ -699,7 +699,7 @@ int dcd_get_library_name(struct dcd_manager *hdcd_mgr,
 		status = -EINVAL;
 		DBC_ASSERT(false);
 	}
-	if (DSP_SUCCEEDED(status)) {
+	if (!status) {
 		if ((strlen(sz_reg_key) + strlen(sz_obj_type)) <
 		    DCD_MAXPATHLENGTH) {
 			strncat(sz_reg_key, sz_obj_type,
@@ -714,7 +714,7 @@ int dcd_get_library_name(struct dcd_manager *hdcd_mgr,
 		else
 			status = -EPERM;
 	}
-	if (DSP_SUCCEEDED(status)) {
+	if (!status) {
 		spin_lock(&dbdcd_lock);
 		list_for_each_entry(dcd_key, &reg_key_list, link) {
 			/*  See if the name matches. */
@@ -767,7 +767,7 @@ int dcd_get_library_name(struct dcd_manager *hdcd_mgr,
 						0 : -ENOKEY;
 	}
 
-	if (DSP_SUCCEEDED(status))
+	if (!status)
 		memcpy(str_lib_name, dcd_key->path, strlen(dcd_key->path) + 1);
 	return status;
 }
@@ -955,7 +955,7 @@ int dcd_register_object(struct dsp_uuid *uuid_obj,
 			status = -EPERM;
 	}
 
-	if (DSP_SUCCEEDED(status)) {
+	if (!status) {
 		/*
 		 *  Because the node database has been updated through a
 		 *  successful object registration/de-registration operation,
@@ -1441,11 +1441,11 @@ static int get_dep_lib_info(struct dcd_manager *hdcd_mgr,
 	}
 
 	/* Open the library */
-	if (DSP_SUCCEEDED(status)) {
+	if (!status) {
 		status = cod_open(dcd_mgr_obj->cod_mgr, psz_file_name,
 				  COD_NOLOAD, &lib);
 	}
-	if (DSP_SUCCEEDED(status)) {
+	if (!status) {
 		/* Get dependent library section information. */
 		status = cod_get_section(lib, DEPLIBSECT, &ul_addr, &ul_len);
 
drivers/staging/tidspbridge/rmgr/disp.c +17 -17
index 417faeb..2d479b2 100644
@@ -111,9 +111,9 @@ int disp_create(struct disp_object **dispatch_obj,
 		disp_obj->hdev_obj = hdev_obj;
 
 	/* Get Channel manager and Bridge function interface */
-	if (DSP_SUCCEEDED(status)) {
+	if (!status) {
 		status = dev_get_chnl_mgr(hdev_obj, &(disp_obj->hchnl_mgr));
-		if (DSP_SUCCEEDED(status)) {
+		if (!status) {
 			(void)dev_get_intf_fxns(hdev_obj, &intf_fxns);
 			disp_obj->intf_fxns = intf_fxns;
 		}
@@ -146,7 +146,7 @@ int disp_create(struct disp_object **dispatch_obj,
 					      CHNL_MODETODSP, ul_chnl_id,
 					      &chnl_attr_obj);
 
-	if (DSP_SUCCEEDED(status)) {
+	if (!status) {
 		ul_chnl_id = disp_attrs->ul_chnl_offset + CHNLFROMRMSOFFSET;
 		status =
 		    (*intf_fxns->pfn_chnl_open) (&(disp_obj->chnl_from_dsp),
@@ -154,7 +154,7 @@ int disp_create(struct disp_object **dispatch_obj,
 						 CHNL_MODEFROMDSP, ul_chnl_id,
 						 &chnl_attr_obj);
 	}
-	if (DSP_SUCCEEDED(status)) {
+	if (!status) {
 		/* Allocate buffer for commands, replies */
 		disp_obj->ul_bufsize = disp_attrs->ul_chnl_buf_size;
 		disp_obj->ul_bufsize_rms = RMS_COMMANDBUFSIZE;
@@ -163,13 +163,13 @@ int disp_create(struct disp_object **dispatch_obj,
 			status = -ENOMEM;
 	}
 func_cont:
-	if (DSP_SUCCEEDED(status))
+	if (!status)
 		*dispatch_obj = disp_obj;
 	else
 		delete_disp(disp_obj);
 
 	DBC_ENSURE(((DSP_FAILED(status)) && ((*dispatch_obj == NULL))) ||
-				((DSP_SUCCEEDED(status)) && *dispatch_obj));
+				(!status && *dispatch_obj));
 	return status;
 }
 
@@ -345,7 +345,7 @@ int disp_node_create(struct disp_object *disp_obj,
 	 *  Socket Args (if DAIS socket node):
 	 *
 	 */
-	if (DSP_SUCCEEDED(status)) {
+	if (!status) {
 		total = 0;	/* Total number of words in buffer so far */
 		pdw_buf = (rms_word *) disp_obj->pbuf;
 		rms_cmd = (struct rms_command *)pdw_buf;
@@ -439,7 +439,7 @@ int disp_node_create(struct disp_object *disp_obj,
 				offset = total;
 			}
 			for (i = 0; (i < task_arg_obj.num_outputs) &&
-			     (DSP_SUCCEEDED(status)); i++) {
+			     (!status); i++) {
 				pdw_buf[sio_out_def_offset + i] =
 				    (offset - args_offset)
 				    * (sizeof(rms_word) / DSPWORDSIZE);
@@ -455,12 +455,12 @@ int disp_node_create(struct disp_object *disp_obj,
 			status = -EPERM;
 		}
 	}
-	if (DSP_SUCCEEDED(status)) {
+	if (!status) {
 		ul_bytes = total * sizeof(rms_word);
 		DBC_ASSERT(ul_bytes < (RMS_COMMANDBUFSIZE * sizeof(rms_word)));
 		status = send_message(disp_obj, node_get_timeout(hnode),
 				      ul_bytes, node_env);
-		if (DSP_SUCCEEDED(status)) {
+		if (status >= 0) {
 			/*
 			 * Message successfully received from RMS.
 			 * Return the status of the Node's create function
@@ -497,7 +497,7 @@ int disp_node_delete(struct disp_object *disp_obj,
 
 	status = dev_get_dev_type(disp_obj->hdev_obj, &dev_type);
 
-	if (DSP_SUCCEEDED(status)) {
+	if (!status) {
 
 		if (dev_type == DSP_UNIT) {
 
@@ -513,7 +513,7 @@ int disp_node_delete(struct disp_object *disp_obj,
 			status = send_message(disp_obj, node_get_timeout(hnode),
 					      sizeof(struct rms_command),
 					      &dw_arg);
-			if (DSP_SUCCEEDED(status)) {
+			if (status >= 0) {
 				/*
 				 * Message successfully received from RMS.
 				 * Return the status of the Node's delete
@@ -550,7 +550,7 @@ int disp_node_run(struct disp_object *disp_obj,
 
 	status = dev_get_dev_type(disp_obj->hdev_obj, &dev_type);
 
-	if (DSP_SUCCEEDED(status)) {
+	if (!status) {
 
 		if (dev_type == DSP_UNIT) {
 
@@ -566,7 +566,7 @@ int disp_node_run(struct disp_object *disp_obj,
 			status = send_message(disp_obj, node_get_timeout(hnode),
 					      sizeof(struct rms_command),
 					      &dw_arg);
-			if (DSP_SUCCEEDED(status)) {
+			if (status >= 0) {
 				/*
 				 * Message successfully received from RMS.
 				 * Return the status of the Node's execute
@@ -649,7 +649,7 @@ static int fill_stream_def(rms_word *pdw_buf, u32 *ptotal, u32 offset,
 		strm_def_obj->timeout = strm_def.utimeout;
 	}
 
-	if (DSP_SUCCEEDED(status)) {
+	if (!status) {
 		/*
 		 *  Since we haven't added the device name yet, subtract
 		 *  1 from total.
@@ -709,7 +709,7 @@ static int send_message(struct disp_object *disp_obj, u32 timeout,
 
 	status =
 	    (*intf_fxns->pfn_chnl_get_ioc) (chnl_obj, timeout, &chnl_ioc_obj);
-	if (DSP_SUCCEEDED(status)) {
+	if (!status) {
 		if (!CHNL_IS_IO_COMPLETE(chnl_ioc_obj)) {
 			if (CHNL_IS_TIMED_OUT(chnl_ioc_obj))
 				status = -ETIME;
@@ -730,7 +730,7 @@ static int send_message(struct disp_object *disp_obj, u32 timeout,
 
 	status =
 	    (*intf_fxns->pfn_chnl_get_ioc) (chnl_obj, timeout, &chnl_ioc_obj);
-	if (DSP_SUCCEEDED(status)) {
+	if (!status) {
 		if (CHNL_IS_TIMED_OUT(chnl_ioc_obj)) {
 			status = -ETIME;
 		} else if (chnl_ioc_obj.byte_size < ul_bytes) {
drivers/staging/tidspbridge/rmgr/drv.c +14 -17
index 2ce0737..93e9369 100644
@@ -90,7 +90,7 @@ int drv_insert_node_res_element(void *hnode, void *node_resource,
 	if (*node_res_obj == NULL)
 		status = -EFAULT;
 
-	if (DSP_SUCCEEDED(status)) {
+	if (!status) {
 		if (mutex_lock_interruptible(&ctxt->node_mutex)) {
 			kfree(*node_res_obj);
 			return -EPERM;
@@ -282,7 +282,7 @@ int drv_proc_insert_strm_res_element(void *stream_obj,
 	if (*pstrm_res == NULL)
 		status = -EFAULT;
 
-	if (DSP_SUCCEEDED(status)) {
+	if (!status) {
 		if (mutex_lock_interruptible(&ctxt->strm_mutex)) {
 			kfree(*pstrm_res);
 			return -EPERM;
@@ -453,9 +453,9 @@ int drv_create(struct drv_object **drv_obj)
 		status = -ENOMEM;
 	}
 	/* Store the DRV Object in the Registry */
-	if (DSP_SUCCEEDED(status))
+	if (!status)
 		status = cfg_set_object((u32) pdrv_object, REG_DRV_OBJECT);
-	if (DSP_SUCCEEDED(status)) {
+	if (!status) {
 		*drv_obj = pdrv_object;
 	} else {
 		kfree(pdrv_object->dev_list);
@@ -556,7 +556,7 @@ u32 drv_get_first_dev_object(void)
 	u32 dw_dev_object = 0;
 	struct drv_object *pdrv_obj;
 
-	if (DSP_SUCCEEDED(cfg_get_object((u32 *) &pdrv_obj, REG_DRV_OBJECT))) {
+	if (!cfg_get_object((u32 *) &pdrv_obj, REG_DRV_OBJECT)) {
 		if ((pdrv_obj->dev_list != NULL) &&
 		    !LST_IS_EMPTY(pdrv_obj->dev_list))
 			dw_dev_object = (u32) lst_first(pdrv_obj->dev_list);
@@ -576,7 +576,7 @@ u32 drv_get_first_dev_extension(void)
 	u32 dw_dev_extension = 0;
 	struct drv_object *pdrv_obj;
 
-	if (DSP_SUCCEEDED(cfg_get_object((u32 *) &pdrv_obj, REG_DRV_OBJECT))) {
+	if (!cfg_get_object((u32 *) &pdrv_obj, REG_DRV_OBJECT)) {
 
 		if ((pdrv_obj->dev_node_string != NULL) &&
 		    !LST_IS_EMPTY(pdrv_obj->dev_node_string)) {
@@ -602,7 +602,7 @@ u32 drv_get_next_dev_object(u32 hdev_obj)
 
 	DBC_REQUIRE(hdev_obj != 0);
 
-	if (DSP_SUCCEEDED(cfg_get_object((u32 *) &pdrv_obj, REG_DRV_OBJECT))) {
+	if (!cfg_get_object((u32 *) &pdrv_obj, REG_DRV_OBJECT)) {
 
 		if ((pdrv_obj->dev_list != NULL) &&
 		    !LST_IS_EMPTY(pdrv_obj->dev_list)) {
@@ -629,7 +629,7 @@ u32 drv_get_next_dev_extension(u32 dev_extension)
 
 	DBC_REQUIRE(dev_extension != 0);
 
-	if (DSP_SUCCEEDED(cfg_get_object((u32 *) &pdrv_obj, REG_DRV_OBJECT))) {
+	if (!cfg_get_object((u32 *) &pdrv_obj, REG_DRV_OBJECT)) {
 		if ((pdrv_obj->dev_node_string != NULL) &&
 		    !LST_IS_EMPTY(pdrv_obj->dev_node_string)) {
 			dw_dev_extension =
@@ -668,7 +668,6 @@ int drv_init(void)
 int drv_insert_dev_object(struct drv_object *driver_obj,
 				 struct dev_object *hdev_obj)
 {
-	int status = 0;
 	struct drv_object *pdrv_object = (struct drv_object *)driver_obj;
 
 	DBC_REQUIRE(refs > 0);
@@ -678,10 +677,9 @@ int drv_insert_dev_object(struct drv_object *driver_obj,
 
 	lst_put_tail(pdrv_object->dev_list, (struct list_head *)hdev_obj);
 
-	DBC_ENSURE(DSP_SUCCEEDED(status)
-		   && !LST_IS_EMPTY(pdrv_object->dev_list));
+	DBC_ENSURE(!LST_IS_EMPTY(pdrv_object->dev_list));
 
-	return status;
+	return 0;
 }
 
 /*
@@ -746,7 +744,7 @@ int drv_request_resources(u32 dw_context, u32 *dev_node_strg)
 	 */
 
 	status = cfg_get_object((u32 *) &pdrv_object, REG_DRV_OBJECT);
-	if (DSP_SUCCEEDED(status)) {
+	if (!status) {
 		pszdev_node = kzalloc(sizeof(struct drv_ext), GFP_KERNEL);
 		if (pszdev_node) {
 			lst_init_elem(&pszdev_node->link);
@@ -767,7 +765,7 @@ int drv_request_resources(u32 dw_context, u32 *dev_node_strg)
 		*dev_node_strg = 0;
 	}
 
-	DBC_ENSURE((DSP_SUCCEEDED(status) && dev_node_strg != NULL &&
+	DBC_ENSURE((!status && dev_node_strg != NULL &&
 		    !LST_IS_EMPTY(pdrv_object->dev_node_string)) ||
 		   (DSP_FAILED(status) && *dev_node_strg == 0));
 
@@ -820,7 +818,6 @@ int drv_release_resources(u32 dw_context, struct drv_object *hdrv_obj)
  */
 static int request_bridge_resources(struct cfg_hostres *res)
 {
-	int status = 0;
 	struct cfg_hostres *host_res = res;
 
 	/* num_mem_windows must not be more than CFG_MAXMEMREGISTERS */
@@ -845,7 +842,7 @@ static int request_bridge_resources(struct cfg_hostres *res)
 	host_res->dw_num_chnls = CHNL_MAXCHANNELS;
 	host_res->dw_chnl_buf_size = 0x400;
 
-	return status;
+	return 0;
 }
 
 /*
@@ -919,7 +916,7 @@ int drv_request_bridge_res_dsp(void **phost_resources)
 					dma_addr, shm_size);
 			}
 		}
-		if (DSP_SUCCEEDED(status)) {
+		if (!status) {
 			/* These are hard-coded values */
 			host_res->birq_registers = 0;
 			host_res->birq_attrib = 0;
drivers/staging/tidspbridge/rmgr/drv_interface.c +1 -1
index 340c92d..b1dcf4a 100644
@@ -588,7 +588,7 @@ static long bridge_ioctl(struct file *filp, unsigned int code,
 		status = api_call_dev_ioctl(code, &buf_in, &retval,
 					     filp->private_data);
 
-		if (DSP_SUCCEEDED(status)) {
+		if (!status) {
 			status = retval;
 		} else {
 			dev_dbg(bridge, "%s: IOCTL Failed, code: 0x%x "
drivers/staging/tidspbridge/rmgr/dspdrv.c +4 -4
index 8fedf18..0a10d88 100644
@@ -64,7 +64,7 @@ u32 dsp_init(u32 *init_status)
 	/* End drv_create */
 	/* Request Resources */
 	status = drv_request_resources((u32) &dev_node, &device_node_string);
-	if (DSP_SUCCEEDED(status)) {
+	if (!status) {
 		/* Attempt to Start the Device */
 		status = dev_start_device((struct cfg_devnode *)
 					  device_node_string);
@@ -97,7 +97,7 @@ u32 dsp_init(u32 *init_status)
 	}			/* Unwinding the loaded drivers */
 func_cont:
 	/* Attempt to Start the Board */
-	if (DSP_SUCCEEDED(status)) {
+	if (!status) {
 		/* BRD_AutoStart could fail if the dsp execuetable is not the
 		 * correct one. We should not propagate that error
 		 * into the device loader. */
@@ -105,7 +105,7 @@ func_cont:
 	} else {
 		dev_dbg(bridge, "%s: Failed\n", __func__);
 	}			/* End api_init_complete2 */
-	DBC_ENSURE((DSP_SUCCEEDED(status) && drv_obj != NULL) ||
+	DBC_ENSURE((!status && drv_obj != NULL) ||
 		   (DSP_FAILED(status) && drv_obj == NULL));
 	*init_status = status;
 	/* Return the Driver Object */
@@ -133,7 +133,7 @@ bool dsp_deinit(u32 device_context)
 
 	/* Get the Manager Object from Registry
 	 * MGR Destroy will unload the DCD dll */
-	if (DSP_SUCCEEDED(cfg_get_object((u32 *) &mgr_obj, REG_MGR_OBJECT)))
+	if (!cfg_get_object((u32 *) &mgr_obj, REG_MGR_OBJECT))
 		(void)mgr_destroy(mgr_obj);
 
 	api_exit();
drivers/staging/tidspbridge/rmgr/mgr.c +10 -10
index 805d3ca..57ae807 100644
@@ -65,10 +65,10 @@ int mgr_create(struct mgr_object **mgr_obj,
 	pmgr_obj = kzalloc(sizeof(struct mgr_object), GFP_KERNEL);
 	if (pmgr_obj) {
 		status = dcd_create_manager(ZLDLLNAME, &pmgr_obj->hdcd_mgr);
-		if (DSP_SUCCEEDED(status)) {
+		if (!status) {
 			/* If succeeded store the handle in the MGR Object */
 			status = cfg_set_object((u32) pmgr_obj, REG_MGR_OBJECT);
-			if (DSP_SUCCEEDED(status)) {
+			if (!status) {
 				*mgr_obj = pmgr_obj;
 			} else {
 				dcd_destroy_manager(pmgr_obj->hdcd_mgr);
@@ -148,7 +148,7 @@ int mgr_enum_node_info(u32 node_id, struct dsp_ndbprops *pndb_props,
 
 		}
 	}
-	if (DSP_SUCCEEDED(status)) {
+	if (!status) {
 		if (node_id > (node_index - 1)) {
 			status = -EINVAL;
 		} else {
@@ -156,7 +156,7 @@ int mgr_enum_node_info(u32 node_id, struct dsp_ndbprops *pndb_props,
 						    (struct dsp_uuid *)
 						    &node_uuid, DSP_DCDNODETYPE,
 						    &gen_obj);
-			if (DSP_SUCCEEDED(status)) {
+			if (!status) {
 				/* Get the Obj def */
 				*pndb_props =
 				    gen_obj.obj_data.node_obj.ndb_props;
@@ -166,7 +166,7 @@ int mgr_enum_node_info(u32 node_id, struct dsp_ndbprops *pndb_props,
 	}
 
 func_cont:
-	DBC_ENSURE((DSP_SUCCEEDED(status) && *pu_num_nodes > 0) ||
+	DBC_ENSURE((!status && *pu_num_nodes > 0) ||
 		   (DSP_FAILED(status) && *pu_num_nodes == 0));
 
 	return status;
@@ -204,15 +204,15 @@ int mgr_enum_processor_info(u32 processor_id,
 
 	*pu_num_procs = 0;
 	status = cfg_get_object((u32 *) &hdrv_obj, REG_DRV_OBJECT);
-	if (DSP_SUCCEEDED(status)) {
+	if (!status) {
 		status = drv_get_dev_object(processor_id, hdrv_obj, &hdev_obj);
-		if (DSP_SUCCEEDED(status)) {
+		if (!status) {
 			status = dev_get_dev_type(hdev_obj, (u8 *) &dev_type);
 			status = dev_get_dev_node(hdev_obj, &dev_node);
 			if (dev_type != DSP_UNIT)
 				status = -EPERM;
 
-			if (DSP_SUCCEEDED(status))
+			if (!status)
 				processor_info->processor_type = DSPTYPE64;
 		}
 	}
@@ -243,7 +243,7 @@ int mgr_enum_processor_info(u32 processor_id,
 		status2 = dcd_get_object_def(pmgr_obj->hdcd_mgr,
 					     (struct dsp_uuid *)&temp_uuid,
 					     DSP_DCDPROCESSORTYPE, &gen_obj);
-		if (DSP_SUCCEEDED(status2)) {
+		if (!status2) {
 			/* Get the Obj def */
 			if (processor_info_size <
 			    sizeof(struct mgr_processorextinfo)) {
@@ -318,7 +318,7 @@ int mgr_get_dcd_handle(struct mgr_object *mgr_handle,
 		*dcd_handle = (u32) pmgr_obj->hdcd_mgr;
 		status = 0;
 	}
-	DBC_ENSURE((DSP_SUCCEEDED(status) && *dcd_handle != (u32) NULL) ||
+	DBC_ENSURE((!status && *dcd_handle != (u32) NULL) ||
 		   (DSP_FAILED(status) && *dcd_handle == (u32) NULL));
 
 	return status;
drivers/staging/tidspbridge/rmgr/nldr.c +46 -47

334 lines not on this page · raw message

drivers/staging/tidspbridge/rmgr/node.c +75 -76

575 lines not on this page · raw message

drivers/staging/tidspbridge/rmgr/proc.c +47 -48

335 lines not on this page · raw message

drivers/staging/tidspbridge/rmgr/pwr.c +6 -12
index 13f5ed6..69c2e19 100644
@@ -91,12 +91,10 @@ int pwr_wake_dsp(const u32 timeout)
 	     hdev_obj != NULL;
 	     hdev_obj = (struct dev_object *)drv_get_next_dev_object
 	     ((u32) hdev_obj)) {
-		if (DSP_SUCCEEDED(dev_get_bridge_context(hdev_obj,
+		if (!(dev_get_bridge_context(hdev_obj,
 						      (struct bridge_dev_context
 						       **)&dw_context))) {
-			if (DSP_SUCCEEDED
-			    (dev_get_intf_fxns
-			     (hdev_obj,
+			if (!(dev_get_intf_fxns(hdev_obj,
 			      (struct bridge_drv_interface **)&intf_fxns))) {
 				status =
 				    (*intf_fxns->pfn_dev_cntrl) (dw_context,
@@ -127,12 +125,10 @@ int pwr_pm_pre_scale(u16 voltage_domain, u32 level)
 	     hdev_obj != NULL;
 	     hdev_obj = (struct dev_object *)drv_get_next_dev_object
 	     ((u32) hdev_obj)) {
-		if (DSP_SUCCEEDED(dev_get_bridge_context(hdev_obj,
+		if (!(dev_get_bridge_context(hdev_obj,
 						      (struct bridge_dev_context
 						       **)&dw_context))) {
-			if (DSP_SUCCEEDED
-			    (dev_get_intf_fxns
-			     (hdev_obj,
+			if (!(dev_get_intf_fxns(hdev_obj,
 			      (struct bridge_drv_interface **)&intf_fxns))) {
 				status =
 				    (*intf_fxns->pfn_dev_cntrl) (dw_context,
@@ -163,12 +159,10 @@ int pwr_pm_post_scale(u16 voltage_domain, u32 level)
 	     hdev_obj != NULL;
 	     hdev_obj = (struct dev_object *)drv_get_next_dev_object
 	     ((u32) hdev_obj)) {
-		if (DSP_SUCCEEDED(dev_get_bridge_context(hdev_obj,
+		if (!(dev_get_bridge_context(hdev_obj,
 						      (struct bridge_dev_context
 						       **)&dw_context))) {
-			if (DSP_SUCCEEDED
-			    (dev_get_intf_fxns
-			     (hdev_obj,
+			if (!(dev_get_intf_fxns(hdev_obj,
 			      (struct bridge_drv_interface **)&intf_fxns))) {
 				status =
 				    (*intf_fxns->pfn_dev_cntrl) (dw_context,
drivers/staging/tidspbridge/rmgr/rmm.c +4 -4
index 6db9ace..633d441 100644
@@ -139,7 +139,7 @@ int rmm_alloc(struct rmm_target_obj *target, u32 segid, u32 size,
 							(struct list_head *)
 							sect);
 	}
-	if (DSP_SUCCEEDED(status)) {
+	if (!status) {
 		/* No overlap - allocate list element for new section. */
 		new_sect = kzalloc(sizeof(struct rmm_ovly_sect), GFP_KERNEL);
 		if (new_sect == NULL) {
@@ -230,7 +230,7 @@ int rmm_create(struct rmm_target_obj **target_obj,
 	}
 func_cont:
 	/* Initialize overlay memory list */
-	if (DSP_SUCCEEDED(status)) {
+	if (!status) {
 		target->ovly_list = kzalloc(sizeof(struct lst_list),
 							GFP_KERNEL);
 		if (target->ovly_list == NULL)
@@ -239,7 +239,7 @@ func_cont:
 			INIT_LIST_HEAD(&target->ovly_list->head);
 	}
 
-	if (DSP_SUCCEEDED(status)) {
+	if (!status) {
 		*target_obj = target;
 	} else {
 		*target_obj = NULL;
@@ -248,7 +248,7 @@ func_cont:
 
 	}
 
-	DBC_ENSURE((DSP_SUCCEEDED(status) && *target_obj)
+	DBC_ENSURE((!status && *target_obj)
 		   || (DSP_FAILED(status) && *target_obj == NULL));
 
 	return status;
drivers/staging/tidspbridge/rmgr/strm.c +24 -24

174 lines not on this page · raw message

Signature · 1 line
1.5.4.5
#10 lore raw

PATCH 10/10 staging:ti dspbridge: remove DSP_FAILED macro definition

In reply to Ernesto Ramos

Since status succeeded is now 0 macro DSP_FAILED
is not necessary anymore. This patch removes this
define.

---
 .../staging/tidspbridge/include/dspbridge/dbdefs.h |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)
drivers/staging/tidspbridge/include/dspbridge/dbdefs.h +0 -3
index 2ccbfe1..5af075d 100644
@@ -91,9 +91,6 @@
 #define DSPWORD       unsigned char
 #define DSPWORDSIZE     sizeof(DSPWORD)
 
-/* Failure macro */
-#define DSP_FAILED(status)         unlikely((s32)(status) < 0)
-
 /* Power control enumerations */
 #define PROC_PWRCONTROL             0x8070
 
Signature · 1 line
1.5.4.5
#4 lore raw

PATCH 4/10 staging:ti dspbridge: remove DSP_SUCCEEDED macro from services

In reply to Ernesto Ramos

Since status succeeded is now 0 macro DSP_SUCCEEDED is not necessary anymore.

---
 drivers/staging/tidspbridge/services/cfg.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
drivers/staging/tidspbridge/services/cfg.c +5 -5
index 4ab3cd7..c3f33f6 100644
@@ -62,7 +62,7 @@ int cfg_get_auto_start(struct cfg_devnode *dev_node_obj,
 		status = -EFAULT;
 	if (!auto_start || !drv_datap)
 		status = -EFAULT;
-	if (DSP_SUCCEEDED(status))
+	if (!status)
 		*auto_start = (drv_datap->base_img) ? 1 : 0;
 
 	DBC_ENSURE((status == 0 &&
@@ -93,7 +93,7 @@ int cfg_get_dev_object(struct cfg_devnode *dev_node_obj,
 		status = -EFAULT;
 
 	dw_buf_size = sizeof(value);
-	if (DSP_SUCCEEDED(status)) {
+	if (!status) {
 
 		/* check the device string and then store dev object */
 		if (!
@@ -127,7 +127,7 @@ int cfg_get_exec_file(struct cfg_devnode *dev_node_obj, u32 buf_size,
 	if (strlen(drv_datap->base_img) > buf_size)
 		status = -EINVAL;
 
-	if (DSP_SUCCEEDED(status) && drv_datap->base_img)
+	if (!status && drv_datap->base_img)
 		strcpy(str_exec_file, drv_datap->base_img);
 
 	if (DSP_FAILED(status))
@@ -178,7 +178,7 @@ int cfg_get_object(u32 *value, u8 dw_type)
 		*value = 0;
 		pr_err("%s: Failed, status 0x%x\n", __func__, status);
 	}
-	DBC_ENSURE((DSP_SUCCEEDED(status) && *value != 0) ||
+	DBC_ENSURE((!status && *value != 0) ||
 		   (DSP_FAILED(status) && *value == 0));
 	return status;
 }
@@ -211,7 +211,7 @@ int cfg_set_dev_object(struct cfg_devnode *dev_node_obj, u32 value)
 	if (!dev_node_obj)
 		status = -EFAULT;
 
-	if (DSP_SUCCEEDED(status)) {
+	if (!status) {
 		/* Store the Bridge device object in the Registry */
 
 		if (!(strcmp((char *)dev_node_obj, "TIOMAP1510")))
Signature · 1 line
1.5.4.5
#0 lore raw

cover staging:ti dspbridge: Remove DSP_FAILED and DSP_SUCCEEDED macros

This series of patches is targetted to remove macros DSP_FAILED and DSP_SUCCEEDED since bridge driver currently uses standard kernel error codes.

Ernesto Ramos (10):
staging:ti dspbridge: remove DSP_SUCCEEDED macro from core staging:ti dspbridge: remove DSP_SUCCEEDED macro from pmgr staging:ti dspbridge: remove DSP_SUCCEEDED macro from rmgr staging:ti dspbridge: remove DSP_SUCCEEDED macro from services staging:ti dspbridge: remove DSP_SUCCEEDED macro definition staging:ti dspbridge: remove DSP_FAILED macro from core staging:ti dspbridge: remove DSP_FAILED macro from pmgr staging:ti dspbridge: remove DSP_FAILED macro from rmgr staging:ti dspbridge: remove DSP_FAILED macro from services staging:ti dspbridge: remove DSP_FAILED macro definition

 drivers/staging/tidspbridge/core/chnl_sm.c         |   42 ++--
 drivers/staging/tidspbridge/core/dsp-clock.c       |    4 +-
 drivers/staging/tidspbridge/core/io_sm.c           |  111 +++++-----
 drivers/staging/tidspbridge/core/msg_sm.c          |   26 ++--
 drivers/staging/tidspbridge/core/tiomap3430.c      |   61 +++---
 drivers/staging/tidspbridge/core/tiomap3430_pwr.c  |    8 +-
 drivers/staging/tidspbridge/core/tiomap_io.c       |   41 ++--
 .../staging/tidspbridge/include/dspbridge/dbdefs.h |    4 -
 drivers/staging/tidspbridge/pmgr/chnl.c            |   10 +-
 drivers/staging/tidspbridge/pmgr/cmm.c             |  137 ++++++-------
 drivers/staging/tidspbridge/pmgr/cod.c             |   18 +-
 drivers/staging/tidspbridge/pmgr/dbll.c            |   32 ++--
 drivers/staging/tidspbridge/pmgr/dev.c             |   79 +++----
 drivers/staging/tidspbridge/pmgr/dmm.c             |   12 +-
 drivers/staging/tidspbridge/pmgr/dspapi.c          |   82 ++++----
 drivers/staging/tidspbridge/pmgr/io.c              |    4 +-
 drivers/staging/tidspbridge/pmgr/msg.c             |    2 +-
 drivers/staging/tidspbridge/rmgr/dbdcd.c           |   48 ++--
 drivers/staging/tidspbridge/rmgr/disp.c            |   62 +++---
 drivers/staging/tidspbridge/rmgr/drv.c             |   39 ++--
 drivers/staging/tidspbridge/rmgr/drv_interface.c   |   10 +-
 drivers/staging/tidspbridge/rmgr/dspdrv.c          |   16 +-
 drivers/staging/tidspbridge/rmgr/mgr.c             |   32 ++--
 drivers/staging/tidspbridge/rmgr/nldr.c            |  106 +++++-----
 drivers/staging/tidspbridge/rmgr/node.c            |  224 ++++++++++----------
 drivers/staging/tidspbridge/rmgr/proc.c            |  137 ++++++------
 drivers/staging/tidspbridge/rmgr/pwr.c             |   26 +--
 drivers/staging/tidspbridge/rmgr/rmm.c             |   12 +-
 drivers/staging/tidspbridge/rmgr/strm.c            |   75 ++++----
 drivers/staging/tidspbridge/services/cfg.c         |   21 +-
 30 files changed, 710 insertions(+), 771 deletions(-)
#9 lore raw

PATCH 9/10 staging:ti dspbridge: remove DSP_FAILED macro from services

In reply to Ernesto Ramos

Since status succeeded is 0, DSP_FAILED macro
is not necessary anymore.

---
 drivers/staging/tidspbridge/services/cfg.c |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)
drivers/staging/tidspbridge/services/cfg.c +6 -7
index c3f33f6..a7af74f 100644
@@ -102,7 +102,7 @@ int cfg_get_dev_object(struct cfg_devnode *dev_node_obj,
 		      "TIOMAP1510")))
 			*value = (u32)drv_datap->dev_object;
 	}
-	if (DSP_FAILED(status))
+	if (status)
 		pr_err("%s: Failed, status 0x%x\n", __func__, status);
 	return status;
 }
@@ -130,7 +130,7 @@ int cfg_get_exec_file(struct cfg_devnode *dev_node_obj, u32 buf_size,
 	if (!status && drv_datap->base_img)
 		strcpy(str_exec_file, drv_datap->base_img);
 
-	if (DSP_FAILED(status))
+	if (status)
 		pr_err("%s: Failed, status 0x%x\n", __func__, status);
 	DBC_ENSURE(((status == 0) &&
 		    (strlen(str_exec_file) <= buf_size))
@@ -174,12 +174,11 @@ int cfg_get_object(u32 *value, u8 dw_type)
 	default:
 		break;
 	}
-	if (DSP_FAILED(status)) {
+	if (status) {
 		*value = 0;
 		pr_err("%s: Failed, status 0x%x\n", __func__, status);
 	}
-	DBC_ENSURE((!status && *value != 0) ||
-		   (DSP_FAILED(status) && *value == 0));
+	DBC_ENSURE((!status && *value != 0) || (status && *value == 0));
 	return status;
 }
 
@@ -217,7 +216,7 @@ int cfg_set_dev_object(struct cfg_devnode *dev_node_obj, u32 value)
 		if (!(strcmp((char *)dev_node_obj, "TIOMAP1510")))
 			drv_datap->dev_object = (void *) value;
 	}
-	if (DSP_FAILED(status))
+	if (status)
 		pr_err("%s: Failed, status 0x%x\n", __func__, status);
 
 	return status;
@@ -248,7 +247,7 @@ int cfg_set_object(u32 value, u8 dw_type)
 	default:
 		break;
 	}
-	if (DSP_FAILED(status))
+	if (status)
 		pr_err("%s: Failed, status 0x%x\n", __func__, status);
 	return status;
 }
Signature · 1 line
1.5.4.5
#6 lore raw

PATCH 6/10 staging:ti dspbridge: remove DSP_FAILED macro from core

In reply to Ernesto Ramos

Since status succeeded is 0, DSP_FAILED macro
is not necessary anymore.

---
 drivers/staging/tidspbridge/core/chnl_sm.c        |   20 +++---
 drivers/staging/tidspbridge/core/io_sm.c          |   64 ++++++++++----------
 drivers/staging/tidspbridge/core/msg_sm.c         |    4 +-
 drivers/staging/tidspbridge/core/tiomap3430.c     |    4 +-
 drivers/staging/tidspbridge/core/tiomap3430_pwr.c |    2 +-
 5 files changed, 47 insertions(+), 47 deletions(-)
drivers/staging/tidspbridge/core/chnl_sm.c +10 -10
index 1b23141..bee2b23 100644
@@ -135,7 +135,7 @@ int bridge_chnl_add_io_req(struct chnl_object *chnl_obj, void *host_buf,
 	if (!dev_ctxt)
 		status = -EFAULT;
 
-	if (DSP_FAILED(status))
+	if (status)
 		goto func_end;
 
 	if (pchnl->chnl_type == CHNL_PCPY && pchnl->chnl_id > 1 && host_buf) {
@@ -266,7 +266,7 @@ int bridge_chnl_cancel_io(struct chnl_object *chnl_obj)
 	} else {
 		status = -EFAULT;
 	}
-	if (DSP_FAILED(status))
+	if (status)
 		goto func_end;
 
 	/*  Mark this channel as cancelled, to prevent further IORequests or
@@ -372,7 +372,7 @@ func_cont:
 		kfree(pchnl);
 		pchnl = NULL;
 	}
-	DBC_ENSURE(DSP_FAILED(status) || !pchnl);
+	DBC_ENSURE(status || !pchnl);
 	return status;
 }
 
@@ -428,7 +428,7 @@ int bridge_chnl_create(struct chnl_mgr **channel_mgr,
 		status = -ENOMEM;
 	}
 
-	if (DSP_FAILED(status)) {
+	if (status) {
 		bridge_chnl_destroy(chnl_mgr_obj);
 		*channel_mgr = NULL;
 	} else {
@@ -456,7 +456,7 @@ int bridge_chnl_destroy(struct chnl_mgr *hchnl_mgr)
 			status =
 			    bridge_chnl_close(chnl_mgr_obj->ap_channel
 					      [chnl_id]);
-			if (DSP_FAILED(status))
+			if (status)
 				dev_dbg(bridge, "%s: Error status 0x%x\n",
 					__func__, status);
 		}
@@ -509,7 +509,7 @@ int bridge_chnl_flush_io(struct chnl_object *chnl_obj, u32 timeout)
 			while (!LST_IS_EMPTY(pchnl->pio_requests) && !status) {
 				status = bridge_chnl_get_ioc(chnl_obj,
 						timeout, &chnl_ioc_obj);
-				if (DSP_FAILED(status))
+				if (status)
 					continue;
 
 				if (chnl_ioc_obj.status & CHNL_IOCSTATTIMEOUT)
@@ -522,7 +522,7 @@ int bridge_chnl_flush_io(struct chnl_object *chnl_obj, u32 timeout)
 			pchnl->dw_state &= ~CHNL_STATECANCEL;
 		}
 	}
-	DBC_ENSURE(DSP_FAILED(status) || LST_IS_EMPTY(pchnl->pio_requests));
+	DBC_ENSURE(status || LST_IS_EMPTY(pchnl->pio_requests));
 	return status;
 }
 
@@ -592,7 +592,7 @@ int bridge_chnl_get_ioc(struct chnl_object *chnl_obj, u32 timeout,
 	if (!dev_ctxt)
 		status = -EFAULT;
 
-	if (DSP_FAILED(status))
+	if (status)
 		goto func_end;
 
 	ioc.status = CHNL_IOCSTATCOMPLETE;
@@ -806,7 +806,7 @@ int bridge_chnl_open(struct chnl_object **chnl,
 			}
 		}
 	}
-	if (DSP_FAILED(status))
+	if (status)
 		goto func_end;
 
 	DBC_ASSERT(ch_id < chnl_mgr_obj->max_channels);
@@ -860,7 +860,7 @@ int bridge_chnl_open(struct chnl_object **chnl,
 		}
 	}
 
-	if (DSP_FAILED(status)) {
+	if (status) {
 		/* Free memory */
 		if (pchnl->pio_completions) {
 			free_chirp_list(pchnl->pio_completions);
drivers/staging/tidspbridge/core/io_sm.c +32 -32

247 lines not on this page · raw message

drivers/staging/tidspbridge/core/msg_sm.c +2 -2
index 85ca448..87712e2 100644
@@ -210,7 +210,7 @@ int bridge_msg_create_queue(struct msg_mgr *hmsg_mgr,
 				status = add_new_msg(msg_q->msg_free_list);
 			}
 		}
-		if (DSP_FAILED(status)) {
+		if (status) {
 			/*  Stay inside CS to prevent others from taking any
 			 *  of the newly allocated message frames. */
 			delete_msg_queue(msg_q, num_allocated);
@@ -439,7 +439,7 @@ int bridge_msg_put(struct msg_queue *msg_queue_obj,
 		syncs[1] = msg_queue_obj->sync_done;
 		status = sync_wait_on_multiple_events(syncs, 2, utimeout,
 						      &index);
-		if (DSP_FAILED(status))
+		if (status)
 			goto func_end;
 		/* Enter critical section */
 		spin_lock_bh(&hmsg_mgr->msg_mgr_lock);
drivers/staging/tidspbridge/core/tiomap3430.c +2 -2
index 8f25a05..9673acb 100644
@@ -1318,7 +1318,7 @@ static int bridge_brd_mem_map(struct bridge_dev_context *dev_ctxt,
 			}
 			status = pte_set(dev_context->pt_attrs, pa,
 					 va, HW_PAGE_SIZE4KB, &hw_attrs);
-			if (DSP_FAILED(status))
+			if (status)
 				break;
 
 			va += HW_PAGE_SIZE4KB;
@@ -1344,7 +1344,7 @@ static int bridge_brd_mem_map(struct bridge_dev_context *dev_ctxt,
 				status = pte_set(dev_context->pt_attrs,
 						 page_to_phys(mapped_page), va,
 						 HW_PAGE_SIZE4KB, &hw_attrs);
-				if (DSP_FAILED(status))
+				if (status)
 					break;
 
 				if (mapped_pages)
drivers/staging/tidspbridge/core/tiomap3430_pwr.c +1 -1
index d938645..b789f8f 100644
@@ -228,7 +228,7 @@ int sleep_dsp(struct bridge_dev_context *dev_context, u32 dw_cmd,
 
 		/* Turn off DSP Peripheral clocks */
 		status = dsp_clock_disable_all(dev_context->dsp_per_clks);
-		if (DSP_FAILED(status))
+		if (status)
 			return status;
 #ifdef CONFIG_TIDSPBRIDGE_DVFS
 		else if (target_pwr_state == PWRDM_POWER_OFF) {
Signature · 1 line
1.5.4.5
#1 lore raw

PATCH 1/10 staging:ti dspbridge: remove DSP_SUCCEEDED macro from core

In reply to Ernesto Ramos

Since status succeeded is now 0 macro DSP_SUCCEEDED is not necessary anymore.

---
 drivers/staging/tidspbridge/core/chnl_sm.c        |   22 ++++----
 drivers/staging/tidspbridge/core/dsp-clock.c      |    4 +-
 drivers/staging/tidspbridge/core/io_sm.c          |   47 ++++++++---------
 drivers/staging/tidspbridge/core/msg_sm.c         |   22 ++++----
 drivers/staging/tidspbridge/core/tiomap3430.c     |   57 +++++++++------------
 drivers/staging/tidspbridge/core/tiomap3430_pwr.c |    6 +-
 drivers/staging/tidspbridge/core/tiomap_io.c      |   41 +++++++--------
 7 files changed, 91 insertions(+), 108 deletions(-)
drivers/staging/tidspbridge/core/chnl_sm.c +10 -12
index 69c4784..1b23141 100644
@@ -170,7 +170,7 @@ func_cont:
 	omap_mbox_disable_irq(dev_ctxt->mbox, IRQ_RX);
 	if (pchnl->chnl_type == CHNL_PCPY) {
 		/* This is a processor-copy channel. */
-		if (DSP_SUCCEEDED(status) && CHNL_IS_OUTPUT(pchnl->chnl_mode)) {
+		if (!status && CHNL_IS_OUTPUT(pchnl->chnl_mode)) {
 			/* Check buffer size on output channels for fit. */
 			if (byte_size >
 			    io_buf_size(pchnl->chnl_mgr_obj->hio_mgr))
@@ -178,7 +178,7 @@ func_cont:
 
 		}
 	}
-	if (DSP_SUCCEEDED(status)) {
+	if (!status) {
 		/* Get a free chirp: */
 		chnl_packet_obj =
 		    (struct chnl_irp *)lst_get_head(pchnl->free_packets_list);
@@ -186,7 +186,7 @@ func_cont:
 			status = -EIO;
 
 	}
-	if (DSP_SUCCEEDED(status)) {
+	if (!status) {
 		/* Enqueue the chirp on the chnl's IORequest queue: */
 		chnl_packet_obj->host_user_buf = chnl_packet_obj->host_sys_buf =
 		    host_buf;
@@ -330,7 +330,7 @@ int bridge_chnl_close(struct chnl_object *chnl_obj)
 		status = bridge_chnl_cancel_io(chnl_obj);
 	}
 func_cont:
-	if (DSP_SUCCEEDED(status)) {
+	if (!status) {
 		/* Assert I/O on this channel is now cancelled: Protects
 		 * from io_dpc. */
 		DBC_ASSERT((pchnl->dw_state & CHNL_STATECANCEL));
@@ -420,8 +420,7 @@ int bridge_chnl_create(struct chnl_mgr **channel_mgr,
 			chnl_mgr_obj->dw_output_mask = 0;
 			chnl_mgr_obj->dw_last_output = 0;
 			chnl_mgr_obj->hdev_obj = hdev_obj;
-			if (DSP_SUCCEEDED(status))
-				spin_lock_init(&chnl_mgr_obj->chnl_mgr_lock);
+			spin_lock_init(&chnl_mgr_obj->chnl_mgr_lock);
 		} else {
 			status = -ENOMEM;
 		}
@@ -499,7 +498,7 @@ int bridge_chnl_flush_io(struct chnl_object *chnl_obj, u32 timeout)
 	} else {
 		status = -EFAULT;
 	}
-	if (DSP_SUCCEEDED(status)) {
+	if (!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. */
@@ -507,8 +506,7 @@ int bridge_chnl_flush_io(struct chnl_object *chnl_obj, u32 timeout)
 		    && (pchnl->chnl_type == CHNL_PCPY)) {
 			/* Wait for IO completions, up to the specified
 			 * timeout: */
-			while (!LST_IS_EMPTY(pchnl->pio_requests) &&
-			       DSP_SUCCEEDED(status)) {
+			while (!LST_IS_EMPTY(pchnl->pio_requests) && !status) {
 				status = bridge_chnl_get_ioc(chnl_obj,
 						timeout, &chnl_ioc_obj);
 				if (DSP_FAILED(status))
@@ -833,7 +831,7 @@ int bridge_chnl_open(struct chnl_object **chnl,
 	else
 		status = -ENOMEM;
 
-	if (DSP_SUCCEEDED(status)) {
+	if (!status) {
 		pchnl->ntfy_obj = kmalloc(sizeof(struct ntfy_object),
 							GFP_KERNEL);
 		if (pchnl->ntfy_obj)
@@ -842,7 +840,7 @@ int bridge_chnl_open(struct chnl_object **chnl,
 			status = -ENOMEM;
 	}
 
-	if (DSP_SUCCEEDED(status)) {
+	if (!status) {
 		if (pchnl->pio_completions && pchnl->pio_requests &&
 		    pchnl->free_packets_list) {
 			/* Initialize CHNL object fields: */
@@ -897,7 +895,7 @@ int bridge_chnl_open(struct chnl_object **chnl,
 		*chnl = pchnl;
 	}
 func_end:
-	DBC_ENSURE((DSP_SUCCEEDED(status) && pchnl) || (*chnl == NULL));
+	DBC_ENSURE((!status && pchnl) || (*chnl == NULL));
 	return status;
 }
 
drivers/staging/tidspbridge/core/dsp-clock.c +2 -2
index b474e83..5b1a0c5 100644
@@ -285,7 +285,7 @@ int dsp_clk_enable(enum dsp_clk_id clk_id)
 		status = -EPERM;
 	}
 
-	if (DSP_SUCCEEDED(status))
+	if (!status)
 		set_dsp_clk_active(&dsp_clocks, clk_id);
 
 out:
@@ -354,7 +354,7 @@ int dsp_clk_disable(enum dsp_clk_id clk_id)
 		status = -EPERM;
 	}
 
-	if (DSP_SUCCEEDED(status))
+	if (!status)
 		set_dsp_clk_inactive(&dsp_clocks, clk_id);
 
 out:
drivers/staging/tidspbridge/core/io_sm.c +22 -25

148 lines not on this page · raw message

drivers/staging/tidspbridge/core/msg_sm.c +11 -11
index 7f44294..85ca448 100644
@@ -102,7 +102,7 @@ int bridge_msg_create(struct msg_mgr **msg_man,
 		else
 			sync_init_event(msg_mgr_obj->sync_event);
 
-		if (DSP_SUCCEEDED(status))
+		if (!status)
 			*msg_man = msg_mgr_obj;
 		else
 			delete_msg_mgr(msg_mgr_obj);
@@ -157,7 +157,7 @@ int bridge_msg_create_queue(struct msg_mgr *hmsg_mgr,
 
 	/*  Create event that will be signalled when a message from
 	 *  the DSP is available. */
-	if (DSP_SUCCEEDED(status)) {
+	if (!status) {
 		msg_q->sync_event = kzalloc(sizeof(struct sync_object),
 							GFP_KERNEL);
 		if (msg_q->sync_event)
@@ -167,7 +167,7 @@ int bridge_msg_create_queue(struct msg_mgr *hmsg_mgr,
 	}
 
 	/* Create a notification list for message ready notification. */
-	if (DSP_SUCCEEDED(status)) {
+	if (!status) {
 		msg_q->ntfy_obj = kmalloc(sizeof(struct ntfy_object),
 							GFP_KERNEL);
 		if (msg_q->ntfy_obj)
@@ -181,7 +181,7 @@ int bridge_msg_create_queue(struct msg_mgr *hmsg_mgr,
 	 *  unblock threads in MSG_Put() or MSG_Get(). sync_done_ack
 	 *  will be set by the unblocked thread to signal that it
 	 *  is unblocked and will no longer reference the object. */
-	if (DSP_SUCCEEDED(status)) {
+	if (!status) {
 		msg_q->sync_done = kzalloc(sizeof(struct sync_object),
 							GFP_KERNEL);
 		if (msg_q->sync_done)
@@ -190,7 +190,7 @@ int bridge_msg_create_queue(struct msg_mgr *hmsg_mgr,
 			status = -ENOMEM;
 	}
 
-	if (DSP_SUCCEEDED(status)) {
+	if (!status) {
 		msg_q->sync_done_ack = kzalloc(sizeof(struct sync_object),
 							GFP_KERNEL);
 		if (msg_q->sync_done_ack)
@@ -199,13 +199,13 @@ int bridge_msg_create_queue(struct msg_mgr *hmsg_mgr,
 			status = -ENOMEM;
 	}
 
-	if (DSP_SUCCEEDED(status)) {
+	if (!status) {
 		/* Enter critical section */
 		spin_lock_bh(&hmsg_mgr->msg_mgr_lock);
 		/* Initialize message frames and put in appropriate queues */
-		for (i = 0; i < max_msgs && DSP_SUCCEEDED(status); i++) {
+		for (i = 0; i < max_msgs && !status; i++) {
 			status = add_new_msg(hmsg_mgr->msg_free_list);
-			if (DSP_SUCCEEDED(status)) {
+			if (!status) {
 				num_allocated++;
 				status = add_new_msg(msg_q->msg_free_list);
 			}
@@ -330,7 +330,7 @@ int bridge_msg_get(struct msg_queue *msg_queue_obj,
 	}
 	/* Exit critical section */
 	spin_unlock_bh(&hmsg_mgr->msg_mgr_lock);
-	if (DSP_SUCCEEDED(status) && !got_msg) {
+	if (!status && !got_msg) {
 		/*  Wait til message is available, timeout, or done. We don't
 		 *  have to schedule the DPC, since the DSP will send messages
 		 *  when they are available. */
@@ -349,7 +349,7 @@ int bridge_msg_get(struct msg_queue *msg_queue_obj,
 			(void)sync_set_event(msg_queue_obj->sync_done_ack);
 			status = -EPERM;
 		} else {
-			if (DSP_SUCCEEDED(status)) {
+			if (!status) {
 				DBC_ASSERT(!LST_IS_EMPTY
 					   (msg_queue_obj->msg_used_list));
 				/* Get msg from used list */
@@ -432,7 +432,7 @@ int bridge_msg_put(struct msg_queue *msg_queue_obj,
 
 		spin_unlock_bh(&hmsg_mgr->msg_mgr_lock);
 	}
-	if (DSP_SUCCEEDED(status) && !put_msg) {
+	if (!status && !put_msg) {
 		/* Wait til a free message frame is available, timeout,
 		 * or done */
 		syncs[0] = hmsg_mgr->sync_event;
drivers/staging/tidspbridge/core/tiomap3430.c +24 -33

193 lines not on this page · raw message

drivers/staging/tidspbridge/core/tiomap3430_pwr.c +3 -3
index dc63b3a..d938645 100644
@@ -112,7 +112,7 @@ int handle_hibernation_from_dsp(struct bridge_dev_context *dev_context)
 		/* Disable wdt on hibernation. */
 		dsp_wdt_enable(false);
 
-		if (DSP_SUCCEEDED(status)) {
+		if (!status) {
 			/* Update the Bridger Driver state */
 			dev_context->dw_brd_state = BRD_DSP_HIBERNATION;
 #ifdef CONFIG_TIDSPBRIDGE_DVFS
@@ -310,7 +310,7 @@ int dsp_peripheral_clk_ctrl(struct bridge_dev_context *dev_context,
 		status = dsp_clk_disable(bpwr_clks[clk_id_index].clk);
 		dsp_clk_wakeup_event_ctrl(bpwr_clks[clk_id_index].clk_id,
 					  false);
-		if (DSP_SUCCEEDED(status)) {
+		if (!status) {
 			(dev_context->dsp_per_clks) &=
 				(~((u32) (1 << bpwr_clks[clk_id_index].clk)));
 		}
@@ -318,7 +318,7 @@ int dsp_peripheral_clk_ctrl(struct bridge_dev_context *dev_context,
 	case BPWR_ENABLE_CLOCK:
 		status = dsp_clk_enable(bpwr_clks[clk_id_index].clk);
 		dsp_clk_wakeup_event_ctrl(bpwr_clks[clk_id_index].clk_id, true);
-		if (DSP_SUCCEEDED(status))
+		if (!status)
 			(dev_context->dsp_per_clks) |=
 				(1 << bpwr_clks[clk_id_index].clk);
 		break;
drivers/staging/tidspbridge/core/tiomap_io.c +19 -22

143 lines not on this page · raw message

Signature · 1 line
1.5.4.5
#8 lore raw

PATCH 8/10 staging:ti dspbridge: remove DSP_FAILED macro from rmgr

In reply to Ernesto Ramos

Since status succeeded is 0, DSP_FAILED macro
is not necessary anymore.

---
 drivers/staging/tidspbridge/rmgr/dbdcd.c         |   24 ++++----
 drivers/staging/tidspbridge/rmgr/disp.c          |   28 ++++----
 drivers/staging/tidspbridge/rmgr/drv.c           |    8 +-
 drivers/staging/tidspbridge/rmgr/drv_interface.c |    8 +-
 drivers/staging/tidspbridge/rmgr/dspdrv.c        |    8 +-
 drivers/staging/tidspbridge/rmgr/mgr.c           |   12 ++--
 drivers/staging/tidspbridge/rmgr/nldr.c          |   15 ++--
 drivers/staging/tidspbridge/rmgr/node.c          |   75 +++++++++++-----------
 drivers/staging/tidspbridge/rmgr/proc.c          |   42 ++++++------
 drivers/staging/tidspbridge/rmgr/pwr.c           |    8 +-
 drivers/staging/tidspbridge/rmgr/rmm.c           |    4 +-
 drivers/staging/tidspbridge/rmgr/strm.c          |   29 ++++----
 12 files changed, 129 insertions(+), 132 deletions(-)
drivers/staging/tidspbridge/rmgr/dbdcd.c +12 -12
index 12d2d41..f71e860 100644
@@ -135,7 +135,7 @@ int dcd_create_manager(char *sz_zl_dll_name,
 	DBC_REQUIRE(dcd_mgr);
 
 	status = cod_create(&cod_mgr, sz_zl_dll_name, NULL);
-	if (DSP_FAILED(status))
+	if (status)
 		goto func_end;
 
 	/* Create a DCD object. */
@@ -464,7 +464,7 @@ int dcd_get_object_def(struct dcd_manager *hdcd_mgr,
 	/* Open COFF file. */
 	status = cod_open(dcd_mgr_obj->cod_mgr, dcd_key->path,
 							COD_NOLOAD, &lib);
-	if (DSP_FAILED(status)) {
+	if (status) {
 		status = -EACCES;
 		goto func_end;
 	}
@@ -480,7 +480,7 @@ int dcd_get_object_def(struct dcd_manager *hdcd_mgr,
 
 	/* Get section information. */
 	status = cod_get_section(lib, sz_sect_name, &ul_addr, &ul_len);
-	if (DSP_FAILED(status)) {
+	if (status) {
 		status = -EACCES;
 		goto func_end;
 	}
@@ -513,7 +513,7 @@ int dcd_get_object_def(struct dcd_manager *hdcd_mgr,
 		/* Parse the content of the COFF buffer. */
 		status =
 		    get_attrs_from_buf(psz_coff_buf, ul_len, obj_type, obj_def);
-		if (DSP_FAILED(status))
+		if (status)
 			status = -EACCES;
 	} else {
 		status = -EACCES;
@@ -557,14 +557,14 @@ int dcd_get_objects(struct dcd_manager *hdcd_mgr,
 
 	/* Open DSP coff file, don't load symbols. */
 	status = cod_open(dcd_mgr_obj->cod_mgr, sz_coff_path, COD_NOLOAD, &lib);
-	if (DSP_FAILED(status)) {
+	if (status) {
 		status = -EACCES;
 		goto func_cont;
 	}
 
 	/* Get DCD_RESIGER_SECTION section information. */
 	status = cod_get_section(lib, DCD_REGISTER_SECTION, &ul_addr, &ul_len);
-	if (DSP_FAILED(status) || !(ul_len > 0)) {
+	if (status || !(ul_len > 0)) {
 		status = -EACCES;
 		goto func_cont;
 	}
@@ -617,7 +617,7 @@ int dcd_get_objects(struct dcd_manager *hdcd_mgr,
 			 */
 			status =
 			    register_fxn(&dsp_uuid_obj, object_type, handle);
-			if (DSP_FAILED(status)) {
+			if (status) {
 				/* if error occurs, break from while loop. */
 				break;
 			}
@@ -729,7 +729,7 @@ int dcd_get_library_name(struct dcd_manager *hdcd_mgr,
 		status = -ENOKEY;
 
 	/* If can't find, phases might be registered as generic LIBRARYTYPE */
-	if (DSP_FAILED(status) && phase != NLDR_NOPHASE) {
+	if (status && phase != NLDR_NOPHASE) {
 		if (phase_split)
 			*phase_split = false;
 
@@ -872,7 +872,7 @@ int dcd_register_object(struct dsp_uuid *uuid_obj,
 			status = -EPERM;
 	}
 
-	if (DSP_FAILED(status))
+	if (status)
 		goto func_end;
 
 	/*
@@ -1449,14 +1449,14 @@ static int get_dep_lib_info(struct dcd_manager *hdcd_mgr,
 		/* Get dependent library section information. */
 		status = cod_get_section(lib, DEPLIBSECT, &ul_addr, &ul_len);
 
-		if (DSP_FAILED(status)) {
+		if (status) {
 			/* Ok, no dependent libraries */
 			ul_len = 0;
 			status = 0;
 		}
 	}
 
-	if (DSP_FAILED(status) || !(ul_len > 0))
+	if (status || !(ul_len > 0))
 		goto func_cont;
 
 	/* Allocate zeroed buffer. */
@@ -1466,7 +1466,7 @@ static int get_dep_lib_info(struct dcd_manager *hdcd_mgr,
 
 	/* Read section contents. */
 	status = cod_read_section(lib, DEPLIBSECT, psz_coff_buf, ul_len);
-	if (DSP_FAILED(status))
+	if (status)
 		goto func_cont;
 
 	/* Compress and format DSP buffer to conform to PC format. */
drivers/staging/tidspbridge/rmgr/disp.c +14 -14
index 2d479b2..b7ce435 100644
@@ -121,12 +121,12 @@ int disp_create(struct disp_object **dispatch_obj,
 
 	/* check device type and decide if streams or messag'ing is used for
 	 * RMS/EDS */
-	if (DSP_FAILED(status))
+	if (status)
 		goto func_cont;
 
 	status = dev_get_dev_type(hdev_obj, &dev_type);
 
-	if (DSP_FAILED(status))
+	if (status)
 		goto func_cont;
 
 	if (dev_type != DSP_UNIT) {
@@ -168,7 +168,7 @@ func_cont:
 	else
 		delete_disp(disp_obj);
 
-	DBC_ENSURE(((DSP_FAILED(status)) && ((*dispatch_obj == NULL))) ||
+	DBC_ENSURE((status && *dispatch_obj == NULL) ||
 				(!status && *dispatch_obj));
 	return status;
 }
@@ -284,7 +284,7 @@ int disp_node_create(struct disp_object *disp_obj,
 
 	status = dev_get_dev_type(disp_obj->hdev_obj, &dev_type);
 
-	if (DSP_FAILED(status))
+	if (status)
 		goto func_end;
 
 	if (dev_type != DSP_UNIT) {
@@ -377,7 +377,7 @@ int disp_node_create(struct disp_object *disp_obj,
 		       node_msg_args.arg_length);
 		total += dw_length;
 	}
-	if (DSP_FAILED(status))
+	if (status)
 		goto func_end;
 
 	/* If node is a task node, copy task create arguments into  buffer */
@@ -425,7 +425,7 @@ int disp_node_create(struct disp_object *disp_obj,
 			/* Fill SIO defs and offsets */
 			offset = sio_defs_offset;
 			for (i = 0; i < task_arg_obj.num_inputs; i++) {
-				if (DSP_FAILED(status))
+				if (status)
 					break;
 
 				pdw_buf[sio_in_def_offset + i] =
@@ -467,7 +467,7 @@ int disp_node_create(struct disp_object *disp_obj,
 			 * on the DSP-side
 			 */
 			status = (((rms_word *) (disp_obj->pbuf))[0]);
-			if (DSP_FAILED(status))
+			if (status < 0)
 				dev_dbg(bridge, "%s: DSP-side failed: 0x%x\n",
 					__func__, status);
 		}
@@ -520,7 +520,7 @@ int disp_node_delete(struct disp_object *disp_obj,
 				 * function on the DSP-side
 				 */
 				status = (((rms_word *) (disp_obj->pbuf))[0]);
-				if (DSP_FAILED(status))
+				if (status < 0)
 					dev_dbg(bridge, "%s: DSP-side failed: "
 						"0x%x\n", __func__, status);
 			}
@@ -573,7 +573,7 @@ int disp_node_run(struct disp_object *disp_obj,
 				 * function on the DSP-side
 				 */
 				status = (((rms_word *) (disp_obj->pbuf))[0]);
-				if (DSP_FAILED(status))
+				if (status < 0)
 					dev_dbg(bridge, "%s: DSP-side failed: "
 						"0x%x\n", __func__, status);
 			}
@@ -603,7 +603,7 @@ static void delete_disp(struct disp_object *disp_obj)
 			 * is invalid. */
 			status = (*intf_fxns->pfn_chnl_close)
 			    (disp_obj->chnl_from_dsp);
-			if (DSP_FAILED(status)) {
+			if (status) {
 				dev_dbg(bridge, "%s: Failed to close channel "
 					"from RMS: 0x%x\n", __func__, status);
 			}
@@ -612,7 +612,7 @@ static void delete_disp(struct disp_object *disp_obj)
 			status =
 			    (*intf_fxns->pfn_chnl_close) (disp_obj->
 							  chnl_to_dsp);
-			if (DSP_FAILED(status)) {
+			if (status) {
 				dev_dbg(bridge, "%s: Failed to close channel to"
 					" RMS: 0x%x\n", __func__, status);
 			}
@@ -704,7 +704,7 @@ static int send_message(struct disp_object *disp_obj, u32 timeout,
 	/* Send the command */
 	status = (*intf_fxns->pfn_chnl_add_io_req) (chnl_obj, pbuf, ul_bytes, 0,
 						    0L, dw_arg);
-	if (DSP_FAILED(status))
+	if (status)
 		goto func_end;
 
 	status =
@@ -718,14 +718,14 @@ static int send_message(struct disp_object *disp_obj, u32 timeout,
 		}
 	}
 	/* Get the reply */
-	if (DSP_FAILED(status))
+	if (status)
 		goto func_end;
 
 	chnl_obj = disp_obj->chnl_from_dsp;
 	ul_bytes = REPLYSIZE;
 	status = (*intf_fxns->pfn_chnl_add_io_req) (chnl_obj, pbuf, ul_bytes,
 						    0, 0L, dw_arg);
-	if (DSP_FAILED(status))
+	if (status)
 		goto func_end;
 
 	status =
drivers/staging/tidspbridge/rmgr/drv.c +4 -4
index 93e9369..12c270a 100644
@@ -180,7 +180,7 @@ int drv_remove_all_dmm_res_elements(void *process_ctxt)
 	list_for_each_entry_safe(map_obj, temp_map, &ctxt->dmm_map_list, link) {
 		status = proc_un_map(ctxt->hprocessor,
 				     (void *)map_obj->dsp_addr, ctxt);
-		if (DSP_FAILED(status))
+		if (status)
 			pr_err("%s: proc_un_map failed!"
 			       " status = 0x%xn", __func__, status);
 	}
@@ -190,7 +190,7 @@ int drv_remove_all_dmm_res_elements(void *process_ctxt)
 		status = proc_un_reserve_memory(ctxt->hprocessor, (void *)
 						rsv_obj->dsp_reserved_addr,
 						ctxt);
-		if (DSP_FAILED(status))
+		if (status)
 			pr_err("%s: proc_un_reserve_memory failed!"
 			       " status = 0x%xn", __func__, status);
 	}
@@ -464,7 +464,7 @@ int drv_create(struct drv_object **drv_obj)
 		kfree(pdrv_object);
 	}
 
-	DBC_ENSURE(DSP_FAILED(status) || pdrv_object);
+	DBC_ENSURE(status || pdrv_object);
 	return status;
 }
 
@@ -767,7 +767,7 @@ int drv_request_resources(u32 dw_context, u32 *dev_node_strg)
 
 	DBC_ENSURE((!status && dev_node_strg != NULL &&
 		    !LST_IS_EMPTY(pdrv_object->dev_node_string)) ||
-		   (DSP_FAILED(status) && *dev_node_strg == 0));
+		   (status && *dev_node_strg == 0));
 
 	return status;
 }
drivers/staging/tidspbridge/rmgr/drv_interface.c +4 -4
index b1dcf4a..aec7cf7 100644
@@ -201,7 +201,7 @@ static void bridge_recover(struct work_struct *work)
 	}
 	dev = dev_get_first();
 	dev_get_dev_node(dev, &dev_node);
-	if (!dev_node || DSP_FAILED(proc_auto_start(dev_node, dev)))
+	if (!dev_node || proc_auto_start(dev_node, dev))
 		pr_err("DSP could not be restarted\n");
 	recover = false;
 	complete_all(&bridge_open_comp);
@@ -397,7 +397,7 @@ static int __devexit omap34_xx_bridge_remove(struct platform_device *pdev)
 	void *hdrv_obj = NULL;
 
 	status = cfg_get_object((u32 *) &hdrv_obj, REG_DRV_OBJECT);
-	if (DSP_FAILED(status))
+	if (status)
 		goto func_cont;
 
 #ifdef CONFIG_TIDSPBRIDGE_DVFS
@@ -439,7 +439,7 @@ static int BRIDGE_SUSPEND(struct platform_device *pdev, pm_message_t state)
 	u32 command = PWR_EMERGENCYDEEPSLEEP;
 
 	status = pwr_sleep_dsp(command, time_out);
-	if (DSP_FAILED(status))
+	if (status)
 		return -1;
 
 	bridge_suspend_data.suspended = 1;
@@ -451,7 +451,7 @@ static int BRIDGE_RESUME(struct platform_device *pdev)
 	u32 status;
 
 	status = pwr_wake_dsp(time_out);
-	if (DSP_FAILED(status))
+	if (status)
 		return -1;
 
 	bridge_suspend_data.suspended = 0;
drivers/staging/tidspbridge/rmgr/dspdrv.c +4 -4
index 0a10d88..714f348 100644
@@ -56,7 +56,7 @@ u32 dsp_init(u32 *init_status)
 		goto func_cont;
 
 	status = drv_create(&drv_obj);
-	if (DSP_FAILED(status)) {
+	if (status) {
 		api_exit();
 		goto func_cont;
 	}
@@ -68,7 +68,7 @@ u32 dsp_init(u32 *init_status)
 		/* Attempt to Start the Device */
 		status = dev_start_device((struct cfg_devnode *)
 					  device_node_string);
-		if (DSP_FAILED(status))
+		if (status)
 			(void)drv_release_resources
 			    ((u32) device_node_string, drv_obj);
 	} else {
@@ -77,7 +77,7 @@ u32 dsp_init(u32 *init_status)
 	}
 
 	/* Unwind whatever was loaded */
-	if (DSP_FAILED(status)) {
+	if (status) {
 		/* irrespective of the status of dev_remove_device we conitinue
 		 * unloading. Get the Driver Object iterate through and remove.
 		 * Reset the status to E_FAIL to avoid going through
@@ -106,7 +106,7 @@ func_cont:
 		dev_dbg(bridge, "%s: Failed\n", __func__);
 	}			/* End api_init_complete2 */
 	DBC_ENSURE((!status && drv_obj != NULL) ||
-		   (DSP_FAILED(status) && drv_obj == NULL));
+		   (status && drv_obj == NULL));
 	*init_status = status;
 	/* Return the Driver Object */
 	return (u32) drv_obj;
drivers/staging/tidspbridge/rmgr/mgr.c +6 -6
index 57ae807..57a39b9 100644
@@ -82,7 +82,7 @@ int mgr_create(struct mgr_object **mgr_obj,
 		status = -ENOMEM;
 	}
 
-	DBC_ENSURE(DSP_FAILED(status) || pmgr_obj);
+	DBC_ENSURE(status || pmgr_obj);
 	return status;
 }
 
@@ -132,7 +132,7 @@ int mgr_enum_node_info(u32 node_id, struct dsp_ndbprops *pndb_props,
 	*pu_num_nodes = 0;
 	/* Get The Manager Object from the Registry */
 	status = cfg_get_object((u32 *) &pmgr_obj, REG_MGR_OBJECT);
-	if (DSP_FAILED(status))
+	if (status)
 		goto func_cont;
 
 	DBC_ASSERT(pmgr_obj);
@@ -167,7 +167,7 @@ int mgr_enum_node_info(u32 node_id, struct dsp_ndbprops *pndb_props,
 
 func_cont:
 	DBC_ENSURE((!status && *pu_num_nodes > 0) ||
-		   (DSP_FAILED(status) && *pu_num_nodes == 0));
+		   (status && *pu_num_nodes == 0));
 
 	return status;
 }
@@ -216,11 +216,11 @@ int mgr_enum_processor_info(u32 processor_id,
 				processor_info->processor_type = DSPTYPE64;
 		}
 	}
-	if (DSP_FAILED(status))
+	if (status)
 		goto func_end;
 
 	/* Get The Manager Object from the Registry */
-	if (DSP_FAILED(cfg_get_object((u32 *) &pmgr_obj, REG_MGR_OBJECT))) {
+	if (cfg_get_object((u32 *) &pmgr_obj, REG_MGR_OBJECT)) {
 		dev_dbg(bridge, "%s: Failed to get MGR Object\n", __func__);
 		goto func_end;
 	}
@@ -319,7 +319,7 @@ int mgr_get_dcd_handle(struct mgr_object *mgr_handle,
 		status = 0;
 	}
 	DBC_ENSURE((!status && *dcd_handle != (u32) NULL) ||
-		   (DSP_FAILED(status) && *dcd_handle == (u32) NULL));
+		   (status && *dcd_handle == (u32) NULL));
 
 	return status;
 }
drivers/staging/tidspbridge/rmgr/nldr.c +7 -8
index 3b83fc3..d8f4eeb 100644
@@ -399,11 +399,11 @@ int nldr_allocate(struct nldr_object *nldr_obj, void *priv_ref,
 		*nldr_nodeobj = (struct nldr_nodeobject *)nldr_node_obj;
 	}
 	/* Cleanup on failure */
-	if (DSP_FAILED(status) && nldr_node_obj)
+	if (status && nldr_node_obj)
 		kfree(nldr_node_obj);
 
 	DBC_ENSURE((!status && *nldr_nodeobj)
-		   || (DSP_FAILED(status) && *nldr_nodeobj == NULL));
+		   || (status && *nldr_nodeobj == NULL));
 	return status;
 }
 
@@ -587,8 +587,7 @@ int nldr_create(struct nldr_object **nldr,
 		*nldr = NULL;
 	}
 	/* FIXME:Temp. Fix. Must be removed */
-	DBC_ENSURE((!status && *nldr)
-		   || (DSP_FAILED(status) && (*nldr == NULL)));
+	DBC_ENSURE((!status && *nldr) || (status && *nldr == NULL));
 	return status;
 }
 
@@ -1012,7 +1011,7 @@ static int add_ovly_node(struct dsp_uuid *uuid_obj,
 	status =
 	    dcd_get_object_def(nldr_obj->hdcd_mgr, uuid_obj, obj_type,
 			       &obj_def);
-	if (DSP_FAILED(status))
+	if (status)
 		goto func_end;
 
 	/* If overlay node, add to the list */
@@ -1422,7 +1421,7 @@ static int load_lib(struct nldr_nodeobject *nldr_node_obj,
 	 *  were loaded, and close the root library.
 	 *  (Persistent libraries are unloaded from the very top)
 	 */
-	if (DSP_FAILED(status)) {
+	if (status) {
 		if (phase != NLDR_EXECUTE) {
 			for (i = 0; i < nldr_node_obj->pers_libs; i++)
 				unload_lib(nldr_node_obj,
@@ -1593,7 +1592,7 @@ static int load_ovly(struct nldr_nodeobject *nldr_node_obj,
 			}
 		}
 	}
-	if (DSP_FAILED(status)) {
+	if (status) {
 		/* 'Deallocate' memory */
 		free_sects(nldr_obj, phase_sects, alloc_num);
 		free_sects(nldr_obj, other_sects_list, other_alloc);
@@ -1684,7 +1683,7 @@ static int remote_alloc(void **ref, u16 mem_sect, u32 size,
 		rmm_addr_obj->segid = segid;
 		status =
 		    rmm_alloc(rmm, segid, word_size, align, dsp_address, false);
-		if (DSP_FAILED(status)) {
+		if (status) {
 			dev_dbg(bridge, "%s: Unable allocate from segment %d\n",
 				__func__, segid);
 		}
drivers/staging/tidspbridge/rmgr/node.c +37 -38

292 lines not on this page · raw message

drivers/staging/tidspbridge/rmgr/proc.c +21 -21

159 lines not on this page · raw message

drivers/staging/tidspbridge/rmgr/pwr.c +4 -4
index 69c2e19..85cb1a2 100644
@@ -49,14 +49,14 @@ int pwr_sleep_dsp(const u32 sleep_code, const u32 timeout)
 	     hdev_obj != NULL;
 	     hdev_obj =
 	     (struct dev_object *)drv_get_next_dev_object((u32) hdev_obj)) {
-		if (DSP_FAILED(dev_get_bridge_context(hdev_obj,
+		if (dev_get_bridge_context(hdev_obj,
 						(struct bridge_dev_context **)
-						   &dw_context))) {
+						   &dw_context)) {
 			continue;
 		}
-		if (DSP_FAILED(dev_get_intf_fxns(hdev_obj,
+		if (dev_get_intf_fxns(hdev_obj,
 						(struct bridge_drv_interface **)
-						&intf_fxns))) {
+						&intf_fxns)) {
 			continue;
 		}
 		if (sleep_code == PWR_DEEPSLEEP)
drivers/staging/tidspbridge/rmgr/rmm.c +2 -2
index 633d441..761e8f4 100644
@@ -186,7 +186,7 @@ int rmm_create(struct rmm_target_obj **target_obj,
 	if (target == NULL)
 		status = -ENOMEM;
 
-	if (DSP_FAILED(status))
+	if (status)
 		goto func_cont;
 
 	target->num_segs = num_segs;
@@ -249,7 +249,7 @@ func_cont:
 	}
 
 	DBC_ENSURE((!status && *target_obj)
-		   || (DSP_FAILED(status) && *target_obj == NULL));
+		   || (status && *target_obj == NULL));
 
 	return status;
 }
drivers/staging/tidspbridge/rmgr/strm.c +14 -15
index 35d6378..df8458e 100644
@@ -120,7 +120,7 @@ int strm_allocate_buffer(struct strm_object *stream_obj, u32 usize,
 		status = -EFAULT;
 	}
 
-	if (DSP_FAILED(status))
+	if (status)
 		goto func_end;
 
 	for (i = 0; i < num_bufs; i++) {
@@ -133,10 +133,10 @@ int strm_allocate_buffer(struct strm_object *stream_obj, u32 usize,
 			break;
 		}
 	}
-	if (DSP_FAILED(status))
+	if (status)
 		strm_free_buffer(stream_obj, ap_buffer, alloc_cnt, pr_ctxt);
 
-	if (DSP_FAILED(status))
+	if (status)
 		goto func_end;
 
 	if (drv_get_strm_res_element(stream_obj, &hstrm_res, pr_ctxt) !=
@@ -180,7 +180,7 @@ int strm_close(struct strm_object *stream_obj,
 			status = delete_strm(stream_obj);
 	}
 
-	if (DSP_FAILED(status))
+	if (status)
 		goto func_end;
 
 	if (drv_get_strm_res_element(stream_obj, &hstrm_res, pr_ctxt) !=
@@ -233,8 +233,7 @@ int strm_create(struct strm_mgr **strm_man,
 	else
 		kfree(strm_mgr_obj);
 
-	DBC_ENSURE((!status && *strm_man) ||
-				(DSP_FAILED(status) && *strm_man == NULL));
+	DBC_ENSURE((!status && *strm_man) || (status && *strm_man == NULL));
 
 	return status;
 }
@@ -291,7 +290,7 @@ int strm_free_buffer(struct strm_object *stream_obj, u8 ** ap_buffer,
 			status =
 			    cmm_xlator_free_buf(stream_obj->xlator,
 						ap_buffer[i]);
-			if (DSP_FAILED(status))
+			if (status)
 				break;
 			ap_buffer[i] = NULL;
 		}
@@ -329,14 +328,14 @@ int strm_get_info(struct strm_object *stream_obj,
 			status = -EINVAL;
 		}
 	}
-	if (DSP_FAILED(status))
+	if (status)
 		goto func_end;
 
 	intf_fxns = stream_obj->strm_mgr_obj->intf_fxns;
 	status =
 	    (*intf_fxns->pfn_chnl_get_info) (stream_obj->chnl_obj,
 						  &chnl_info_obj);
-	if (DSP_FAILED(status))
+	if (status)
 		goto func_end;
 
 	if (stream_obj->xlator) {
@@ -540,7 +539,7 @@ int strm_open(struct node_object *hnode, u32 dir, u32 index,
 
 		}
 	}
-	if (DSP_FAILED(status))
+	if (status)
 		goto func_cont;
 
 	if ((pattr->virt_base == NULL) || !(pattr->ul_virt_size > 0))
@@ -572,7 +571,7 @@ func_cont:
 						      strm_mgr_obj->hchnl_mgr,
 						      chnl_mode, ul_chnl_id,
 						      &chnl_attr_obj);
-		if (DSP_FAILED(status)) {
+		if (status) {
 			/*
 			 * over-ride non-returnable status codes so we return
 			 * something documented
@@ -767,7 +766,7 @@ int strm_select(struct strm_object **strm_tab, u32 strms,
 			break;
 		}
 	}
-	if (DSP_FAILED(status))
+	if (status)
 		goto func_end;
 
 	/* Determine which channels have IO ready */
@@ -775,7 +774,7 @@ int strm_select(struct strm_object **strm_tab, u32 strms,
 		intf_fxns = strm_tab[i]->strm_mgr_obj->intf_fxns;
 		status = (*intf_fxns->pfn_chnl_get_info) (strm_tab[i]->chnl_obj,
 							  &chnl_info_obj);
-		if (DSP_FAILED(status)) {
+		if (status) {
 			break;
 		} else {
 			if (chnl_info_obj.cio_cs > 0)
@@ -796,7 +795,7 @@ int strm_select(struct strm_object **strm_tab, u32 strms,
 				    strm_tab[i]->strm_mgr_obj->intf_fxns;
 				status = (*intf_fxns->pfn_chnl_get_info)
 				    (strm_tab[i]->chnl_obj, &chnl_info_obj);
-				if (DSP_FAILED(status))
+				if (status)
 					break;
 				else
 					sync_events[i] =
@@ -820,7 +819,7 @@ func_end:
 	kfree(sync_events);
 
 	DBC_ENSURE((!status && (*pmask != 0 || utimeout == 0)) ||
-		   (DSP_FAILED(status) && *pmask == 0));
+		   (status && *pmask == 0));
 
 	return status;
 }
Signature · 1 line
1.5.4.5
#5 lore raw

PATCH 5/10 staging:ti dspbridge: remove DSP_SUCCEEDED macro definition

In reply to Ernesto Ramos

Since status succeeded is now 0 macro DSP_SUCCEEDED is not necessary anymore. This patch removes this define.

---
 .../staging/tidspbridge/include/dspbridge/dbdefs.h |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
drivers/staging/tidspbridge/include/dspbridge/dbdefs.h +1 -2
index 397e2cb..2ccbfe1 100644
@@ -91,8 +91,7 @@
 #define DSPWORD       unsigned char
 #define DSPWORDSIZE     sizeof(DSPWORD)
 
-/* Success & Failure macros */
-#define DSP_SUCCEEDED(status)      likely((s32)(status) >= 0)
+/* Failure macro */
 #define DSP_FAILED(status)         unlikely((s32)(status) < 0)
 
 /* Power control enumerations */
Signature · 1 line
1.5.4.5
#7 lore raw

PATCH 7/10 staging:ti dspbridge: remove DSP_FAILED macro from pmgr

In reply to Ernesto Ramos

Since status succeeded is 0, DSP_FAILED macro
is not necessary anymore.

---
 drivers/staging/tidspbridge/pmgr/chnl.c   |    2 +-
 drivers/staging/tidspbridge/pmgr/cmm.c    |    2 +-
 drivers/staging/tidspbridge/pmgr/cod.c    |    8 +++---
 drivers/staging/tidspbridge/pmgr/dbll.c   |   12 +++++-----
 drivers/staging/tidspbridge/pmgr/dev.c    |   24 ++++++++++------------
 drivers/staging/tidspbridge/pmgr/dmm.c    |    2 +-
 drivers/staging/tidspbridge/pmgr/dspapi.c |   30 ++++++++++++++--------------
 7 files changed, 39 insertions(+), 41 deletions(-)
drivers/staging/tidspbridge/pmgr/chnl.c +1 -1
index 626a993..90317b5 100644
@@ -100,7 +100,7 @@ int chnl_create(struct chnl_mgr **channel_mgr,
 		}
 	}
 
-	DBC_ENSURE(DSP_FAILED(status) || chnl_mgr_obj);
+	DBC_ENSURE(status || chnl_mgr_obj);
 
 	return status;
 }
drivers/staging/tidspbridge/pmgr/cmm.c +1 -1
index 2f974c5..ce3dc88 100644
@@ -1042,7 +1042,7 @@ int cmm_xlator_free_buf(struct cmm_xlatorobject *xlator, void *buf_va)
 		if (buf_pa) {
 			status = cmm_free_buf(xlator_obj->hcmm_mgr, buf_pa,
 					      xlator_obj->ul_seg_id);
-			if (DSP_FAILED(status)) {
+			if (status) {
 				/* Uh oh, this shouldn't happen. Descriptor
 				 * gone! */
 				DBC_ASSERT(false);	/* CMM is leaking mem */
drivers/staging/tidspbridge/pmgr/cod.c +4 -4
index 9f902de..52989ab 100644
@@ -257,7 +257,7 @@ int cod_create(struct cod_manager **mgr, char *str_zl_file,
 
 	status = mgr_new->fxns.create_fxn(&mgr_new->target, &zl_attrs);
 
-	if (DSP_FAILED(status)) {
+	if (status) {
 		cod_delete(mgr_new);
 		return -ESPIPE;
 	}
@@ -529,7 +529,7 @@ int cod_load_base(struct cod_manager *cod_mgr_obj, u32 num_argc, char *args[],
 	status = cod_mgr_obj->fxns.load_fxn(cod_mgr_obj->base_lib, flags,
 					    &new_attrs,
 					    &cod_mgr_obj->ul_entry);
-	if (DSP_FAILED(status))
+	if (status)
 		cod_mgr_obj->fxns.close_fxn(cod_mgr_obj->base_lib);
 
 	if (!status)
@@ -570,7 +570,7 @@ int cod_open(struct cod_manager *hmgr, char *sz_coff_path,
 			*lib_obj = lib;
 	}
 
-	if (DSP_FAILED(status))
+	if (status)
 		pr_err("%s: error status 0x%x, sz_coff_path: %s flags: 0x%x\n",
 		       __func__, status, sz_coff_path, flags);
 	return status;
@@ -608,7 +608,7 @@ int cod_open_base(struct cod_manager *hmgr, char *sz_coff_path,
 		hmgr->sz_zl_file[COD_MAXPATHLENGTH - 1] = '\0';
 	}
 
-	if (DSP_FAILED(status))
+	if (status)
 		pr_err("%s: error status 0x%x sz_coff_path: %s\n", __func__,
 		       status, sz_coff_path);
 	return status;
drivers/staging/tidspbridge/pmgr/dbll.c +6 -6
index ea27824..2340638 100644
@@ -256,7 +256,7 @@ int dbll_create(struct dbll_tar_obj **target_obj,
 			*target_obj = (struct dbll_tar_obj *)pzl_target;
 		}
 		DBC_ENSURE((!status && *target_obj) ||
-				(DSP_FAILED(status) && *target_obj == NULL));
+				(status && *target_obj == NULL));
 	}
 
 	return status;
@@ -559,7 +559,7 @@ int dbll_load(struct dbll_library_obj *lib, dbll_flags flags,
 	if (opened_doff)
 		dof_close(zl_lib);
 
-	DBC_ENSURE(DSP_FAILED(status) || zl_lib->load_ref > 0);
+	DBC_ENSURE(status || zl_lib->load_ref > 0);
 
 	dev_dbg(bridge, "%s: lib: %p flags: 0x%x entry: %p, status 0x%x\n",
 		__func__, lib, flags, entry, status);
@@ -631,7 +631,7 @@ int dbll_open(struct dbll_tar_obj *target, char *file, dbll_flags flags,
 	/*
 	 *  Set up objects needed by the dynamic loader
 	 */
-	if (DSP_FAILED(status))
+	if (status)
 		goto func_cont;
 
 	/* Stream */
@@ -713,7 +713,7 @@ func_cont:
 
 	}
 	DBC_ENSURE((!status && (zl_lib->open_ref > 0) && *lib_obj)
-				|| (DSP_FAILED(status) && *lib_obj == NULL));
+				|| (status && *lib_obj == NULL));
 
 	dev_dbg(bridge, "%s: target: %p file: %s lib_obj: %p, status 0x%x\n",
 		__func__, target, file, lib_obj, status);
@@ -756,7 +756,7 @@ int dbll_read_sect(struct dbll_library_obj *lib, char *name,
 	} else {
 		status = -EFAULT;
 	}
-	if (DSP_FAILED(status))
+	if (status)
 		goto func_cont;
 
 	byte_size = 1;
@@ -1314,7 +1314,7 @@ func_cont:
 						    (u32 *) &rmm_addr_obj,
 						    seg_id, req, false);
 	}
-	if (DSP_FAILED(status)) {
+	if (status) {
 		ret = false;
 	} else {
 		/* RMM gives word address. Need to convert to byte address */
drivers/staging/tidspbridge/pmgr/dev.c +11 -13
index 8f1e56a..4ddf03d 100644
@@ -150,7 +150,7 @@ int dev_create_device(struct dev_object **device_obj,
 
 	status = drv_request_bridge_res_dsp((void *)&host_res);
 
-	if (DSP_FAILED(status)) {
+	if (status) {
 		dev_dbg(bridge, "%s: Failed to reserve bridge resources\n",
 			__func__);
 		goto leave;
@@ -158,7 +158,7 @@ int dev_create_device(struct dev_object **device_obj,
 
 	/*  Get the Bridge driver interface functions */
 	bridge_drv_entry(&drv_fxns, driver_file_name);
-	if (DSP_FAILED(cfg_get_object((u32 *) &hdrv_obj, REG_DRV_OBJECT))) {
+	if (cfg_get_object((u32 *) &hdrv_obj, REG_DRV_OBJECT)) {
 		/* don't propogate CFG errors from this PROC function */
 		status = -EPERM;
 	}
@@ -189,7 +189,7 @@ int dev_create_device(struct dev_object **device_obj,
 			    (&dev_obj->hbridge_context, dev_obj,
 			     host_res);
 			/* Assert bridge_dev_create()'s ensure clause: */
-			DBC_ASSERT(DSP_FAILED(status)
+			DBC_ASSERT(status
 				   || (dev_obj->hbridge_context != NULL));
 		} else {
 			status = -ENOMEM;
@@ -276,8 +276,7 @@ leave:
 		*device_obj = NULL;
 	}
 
-	DBC_ENSURE((!status && *device_obj) ||
-		   (DSP_FAILED(status) && !*device_obj));
+	DBC_ENSURE((!status && *device_obj) || (status && !*device_obj));
 	return status;
 }
 
@@ -299,11 +298,11 @@ int dev_create2(struct dev_object *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 (DSP_FAILED(status))
+	if (status)
 		dev_obj->hnode_mgr = NULL;
 
 	DBC_ENSURE((!status && dev_obj->hnode_mgr != NULL)
-		   || (DSP_FAILED(status) && dev_obj->hnode_mgr == NULL));
+		   || (status && dev_obj->hnode_mgr == NULL));
 	return status;
 }
 
@@ -321,15 +320,14 @@ int dev_destroy2(struct dev_object *hdev_obj)
 	DBC_REQUIRE(hdev_obj);
 
 	if (dev_obj->hnode_mgr) {
-		if (DSP_FAILED(node_delete_mgr(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) ||
-		   DSP_FAILED(status));
+	DBC_ENSURE((!status && dev_obj->hnode_mgr == NULL) || status);
 	return status;
 }
 
@@ -847,7 +845,7 @@ int dev_set_chnl_mgr(struct dev_object *hdev_obj,
 	else
 		status = -EFAULT;
 
-	DBC_ENSURE(DSP_FAILED(status) || (dev_obj->hchnl_mgr == hmgr));
+	DBC_ENSURE(status || (dev_obj->hchnl_mgr == hmgr));
 	return status;
 }
 
@@ -885,7 +883,7 @@ int dev_start_device(struct cfg_devnode *dev_node_obj)
 	if (!status) {
 		/* Store away the hdev_obj with the DEVNODE */
 		status = cfg_set_dev_object(dev_node_obj, (u32) hdev_obj);
-		if (DSP_FAILED(status)) {
+		if (status) {
 			/* Clean up */
 			dev_destroy_device(hdev_obj);
 			hdev_obj = NULL;
@@ -895,7 +893,7 @@ int dev_start_device(struct cfg_devnode *dev_node_obj)
 		/* Create the Manager Object */
 		status = mgr_create(&hmgr_obj, dev_node_obj);
 	}
-	if (DSP_FAILED(status)) {
+	if (status) {
 		if (hdev_obj)
 			dev_destroy_device(hdev_obj);
 
drivers/staging/tidspbridge/pmgr/dmm.c +1 -1
index ef28748..8685233 100644
@@ -106,7 +106,7 @@ int dmm_create_tables(struct dmm_object *dmm_mgr, u32 addr, u32 size)
 		}
 	}
 
-	if (DSP_FAILED(status))
+	if (status)
 		pr_err("%s: failure, status 0x%x\n", __func__, status);
 
 	return status;
drivers/staging/tidspbridge/pmgr/dspapi.c +15 -15
index 60d7410..1b0ab4a 100644
@@ -170,7 +170,7 @@ static u8 size_cmd[] = {
 static inline void _cp_fm_usr(void *to, const void __user * from,
 			      int *err, unsigned long bytes)
 {
-	if (DSP_FAILED(*err))
+	if (*err)
 		return;
 
 	if (unlikely(!from)) {
@@ -188,7 +188,7 @@ static inline void _cp_fm_usr(void *to, const void __user * from,
 static inline void _cp_to_usr(void __user *to, const void *from,
 			      int *err, unsigned long bytes)
 {
-	if (DSP_FAILED(*err))
+	if (*err)
 		return;
 
 	if (unlikely(!to)) {
@@ -391,10 +391,10 @@ int api_init_complete2(void)
 	 *  requires KFILE. */
 	for (hdev_obj = dev_get_first(); hdev_obj != NULL;
 	     hdev_obj = dev_get_next(hdev_obj)) {
-		if (DSP_FAILED(dev_get_dev_node(hdev_obj, &dev_node)))
+		if (dev_get_dev_node(hdev_obj, &dev_node))
 			continue;
 
-		if (DSP_FAILED(dev_get_dev_type(hdev_obj, &dev_type)))
+		if (dev_get_dev_type(hdev_obj, &dev_type))
 			continue;
 
 		if ((dev_type == DSP_UNIT) || (dev_type == IVA_UNIT))
@@ -486,7 +486,7 @@ u32 mgrwrap_register_object(union trapped_args *args, void *pr_ctxt)
 	int status = 0;
 
 	CP_FM_USR(&uuid_obj, args->args_mgr_registerobject.uuid_obj, status, 1);
-	if (DSP_FAILED(status))
+	if (status)
 		goto func_end;
 	/* path_size is increased by 1 to accommodate NULL */
 	path_size = strlen_user((char *)
@@ -523,7 +523,7 @@ u32 mgrwrap_unregister_object(union trapped_args *args, void *pr_ctxt)
 	struct dsp_uuid uuid_obj;
 
 	CP_FM_USR(&uuid_obj, args->args_mgr_registerobject.uuid_obj, status, 1);
-	if (DSP_FAILED(status))
+	if (status)
 		goto func_end;
 
 	status = dcd_unregister_object(&uuid_obj,
@@ -834,7 +834,7 @@ u32 procwrap_load(union trapped_args *args, void *pr_ctxt)
 	}
 
 	CP_FM_USR(argv, args->args_proc_load.user_args, status, count);
-	if (DSP_FAILED(status)) {
+	if (status) {
 		kfree(argv);
 		argv = NULL;
 		goto func_cont;
@@ -850,7 +850,7 @@ u32 procwrap_load(union trapped_args *args, void *pr_ctxt)
 			argv[i] = kmalloc(len, GFP_KERNEL);
 			if (argv[i]) {
 				CP_FM_USR(argv[i], temp, status, len);
-				if (DSP_FAILED(status)) {
+				if (status) {
 					kfree(argv[i]);
 					argv[i] = NULL;
 					goto func_cont;
@@ -876,7 +876,7 @@ u32 procwrap_load(union trapped_args *args, void *pr_ctxt)
 		}
 
 		CP_FM_USR(envp, args->args_proc_load.user_envp, status, count);
-		if (DSP_FAILED(status)) {
+		if (status) {
 			kfree(envp);
 			envp = NULL;
 			goto func_cont;
@@ -890,7 +890,7 @@ u32 procwrap_load(union trapped_args *args, void *pr_ctxt)
 			envp[i] = kmalloc(len, GFP_KERNEL);
 			if (envp[i]) {
 				CP_FM_USR(envp[i], temp, status, len);
-				if (DSP_FAILED(status)) {
+				if (status) {
 					kfree(envp[i]);
 					envp[i] = NULL;
 					goto func_cont;
@@ -1078,7 +1078,7 @@ u32 nodewrap_allocate(union trapped_args *args, void *pr_ctxt)
 			  cb_data_size);
 	}
 	CP_FM_USR(&node_uuid, args->args_node_allocate.node_id_ptr, status, 1);
-	if (DSP_FAILED(status))
+	if (status)
 		goto func_cont;
 	/* Optional argument */
 	if (args->args_node_allocate.attr_in) {
@@ -1097,7 +1097,7 @@ u32 nodewrap_allocate(union trapped_args *args, void *pr_ctxt)
 	}
 	if (!status) {
 		CP_TO_USR(args->args_node_allocate.ph_node, &hnode, status, 1);
-		if (DSP_FAILED(status)) {
+		if (status) {
 			status = -EFAULT;
 			node_delete(hnode, pr_ctxt);
 		}
@@ -1179,7 +1179,7 @@ u32 nodewrap_connect(union trapped_args *args, void *pr_ctxt)
 		}
 		CP_FM_USR(pargs, args->args_node_connect.conn_param, status,
 			  cb_data_size);
-		if (DSP_FAILED(status))
+		if (status)
 			goto func_cont;
 	}
 	if (args->args_node_connect.pattrs) {	/* Optional argument */
@@ -1378,7 +1378,7 @@ u32 nodewrap_get_uuid_props(union trapped_args *args, void *pr_ctxt)
 
 	CP_FM_USR(&node_uuid, args->args_node_getuuidprops.node_id_ptr, status,
 		  1);
-	if (DSP_FAILED(status))
+	if (status)
 		goto func_cont;
 	pnode_props = kmalloc(sizeof(struct dsp_ndbprops), GFP_KERNEL);
 	if (pnode_props != NULL) {
@@ -1416,7 +1416,7 @@ u32 strmwrap_allocate_buffer(union trapped_args *args, void *pr_ctxt)
 	if (!status) {
 		CP_TO_USR(args->args_strm_allocatebuffer.ap_buffer, ap_buffer,
 			  status, num_bufs);
-		if (DSP_FAILED(status)) {
+		if (status) {
 			status = -EFAULT;
 			strm_free_buffer(args->args_strm_allocatebuffer.hstream,
 					 ap_buffer, num_bufs, pr_ctxt);
Signature · 1 line
1.5.4.5
#2 lore raw

PATCH 2/10 staging:ti dspbridge: remove DSP_SUCCEEDED macro from pmgr

In reply to Ernesto Ramos

Since status succeeded is now 0 macro DSP_SUCCEEDED is not necessary anymore.

---
 drivers/staging/tidspbridge/pmgr/chnl.c   |    8 +-
 drivers/staging/tidspbridge/pmgr/cmm.c    |  135 +++++++++++++----------------
 drivers/staging/tidspbridge/pmgr/cod.c    |   10 +-
 drivers/staging/tidspbridge/pmgr/dbll.c   |   20 ++--
 drivers/staging/tidspbridge/pmgr/dev.c    |   59 ++++++-------
 drivers/staging/tidspbridge/pmgr/dmm.c    |   10 +-
 drivers/staging/tidspbridge/pmgr/dspapi.c |   52 ++++++------
 drivers/staging/tidspbridge/pmgr/io.c     |    4 +-
 drivers/staging/tidspbridge/pmgr/msg.c    |    2 +-
 9 files changed, 139 insertions(+), 161 deletions(-)
drivers/staging/tidspbridge/pmgr/chnl.c +4 -4
index d73c89c..626a993 100644
@@ -77,20 +77,20 @@ int chnl_create(struct chnl_mgr **channel_mgr,
 	if (mgr_attrts->word_size == 0)
 		status = -EINVAL;
 
-	if (DSP_SUCCEEDED(status)) {
+	if (!status) {
 		status = dev_get_chnl_mgr(hdev_obj, &hchnl_mgr);
-		if (DSP_SUCCEEDED(status) && hchnl_mgr != NULL)
+		if (!status && hchnl_mgr != NULL)
 			status = -EEXIST;
 
 	}
 
-	if (DSP_SUCCEEDED(status)) {
+	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 (DSP_SUCCEEDED(status)) {
+		if (!status) {
 			/* Fill in DSP API channel module's fields of the
 			 * chnl_mgr structure */
 			chnl_mgr_obj = (struct chnl_mgr_ *)hchnl_mgr;
drivers/staging/tidspbridge/pmgr/cmm.c +60 -75

198 lines not on this page · raw message

drivers/staging/tidspbridge/pmgr/cod.c +5 -5
index 81102d2..9f902de 100644
@@ -411,7 +411,7 @@ int cod_get_section(struct cod_libraryobj *lib, char *str_sect,
 		status = -ESPIPE;
 	}
 
-	DBC_ENSURE(DSP_SUCCEEDED(status) || ((*addr == 0) && (*len == 0)));
+	DBC_ENSURE(!status || ((*addr == 0) && (*len == 0)));
 
 	return status;
 }
@@ -532,7 +532,7 @@ int cod_load_base(struct cod_manager *cod_mgr_obj, u32 num_argc, char *args[],
 	if (DSP_FAILED(status))
 		cod_mgr_obj->fxns.close_fxn(cod_mgr_obj->base_lib);
 
-	if (DSP_SUCCEEDED(status))
+	if (!status)
 		cod_mgr_obj->loaded = true;
 	else
 		cod_mgr_obj->base_lib = NULL;
@@ -562,11 +562,11 @@ int cod_open(struct cod_manager *hmgr, char *sz_coff_path,
 	if (lib == NULL)
 		status = -ENOMEM;
 
-	if (DSP_SUCCEEDED(status)) {
+	if (!status) {
 		lib->cod_mgr = hmgr;
 		status = hmgr->fxns.open_fxn(hmgr->target, sz_coff_path, flags,
 					     &lib->dbll_lib);
-		if (DSP_SUCCEEDED(status))
+		if (!status)
 			*lib_obj = lib;
 	}
 
@@ -601,7 +601,7 @@ int cod_open_base(struct cod_manager *hmgr, char *sz_coff_path,
 		hmgr->base_lib = NULL;
 	}
 	status = hmgr->fxns.open_fxn(hmgr->target, sz_coff_path, flags, &lib);
-	if (DSP_SUCCEEDED(status)) {
+	if (!status) {
 		/* hang onto the library for subsequent sym table usage */
 		hmgr->base_lib = lib;
 		strncpy(hmgr->sz_zl_file, sz_coff_path, COD_MAXPATHLENGTH - 1);
drivers/staging/tidspbridge/pmgr/dbll.c +10 -10
index d1806aa..ea27824 100644
@@ -255,7 +255,7 @@ int dbll_create(struct dbll_tar_obj **target_obj,
 			pzl_target->attrs = *pattrs;
 			*target_obj = (struct dbll_tar_obj *)pzl_target;
 		}
-		DBC_ENSURE((DSP_SUCCEEDED(status) && *target_obj) ||
+		DBC_ENSURE((!status && *target_obj) ||
 				(DSP_FAILED(status) && *target_obj == NULL));
 	}
 
@@ -393,7 +393,7 @@ int dbll_get_sect(struct dbll_library_obj *lib, char *name, u32 *paddr,
 	if (zl_lib != NULL) {
 		if (zl_lib->fp == NULL) {
 			status = dof_open(zl_lib);
-			if (DSP_SUCCEEDED(status))
+			if (!status)
 				opened_doff = true;
 
 		} else {
@@ -404,7 +404,7 @@ int dbll_get_sect(struct dbll_library_obj *lib, char *name, u32 *paddr,
 	} else {
 		status = -EFAULT;
 	}
-	if (DSP_SUCCEEDED(status)) {
+	if (!status) {
 		byte_size = 1;
 		if (dload_get_section_info(zl_lib->desc, name, &sect)) {
 			*paddr = sect->load_addr;
@@ -517,11 +517,11 @@ int dbll_load(struct dbll_library_obj *lib, dbll_flags flags,
 		/* If COFF file is not open, we open it. */
 		if (zl_lib->fp == NULL) {
 			status = dof_open(zl_lib);
-			if (DSP_SUCCEEDED(status))
+			if (!status)
 				opened_doff = true;
 
 		}
-		if (DSP_SUCCEEDED(status)) {
+		if (!status) {
 			zl_lib->ul_pos = (*(zl_lib->target_obj->attrs.ftell))
 			    (zl_lib->fp);
 			/* Reset file cursor */
@@ -552,7 +552,7 @@ int dbll_load(struct dbll_library_obj *lib, dbll_flags flags,
 			}
 		}
 	}
-	if (DSP_SUCCEEDED(status))
+	if (!status)
 		zl_lib->load_ref++;
 
 	/* Clean up DOFF resources */
@@ -658,7 +658,7 @@ int dbll_open(struct dbll_tar_obj *target, char *file, dbll_flags flags,
 	zl_lib->init.dl_init.execute = execute;
 	zl_lib->init.dl_init.release = release;
 	zl_lib->init.lib = zl_lib;
-	if (DSP_SUCCEEDED(status) && zl_lib->fp == NULL)
+	if (!status && zl_lib->fp == NULL)
 		status = dof_open(zl_lib);
 
 	zl_lib->ul_pos = (*(zl_lib->target_obj->attrs.ftell)) (zl_lib->fp);
@@ -695,7 +695,7 @@ int dbll_open(struct dbll_tar_obj *target, char *file, dbll_flags flags,
 		}
 	}
 func_cont:
-	if (DSP_SUCCEEDED(status)) {
+	if (!status) {
 		if (zl_lib->open_ref == 1) {
 			/* First time opened - insert in list */
 			if (zl_target->head)
@@ -712,7 +712,7 @@ func_cont:
 			dbll_close((struct dbll_library_obj *)zl_lib);
 
 	}
-	DBC_ENSURE((DSP_SUCCEEDED(status) && (zl_lib->open_ref > 0) && *lib_obj)
+	DBC_ENSURE((!status && (zl_lib->open_ref > 0) && *lib_obj)
 				|| (DSP_FAILED(status) && *lib_obj == NULL));
 
 	dev_dbg(bridge, "%s: target: %p file: %s lib_obj: %p, status 0x%x\n",
@@ -745,7 +745,7 @@ int dbll_read_sect(struct dbll_library_obj *lib, char *name,
 	if (zl_lib != NULL) {
 		if (zl_lib->fp == NULL) {
 			status = dof_open(zl_lib);
-			if (DSP_SUCCEEDED(status))
+			if (!status)
 				opened_doff = true;
 
 		} else {
drivers/staging/tidspbridge/pmgr/dev.c +26 -33

202 lines not on this page · raw message

drivers/staging/tidspbridge/pmgr/dmm.c +5 -5
index e53700f..ef28748 100644
@@ -88,7 +88,7 @@ int dmm_create_tables(struct dmm_object *dmm_mgr, u32 addr, u32 size)
 	int status = 0;
 
 	status = dmm_delete_tables(dmm_obj);
-	if (DSP_SUCCEEDED(status)) {
+	if (!status) {
 		dyn_mem_map_beg = addr;
 		table_size = PG_ALIGN_HIGH(size, PG_SIZE4K) / PG_SIZE4K;
 		/*  Create the free list */
@@ -152,7 +152,7 @@ int dmm_destroy(struct dmm_object *dmm_mgr)
 	DBC_REQUIRE(refs > 0);
 	if (dmm_mgr) {
 		status = dmm_delete_tables(dmm_obj);
-		if (DSP_SUCCEEDED(status))
+		if (!status)
 			kfree(dmm_obj);
 	} else
 		status = -EFAULT;
@@ -209,7 +209,7 @@ int dmm_get_handle(void *hprocessor, struct dmm_object **dmm_manager)
 	else
 		hdev_obj = dev_get_first();	/* default */
 
-	if (DSP_SUCCEEDED(status))
+	if (!status)
 		status = dev_get_dmm_mgr(hdev_obj, dmm_manager);
 
 	return status;
@@ -337,7 +337,7 @@ int dmm_un_map_memory(struct dmm_object *dmm_mgr, u32 addr, u32 *psize)
 	if (chunk == NULL)
 		status = -ENOENT;
 
-	if (DSP_SUCCEEDED(status)) {
+	if (!status) {
 		/* Unmap the region */
 		*psize = chunk->mapped_size * PG_SIZE4K;
 		chunk->mapped = false;
@@ -371,7 +371,7 @@ int dmm_un_reserve_memory(struct dmm_object *dmm_mgr, u32 rsv_addr)
 	if (chunk == NULL)
 		status = -ENOENT;
 
-	if (DSP_SUCCEEDED(status)) {
+	if (!status) {
 		/* Free all the mapped pages for this reserved region */
 		i = 0;
 		while (i < chunk->region_size) {
drivers/staging/tidspbridge/pmgr/dspapi.c +26 -26

199 lines not on this page · raw message

drivers/staging/tidspbridge/pmgr/io.c +2 -2
index 2c26f06..7970fe5 100644
@@ -67,14 +67,14 @@ int io_create(struct io_mgr **io_man, struct dev_object *hdev_obj,
 	if (mgr_attrts->word_size == 0)
 		status = -EINVAL;
 
-	if (DSP_SUCCEEDED(status)) {
+	if (!status) {
 		dev_get_intf_fxns(hdev_obj, &intf_fxns);
 
 		/* Let Bridge channel module finish the create: */
 		status = (*intf_fxns->pfn_io_create) (&hio_mgr, hdev_obj,
 						      mgr_attrts);
 
-		if (DSP_SUCCEEDED(status)) {
+		if (!status) {
 			pio_mgr = (struct io_mgr_ *)hio_mgr;
 			pio_mgr->intf_fxns = intf_fxns;
 			pio_mgr->hdev_obj = hdev_obj;
drivers/staging/tidspbridge/pmgr/msg.c +1 -1
index 884f8b5..abd4365 100644
@@ -66,7 +66,7 @@ int msg_create(struct msg_mgr **msg_man,
 	status =
 	    (*intf_fxns->pfn_msg_create) (&hmsg_mgr, hdev_obj, msg_callback);
 
-	if (DSP_SUCCEEDED(status)) {
+	if (!status) {
 		/* Fill in DSP API message module's fields of the msg_mgr
 		 * structure */
 		msg_mgr_obj = (struct msg_mgr_ *)hmsg_mgr;
Signature · 1 line
1.5.4.5
#11 lore raw
In reply to Ernesto Ramos

Hi Ernesto,

Quoted 3 lines · Ernesto Ramos

This series of patches is targetted to remove macros DSP_FAILED and DSP_SUCCEEDED since bridge driver currently uses standard kernel error codes.

These macros were often used to test for success, instead for errors.

This often leads to dspbridge code being highly nested, and hard to read. The excessive indentation sometimes even lead to longer lines, which were broken to meet the 80-chars recommendation, where the real problem is actually the redundant indentation (e.g. check out this patch http://www.mail-archive.com/[email protected]/msg26700.html).

E.g. the following error testing is very common in the bridge code:

do_something1();

if (success) {
    do_something2();
    if (success) {
        do_something3();
        ....
    }
}

The kernel alternative would be to check for errors, and take error paths out of the code flow, e.g.:

do_something1();
if (error)

    leave;

do_something2();
if (error)

    leave;

do_something3();
if (error)

    leave;

This leads to code which is much more easier to read.

If you could hunt some of those highly nested areas and make them test for error instead of success, it can be really great.

Thanks,
Ohad.

Quoted 46 lines

Ernesto Ramos (10):
 staging:ti dspbridge: remove DSP_SUCCEEDED macro from core staging:ti dspbridge: remove DSP_SUCCEEDED macro from pmgr staging:ti dspbridge: remove DSP_SUCCEEDED macro from rmgr staging:ti dspbridge: remove DSP_SUCCEEDED macro from services staging:ti dspbridge: remove DSP_SUCCEEDED macro definition staging:ti dspbridge: remove DSP_FAILED macro from core staging:ti dspbridge: remove DSP_FAILED macro from pmgr staging:ti dspbridge: remove DSP_FAILED macro from rmgr staging:ti dspbridge: remove DSP_FAILED macro from services staging:ti dspbridge: remove DSP_FAILED macro definition

 drivers/staging/tidspbridge/core/chnl_sm.c         |   42 ++-- drivers/staging/tidspbridge/core/dsp-clock.c       |    4 +- drivers/staging/tidspbridge/core/io_sm.c           |  111 +++++----- drivers/staging/tidspbridge/core/msg_sm.c          |   26 ++-- drivers/staging/tidspbridge/core/tiomap3430.c      |   61 +++--- drivers/staging/tidspbridge/core/tiomap3430_pwr.c  |    8 +- drivers/staging/tidspbridge/core/tiomap_io.c       |   41 ++-- .../staging/tidspbridge/include/dspbridge/dbdefs.h |    4 -

 drivers/staging/tidspbridge/pmgr/chnl.c            |   10 +-
 drivers/staging/tidspbridge/pmgr/cmm.c             |  137 ++++++-------
 drivers/staging/tidspbridge/pmgr/cod.c             |   18 +-
 drivers/staging/tidspbridge/pmgr/dbll.c            |   32 ++--
 drivers/staging/tidspbridge/pmgr/dev.c             |   79 +++----
 drivers/staging/tidspbridge/pmgr/dmm.c             |   12 +-

 drivers/staging/tidspbridge/pmgr/dspapi.c          |   82 ++++---- drivers/staging/tidspbridge/pmgr/io.c              |    4 +- drivers/staging/tidspbridge/pmgr/msg.c             |    2 +- drivers/staging/tidspbridge/rmgr/dbdcd.c           |   48 ++-- drivers/staging/tidspbridge/rmgr/disp.c            |   62 +++--- drivers/staging/tidspbridge/rmgr/drv.c             |   39 ++-- drivers/staging/tidspbridge/rmgr/drv_interface.c   |   10 +- drivers/staging/tidspbridge/rmgr/dspdrv.c          |   16 +-

 drivers/staging/tidspbridge/rmgr/mgr.c             |   32 ++--
 drivers/staging/tidspbridge/rmgr/nldr.c            |  106 +++++-----
 drivers/staging/tidspbridge/rmgr/node.c            |  224 ++++++++++----------
 drivers/staging/tidspbridge/rmgr/proc.c            |  137 ++++++------
 drivers/staging/tidspbridge/rmgr/pwr.c             |   26 +--
 drivers/staging/tidspbridge/rmgr/rmm.c             |   12 +-
 drivers/staging/tidspbridge/rmgr/strm.c            |   75 ++++----
 drivers/staging/tidspbridge/services/cfg.c         |   21 +-
 30 files changed, 710 insertions(+), 771 deletions(-)