aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/tidspbridge/core/chnl_sm.c19
-rw-r--r--drivers/staging/tidspbridge/core/tiomap3430.c3
-rw-r--r--drivers/staging/tidspbridge/gen/uuidutil.c4
-rw-r--r--drivers/staging/tidspbridge/include/dspbridge/dbc.h7
-rw-r--r--drivers/staging/tidspbridge/pmgr/chnl.c16
-rw-r--r--drivers/staging/tidspbridge/pmgr/cmm.c59
-rw-r--r--drivers/staging/tidspbridge/pmgr/cod.c71
-rw-r--r--drivers/staging/tidspbridge/pmgr/dbll.c108
-rw-r--r--drivers/staging/tidspbridge/pmgr/dev.c123
-rw-r--r--drivers/staging/tidspbridge/pmgr/dmm.c11
-rw-r--r--drivers/staging/tidspbridge/pmgr/dspapi.c4
-rw-r--r--drivers/staging/tidspbridge/pmgr/io.c14
-rw-r--r--drivers/staging/tidspbridge/pmgr/msg.c14
-rw-r--r--drivers/staging/tidspbridge/rmgr/dbdcd.c80
-rw-r--r--drivers/staging/tidspbridge/rmgr/disp.c38
-rw-r--r--drivers/staging/tidspbridge/rmgr/drv.c38
-rw-r--r--drivers/staging/tidspbridge/rmgr/drv_interface.c1
-rw-r--r--drivers/staging/tidspbridge/rmgr/dspdrv.c2
-rw-r--r--drivers/staging/tidspbridge/rmgr/mgr.c31
-rw-r--r--drivers/staging/tidspbridge/rmgr/nldr.c47
-rw-r--r--drivers/staging/tidspbridge/rmgr/node.c84
-rw-r--r--drivers/staging/tidspbridge/rmgr/proc.c73
-rw-r--r--drivers/staging/tidspbridge/rmgr/rmm.c30
-rw-r--r--drivers/staging/tidspbridge/rmgr/strm.c72
24 files changed, 3 insertions, 946 deletions
diff --git a/drivers/staging/tidspbridge/core/chnl_sm.c b/drivers/staging/tidspbridge/core/chnl_sm.c
index 6d66e7d0fba..91daf25d29a 100644
--- a/drivers/staging/tidspbridge/core/chnl_sm.c
+++ b/drivers/staging/tidspbridge/core/chnl_sm.c
@@ -358,13 +358,6 @@ int bridge_chnl_create(struct chnl_mgr **channel_mgr,
358 struct chnl_mgr *chnl_mgr_obj = NULL; 358 struct chnl_mgr *chnl_mgr_obj = NULL;
359 u8 max_channels; 359 u8 max_channels;
360 360
361 /* Check DBC requirements: */
362 DBC_REQUIRE(channel_mgr != NULL);
363 DBC_REQUIRE(mgr_attrts != NULL);
364 DBC_REQUIRE(mgr_attrts->max_channels > 0);
365 DBC_REQUIRE(mgr_attrts->max_channels <= CHNL_MAXCHANNELS);
366 DBC_REQUIRE(mgr_attrts->word_size != 0);
367
368 /* Allocate channel manager object */ 361 /* Allocate channel manager object */
369 chnl_mgr_obj = kzalloc(sizeof(struct chnl_mgr), GFP_KERNEL); 362 chnl_mgr_obj = kzalloc(sizeof(struct chnl_mgr), GFP_KERNEL);
370 if (chnl_mgr_obj) { 363 if (chnl_mgr_obj) {
@@ -491,7 +484,6 @@ int bridge_chnl_flush_io(struct chnl_object *chnl_obj, u32 timeout)
491 pchnl->state &= ~CHNL_STATECANCEL; 484 pchnl->state &= ~CHNL_STATECANCEL;
492 } 485 }
493 } 486 }
494 DBC_ENSURE(status || list_empty(&pchnl->io_requests));
495 return status; 487 return status;
496} 488}
497 489
@@ -705,8 +697,6 @@ int bridge_chnl_idle(struct chnl_object *chnl_obj, u32 timeout,
705 struct chnl_mgr *chnl_mgr_obj; 697 struct chnl_mgr *chnl_mgr_obj;
706 int status = 0; 698 int status = 0;
707 699
708 DBC_REQUIRE(chnl_obj);
709
710 chnl_mode = chnl_obj->chnl_mode; 700 chnl_mode = chnl_obj->chnl_mode;
711 chnl_mgr_obj = chnl_obj->chnl_mgr_obj; 701 chnl_mgr_obj = chnl_obj->chnl_mgr_obj;
712 702
@@ -736,10 +726,7 @@ int bridge_chnl_open(struct chnl_object **chnl,
736 struct chnl_mgr *chnl_mgr_obj = hchnl_mgr; 726 struct chnl_mgr *chnl_mgr_obj = hchnl_mgr;
737 struct chnl_object *pchnl = NULL; 727 struct chnl_object *pchnl = NULL;
738 struct sync_object *sync_event = NULL; 728 struct sync_object *sync_event = NULL;
739 /* Ensure DBC requirements: */ 729
740 DBC_REQUIRE(chnl != NULL);
741 DBC_REQUIRE(pattrs != NULL);
742 DBC_REQUIRE(hchnl_mgr != NULL);
743 *chnl = NULL; 730 *chnl = NULL;
744 731
745 /* Validate Args: */ 732 /* Validate Args: */
@@ -906,8 +893,6 @@ static void free_chirp_list(struct list_head *chirp_list)
906{ 893{
907 struct chnl_irp *chirp, *tmp; 894 struct chnl_irp *chirp, *tmp;
908 895
909 DBC_REQUIRE(chirp_list != NULL);
910
911 list_for_each_entry_safe(chirp, tmp, chirp_list, link) { 896 list_for_each_entry_safe(chirp, tmp, chirp_list, link) {
912 list_del(&chirp->link); 897 list_del(&chirp->link);
913 kfree(chirp); 898 kfree(chirp);
@@ -924,8 +909,6 @@ static int search_free_channel(struct chnl_mgr *chnl_mgr_obj,
924 int status = -ENOSR; 909 int status = -ENOSR;
925 u32 i; 910 u32 i;
926 911
927 DBC_REQUIRE(chnl_mgr_obj);
928
929 for (i = 0; i < chnl_mgr_obj->max_channels; i++) { 912 for (i = 0; i < chnl_mgr_obj->max_channels; i++) {
930 if (chnl_mgr_obj->channels[i] == NULL) { 913 if (chnl_mgr_obj->channels[i] == NULL) {
931 status = 0; 914 status = 0;
diff --git a/drivers/staging/tidspbridge/core/tiomap3430.c b/drivers/staging/tidspbridge/core/tiomap3430.c
index e1c4492a710..212cbc9414d 100644
--- a/drivers/staging/tidspbridge/core/tiomap3430.c
+++ b/drivers/staging/tidspbridge/core/tiomap3430.c
@@ -256,9 +256,6 @@ static void bad_page_dump(u32 pa, struct page *pg)
256void bridge_drv_entry(struct bridge_drv_interface **drv_intf, 256void bridge_drv_entry(struct bridge_drv_interface **drv_intf,
257 const char *driver_file_name) 257 const char *driver_file_name)
258{ 258{
259
260 DBC_REQUIRE(driver_file_name != NULL);
261
262 if (strcmp(driver_file_name, "UMA") == 0) 259 if (strcmp(driver_file_name, "UMA") == 0)
263 *drv_intf = &drv_interface_fxns; 260 *drv_intf = &drv_interface_fxns;
264 else 261 else
diff --git a/drivers/staging/tidspbridge/gen/uuidutil.c b/drivers/staging/tidspbridge/gen/uuidutil.c
index ff6ebadf98f..5797fb5c306 100644
--- a/drivers/staging/tidspbridge/gen/uuidutil.c
+++ b/drivers/staging/tidspbridge/gen/uuidutil.c
@@ -41,8 +41,6 @@ void uuid_uuid_to_string(struct dsp_uuid *uuid_obj, char *sz_uuid,
41{ 41{
42 s32 i; /* return result from snprintf. */ 42 s32 i; /* return result from snprintf. */
43 43
44 DBC_REQUIRE(uuid_obj && sz_uuid);
45
46 i = snprintf(sz_uuid, size, 44 i = snprintf(sz_uuid, size,
47 "%.8X_%.4X_%.4X_%.2X%.2X_%.2X%.2X%.2X%.2X%.2X%.2X", 45 "%.8X_%.4X_%.4X_%.2X%.2X_%.2X%.2X%.2X%.2X%.2X%.2X",
48 uuid_obj->data1, uuid_obj->data2, uuid_obj->data3, 46 uuid_obj->data1, uuid_obj->data2, uuid_obj->data3,
@@ -50,8 +48,6 @@ void uuid_uuid_to_string(struct dsp_uuid *uuid_obj, char *sz_uuid,
50 uuid_obj->data6[0], uuid_obj->data6[1], 48 uuid_obj->data6[0], uuid_obj->data6[1],
51 uuid_obj->data6[2], uuid_obj->data6[3], 49 uuid_obj->data6[2], uuid_obj->data6[3],
52 uuid_obj->data6[4], uuid_obj->data6[5]); 50 uuid_obj->data6[4], uuid_obj->data6[5]);
53
54 DBC_ENSURE(i != -1);
55} 51}
56 52
57static s32 uuid_hex_to_bin(char *buf, s32 len) 53static s32 uuid_hex_to_bin(char *buf, s32 len)
diff --git a/drivers/staging/tidspbridge/include/dspbridge/dbc.h b/drivers/staging/tidspbridge/include/dspbridge/dbc.h
index 463760f499a..dc88f34f166 100644
--- a/drivers/staging/tidspbridge/include/dspbridge/dbc.h
+++ b/drivers/staging/tidspbridge/include/dspbridge/dbc.h
@@ -32,15 +32,8 @@
32 if (!(exp)) \ 32 if (!(exp)) \
33 pr_err("%s, line %d: Assertion (" #exp ") failed.\n", \ 33 pr_err("%s, line %d: Assertion (" #exp ") failed.\n", \
34 __FILE__, __LINE__) 34 __FILE__, __LINE__)
35#define DBC_REQUIRE DBC_ASSERT /* Function Precondition. */
36#define DBC_ENSURE DBC_ASSERT /* Function Postcondition. */
37
38#else 35#else
39
40#define DBC_ASSERT(exp) {} 36#define DBC_ASSERT(exp) {}
41#define DBC_REQUIRE(exp) {}
42#define DBC_ENSURE(exp) {}
43
44#endif /* DEBUG */ 37#endif /* DEBUG */
45 38
46#endif /* DBC_ */ 39#endif /* DBC_ */
diff --git a/drivers/staging/tidspbridge/pmgr/chnl.c b/drivers/staging/tidspbridge/pmgr/chnl.c
index 245de82e2d6..61ee0f0e511 100644
--- a/drivers/staging/tidspbridge/pmgr/chnl.c
+++ b/drivers/staging/tidspbridge/pmgr/chnl.c
@@ -58,10 +58,6 @@ int chnl_create(struct chnl_mgr **channel_mgr,
58 struct chnl_mgr *hchnl_mgr; 58 struct chnl_mgr *hchnl_mgr;
59 struct chnl_mgr_ *chnl_mgr_obj = NULL; 59 struct chnl_mgr_ *chnl_mgr_obj = NULL;
60 60
61 DBC_REQUIRE(refs > 0);
62 DBC_REQUIRE(channel_mgr != NULL);
63 DBC_REQUIRE(mgr_attrts != NULL);
64
65 *channel_mgr = NULL; 61 *channel_mgr = NULL;
66 62
67 /* Validate args: */ 63 /* Validate args: */
@@ -99,8 +95,6 @@ int chnl_create(struct chnl_mgr **channel_mgr,
99 } 95 }
100 } 96 }
101 97
102 DBC_ENSURE(status || chnl_mgr_obj);
103
104 return status; 98 return status;
105} 99}
106 100
@@ -115,8 +109,6 @@ int chnl_destroy(struct chnl_mgr *hchnl_mgr)
115 struct bridge_drv_interface *intf_fxns; 109 struct bridge_drv_interface *intf_fxns;
116 int status; 110 int status;
117 111
118 DBC_REQUIRE(refs > 0);
119
120 if (chnl_mgr_obj) { 112 if (chnl_mgr_obj) {
121 intf_fxns = chnl_mgr_obj->intf_fxns; 113 intf_fxns = chnl_mgr_obj->intf_fxns;
122 /* Let Bridge channel module destroy the chnl_mgr: */ 114 /* Let Bridge channel module destroy the chnl_mgr: */
@@ -135,11 +127,7 @@ int chnl_destroy(struct chnl_mgr *hchnl_mgr)
135 */ 127 */
136void chnl_exit(void) 128void chnl_exit(void)
137{ 129{
138 DBC_REQUIRE(refs > 0);
139
140 refs--; 130 refs--;
141
142 DBC_ENSURE(refs >= 0);
143} 131}
144 132
145/* 133/*
@@ -151,12 +139,8 @@ bool chnl_init(void)
151{ 139{
152 bool ret = true; 140 bool ret = true;
153 141
154 DBC_REQUIRE(refs >= 0);
155
156 if (ret) 142 if (ret)
157 refs++; 143 refs++;
158 144
159 DBC_ENSURE((ret && (refs > 0)) || (!ret && (refs >= 0)));
160
161 return ret; 145 return ret;
162} 146}
diff --git a/drivers/staging/tidspbridge/pmgr/cmm.c b/drivers/staging/tidspbridge/pmgr/cmm.c
index e6b2c8962f8..2eeb5370927 100644
--- a/drivers/staging/tidspbridge/pmgr/cmm.c
+++ b/drivers/staging/tidspbridge/pmgr/cmm.c
@@ -244,9 +244,6 @@ int cmm_create(struct cmm_object **ph_cmm_mgr,
244 struct cmm_object *cmm_obj = NULL; 244 struct cmm_object *cmm_obj = NULL;
245 int status = 0; 245 int status = 0;
246 246
247 DBC_REQUIRE(refs > 0);
248 DBC_REQUIRE(ph_cmm_mgr != NULL);
249
250 *ph_cmm_mgr = NULL; 247 *ph_cmm_mgr = NULL;
251 /* create, zero, and tag a cmm mgr object */ 248 /* create, zero, and tag a cmm mgr object */
252 cmm_obj = kzalloc(sizeof(struct cmm_object), GFP_KERNEL); 249 cmm_obj = kzalloc(sizeof(struct cmm_object), GFP_KERNEL);
@@ -283,7 +280,6 @@ int cmm_destroy(struct cmm_object *hcmm_mgr, bool force)
283 s32 slot_seg; 280 s32 slot_seg;
284 struct cmm_mnode *node, *tmp; 281 struct cmm_mnode *node, *tmp;
285 282
286 DBC_REQUIRE(refs > 0);
287 if (!hcmm_mgr) { 283 if (!hcmm_mgr) {
288 status = -EFAULT; 284 status = -EFAULT;
289 return status; 285 return status;
@@ -333,8 +329,6 @@ int cmm_destroy(struct cmm_object *hcmm_mgr, bool force)
333 */ 329 */
334void cmm_exit(void) 330void cmm_exit(void)
335{ 331{
336 DBC_REQUIRE(refs > 0);
337
338 refs--; 332 refs--;
339} 333}
340 334
@@ -351,9 +345,6 @@ int cmm_free_buf(struct cmm_object *hcmm_mgr, void *buf_pa, u32 ul_seg_id)
351 struct cmm_allocator *allocator; 345 struct cmm_allocator *allocator;
352 struct cmm_attrs *pattrs; 346 struct cmm_attrs *pattrs;
353 347
354 DBC_REQUIRE(refs > 0);
355 DBC_REQUIRE(buf_pa != NULL);
356
357 if (ul_seg_id == 0) { 348 if (ul_seg_id == 0) {
358 pattrs = &cmm_dfltalctattrs; 349 pattrs = &cmm_dfltalctattrs;
359 ul_seg_id = pattrs->seg_id; 350 ul_seg_id = pattrs->seg_id;
@@ -392,8 +383,6 @@ int cmm_get_handle(void *hprocessor, struct cmm_object ** ph_cmm_mgr)
392 int status = 0; 383 int status = 0;
393 struct dev_object *hdev_obj; 384 struct dev_object *hdev_obj;
394 385
395 DBC_REQUIRE(refs > 0);
396 DBC_REQUIRE(ph_cmm_mgr != NULL);
397 if (hprocessor != NULL) 386 if (hprocessor != NULL)
398 status = proc_get_dev_object(hprocessor, &hdev_obj); 387 status = proc_get_dev_object(hprocessor, &hdev_obj);
399 else 388 else
@@ -419,8 +408,6 @@ int cmm_get_info(struct cmm_object *hcmm_mgr,
419 struct cmm_allocator *altr; 408 struct cmm_allocator *altr;
420 struct cmm_mnode *curr; 409 struct cmm_mnode *curr;
421 410
422 DBC_REQUIRE(cmm_info_obj != NULL);
423
424 if (!hcmm_mgr) { 411 if (!hcmm_mgr) {
425 status = -EFAULT; 412 status = -EFAULT;
426 return status; 413 return status;
@@ -472,12 +459,9 @@ bool cmm_init(void)
472{ 459{
473 bool ret = true; 460 bool ret = true;
474 461
475 DBC_REQUIRE(refs >= 0);
476 if (ret) 462 if (ret)
477 refs++; 463 refs++;
478 464
479 DBC_ENSURE((ret && (refs > 0)) || (!ret && (refs >= 0)));
480
481 return ret; 465 return ret;
482} 466}
483 467
@@ -499,13 +483,6 @@ int cmm_register_gppsm_seg(struct cmm_object *hcmm_mgr,
499 struct cmm_mnode *new_node; 483 struct cmm_mnode *new_node;
500 s32 slot_seg; 484 s32 slot_seg;
501 485
502 DBC_REQUIRE(ul_size > 0);
503 DBC_REQUIRE(sgmt_id != NULL);
504 DBC_REQUIRE(dw_gpp_base_pa != 0);
505 DBC_REQUIRE(gpp_base_va != 0);
506 DBC_REQUIRE((c_factor <= CMM_ADDTODSPPA) &&
507 (c_factor >= CMM_SUBFROMDSPPA));
508
509 dev_dbg(bridge, "%s: dw_gpp_base_pa %x ul_size %x dsp_addr_offset %x " 486 dev_dbg(bridge, "%s: dw_gpp_base_pa %x ul_size %x dsp_addr_offset %x "
510 "dw_dsp_base %x ul_dsp_size %x gpp_base_va %x\n", 487 "dw_dsp_base %x ul_dsp_size %x gpp_base_va %x\n",
511 __func__, dw_gpp_base_pa, ul_size, dsp_addr_offset, 488 __func__, dw_gpp_base_pa, ul_size, dsp_addr_offset,
@@ -589,7 +566,6 @@ int cmm_un_register_gppsm_seg(struct cmm_object *hcmm_mgr,
589 struct cmm_allocator *psma; 566 struct cmm_allocator *psma;
590 u32 ul_id = ul_seg_id; 567 u32 ul_id = ul_seg_id;
591 568
592 DBC_REQUIRE(ul_seg_id > 0);
593 if (!hcmm_mgr) 569 if (!hcmm_mgr)
594 return -EFAULT; 570 return -EFAULT;
595 571
@@ -635,8 +611,6 @@ static void un_register_gppsm_seg(struct cmm_allocator *psma)
635{ 611{
636 struct cmm_mnode *curr, *tmp; 612 struct cmm_mnode *curr, *tmp;
637 613
638 DBC_REQUIRE(psma != NULL);
639
640 /* free nodes on free list */ 614 /* free nodes on free list */
641 list_for_each_entry_safe(curr, tmp, &psma->free_list, link) { 615 list_for_each_entry_safe(curr, tmp, &psma->free_list, link) {
642 list_del(&curr->link); 616 list_del(&curr->link);
@@ -664,7 +638,6 @@ static void un_register_gppsm_seg(struct cmm_allocator *psma)
664static s32 get_slot(struct cmm_object *cmm_mgr_obj) 638static s32 get_slot(struct cmm_object *cmm_mgr_obj)
665{ 639{
666 s32 slot_seg = -1; /* neg on failure */ 640 s32 slot_seg = -1; /* neg on failure */
667 DBC_REQUIRE(cmm_mgr_obj != NULL);
668 /* get first available slot in cmm mgr SMSegTab[] */ 641 /* get first available slot in cmm mgr SMSegTab[] */
669 for (slot_seg = 0; slot_seg < CMM_MAXGPPSEGS; slot_seg++) { 642 for (slot_seg = 0; slot_seg < CMM_MAXGPPSEGS; slot_seg++) {
670 if (cmm_mgr_obj->pa_gppsm_seg_tab[slot_seg] == NULL) 643 if (cmm_mgr_obj->pa_gppsm_seg_tab[slot_seg] == NULL)
@@ -687,11 +660,6 @@ static struct cmm_mnode *get_node(struct cmm_object *cmm_mgr_obj, u32 dw_pa,
687{ 660{
688 struct cmm_mnode *pnode; 661 struct cmm_mnode *pnode;
689 662
690 DBC_REQUIRE(cmm_mgr_obj != NULL);
691 DBC_REQUIRE(dw_pa != 0);
692 DBC_REQUIRE(dw_va != 0);
693 DBC_REQUIRE(ul_size != 0);
694
695 /* Check cmm mgr's node freelist */ 663 /* Check cmm mgr's node freelist */
696 if (list_empty(&cmm_mgr_obj->node_free_list)) { 664 if (list_empty(&cmm_mgr_obj->node_free_list)) {
697 pnode = kzalloc(sizeof(struct cmm_mnode), GFP_KERNEL); 665 pnode = kzalloc(sizeof(struct cmm_mnode), GFP_KERNEL);
@@ -719,7 +687,6 @@ static struct cmm_mnode *get_node(struct cmm_object *cmm_mgr_obj, u32 dw_pa,
719 */ 687 */
720static void delete_node(struct cmm_object *cmm_mgr_obj, struct cmm_mnode *pnode) 688static void delete_node(struct cmm_object *cmm_mgr_obj, struct cmm_mnode *pnode)
721{ 689{
722 DBC_REQUIRE(pnode != NULL);
723 list_add_tail(&pnode->link, &cmm_mgr_obj->node_free_list); 690 list_add_tail(&pnode->link, &cmm_mgr_obj->node_free_list);
724} 691}
725 692
@@ -794,9 +761,6 @@ static void add_to_free_list(struct cmm_allocator *allocator,
794static struct cmm_allocator *get_allocator(struct cmm_object *cmm_mgr_obj, 761static struct cmm_allocator *get_allocator(struct cmm_object *cmm_mgr_obj,
795 u32 ul_seg_id) 762 u32 ul_seg_id)
796{ 763{
797 DBC_REQUIRE(cmm_mgr_obj != NULL);
798 DBC_REQUIRE((ul_seg_id > 0) && (ul_seg_id <= CMM_MAXGPPSEGS));
799
800 return cmm_mgr_obj->pa_gppsm_seg_tab[ul_seg_id - 1]; 764 return cmm_mgr_obj->pa_gppsm_seg_tab[ul_seg_id - 1];
801} 765}
802 766
@@ -818,10 +782,6 @@ int cmm_xlator_create(struct cmm_xlatorobject **xlator,
818 struct cmm_xlator *xlator_object = NULL; 782 struct cmm_xlator *xlator_object = NULL;
819 int status = 0; 783 int status = 0;
820 784
821 DBC_REQUIRE(refs > 0);
822 DBC_REQUIRE(xlator != NULL);
823 DBC_REQUIRE(hcmm_mgr != NULL);
824
825 *xlator = NULL; 785 *xlator = NULL;
826 if (xlator_attrs == NULL) 786 if (xlator_attrs == NULL)
827 xlator_attrs = &cmm_dfltxlatorattrs; /* set defaults */ 787 xlator_attrs = &cmm_dfltxlatorattrs; /* set defaults */
@@ -851,13 +811,6 @@ void *cmm_xlator_alloc_buf(struct cmm_xlatorobject *xlator, void *va_buf,
851 void *tmp_va_buff; 811 void *tmp_va_buff;
852 struct cmm_attrs attrs; 812 struct cmm_attrs attrs;
853 813
854 DBC_REQUIRE(refs > 0);
855 DBC_REQUIRE(xlator != NULL);
856 DBC_REQUIRE(xlator_obj->cmm_mgr != NULL);
857 DBC_REQUIRE(va_buf != NULL);
858 DBC_REQUIRE(pa_size > 0);
859 DBC_REQUIRE(xlator_obj->seg_id > 0);
860
861 if (xlator_obj) { 814 if (xlator_obj) {
862 attrs.seg_id = xlator_obj->seg_id; 815 attrs.seg_id = xlator_obj->seg_id;
863 __raw_writel(0, va_buf); 816 __raw_writel(0, va_buf);
@@ -887,10 +840,6 @@ int cmm_xlator_free_buf(struct cmm_xlatorobject *xlator, void *buf_va)
887 int status = -EPERM; 840 int status = -EPERM;
888 void *buf_pa = NULL; 841 void *buf_pa = NULL;
889 842
890 DBC_REQUIRE(refs > 0);
891 DBC_REQUIRE(buf_va != NULL);
892 DBC_REQUIRE(xlator_obj->seg_id > 0);
893
894 if (xlator_obj) { 843 if (xlator_obj) {
895 /* convert Va to Pa so we can free it. */ 844 /* convert Va to Pa so we can free it. */
896 buf_pa = cmm_xlator_translate(xlator, buf_va, CMM_VA2PA); 845 buf_pa = cmm_xlator_translate(xlator, buf_va, CMM_VA2PA);
@@ -918,10 +867,6 @@ int cmm_xlator_info(struct cmm_xlatorobject *xlator, u8 ** paddr,
918 struct cmm_xlator *xlator_obj = (struct cmm_xlator *)xlator; 867 struct cmm_xlator *xlator_obj = (struct cmm_xlator *)xlator;
919 int status = 0; 868 int status = 0;
920 869
921 DBC_REQUIRE(refs > 0);
922 DBC_REQUIRE(paddr != NULL);
923 DBC_REQUIRE((segm_id > 0) && (segm_id <= CMM_MAXGPPSEGS));
924
925 if (xlator_obj) { 870 if (xlator_obj) {
926 if (set_info) { 871 if (set_info) {
927 /* set translators virtual address range */ 872 /* set translators virtual address range */
@@ -948,10 +893,6 @@ void *cmm_xlator_translate(struct cmm_xlatorobject *xlator, void *paddr,
948 struct cmm_allocator *allocator = NULL; 893 struct cmm_allocator *allocator = NULL;
949 u32 dw_offset = 0; 894 u32 dw_offset = 0;
950 895
951 DBC_REQUIRE(refs > 0);
952 DBC_REQUIRE(paddr != NULL);
953 DBC_REQUIRE((xtype >= CMM_VA2PA) && (xtype <= CMM_DSPPA2PA));
954
955 if (!xlator_obj) 896 if (!xlator_obj)
956 goto loop_cont; 897 goto loop_cont;
957 898
diff --git a/drivers/staging/tidspbridge/pmgr/cod.c b/drivers/staging/tidspbridge/pmgr/cod.c
index 1a29264b585..be7c7772521 100644
--- a/drivers/staging/tidspbridge/pmgr/cod.c
+++ b/drivers/staging/tidspbridge/pmgr/cod.c
@@ -183,10 +183,6 @@ void cod_close(struct cod_libraryobj *lib)
183{ 183{
184 struct cod_manager *hmgr; 184 struct cod_manager *hmgr;
185 185
186 DBC_REQUIRE(refs > 0);
187 DBC_REQUIRE(lib != NULL);
188 DBC_REQUIRE(lib->cod_mgr);
189
190 hmgr = lib->cod_mgr; 186 hmgr = lib->cod_mgr;
191 hmgr->fxns.close_fxn(lib->dbll_lib); 187 hmgr->fxns.close_fxn(lib->dbll_lib);
192 188
@@ -208,9 +204,6 @@ int cod_create(struct cod_manager **mgr, char *str_zl_file)
208 struct dbll_attrs zl_attrs; 204 struct dbll_attrs zl_attrs;
209 int status = 0; 205 int status = 0;
210 206
211 DBC_REQUIRE(refs > 0);
212 DBC_REQUIRE(mgr != NULL);
213
214 /* assume failure */ 207 /* assume failure */
215 *mgr = NULL; 208 *mgr = NULL;
216 209
@@ -263,9 +256,6 @@ int cod_create(struct cod_manager **mgr, char *str_zl_file)
263 */ 256 */
264void cod_delete(struct cod_manager *cod_mgr_obj) 257void cod_delete(struct cod_manager *cod_mgr_obj)
265{ 258{
266 DBC_REQUIRE(refs > 0);
267 DBC_REQUIRE(cod_mgr_obj);
268
269 if (cod_mgr_obj->base_lib) { 259 if (cod_mgr_obj->base_lib) {
270 if (cod_mgr_obj->loaded) 260 if (cod_mgr_obj->loaded)
271 cod_mgr_obj->fxns.unload_fxn(cod_mgr_obj->base_lib, 261 cod_mgr_obj->fxns.unload_fxn(cod_mgr_obj->base_lib,
@@ -288,11 +278,7 @@ void cod_delete(struct cod_manager *cod_mgr_obj)
288 */ 278 */
289void cod_exit(void) 279void cod_exit(void)
290{ 280{
291 DBC_REQUIRE(refs > 0);
292
293 refs--; 281 refs--;
294
295 DBC_ENSURE(refs >= 0);
296} 282}
297 283
298/* 284/*
@@ -305,10 +291,6 @@ int cod_get_base_lib(struct cod_manager *cod_mgr_obj,
305{ 291{
306 int status = 0; 292 int status = 0;
307 293
308 DBC_REQUIRE(refs > 0);
309 DBC_REQUIRE(cod_mgr_obj);
310 DBC_REQUIRE(plib != NULL);
311
312 *plib = (struct dbll_library_obj *)cod_mgr_obj->base_lib; 294 *plib = (struct dbll_library_obj *)cod_mgr_obj->base_lib;
313 295
314 return status; 296 return status;
@@ -322,10 +304,6 @@ int cod_get_base_name(struct cod_manager *cod_mgr_obj, char *sz_name,
322{ 304{
323 int status = 0; 305 int status = 0;
324 306
325 DBC_REQUIRE(refs > 0);
326 DBC_REQUIRE(cod_mgr_obj);
327 DBC_REQUIRE(sz_name != NULL);
328
329 if (usize <= COD_MAXPATHLENGTH) 307 if (usize <= COD_MAXPATHLENGTH)
330 strncpy(sz_name, cod_mgr_obj->sz_zl_file, usize); 308 strncpy(sz_name, cod_mgr_obj->sz_zl_file, usize);
331 else 309 else
@@ -342,10 +320,6 @@ int cod_get_base_name(struct cod_manager *cod_mgr_obj, char *sz_name,
342 */ 320 */
343int cod_get_entry(struct cod_manager *cod_mgr_obj, u32 *entry_pt) 321int cod_get_entry(struct cod_manager *cod_mgr_obj, u32 *entry_pt)
344{ 322{
345 DBC_REQUIRE(refs > 0);
346 DBC_REQUIRE(cod_mgr_obj);
347 DBC_REQUIRE(entry_pt != NULL);
348
349 *entry_pt = cod_mgr_obj->entry; 323 *entry_pt = cod_mgr_obj->entry;
350 324
351 return 0; 325 return 0;
@@ -361,10 +335,6 @@ int cod_get_loader(struct cod_manager *cod_mgr_obj,
361{ 335{
362 int status = 0; 336 int status = 0;
363 337
364 DBC_REQUIRE(refs > 0);
365 DBC_REQUIRE(cod_mgr_obj);
366 DBC_REQUIRE(loader != NULL);
367
368 *loader = (struct dbll_tar_obj *)cod_mgr_obj->target; 338 *loader = (struct dbll_tar_obj *)cod_mgr_obj->target;
369 339
370 return status; 340 return status;
@@ -382,13 +352,6 @@ int cod_get_section(struct cod_libraryobj *lib, char *str_sect,
382 struct cod_manager *cod_mgr_obj; 352 struct cod_manager *cod_mgr_obj;
383 int status = 0; 353 int status = 0;
384 354
385 DBC_REQUIRE(refs > 0);
386 DBC_REQUIRE(lib != NULL);
387 DBC_REQUIRE(lib->cod_mgr);
388 DBC_REQUIRE(str_sect != NULL);
389 DBC_REQUIRE(addr != NULL);
390 DBC_REQUIRE(len != NULL);
391
392 *addr = 0; 355 *addr = 0;
393 *len = 0; 356 *len = 0;
394 if (lib != NULL) { 357 if (lib != NULL) {
@@ -399,8 +362,6 @@ int cod_get_section(struct cod_libraryobj *lib, char *str_sect,
399 status = -ESPIPE; 362 status = -ESPIPE;
400 } 363 }
401 364
402 DBC_ENSURE(!status || ((*addr == 0) && (*len == 0)));
403
404 return status; 365 return status;
405} 366}
406 367
@@ -417,11 +378,6 @@ int cod_get_sym_value(struct cod_manager *cod_mgr_obj, char *str_sym,
417{ 378{
418 struct dbll_sym_val *dbll_sym; 379 struct dbll_sym_val *dbll_sym;
419 380
420 DBC_REQUIRE(refs > 0);
421 DBC_REQUIRE(cod_mgr_obj);
422 DBC_REQUIRE(str_sym != NULL);
423 DBC_REQUIRE(pul_value != NULL);
424
425 dev_dbg(bridge, "%s: cod_mgr_obj: %p str_sym: %s pul_value: %p\n", 381 dev_dbg(bridge, "%s: cod_mgr_obj: %p str_sym: %s pul_value: %p\n",
426 __func__, cod_mgr_obj, str_sym, pul_value); 382 __func__, cod_mgr_obj, str_sym, pul_value);
427 if (cod_mgr_obj->base_lib) { 383 if (cod_mgr_obj->base_lib) {
@@ -451,12 +407,9 @@ bool cod_init(void)
451{ 407{
452 bool ret = true; 408 bool ret = true;
453 409
454 DBC_REQUIRE(refs >= 0);
455
456 if (ret) 410 if (ret)
457 refs++; 411 refs++;
458 412
459 DBC_ENSURE((ret && refs > 0) || (!ret && refs >= 0));
460 return ret; 413 return ret;
461} 414}
462 415
@@ -482,14 +435,6 @@ int cod_load_base(struct cod_manager *cod_mgr_obj, u32 num_argc, char *args[],
482 int status; 435 int status;
483 u32 i; 436 u32 i;
484 437
485 DBC_REQUIRE(refs > 0);
486 DBC_REQUIRE(cod_mgr_obj);
487 DBC_REQUIRE(num_argc > 0);
488 DBC_REQUIRE(args != NULL);
489 DBC_REQUIRE(args[0] != NULL);
490 DBC_REQUIRE(pfn_write != NULL);
491 DBC_REQUIRE(cod_mgr_obj->base_lib != NULL);
492
493 /* 438 /*
494 * Make sure every argv[] stated in argc has a value, or change argc to 439 * Make sure every argv[] stated in argc has a value, or change argc to
495 * reflect true number in NULL terminated argv array. 440 * reflect true number in NULL terminated argv array.
@@ -538,12 +483,6 @@ int cod_open(struct cod_manager *hmgr, char *sz_coff_path,
538 int status = 0; 483 int status = 0;
539 struct cod_libraryobj *lib = NULL; 484 struct cod_libraryobj *lib = NULL;
540 485
541 DBC_REQUIRE(refs > 0);
542 DBC_REQUIRE(hmgr);
543 DBC_REQUIRE(sz_coff_path != NULL);
544 DBC_REQUIRE(flags == COD_NOLOAD || flags == COD_SYMB);
545 DBC_REQUIRE(lib_obj != NULL);
546
547 *lib_obj = NULL; 486 *lib_obj = NULL;
548 487
549 lib = kzalloc(sizeof(struct cod_libraryobj), GFP_KERNEL); 488 lib = kzalloc(sizeof(struct cod_libraryobj), GFP_KERNEL);
@@ -575,10 +514,6 @@ int cod_open_base(struct cod_manager *hmgr, char *sz_coff_path,
575 int status = 0; 514 int status = 0;
576 struct dbll_library_obj *lib; 515 struct dbll_library_obj *lib;
577 516
578 DBC_REQUIRE(refs > 0);
579 DBC_REQUIRE(hmgr);
580 DBC_REQUIRE(sz_coff_path != NULL);
581
582 /* if we previously opened a base image, close it now */ 517 /* if we previously opened a base image, close it now */
583 if (hmgr->base_lib) { 518 if (hmgr->base_lib) {
584 if (hmgr->loaded) { 519 if (hmgr->loaded) {
@@ -612,12 +547,6 @@ int cod_read_section(struct cod_libraryobj *lib, char *str_sect,
612{ 547{
613 int status = 0; 548 int status = 0;
614 549
615 DBC_REQUIRE(refs > 0);
616 DBC_REQUIRE(lib != NULL);
617 DBC_REQUIRE(lib->cod_mgr);
618 DBC_REQUIRE(str_sect != NULL);
619 DBC_REQUIRE(str_content != NULL);
620
621 if (lib != NULL) 550 if (lib != NULL)
622 status = 551 status =
623 lib->cod_mgr->fxns.read_sect_fxn(lib->dbll_lib, str_sect, 552 lib->cod_mgr->fxns.read_sect_fxn(lib->dbll_lib, str_sect,
diff --git a/drivers/staging/tidspbridge/pmgr/dbll.c b/drivers/staging/tidspbridge/pmgr/dbll.c
index 31da62b14bc..db1af795544 100644
--- a/drivers/staging/tidspbridge/pmgr/dbll.c
+++ b/drivers/staging/tidspbridge/pmgr/dbll.c
@@ -202,9 +202,6 @@ void dbll_close(struct dbll_library_obj *zl_lib)
202{ 202{
203 struct dbll_tar_obj *zl_target; 203 struct dbll_tar_obj *zl_target;
204 204
205 DBC_REQUIRE(refs > 0);
206 DBC_REQUIRE(zl_lib);
207 DBC_REQUIRE(zl_lib->open_ref > 0);
208 zl_target = zl_lib->target_obj; 205 zl_target = zl_lib->target_obj;
209 zl_lib->open_ref--; 206 zl_lib->open_ref--;
210 if (zl_lib->open_ref == 0) { 207 if (zl_lib->open_ref == 0) {
@@ -241,10 +238,6 @@ int dbll_create(struct dbll_tar_obj **target_obj,
241 struct dbll_tar_obj *pzl_target; 238 struct dbll_tar_obj *pzl_target;
242 int status = 0; 239 int status = 0;
243 240
244 DBC_REQUIRE(refs > 0);
245 DBC_REQUIRE(pattrs != NULL);
246 DBC_REQUIRE(target_obj != NULL);
247
248 /* Allocate DBL target object */ 241 /* Allocate DBL target object */
249 pzl_target = kzalloc(sizeof(struct dbll_tar_obj), GFP_KERNEL); 242 pzl_target = kzalloc(sizeof(struct dbll_tar_obj), GFP_KERNEL);
250 if (target_obj != NULL) { 243 if (target_obj != NULL) {
@@ -255,8 +248,6 @@ int dbll_create(struct dbll_tar_obj **target_obj,
255 pzl_target->attrs = *pattrs; 248 pzl_target->attrs = *pattrs;
256 *target_obj = (struct dbll_tar_obj *)pzl_target; 249 *target_obj = (struct dbll_tar_obj *)pzl_target;
257 } 250 }
258 DBC_ENSURE((!status && *target_obj) ||
259 (status && *target_obj == NULL));
260 } 251 }
261 252
262 return status; 253 return status;
@@ -269,9 +260,6 @@ void dbll_delete(struct dbll_tar_obj *target)
269{ 260{
270 struct dbll_tar_obj *zl_target = (struct dbll_tar_obj *)target; 261 struct dbll_tar_obj *zl_target = (struct dbll_tar_obj *)target;
271 262
272 DBC_REQUIRE(refs > 0);
273 DBC_REQUIRE(zl_target);
274
275 kfree(zl_target); 263 kfree(zl_target);
276 264
277} 265}
@@ -282,14 +270,10 @@ void dbll_delete(struct dbll_tar_obj *target)
282 */ 270 */
283void dbll_exit(void) 271void dbll_exit(void)
284{ 272{
285 DBC_REQUIRE(refs > 0);
286
287 refs--; 273 refs--;
288 274
289 if (refs == 0) 275 if (refs == 0)
290 gh_exit(); 276 gh_exit();
291
292 DBC_ENSURE(refs >= 0);
293} 277}
294 278
295/* 279/*
@@ -302,12 +286,6 @@ bool dbll_get_addr(struct dbll_library_obj *zl_lib, char *name,
302 struct dbll_symbol *sym; 286 struct dbll_symbol *sym;
303 bool status = false; 287 bool status = false;
304 288
305 DBC_REQUIRE(refs > 0);
306 DBC_REQUIRE(zl_lib);
307 DBC_REQUIRE(name != NULL);
308 DBC_REQUIRE(sym_val != NULL);
309 DBC_REQUIRE(zl_lib->sym_tab != NULL);
310
311 sym = (struct dbll_symbol *)gh_find(zl_lib->sym_tab, name); 289 sym = (struct dbll_symbol *)gh_find(zl_lib->sym_tab, name);
312 if (sym != NULL) { 290 if (sym != NULL) {
313 *sym_val = &sym->value; 291 *sym_val = &sym->value;
@@ -327,10 +305,6 @@ void dbll_get_attrs(struct dbll_tar_obj *target, struct dbll_attrs *pattrs)
327{ 305{
328 struct dbll_tar_obj *zl_target = (struct dbll_tar_obj *)target; 306 struct dbll_tar_obj *zl_target = (struct dbll_tar_obj *)target;
329 307
330 DBC_REQUIRE(refs > 0);
331 DBC_REQUIRE(zl_target);
332 DBC_REQUIRE(pattrs != NULL);
333
334 if ((pattrs != NULL) && (zl_target != NULL)) 308 if ((pattrs != NULL) && (zl_target != NULL))
335 *pattrs = zl_target->attrs; 309 *pattrs = zl_target->attrs;
336 310
@@ -347,12 +321,6 @@ bool dbll_get_c_addr(struct dbll_library_obj *zl_lib, char *name,
347 char cname[MAXEXPR + 1]; 321 char cname[MAXEXPR + 1];
348 bool status = false; 322 bool status = false;
349 323
350 DBC_REQUIRE(refs > 0);
351 DBC_REQUIRE(zl_lib);
352 DBC_REQUIRE(sym_val != NULL);
353 DBC_REQUIRE(zl_lib->sym_tab != NULL);
354 DBC_REQUIRE(name != NULL);
355
356 cname[0] = '_'; 324 cname[0] = '_';
357 325
358 strncpy(cname + 1, name, sizeof(cname) - 2); 326 strncpy(cname + 1, name, sizeof(cname) - 2);
@@ -382,12 +350,6 @@ int dbll_get_sect(struct dbll_library_obj *lib, char *name, u32 *paddr,
382 struct dbll_library_obj *zl_lib = (struct dbll_library_obj *)lib; 350 struct dbll_library_obj *zl_lib = (struct dbll_library_obj *)lib;
383 int status = 0; 351 int status = 0;
384 352
385 DBC_REQUIRE(refs > 0);
386 DBC_REQUIRE(name != NULL);
387 DBC_REQUIRE(paddr != NULL);
388 DBC_REQUIRE(psize != NULL);
389 DBC_REQUIRE(zl_lib);
390
391 /* If DOFF file is not open, we open it. */ 353 /* If DOFF file is not open, we open it. */
392 if (zl_lib != NULL) { 354 if (zl_lib != NULL) {
393 if (zl_lib->fp == NULL) { 355 if (zl_lib->fp == NULL) {
@@ -434,8 +396,6 @@ int dbll_get_sect(struct dbll_library_obj *lib, char *name, u32 *paddr,
434 */ 396 */
435bool dbll_init(void) 397bool dbll_init(void)
436{ 398{
437 DBC_REQUIRE(refs >= 0);
438
439 if (refs == 0) 399 if (refs == 0)
440 gh_init(); 400 gh_init();
441 401
@@ -456,10 +416,6 @@ int dbll_load(struct dbll_library_obj *lib, dbll_flags flags,
456 s32 err; 416 s32 err;
457 int status = 0; 417 int status = 0;
458 bool opened_doff = false; 418 bool opened_doff = false;
459 DBC_REQUIRE(refs > 0);
460 DBC_REQUIRE(zl_lib);
461 DBC_REQUIRE(entry != NULL);
462 DBC_REQUIRE(attrs != NULL);
463 419
464 /* 420 /*
465 * Load if not already loaded. 421 * Load if not already loaded.
@@ -558,8 +514,6 @@ int dbll_load(struct dbll_library_obj *lib, dbll_flags flags,
558 if (opened_doff) 514 if (opened_doff)
559 dof_close(zl_lib); 515 dof_close(zl_lib);
560 516
561 DBC_ENSURE(status || zl_lib->load_ref > 0);
562
563 dev_dbg(bridge, "%s: lib: %p flags: 0x%x entry: %p, status 0x%x\n", 517 dev_dbg(bridge, "%s: lib: %p flags: 0x%x entry: %p, status 0x%x\n",
564 __func__, lib, flags, entry, status); 518 __func__, lib, flags, entry, status);
565 519
@@ -577,12 +531,6 @@ int dbll_open(struct dbll_tar_obj *target, char *file, dbll_flags flags,
577 s32 err; 531 s32 err;
578 int status = 0; 532 int status = 0;
579 533
580 DBC_REQUIRE(refs > 0);
581 DBC_REQUIRE(zl_target);
582 DBC_REQUIRE(zl_target->attrs.fopen != NULL);
583 DBC_REQUIRE(file != NULL);
584 DBC_REQUIRE(lib_obj != NULL);
585
586 zl_lib = zl_target->head; 534 zl_lib = zl_target->head;
587 while (zl_lib != NULL) { 535 while (zl_lib != NULL) {
588 if (strcmp(zl_lib->file_name, file) == 0) { 536 if (strcmp(zl_lib->file_name, file) == 0) {
@@ -699,8 +647,6 @@ func_cont:
699 dbll_close((struct dbll_library_obj *)zl_lib); 647 dbll_close((struct dbll_library_obj *)zl_lib);
700 648
701 } 649 }
702 DBC_ENSURE((!status && (zl_lib->open_ref > 0) && *lib_obj)
703 || (status && *lib_obj == NULL));
704 650
705 dev_dbg(bridge, "%s: target: %p file: %s lib_obj: %p, status 0x%x\n", 651 dev_dbg(bridge, "%s: target: %p file: %s lib_obj: %p, status 0x%x\n",
706 __func__, target, file, lib_obj, status); 652 __func__, target, file, lib_obj, status);
@@ -722,12 +668,6 @@ int dbll_read_sect(struct dbll_library_obj *lib, char *name,
722 const struct ldr_section_info *sect = NULL; 668 const struct ldr_section_info *sect = NULL;
723 int status = 0; 669 int status = 0;
724 670
725 DBC_REQUIRE(refs > 0);
726 DBC_REQUIRE(zl_lib);
727 DBC_REQUIRE(name != NULL);
728 DBC_REQUIRE(buf != NULL);
729 DBC_REQUIRE(size != 0);
730
731 /* If DOFF file is not open, we open it. */ 671 /* If DOFF file is not open, we open it. */
732 if (zl_lib != NULL) { 672 if (zl_lib != NULL) {
733 if (zl_lib->fp == NULL) { 673 if (zl_lib->fp == NULL) {
@@ -788,14 +728,11 @@ void dbll_unload(struct dbll_library_obj *lib, struct dbll_attrs *attrs)
788 struct dbll_library_obj *zl_lib = (struct dbll_library_obj *)lib; 728 struct dbll_library_obj *zl_lib = (struct dbll_library_obj *)lib;
789 s32 err = 0; 729 s32 err = 0;
790 730
791 DBC_REQUIRE(refs > 0);
792 DBC_REQUIRE(zl_lib);
793 DBC_REQUIRE(zl_lib->load_ref > 0);
794 dev_dbg(bridge, "%s: lib: %p\n", __func__, lib); 731 dev_dbg(bridge, "%s: lib: %p\n", __func__, lib);
795 zl_lib->load_ref--; 732 zl_lib->load_ref--;
796 /* Unload only if reference count is 0 */ 733 /* Unload only if reference count is 0 */
797 if (zl_lib->load_ref != 0) 734 if (zl_lib->load_ref != 0)
798 goto func_end; 735 return;
799 736
800 zl_lib->target_obj->attrs = *attrs; 737 zl_lib->target_obj->attrs = *attrs;
801 if (zl_lib->dload_mod_obj) { 738 if (zl_lib->dload_mod_obj) {
@@ -814,8 +751,6 @@ void dbll_unload(struct dbll_library_obj *lib, struct dbll_attrs *attrs)
814 /* delete DOFF desc since it holds *lots* of host OS 751 /* delete DOFF desc since it holds *lots* of host OS
815 * resources */ 752 * resources */
816 dof_close(zl_lib); 753 dof_close(zl_lib);
817func_end:
818 DBC_ENSURE(zl_lib->load_ref >= 0);
819} 754}
820 755
821/* 756/*
@@ -874,8 +809,6 @@ static u16 name_hash(void *key, u16 max_bucket)
874 u16 hash; 809 u16 hash;
875 char *name = (char *)key; 810 char *name = (char *)key;
876 811
877 DBC_REQUIRE(name != NULL);
878
879 hash = 0; 812 hash = 0;
880 813
881 while (*name) { 814 while (*name) {
@@ -893,9 +826,6 @@ static u16 name_hash(void *key, u16 max_bucket)
893 */ 826 */
894static bool name_match(void *key, void *sp) 827static bool name_match(void *key, void *sp)
895{ 828{
896 DBC_REQUIRE(key != NULL);
897 DBC_REQUIRE(sp != NULL);
898
899 if ((key != NULL) && (sp != NULL)) { 829 if ((key != NULL) && (sp != NULL)) {
900 if (strcmp((char *)key, ((struct dbll_symbol *)sp)->name) == 830 if (strcmp((char *)key, ((struct dbll_symbol *)sp)->name) ==
901 0) 831 0)
@@ -938,10 +868,7 @@ static int dbll_read_buffer(struct dynamic_loader_stream *this, void *buffer,
938 struct dbll_library_obj *lib; 868 struct dbll_library_obj *lib;
939 int bytes_read = 0; 869 int bytes_read = 0;
940 870
941 DBC_REQUIRE(this != NULL);
942 lib = pstream->lib; 871 lib = pstream->lib;
943 DBC_REQUIRE(lib);
944
945 if (lib != NULL) { 872 if (lib != NULL) {
946 bytes_read = 873 bytes_read =
947 (*(lib->target_obj->attrs.fread)) (buffer, 1, bufsize, 874 (*(lib->target_obj->attrs.fread)) (buffer, 1, bufsize,
@@ -960,10 +887,7 @@ static int dbll_set_file_posn(struct dynamic_loader_stream *this,
960 struct dbll_library_obj *lib; 887 struct dbll_library_obj *lib;
961 int status = 0; /* Success */ 888 int status = 0; /* Success */
962 889
963 DBC_REQUIRE(this != NULL);
964 lib = pstream->lib; 890 lib = pstream->lib;
965 DBC_REQUIRE(lib);
966
967 if (lib != NULL) { 891 if (lib != NULL) {
968 status = (*(lib->target_obj->attrs.fseek)) (lib->fp, (long)pos, 892 status = (*(lib->target_obj->attrs.fseek)) (lib->fp, (long)pos,
969 SEEK_SET); 893 SEEK_SET);
@@ -986,10 +910,7 @@ static struct dynload_symbol *dbll_find_symbol(struct dynamic_loader_sym *this,
986 struct dbll_sym_val *dbll_sym = NULL; 910 struct dbll_sym_val *dbll_sym = NULL;
987 bool status = false; /* Symbol not found yet */ 911 bool status = false; /* Symbol not found yet */
988 912
989 DBC_REQUIRE(this != NULL);
990 lib = ldr_sym->lib; 913 lib = ldr_sym->lib;
991 DBC_REQUIRE(lib);
992
993 if (lib != NULL) { 914 if (lib != NULL) {
994 if (lib->target_obj->attrs.sym_lookup) { 915 if (lib->target_obj->attrs.sym_lookup) {
995 /* Check current lib + base lib + dep lib + 916 /* Check current lib + base lib + dep lib +
@@ -1034,11 +955,7 @@ static struct dynload_symbol *find_in_symbol_table(struct dynamic_loader_sym
1034 struct dbll_library_obj *lib; 955 struct dbll_library_obj *lib;
1035 struct dbll_symbol *sym; 956 struct dbll_symbol *sym;
1036 957
1037 DBC_REQUIRE(this != NULL);
1038 lib = ldr_sym->lib; 958 lib = ldr_sym->lib;
1039 DBC_REQUIRE(lib);
1040 DBC_REQUIRE(lib->sym_tab != NULL);
1041
1042 sym = (struct dbll_symbol *)gh_find(lib->sym_tab, (char *)name); 959 sym = (struct dbll_symbol *)gh_find(lib->sym_tab, (char *)name);
1043 960
1044 ret_sym = (struct dynload_symbol *)&sym->value; 961 ret_sym = (struct dynload_symbol *)&sym->value;
@@ -1059,10 +976,7 @@ static struct dynload_symbol *dbll_add_to_symbol_table(struct dynamic_loader_sym
1059 struct dbll_library_obj *lib; 976 struct dbll_library_obj *lib;
1060 struct dynload_symbol *ret; 977 struct dynload_symbol *ret;
1061 978
1062 DBC_REQUIRE(this != NULL);
1063 DBC_REQUIRE(name);
1064 lib = ldr_sym->lib; 979 lib = ldr_sym->lib;
1065 DBC_REQUIRE(lib);
1066 980
1067 /* Check to see if symbol is already defined in symbol table */ 981 /* Check to see if symbol is already defined in symbol table */
1068 if (!(lib->target_obj->attrs.base_image)) { 982 if (!(lib->target_obj->attrs.base_image)) {
@@ -1111,10 +1025,7 @@ static void dbll_purge_symbol_table(struct dynamic_loader_sym *this,
1111 struct ldr_symbol *ldr_sym = (struct ldr_symbol *)this; 1025 struct ldr_symbol *ldr_sym = (struct ldr_symbol *)this;
1112 struct dbll_library_obj *lib; 1026 struct dbll_library_obj *lib;
1113 1027
1114 DBC_REQUIRE(this != NULL);
1115 lib = ldr_sym->lib; 1028 lib = ldr_sym->lib;
1116 DBC_REQUIRE(lib);
1117
1118 /* May not need to do anything */ 1029 /* May not need to do anything */
1119} 1030}
1120 1031
@@ -1127,9 +1038,7 @@ static void *allocate(struct dynamic_loader_sym *this, unsigned memsize)
1127 struct dbll_library_obj *lib; 1038 struct dbll_library_obj *lib;
1128 void *buf; 1039 void *buf;
1129 1040
1130 DBC_REQUIRE(this != NULL);
1131 lib = ldr_sym->lib; 1041 lib = ldr_sym->lib;
1132 DBC_REQUIRE(lib);
1133 1042
1134 buf = kzalloc(memsize, GFP_KERNEL); 1043 buf = kzalloc(memsize, GFP_KERNEL);
1135 1044
@@ -1144,9 +1053,7 @@ static void deallocate(struct dynamic_loader_sym *this, void *mem_ptr)
1144 struct ldr_symbol *ldr_sym = (struct ldr_symbol *)this; 1053 struct ldr_symbol *ldr_sym = (struct ldr_symbol *)this;
1145 struct dbll_library_obj *lib; 1054 struct dbll_library_obj *lib;
1146 1055
1147 DBC_REQUIRE(this != NULL);
1148 lib = ldr_sym->lib; 1056 lib = ldr_sym->lib;
1149 DBC_REQUIRE(lib);
1150 1057
1151 kfree(mem_ptr); 1058 kfree(mem_ptr);
1152} 1059}
@@ -1161,9 +1068,7 @@ static void dbll_err_report(struct dynamic_loader_sym *this, const char *errstr,
1161 struct dbll_library_obj *lib; 1068 struct dbll_library_obj *lib;
1162 char temp_buf[MAXEXPR]; 1069 char temp_buf[MAXEXPR];
1163 1070
1164 DBC_REQUIRE(this != NULL);
1165 lib = ldr_sym->lib; 1071 lib = ldr_sym->lib;
1166 DBC_REQUIRE(lib);
1167 vsnprintf((char *)temp_buf, MAXEXPR, (char *)errstr, args); 1072 vsnprintf((char *)temp_buf, MAXEXPR, (char *)errstr, args);
1168 dev_dbg(bridge, "%s\n", temp_buf); 1073 dev_dbg(bridge, "%s\n", temp_buf);
1169} 1074}
@@ -1195,9 +1100,7 @@ static int dbll_rmm_alloc(struct dynamic_loader_allocate *this,
1195 u32 alloc_size = 0; 1100 u32 alloc_size = 0;
1196 u32 run_addr_flag = 0; 1101 u32 run_addr_flag = 0;
1197 1102
1198 DBC_REQUIRE(this != NULL);
1199 lib = dbll_alloc_obj->lib; 1103 lib = dbll_alloc_obj->lib;
1200 DBC_REQUIRE(lib);
1201 1104
1202 mem_sect_type = 1105 mem_sect_type =
1203 (stype == DLOAD_TEXT) ? DBLL_CODE : (stype == 1106 (stype == DLOAD_TEXT) ? DBLL_CODE : (stype ==
@@ -1206,7 +1109,6 @@ static int dbll_rmm_alloc(struct dynamic_loader_allocate *this,
1206 1109
1207 /* Attempt to extract the segment ID and requirement information from 1110 /* Attempt to extract the segment ID and requirement information from
1208 the name of the section */ 1111 the name of the section */
1209 DBC_REQUIRE(info->name);
1210 token_len = strlen((char *)(info->name)) + 1; 1112 token_len = strlen((char *)(info->name)) + 1;
1211 1113
1212 sz_sect_name = kzalloc(token_len, GFP_KERNEL); 1114 sz_sect_name = kzalloc(token_len, GFP_KERNEL);
@@ -1307,9 +1209,7 @@ static void rmm_dealloc(struct dynamic_loader_allocate *this,
1307 (stype == DLOAD_TEXT) ? DBLL_CODE : (stype == 1209 (stype == DLOAD_TEXT) ? DBLL_CODE : (stype ==
1308 DLOAD_BSS) ? DBLL_BSS : 1210 DLOAD_BSS) ? DBLL_BSS :
1309 DBLL_DATA; 1211 DBLL_DATA;
1310 DBC_REQUIRE(this != NULL);
1311 lib = dbll_alloc_obj->lib; 1212 lib = dbll_alloc_obj->lib;
1312 DBC_REQUIRE(lib);
1313 /* segid was set by alloc function */ 1213 /* segid was set by alloc function */
1314 segid = (u32) info->context; 1214 segid = (u32) info->context;
1315 if (mem_sect_type == DBLL_CODE) 1215 if (mem_sect_type == DBLL_CODE)
@@ -1347,9 +1247,7 @@ static int read_mem(struct dynamic_loader_initialize *this, void *buf,
1347 struct dbll_library_obj *lib; 1247 struct dbll_library_obj *lib;
1348 int bytes_read = 0; 1248 int bytes_read = 0;
1349 1249
1350 DBC_REQUIRE(this != NULL);
1351 lib = init_obj->lib; 1250 lib = init_obj->lib;
1352 DBC_REQUIRE(lib);
1353 /* Need bridge_brd_read function */ 1251 /* Need bridge_brd_read function */
1354 return bytes_read; 1252 return bytes_read;
1355} 1253}
@@ -1368,7 +1266,6 @@ static int write_mem(struct dynamic_loader_initialize *this, void *buf,
1368 u32 mem_sect_type; 1266 u32 mem_sect_type;
1369 bool ret = true; 1267 bool ret = true;
1370 1268
1371 DBC_REQUIRE(this != NULL);
1372 lib = init_obj->lib; 1269 lib = init_obj->lib;
1373 if (!lib) 1270 if (!lib)
1374 return false; 1271 return false;
@@ -1415,7 +1312,6 @@ static int fill_mem(struct dynamic_loader_initialize *this, ldr_addr addr,
1415 struct dbll_library_obj *lib; 1312 struct dbll_library_obj *lib;
1416 struct dbll_init_obj *init_obj = (struct dbll_init_obj *)this; 1313 struct dbll_init_obj *init_obj = (struct dbll_init_obj *)this;
1417 1314
1418 DBC_REQUIRE(this != NULL);
1419 lib = init_obj->lib; 1315 lib = init_obj->lib;
1420 pbuf = NULL; 1316 pbuf = NULL;
1421 /* Pass the NULL pointer to write_mem to get the start address of Shared 1317 /* Pass the NULL pointer to write_mem to get the start address of Shared
@@ -1439,9 +1335,7 @@ static int execute(struct dynamic_loader_initialize *this, ldr_addr start)
1439 struct dbll_library_obj *lib; 1335 struct dbll_library_obj *lib;
1440 bool ret = true; 1336 bool ret = true;
1441 1337
1442 DBC_REQUIRE(this != NULL);
1443 lib = init_obj->lib; 1338 lib = init_obj->lib;
1444 DBC_REQUIRE(lib);
1445 /* Save entry point */ 1339 /* Save entry point */
1446 if (lib != NULL) 1340 if (lib != NULL)
1447 lib->entry = (u32) start; 1341 lib->entry = (u32) start;
diff --git a/drivers/staging/tidspbridge/pmgr/dev.c b/drivers/staging/tidspbridge/pmgr/dev.c
index 522810bc742..e4257fd7ff0 100644
--- a/drivers/staging/tidspbridge/pmgr/dev.c
+++ b/drivers/staging/tidspbridge/pmgr/dev.c
@@ -106,8 +106,6 @@ u32 dev_brd_write_fxn(void *arb, u32 dsp_add, void *host_buf,
106 u32 ul_written = 0; 106 u32 ul_written = 0;
107 int status; 107 int status;
108 108
109 DBC_REQUIRE(refs > 0);
110 DBC_REQUIRE(host_buf != NULL); /* Required of BrdWrite(). */
111 if (dev_obj) { 109 if (dev_obj) {
112 /* Require of BrdWrite() */ 110 /* Require of BrdWrite() */
113 DBC_ASSERT(dev_obj->bridge_context != NULL); 111 DBC_ASSERT(dev_obj->bridge_context != NULL);
@@ -143,9 +141,6 @@ int dev_create_device(struct dev_object **device_obj,
143 struct drv_object *hdrv_obj = NULL; 141 struct drv_object *hdrv_obj = NULL;
144 struct drv_data *drv_datap = dev_get_drvdata(bridge); 142 struct drv_data *drv_datap = dev_get_drvdata(bridge);
145 int status = 0; 143 int status = 0;
146 DBC_REQUIRE(refs > 0);
147 DBC_REQUIRE(device_obj != NULL);
148 DBC_REQUIRE(driver_file_name != NULL);
149 144
150 status = drv_request_bridge_res_dsp((void *)&host_res); 145 status = drv_request_bridge_res_dsp((void *)&host_res);
151 146
@@ -271,7 +266,6 @@ leave:
271 *device_obj = NULL; 266 *device_obj = NULL;
272 } 267 }
273 268
274 DBC_ENSURE((!status && *device_obj) || (status && !*device_obj));
275 return status; 269 return status;
276} 270}
277 271
@@ -287,17 +281,12 @@ int dev_create2(struct dev_object *hdev_obj)
287 int status = 0; 281 int status = 0;
288 struct dev_object *dev_obj = hdev_obj; 282 struct dev_object *dev_obj = hdev_obj;
289 283
290 DBC_REQUIRE(refs > 0);
291 DBC_REQUIRE(hdev_obj);
292
293 /* There can be only one Node Manager per DEV object */ 284 /* There can be only one Node Manager per DEV object */
294 DBC_ASSERT(!dev_obj->node_mgr); 285 DBC_ASSERT(!dev_obj->node_mgr);
295 status = node_create_mgr(&dev_obj->node_mgr, hdev_obj); 286 status = node_create_mgr(&dev_obj->node_mgr, hdev_obj);
296 if (status) 287 if (status)
297 dev_obj->node_mgr = NULL; 288 dev_obj->node_mgr = NULL;
298 289
299 DBC_ENSURE((!status && dev_obj->node_mgr != NULL)
300 || (status && dev_obj->node_mgr == NULL));
301 return status; 290 return status;
302} 291}
303 292
@@ -311,9 +300,6 @@ int dev_destroy2(struct dev_object *hdev_obj)
311 int status = 0; 300 int status = 0;
312 struct dev_object *dev_obj = hdev_obj; 301 struct dev_object *dev_obj = hdev_obj;
313 302
314 DBC_REQUIRE(refs > 0);
315 DBC_REQUIRE(hdev_obj);
316
317 if (dev_obj->node_mgr) { 303 if (dev_obj->node_mgr) {
318 if (node_delete_mgr(dev_obj->node_mgr)) 304 if (node_delete_mgr(dev_obj->node_mgr))
319 status = -EPERM; 305 status = -EPERM;
@@ -322,7 +308,6 @@ int dev_destroy2(struct dev_object *hdev_obj)
322 308
323 } 309 }
324 310
325 DBC_ENSURE((!status && dev_obj->node_mgr == NULL) || status);
326 return status; 311 return status;
327} 312}
328 313
@@ -337,8 +322,6 @@ int dev_destroy_device(struct dev_object *hdev_obj)
337 int status = 0; 322 int status = 0;
338 struct dev_object *dev_obj = hdev_obj; 323 struct dev_object *dev_obj = hdev_obj;
339 324
340 DBC_REQUIRE(refs > 0);
341
342 if (hdev_obj) { 325 if (hdev_obj) {
343 if (dev_obj->cod_mgr) { 326 if (dev_obj->cod_mgr) {
344 cod_delete(dev_obj->cod_mgr); 327 cod_delete(dev_obj->cod_mgr);
@@ -415,9 +398,6 @@ int dev_get_chnl_mgr(struct dev_object *hdev_obj,
415 int status = 0; 398 int status = 0;
416 struct dev_object *dev_obj = hdev_obj; 399 struct dev_object *dev_obj = hdev_obj;
417 400
418 DBC_REQUIRE(refs > 0);
419 DBC_REQUIRE(mgr != NULL);
420
421 if (hdev_obj) { 401 if (hdev_obj) {
422 *mgr = dev_obj->chnl_mgr; 402 *mgr = dev_obj->chnl_mgr;
423 } else { 403 } else {
@@ -425,7 +405,6 @@ int dev_get_chnl_mgr(struct dev_object *hdev_obj,
425 status = -EFAULT; 405 status = -EFAULT;
426 } 406 }
427 407
428 DBC_ENSURE(!status || (mgr != NULL && *mgr == NULL));
429 return status; 408 return status;
430} 409}
431 410
@@ -441,9 +420,6 @@ int dev_get_cmm_mgr(struct dev_object *hdev_obj,
441 int status = 0; 420 int status = 0;
442 struct dev_object *dev_obj = hdev_obj; 421 struct dev_object *dev_obj = hdev_obj;
443 422
444 DBC_REQUIRE(refs > 0);
445 DBC_REQUIRE(mgr != NULL);
446
447 if (hdev_obj) { 423 if (hdev_obj) {
448 *mgr = dev_obj->cmm_mgr; 424 *mgr = dev_obj->cmm_mgr;
449 } else { 425 } else {
@@ -451,7 +427,6 @@ int dev_get_cmm_mgr(struct dev_object *hdev_obj,
451 status = -EFAULT; 427 status = -EFAULT;
452 } 428 }
453 429
454 DBC_ENSURE(!status || (mgr != NULL && *mgr == NULL));
455 return status; 430 return status;
456} 431}
457 432
@@ -467,9 +442,6 @@ int dev_get_dmm_mgr(struct dev_object *hdev_obj,
467 int status = 0; 442 int status = 0;
468 struct dev_object *dev_obj = hdev_obj; 443 struct dev_object *dev_obj = hdev_obj;
469 444
470 DBC_REQUIRE(refs > 0);
471 DBC_REQUIRE(mgr != NULL);
472
473 if (hdev_obj) { 445 if (hdev_obj) {
474 *mgr = dev_obj->dmm_mgr; 446 *mgr = dev_obj->dmm_mgr;
475 } else { 447 } else {
@@ -477,7 +449,6 @@ int dev_get_dmm_mgr(struct dev_object *hdev_obj,
477 status = -EFAULT; 449 status = -EFAULT;
478 } 450 }
479 451
480 DBC_ENSURE(!status || (mgr != NULL && *mgr == NULL));
481 return status; 452 return status;
482} 453}
483 454
@@ -492,9 +463,6 @@ int dev_get_cod_mgr(struct dev_object *hdev_obj,
492 int status = 0; 463 int status = 0;
493 struct dev_object *dev_obj = hdev_obj; 464 struct dev_object *dev_obj = hdev_obj;
494 465
495 DBC_REQUIRE(refs > 0);
496 DBC_REQUIRE(cod_mgr != NULL);
497
498 if (hdev_obj) { 466 if (hdev_obj) {
499 *cod_mgr = dev_obj->cod_mgr; 467 *cod_mgr = dev_obj->cod_mgr;
500 } else { 468 } else {
@@ -502,7 +470,6 @@ int dev_get_cod_mgr(struct dev_object *hdev_obj,
502 status = -EFAULT; 470 status = -EFAULT;
503 } 471 }
504 472
505 DBC_ENSURE(!status || (cod_mgr != NULL && *cod_mgr == NULL));
506 return status; 473 return status;
507} 474}
508 475
@@ -514,9 +481,6 @@ int dev_get_deh_mgr(struct dev_object *hdev_obj,
514{ 481{
515 int status = 0; 482 int status = 0;
516 483
517 DBC_REQUIRE(refs > 0);
518 DBC_REQUIRE(deh_manager != NULL);
519 DBC_REQUIRE(hdev_obj);
520 if (hdev_obj) { 484 if (hdev_obj) {
521 *deh_manager = hdev_obj->deh_mgr; 485 *deh_manager = hdev_obj->deh_mgr;
522 } else { 486 } else {
@@ -537,9 +501,6 @@ int dev_get_dev_node(struct dev_object *hdev_obj,
537 int status = 0; 501 int status = 0;
538 struct dev_object *dev_obj = hdev_obj; 502 struct dev_object *dev_obj = hdev_obj;
539 503
540 DBC_REQUIRE(refs > 0);
541 DBC_REQUIRE(dev_nde != NULL);
542
543 if (hdev_obj) { 504 if (hdev_obj) {
544 *dev_nde = dev_obj->dev_node_obj; 505 *dev_nde = dev_obj->dev_node_obj;
545 } else { 506 } else {
@@ -547,7 +508,6 @@ int dev_get_dev_node(struct dev_object *hdev_obj,
547 status = -EFAULT; 508 status = -EFAULT;
548 } 509 }
549 510
550 DBC_ENSURE(!status || (dev_nde != NULL && *dev_nde == NULL));
551 return status; 511 return status;
552} 512}
553 513
@@ -578,9 +538,6 @@ int dev_get_intf_fxns(struct dev_object *hdev_obj,
578 int status = 0; 538 int status = 0;
579 struct dev_object *dev_obj = hdev_obj; 539 struct dev_object *dev_obj = hdev_obj;
580 540
581 DBC_REQUIRE(refs > 0);
582 DBC_REQUIRE(if_fxns != NULL);
583
584 if (hdev_obj) { 541 if (hdev_obj) {
585 *if_fxns = &dev_obj->bridge_interface; 542 *if_fxns = &dev_obj->bridge_interface;
586 } else { 543 } else {
@@ -588,7 +545,6 @@ int dev_get_intf_fxns(struct dev_object *hdev_obj,
588 status = -EFAULT; 545 status = -EFAULT;
589 } 546 }
590 547
591 DBC_ENSURE(!status || ((if_fxns != NULL) && (*if_fxns == NULL)));
592 return status; 548 return status;
593} 549}
594 550
@@ -600,10 +556,6 @@ int dev_get_io_mgr(struct dev_object *hdev_obj,
600{ 556{
601 int status = 0; 557 int status = 0;
602 558
603 DBC_REQUIRE(refs > 0);
604 DBC_REQUIRE(io_man != NULL);
605 DBC_REQUIRE(hdev_obj);
606
607 if (hdev_obj) { 559 if (hdev_obj) {
608 *io_man = hdev_obj->iomgr; 560 *io_man = hdev_obj->iomgr;
609 } else { 561 } else {
@@ -638,10 +590,6 @@ struct dev_object *dev_get_next(struct dev_object *hdev_obj)
638 */ 590 */
639void dev_get_msg_mgr(struct dev_object *hdev_obj, struct msg_mgr **msg_man) 591void dev_get_msg_mgr(struct dev_object *hdev_obj, struct msg_mgr **msg_man)
640{ 592{
641 DBC_REQUIRE(refs > 0);
642 DBC_REQUIRE(msg_man != NULL);
643 DBC_REQUIRE(hdev_obj);
644
645 *msg_man = hdev_obj->msg_mgr; 593 *msg_man = hdev_obj->msg_mgr;
646} 594}
647 595
@@ -656,9 +604,6 @@ int dev_get_node_manager(struct dev_object *hdev_obj,
656 int status = 0; 604 int status = 0;
657 struct dev_object *dev_obj = hdev_obj; 605 struct dev_object *dev_obj = hdev_obj;
658 606
659 DBC_REQUIRE(refs > 0);
660 DBC_REQUIRE(node_man != NULL);
661
662 if (hdev_obj) { 607 if (hdev_obj) {
663 *node_man = dev_obj->node_mgr; 608 *node_man = dev_obj->node_mgr;
664 } else { 609 } else {
@@ -666,7 +611,6 @@ int dev_get_node_manager(struct dev_object *hdev_obj,
666 status = -EFAULT; 611 status = -EFAULT;
667 } 612 }
668 613
669 DBC_ENSURE(!status || (node_man != NULL && *node_man == NULL));
670 return status; 614 return status;
671} 615}
672 616
@@ -679,9 +623,6 @@ int dev_get_symbol(struct dev_object *hdev_obj,
679 int status = 0; 623 int status = 0;
680 struct cod_manager *cod_mgr; 624 struct cod_manager *cod_mgr;
681 625
682 DBC_REQUIRE(refs > 0);
683 DBC_REQUIRE(str_sym != NULL && pul_value != NULL);
684
685 if (hdev_obj) { 626 if (hdev_obj) {
686 status = dev_get_cod_mgr(hdev_obj, &cod_mgr); 627 status = dev_get_cod_mgr(hdev_obj, &cod_mgr);
687 if (cod_mgr) 628 if (cod_mgr)
@@ -706,9 +647,6 @@ int dev_get_bridge_context(struct dev_object *hdev_obj,
706 int status = 0; 647 int status = 0;
707 struct dev_object *dev_obj = hdev_obj; 648 struct dev_object *dev_obj = hdev_obj;
708 649
709 DBC_REQUIRE(refs > 0);
710 DBC_REQUIRE(phbridge_context != NULL);
711
712 if (hdev_obj) { 650 if (hdev_obj) {
713 *phbridge_context = dev_obj->bridge_context; 651 *phbridge_context = dev_obj->bridge_context;
714 } else { 652 } else {
@@ -716,8 +654,6 @@ int dev_get_bridge_context(struct dev_object *hdev_obj,
716 status = -EFAULT; 654 status = -EFAULT;
717 } 655 }
718 656
719 DBC_ENSURE(!status || ((phbridge_context != NULL) &&
720 (*phbridge_context == NULL)));
721 return status; 657 return status;
722} 658}
723 659
@@ -729,16 +665,12 @@ int dev_get_bridge_context(struct dev_object *hdev_obj,
729 */ 665 */
730void dev_exit(void) 666void dev_exit(void)
731{ 667{
732 DBC_REQUIRE(refs > 0);
733
734 refs--; 668 refs--;
735 669
736 if (refs == 0) { 670 if (refs == 0) {
737 cmm_exit(); 671 cmm_exit();
738 dmm_exit(); 672 dmm_exit();
739 } 673 }
740
741 DBC_ENSURE(refs >= 0);
742} 674}
743 675
744/* 676/*
@@ -750,8 +682,6 @@ bool dev_init(void)
750{ 682{
751 bool cmm_ret, dmm_ret, ret = true; 683 bool cmm_ret, dmm_ret, ret = true;
752 684
753 DBC_REQUIRE(refs >= 0);
754
755 if (refs == 0) { 685 if (refs == 0) {
756 cmm_ret = cmm_init(); 686 cmm_ret = cmm_init();
757 dmm_ret = dmm_init(); 687 dmm_ret = dmm_init();
@@ -771,8 +701,6 @@ bool dev_init(void)
771 if (ret) 701 if (ret)
772 refs++; 702 refs++;
773 703
774 DBC_ENSURE((ret && (refs > 0)) || (!ret && (refs >= 0)));
775
776 return ret; 704 return ret;
777} 705}
778 706
@@ -841,14 +769,11 @@ int dev_set_chnl_mgr(struct dev_object *hdev_obj,
841 int status = 0; 769 int status = 0;
842 struct dev_object *dev_obj = hdev_obj; 770 struct dev_object *dev_obj = hdev_obj;
843 771
844 DBC_REQUIRE(refs > 0);
845
846 if (hdev_obj) 772 if (hdev_obj)
847 dev_obj->chnl_mgr = hmgr; 773 dev_obj->chnl_mgr = hmgr;
848 else 774 else
849 status = -EFAULT; 775 status = -EFAULT;
850 776
851 DBC_ENSURE(status || (dev_obj->chnl_mgr == hmgr));
852 return status; 777 return status;
853} 778}
854 779
@@ -859,9 +784,6 @@ int dev_set_chnl_mgr(struct dev_object *hdev_obj,
859 */ 784 */
860void dev_set_msg_mgr(struct dev_object *hdev_obj, struct msg_mgr *hmgr) 785void dev_set_msg_mgr(struct dev_object *hdev_obj, struct msg_mgr *hmgr)
861{ 786{
862 DBC_REQUIRE(refs > 0);
863 DBC_REQUIRE(hdev_obj);
864
865 hdev_obj->msg_mgr = hmgr; 787 hdev_obj->msg_mgr = hmgr;
866} 788}
867 789
@@ -879,8 +801,6 @@ int dev_start_device(struct cfg_devnode *dev_node_obj)
879 struct mgr_object *hmgr_obj = NULL; 801 struct mgr_object *hmgr_obj = NULL;
880 struct drv_data *drv_datap = dev_get_drvdata(bridge); 802 struct drv_data *drv_datap = dev_get_drvdata(bridge);
881 803
882 DBC_REQUIRE(refs > 0);
883
884 /* Given all resources, create a device object. */ 804 /* Given all resources, create a device object. */
885 status = dev_create_device(&hdev_obj, bridge_file_name, 805 status = dev_create_device(&hdev_obj, bridge_file_name,
886 dev_node_obj); 806 dev_node_obj);
@@ -944,9 +864,6 @@ static int init_cod_mgr(struct dev_object *dev_obj)
944 int status = 0; 864 int status = 0;
945 char *sz_dummy_file = "dummy"; 865 char *sz_dummy_file = "dummy";
946 866
947 DBC_REQUIRE(refs > 0);
948 DBC_REQUIRE(!dev_obj || (dev_obj->cod_mgr == NULL));
949
950 status = cod_create(&dev_obj->cod_mgr, sz_dummy_file); 867 status = cod_create(&dev_obj->cod_mgr, sz_dummy_file);
951 868
952 return status; 869 return status;
@@ -976,10 +893,6 @@ int dev_insert_proc_object(struct dev_object *hdev_obj,
976{ 893{
977 struct dev_object *dev_obj = (struct dev_object *)hdev_obj; 894 struct dev_object *dev_obj = (struct dev_object *)hdev_obj;
978 895
979 DBC_REQUIRE(refs > 0);
980 DBC_REQUIRE(dev_obj);
981 DBC_REQUIRE(proc_obj != 0);
982 DBC_REQUIRE(already_attached != NULL);
983 if (!list_empty(&dev_obj->proc_list)) 896 if (!list_empty(&dev_obj->proc_list))
984 *already_attached = true; 897 *already_attached = true;
985 898
@@ -1017,10 +930,6 @@ int dev_remove_proc_object(struct dev_object *hdev_obj, u32 proc_obj)
1017 struct list_head *cur_elem; 930 struct list_head *cur_elem;
1018 struct dev_object *dev_obj = (struct dev_object *)hdev_obj; 931 struct dev_object *dev_obj = (struct dev_object *)hdev_obj;
1019 932
1020 DBC_REQUIRE(dev_obj);
1021 DBC_REQUIRE(proc_obj != 0);
1022 DBC_REQUIRE(!list_empty(&dev_obj->proc_list));
1023
1024 /* Search list for dev_obj: */ 933 /* Search list for dev_obj: */
1025 list_for_each(cur_elem, &dev_obj->proc_list) { 934 list_for_each(cur_elem, &dev_obj->proc_list) {
1026 if ((u32) cur_elem == proc_obj) { 935 if ((u32) cur_elem == proc_obj) {
@@ -1069,10 +978,6 @@ static void store_interface_fxns(struct bridge_drv_interface *drv_fxns,
1069 (intf_fxns->pfn = ((drv_fxns->pfn != NULL) ? drv_fxns->pfn : \ 978 (intf_fxns->pfn = ((drv_fxns->pfn != NULL) ? drv_fxns->pfn : \
1070 (cast)fxn_not_implemented)) 979 (cast)fxn_not_implemented))
1071 980
1072 DBC_REQUIRE(intf_fxns != NULL);
1073 DBC_REQUIRE(drv_fxns != NULL);
1074 DBC_REQUIRE(MAKEVERSION(drv_fxns->brd_api_major_version,
1075 drv_fxns->brd_api_minor_version) <= BRD_API_VERSION);
1076 bridge_version = MAKEVERSION(drv_fxns->brd_api_major_version, 981 bridge_version = MAKEVERSION(drv_fxns->brd_api_major_version,
1077 drv_fxns->brd_api_minor_version); 982 drv_fxns->brd_api_minor_version);
1078 intf_fxns->brd_api_major_version = drv_fxns->brd_api_major_version; 983 intf_fxns->brd_api_major_version = drv_fxns->brd_api_major_version;
@@ -1119,33 +1024,5 @@ static void store_interface_fxns(struct bridge_drv_interface *drv_fxns,
1119 STORE_FXN(fxn_msg_setqueueid, msg_set_queue_id); 1024 STORE_FXN(fxn_msg_setqueueid, msg_set_queue_id);
1120 } 1025 }
1121 /* Add code for any additional functions in newerBridge versions here */ 1026 /* Add code for any additional functions in newerBridge versions here */
1122 /* Ensure postcondition: */
1123 DBC_ENSURE(intf_fxns->dev_create != NULL);
1124 DBC_ENSURE(intf_fxns->dev_destroy != NULL);
1125 DBC_ENSURE(intf_fxns->dev_cntrl != NULL);
1126 DBC_ENSURE(intf_fxns->brd_monitor != NULL);
1127 DBC_ENSURE(intf_fxns->brd_start != NULL);
1128 DBC_ENSURE(intf_fxns->brd_stop != NULL);
1129 DBC_ENSURE(intf_fxns->brd_status != NULL);
1130 DBC_ENSURE(intf_fxns->brd_read != NULL);
1131 DBC_ENSURE(intf_fxns->brd_write != NULL);
1132 DBC_ENSURE(intf_fxns->chnl_create != NULL);
1133 DBC_ENSURE(intf_fxns->chnl_destroy != NULL);
1134 DBC_ENSURE(intf_fxns->chnl_open != NULL);
1135 DBC_ENSURE(intf_fxns->chnl_close != NULL);
1136 DBC_ENSURE(intf_fxns->chnl_add_io_req != NULL);
1137 DBC_ENSURE(intf_fxns->chnl_get_ioc != NULL);
1138 DBC_ENSURE(intf_fxns->chnl_cancel_io != NULL);
1139 DBC_ENSURE(intf_fxns->chnl_flush_io != NULL);
1140 DBC_ENSURE(intf_fxns->chnl_get_info != NULL);
1141 DBC_ENSURE(intf_fxns->chnl_get_mgr_info != NULL);
1142 DBC_ENSURE(intf_fxns->chnl_idle != NULL);
1143 DBC_ENSURE(intf_fxns->chnl_register_notify != NULL);
1144 DBC_ENSURE(intf_fxns->io_create != NULL);
1145 DBC_ENSURE(intf_fxns->io_destroy != NULL);
1146 DBC_ENSURE(intf_fxns->io_on_loaded != NULL);
1147 DBC_ENSURE(intf_fxns->io_get_proc_load != NULL);
1148 DBC_ENSURE(intf_fxns->msg_set_queue_id != NULL);
1149
1150#undef STORE_FXN 1027#undef STORE_FXN
1151} 1028}
diff --git a/drivers/staging/tidspbridge/pmgr/dmm.c b/drivers/staging/tidspbridge/pmgr/dmm.c
index 8685233d762..cece7801d6c 100644
--- a/drivers/staging/tidspbridge/pmgr/dmm.c
+++ b/drivers/staging/tidspbridge/pmgr/dmm.c
@@ -123,8 +123,6 @@ int dmm_create(struct dmm_object **dmm_manager,
123{ 123{
124 struct dmm_object *dmm_obj = NULL; 124 struct dmm_object *dmm_obj = NULL;
125 int status = 0; 125 int status = 0;
126 DBC_REQUIRE(refs > 0);
127 DBC_REQUIRE(dmm_manager != NULL);
128 126
129 *dmm_manager = NULL; 127 *dmm_manager = NULL;
130 /* create, zero, and tag a cmm mgr object */ 128 /* create, zero, and tag a cmm mgr object */
@@ -149,7 +147,6 @@ int dmm_destroy(struct dmm_object *dmm_mgr)
149 struct dmm_object *dmm_obj = (struct dmm_object *)dmm_mgr; 147 struct dmm_object *dmm_obj = (struct dmm_object *)dmm_mgr;
150 int status = 0; 148 int status = 0;
151 149
152 DBC_REQUIRE(refs > 0);
153 if (dmm_mgr) { 150 if (dmm_mgr) {
154 status = dmm_delete_tables(dmm_obj); 151 status = dmm_delete_tables(dmm_obj);
155 if (!status) 152 if (!status)
@@ -169,7 +166,6 @@ int dmm_delete_tables(struct dmm_object *dmm_mgr)
169{ 166{
170 int status = 0; 167 int status = 0;
171 168
172 DBC_REQUIRE(refs > 0);
173 /* Delete all DMM tables */ 169 /* Delete all DMM tables */
174 if (dmm_mgr) 170 if (dmm_mgr)
175 vfree(virtual_mapping_table); 171 vfree(virtual_mapping_table);
@@ -186,7 +182,6 @@ int dmm_delete_tables(struct dmm_object *dmm_mgr)
186 */ 182 */
187void dmm_exit(void) 183void dmm_exit(void)
188{ 184{
189 DBC_REQUIRE(refs > 0);
190 185
191 refs--; 186 refs--;
192} 187}
@@ -202,8 +197,6 @@ int dmm_get_handle(void *hprocessor, struct dmm_object **dmm_manager)
202 int status = 0; 197 int status = 0;
203 struct dev_object *hdev_obj; 198 struct dev_object *hdev_obj;
204 199
205 DBC_REQUIRE(refs > 0);
206 DBC_REQUIRE(dmm_manager != NULL);
207 if (hprocessor != NULL) 200 if (hprocessor != NULL)
208 status = proc_get_dev_object(hprocessor, &hdev_obj); 201 status = proc_get_dev_object(hprocessor, &hdev_obj);
209 else 202 else
@@ -224,13 +217,9 @@ bool dmm_init(void)
224{ 217{
225 bool ret = true; 218 bool ret = true;
226 219
227 DBC_REQUIRE(refs >= 0);
228
229 if (ret) 220 if (ret)
230 refs++; 221 refs++;
231 222
232 DBC_ENSURE((ret && (refs > 0)) || (!ret && (refs >= 0)));
233
234 virtual_mapping_table = NULL; 223 virtual_mapping_table = NULL;
235 table_size = 0; 224 table_size = 0;
236 225
diff --git a/drivers/staging/tidspbridge/pmgr/dspapi.c b/drivers/staging/tidspbridge/pmgr/dspapi.c
index 767ffe270ed..27c14a577dc 100644
--- a/drivers/staging/tidspbridge/pmgr/dspapi.c
+++ b/drivers/staging/tidspbridge/pmgr/dspapi.c
@@ -266,7 +266,6 @@ err:
266 */ 266 */
267void api_exit(void) 267void api_exit(void)
268{ 268{
269 DBC_REQUIRE(api_c_refs > 0);
270 api_c_refs--; 269 api_c_refs--;
271 270
272 if (api_c_refs == 0) { 271 if (api_c_refs == 0) {
@@ -284,7 +283,6 @@ void api_exit(void)
284 rmm_exit(); 283 rmm_exit();
285 drv_exit(); 284 drv_exit();
286 } 285 }
287 DBC_ENSURE(api_c_refs >= 0);
288} 286}
289 287
290/* 288/*
@@ -382,8 +380,6 @@ int api_init_complete2(void)
382 struct drv_data *drv_datap; 380 struct drv_data *drv_datap;
383 u8 dev_type; 381 u8 dev_type;
384 382
385 DBC_REQUIRE(api_c_refs > 0);
386
387 /* Walk the list of DevObjects, get each devnode, and attempting to 383 /* Walk the list of DevObjects, get each devnode, and attempting to
388 * autostart the board. Note that this requires COF loading, which 384 * autostart the board. Note that this requires COF loading, which
389 * requires KFILE. */ 385 * requires KFILE. */
diff --git a/drivers/staging/tidspbridge/pmgr/io.c b/drivers/staging/tidspbridge/pmgr/io.c
index 65245f310f8..bbfe94cb36b 100644
--- a/drivers/staging/tidspbridge/pmgr/io.c
+++ b/drivers/staging/tidspbridge/pmgr/io.c
@@ -50,10 +50,6 @@ int io_create(struct io_mgr **io_man, struct dev_object *hdev_obj,
50 struct io_mgr_ *pio_mgr = NULL; 50 struct io_mgr_ *pio_mgr = NULL;
51 int status = 0; 51 int status = 0;
52 52
53 DBC_REQUIRE(refs > 0);
54 DBC_REQUIRE(io_man != NULL);
55 DBC_REQUIRE(mgr_attrts != NULL);
56
57 *io_man = NULL; 53 *io_man = NULL;
58 54
59 /* A memory base of 0 implies no memory base: */ 55 /* A memory base of 0 implies no memory base: */
@@ -94,8 +90,6 @@ int io_destroy(struct io_mgr *hio_mgr)
94 struct io_mgr_ *pio_mgr = (struct io_mgr_ *)hio_mgr; 90 struct io_mgr_ *pio_mgr = (struct io_mgr_ *)hio_mgr;
95 int status; 91 int status;
96 92
97 DBC_REQUIRE(refs > 0);
98
99 intf_fxns = pio_mgr->intf_fxns; 93 intf_fxns = pio_mgr->intf_fxns;
100 94
101 /* Let Bridge channel module destroy the io_mgr: */ 95 /* Let Bridge channel module destroy the io_mgr: */
@@ -111,11 +105,7 @@ int io_destroy(struct io_mgr *hio_mgr)
111 */ 105 */
112void io_exit(void) 106void io_exit(void)
113{ 107{
114 DBC_REQUIRE(refs > 0);
115
116 refs--; 108 refs--;
117
118 DBC_ENSURE(refs >= 0);
119} 109}
120 110
121/* 111/*
@@ -127,12 +117,8 @@ bool io_init(void)
127{ 117{
128 bool ret = true; 118 bool ret = true;
129 119
130 DBC_REQUIRE(refs >= 0);
131
132 if (ret) 120 if (ret)
133 refs++; 121 refs++;
134 122
135 DBC_ENSURE((ret && (refs > 0)) || (!ret && (refs >= 0)));
136
137 return ret; 123 return ret;
138} 124}
diff --git a/drivers/staging/tidspbridge/pmgr/msg.c b/drivers/staging/tidspbridge/pmgr/msg.c
index a6916039eed..150026dfc74 100644
--- a/drivers/staging/tidspbridge/pmgr/msg.c
+++ b/drivers/staging/tidspbridge/pmgr/msg.c
@@ -53,11 +53,6 @@ int msg_create(struct msg_mgr **msg_man,
53 struct msg_mgr *hmsg_mgr; 53 struct msg_mgr *hmsg_mgr;
54 int status = 0; 54 int status = 0;
55 55
56 DBC_REQUIRE(refs > 0);
57 DBC_REQUIRE(msg_man != NULL);
58 DBC_REQUIRE(msg_callback != NULL);
59 DBC_REQUIRE(hdev_obj != NULL);
60
61 *msg_man = NULL; 56 *msg_man = NULL;
62 57
63 dev_get_intf_fxns(hdev_obj, &intf_fxns); 58 dev_get_intf_fxns(hdev_obj, &intf_fxns);
@@ -90,8 +85,6 @@ void msg_delete(struct msg_mgr *hmsg_mgr)
90 struct msg_mgr_ *msg_mgr_obj = (struct msg_mgr_ *)hmsg_mgr; 85 struct msg_mgr_ *msg_mgr_obj = (struct msg_mgr_ *)hmsg_mgr;
91 struct bridge_drv_interface *intf_fxns; 86 struct bridge_drv_interface *intf_fxns;
92 87
93 DBC_REQUIRE(refs > 0);
94
95 if (msg_mgr_obj) { 88 if (msg_mgr_obj) {
96 intf_fxns = msg_mgr_obj->intf_fxns; 89 intf_fxns = msg_mgr_obj->intf_fxns;
97 90
@@ -108,10 +101,7 @@ void msg_delete(struct msg_mgr *hmsg_mgr)
108 */ 101 */
109void msg_exit(void) 102void msg_exit(void)
110{ 103{
111 DBC_REQUIRE(refs > 0);
112 refs--; 104 refs--;
113
114 DBC_ENSURE(refs >= 0);
115} 105}
116 106
117/* 107/*
@@ -119,11 +109,7 @@ void msg_exit(void)
119 */ 109 */
120bool msg_mod_init(void) 110bool msg_mod_init(void)
121{ 111{
122 DBC_REQUIRE(refs >= 0);
123
124 refs++; 112 refs++;
125 113
126 DBC_ENSURE(refs >= 0);
127
128 return true; 114 return true;
129} 115}
diff --git a/drivers/staging/tidspbridge/rmgr/dbdcd.c b/drivers/staging/tidspbridge/rmgr/dbdcd.c
index fda240214cd..792b44363fd 100644
--- a/drivers/staging/tidspbridge/rmgr/dbdcd.c
+++ b/drivers/staging/tidspbridge/rmgr/dbdcd.c
@@ -85,8 +85,6 @@ int dcd_auto_register(struct dcd_manager *hdcd_mgr,
85{ 85{
86 int status = 0; 86 int status = 0;
87 87
88 DBC_REQUIRE(refs > 0);
89
90 if (hdcd_mgr) 88 if (hdcd_mgr)
91 status = dcd_get_objects(hdcd_mgr, sz_coff_path, 89 status = dcd_get_objects(hdcd_mgr, sz_coff_path,
92 (dcd_registerfxn) dcd_register_object, 90 (dcd_registerfxn) dcd_register_object,
@@ -107,8 +105,6 @@ int dcd_auto_unregister(struct dcd_manager *hdcd_mgr,
107{ 105{
108 int status = 0; 106 int status = 0;
109 107
110 DBC_REQUIRE(refs > 0);
111
112 if (hdcd_mgr) 108 if (hdcd_mgr)
113 status = dcd_get_objects(hdcd_mgr, sz_coff_path, 109 status = dcd_get_objects(hdcd_mgr, sz_coff_path,
114 (dcd_registerfxn) dcd_register_object, 110 (dcd_registerfxn) dcd_register_object,
@@ -131,9 +127,6 @@ int dcd_create_manager(char *sz_zl_dll_name,
131 struct dcd_manager *dcd_mgr_obj = NULL; /* DCD Manager pointer */ 127 struct dcd_manager *dcd_mgr_obj = NULL; /* DCD Manager pointer */
132 int status = 0; 128 int status = 0;
133 129
134 DBC_REQUIRE(refs >= 0);
135 DBC_REQUIRE(dcd_mgr);
136
137 status = cod_create(&cod_mgr, sz_zl_dll_name); 130 status = cod_create(&cod_mgr, sz_zl_dll_name);
138 if (status) 131 if (status)
139 goto func_end; 132 goto func_end;
@@ -156,9 +149,6 @@ int dcd_create_manager(char *sz_zl_dll_name,
156 cod_delete(cod_mgr); 149 cod_delete(cod_mgr);
157 } 150 }
158 151
159 DBC_ENSURE((!status) ||
160 ((dcd_mgr_obj == NULL) && (status == -ENOMEM)));
161
162func_end: 152func_end:
163 return status; 153 return status;
164} 154}
@@ -173,8 +163,6 @@ int dcd_destroy_manager(struct dcd_manager *hdcd_mgr)
173 struct dcd_manager *dcd_mgr_obj = hdcd_mgr; 163 struct dcd_manager *dcd_mgr_obj = hdcd_mgr;
174 int status = -EFAULT; 164 int status = -EFAULT;
175 165
176 DBC_REQUIRE(refs >= 0);
177
178 if (hdcd_mgr) { 166 if (hdcd_mgr) {
179 /* Delete the COD manager. */ 167 /* Delete the COD manager. */
180 cod_delete(dcd_mgr_obj->cod_mgr); 168 cod_delete(dcd_mgr_obj->cod_mgr);
@@ -205,10 +193,6 @@ int dcd_enumerate_object(s32 index, enum dsp_dcdobjtype obj_type,
205 struct dcd_key_elem *dcd_key; 193 struct dcd_key_elem *dcd_key;
206 int len; 194 int len;
207 195
208 DBC_REQUIRE(refs >= 0);
209 DBC_REQUIRE(index >= 0);
210 DBC_REQUIRE(uuid_obj != NULL);
211
212 if ((index != 0) && (enum_refs == 0)) { 196 if ((index != 0) && (enum_refs == 0)) {
213 /* 197 /*
214 * If an enumeration is being performed on an index greater 198 * If an enumeration is being performed on an index greater
@@ -294,8 +278,6 @@ int dcd_enumerate_object(s32 index, enum dsp_dcdobjtype obj_type,
294 } 278 }
295 } 279 }
296 280
297 DBC_ENSURE(uuid_obj || (status == -EPERM));
298
299 return status; 281 return status;
300} 282}
301 283
@@ -307,7 +289,6 @@ int dcd_enumerate_object(s32 index, enum dsp_dcdobjtype obj_type,
307void dcd_exit(void) 289void dcd_exit(void)
308{ 290{
309 struct dcd_key_elem *rv, *rv_tmp; 291 struct dcd_key_elem *rv, *rv_tmp;
310 DBC_REQUIRE(refs > 0);
311 292
312 refs--; 293 refs--;
313 if (refs == 0) { 294 if (refs == 0) {
@@ -319,7 +300,6 @@ void dcd_exit(void)
319 } 300 }
320 } 301 }
321 302
322 DBC_ENSURE(refs >= 0);
323} 303}
324 304
325/* 305/*
@@ -333,12 +313,6 @@ int dcd_get_dep_libs(struct dcd_manager *hdcd_mgr,
333{ 313{
334 int status = 0; 314 int status = 0;
335 315
336 DBC_REQUIRE(refs > 0);
337 DBC_REQUIRE(hdcd_mgr);
338 DBC_REQUIRE(uuid_obj != NULL);
339 DBC_REQUIRE(dep_lib_uuids != NULL);
340 DBC_REQUIRE(prstnt_dep_libs != NULL);
341
342 status = 316 status =
343 get_dep_lib_info(hdcd_mgr, uuid_obj, &num_libs, NULL, dep_lib_uuids, 317 get_dep_lib_info(hdcd_mgr, uuid_obj, &num_libs, NULL, dep_lib_uuids,
344 prstnt_dep_libs, phase); 318 prstnt_dep_libs, phase);
@@ -356,12 +330,6 @@ int dcd_get_num_dep_libs(struct dcd_manager *hdcd_mgr,
356{ 330{
357 int status = 0; 331 int status = 0;
358 332
359 DBC_REQUIRE(refs > 0);
360 DBC_REQUIRE(hdcd_mgr);
361 DBC_REQUIRE(num_libs != NULL);
362 DBC_REQUIRE(num_pers_libs != NULL);
363 DBC_REQUIRE(uuid_obj != NULL);
364
365 status = get_dep_lib_info(hdcd_mgr, uuid_obj, num_libs, num_pers_libs, 333 status = get_dep_lib_info(hdcd_mgr, uuid_obj, num_libs, num_pers_libs,
366 NULL, NULL, phase); 334 NULL, NULL, phase);
367 335
@@ -393,10 +361,6 @@ int dcd_get_object_def(struct dcd_manager *hdcd_mgr,
393 u32 dw_key_len; /* Len of REG key. */ 361 u32 dw_key_len; /* Len of REG key. */
394 char sz_obj_type[MAX_INT2CHAR_LENGTH]; /* str. rep. of obj_type. */ 362 char sz_obj_type[MAX_INT2CHAR_LENGTH]; /* str. rep. of obj_type. */
395 363
396 DBC_REQUIRE(refs > 0);
397 DBC_REQUIRE(obj_def != NULL);
398 DBC_REQUIRE(obj_uuid != NULL);
399
400 sz_uuid = kzalloc(MAXUUIDLEN, GFP_KERNEL); 364 sz_uuid = kzalloc(MAXUUIDLEN, GFP_KERNEL);
401 if (!sz_uuid) { 365 if (!sz_uuid) {
402 status = -ENOMEM; 366 status = -ENOMEM;
@@ -553,7 +517,6 @@ int dcd_get_objects(struct dcd_manager *hdcd_mgr,
553 struct dsp_uuid dsp_uuid_obj; 517 struct dsp_uuid dsp_uuid_obj;
554 s32 object_type; 518 s32 object_type;
555 519
556 DBC_REQUIRE(refs > 0);
557 if (!hdcd_mgr) { 520 if (!hdcd_mgr) {
558 status = -EFAULT; 521 status = -EFAULT;
559 goto func_end; 522 goto func_end;
@@ -663,11 +626,6 @@ int dcd_get_library_name(struct dcd_manager *hdcd_mgr,
663 int status = 0; 626 int status = 0;
664 struct dcd_key_elem *dcd_key = NULL; 627 struct dcd_key_elem *dcd_key = NULL;
665 628
666 DBC_REQUIRE(uuid_obj != NULL);
667 DBC_REQUIRE(str_lib_name != NULL);
668 DBC_REQUIRE(buff_size != NULL);
669 DBC_REQUIRE(hdcd_mgr);
670
671 dev_dbg(bridge, "%s: hdcd_mgr %p, uuid_obj %p, str_lib_name %p," 629 dev_dbg(bridge, "%s: hdcd_mgr %p, uuid_obj %p, str_lib_name %p,"
672 " buff_size %p\n", __func__, hdcd_mgr, uuid_obj, str_lib_name, 630 " buff_size %p\n", __func__, hdcd_mgr, uuid_obj, str_lib_name,
673 buff_size); 631 buff_size);
@@ -790,8 +748,6 @@ bool dcd_init(void)
790 bool init_cod; 748 bool init_cod;
791 bool ret = true; 749 bool ret = true;
792 750
793 DBC_REQUIRE(refs >= 0);
794
795 if (refs == 0) { 751 if (refs == 0) {
796 /* Initialize required modules. */ 752 /* Initialize required modules. */
797 init_cod = cod_init(); 753 init_cod = cod_init();
@@ -809,8 +765,6 @@ bool dcd_init(void)
809 if (ret) 765 if (ret)
810 refs++; 766 refs++;
811 767
812 DBC_ENSURE((ret && (refs > 0)) || (!ret && (refs == 0)));
813
814 return ret; 768 return ret;
815} 769}
816 770
@@ -832,15 +786,6 @@ int dcd_register_object(struct dsp_uuid *uuid_obj,
832 char sz_obj_type[MAX_INT2CHAR_LENGTH]; /* str. rep. of obj_type. */ 786 char sz_obj_type[MAX_INT2CHAR_LENGTH]; /* str. rep. of obj_type. */
833 struct dcd_key_elem *dcd_key = NULL; 787 struct dcd_key_elem *dcd_key = NULL;
834 788
835 DBC_REQUIRE(refs > 0);
836 DBC_REQUIRE(uuid_obj != NULL);
837 DBC_REQUIRE((obj_type == DSP_DCDNODETYPE) ||
838 (obj_type == DSP_DCDPROCESSORTYPE) ||
839 (obj_type == DSP_DCDLIBRARYTYPE) ||
840 (obj_type == DSP_DCDCREATELIBTYPE) ||
841 (obj_type == DSP_DCDEXECUTELIBTYPE) ||
842 (obj_type == DSP_DCDDELETELIBTYPE));
843
844 dev_dbg(bridge, "%s: object UUID %p, obj_type %d, szPathName %s\n", 789 dev_dbg(bridge, "%s: object UUID %p, obj_type %d, szPathName %s\n",
845 __func__, uuid_obj, obj_type, psz_path_name); 790 __func__, uuid_obj, obj_type, psz_path_name);
846 791
@@ -987,15 +932,6 @@ int dcd_unregister_object(struct dsp_uuid *uuid_obj,
987{ 932{
988 int status = 0; 933 int status = 0;
989 934
990 DBC_REQUIRE(refs > 0);
991 DBC_REQUIRE(uuid_obj != NULL);
992 DBC_REQUIRE((obj_type == DSP_DCDNODETYPE) ||
993 (obj_type == DSP_DCDPROCESSORTYPE) ||
994 (obj_type == DSP_DCDLIBRARYTYPE) ||
995 (obj_type == DSP_DCDCREATELIBTYPE) ||
996 (obj_type == DSP_DCDEXECUTELIBTYPE) ||
997 (obj_type == DSP_DCDDELETELIBTYPE));
998
999 /* 935 /*
1000 * When dcd_register_object is called with NULL as pathname, 936 * When dcd_register_object is called with NULL as pathname,
1001 * it indicates an unregister object operation. 937 * it indicates an unregister object operation.
@@ -1055,12 +991,6 @@ static int get_attrs_from_buf(char *psz_buf, u32 ul_buf_size,
1055 s32 entry_id; 991 s32 entry_id;
1056#endif 992#endif
1057 993
1058 DBC_REQUIRE(psz_buf != NULL);
1059 DBC_REQUIRE(ul_buf_size != 0);
1060 DBC_REQUIRE((obj_type == DSP_DCDNODETYPE)
1061 || (obj_type == DSP_DCDPROCESSORTYPE));
1062 DBC_REQUIRE(gen_obj != NULL);
1063
1064 switch (obj_type) { 994 switch (obj_type) {
1065 case DSP_DCDNODETYPE: 995 case DSP_DCDNODETYPE:
1066 /* 996 /*
@@ -1082,7 +1012,6 @@ static int get_attrs_from_buf(char *psz_buf, u32 ul_buf_size,
1082 token = strsep(&psz_cur, seps); 1012 token = strsep(&psz_cur, seps);
1083 1013
1084 /* ac_name */ 1014 /* ac_name */
1085 DBC_REQUIRE(token);
1086 token_len = strlen(token); 1015 token_len = strlen(token);
1087 if (token_len > DSP_MAXNAMELEN - 1) 1016 if (token_len > DSP_MAXNAMELEN - 1)
1088 token_len = DSP_MAXNAMELEN - 1; 1017 token_len = DSP_MAXNAMELEN - 1;
@@ -1167,7 +1096,6 @@ static int get_attrs_from_buf(char *psz_buf, u32 ul_buf_size,
1167 token = strsep(&psz_cur, seps); 1096 token = strsep(&psz_cur, seps);
1168 1097
1169 /* char *str_create_phase_fxn */ 1098 /* char *str_create_phase_fxn */
1170 DBC_REQUIRE(token);
1171 token_len = strlen(token); 1099 token_len = strlen(token);
1172 gen_obj->obj_data.node_obj.str_create_phase_fxn = 1100 gen_obj->obj_data.node_obj.str_create_phase_fxn =
1173 kzalloc(token_len + 1, GFP_KERNEL); 1101 kzalloc(token_len + 1, GFP_KERNEL);
@@ -1178,7 +1106,6 @@ static int get_attrs_from_buf(char *psz_buf, u32 ul_buf_size,
1178 token = strsep(&psz_cur, seps); 1106 token = strsep(&psz_cur, seps);
1179 1107
1180 /* char *str_execute_phase_fxn */ 1108 /* char *str_execute_phase_fxn */
1181 DBC_REQUIRE(token);
1182 token_len = strlen(token); 1109 token_len = strlen(token);
1183 gen_obj->obj_data.node_obj.str_execute_phase_fxn = 1110 gen_obj->obj_data.node_obj.str_execute_phase_fxn =
1184 kzalloc(token_len + 1, GFP_KERNEL); 1111 kzalloc(token_len + 1, GFP_KERNEL);
@@ -1189,7 +1116,6 @@ static int get_attrs_from_buf(char *psz_buf, u32 ul_buf_size,
1189 token = strsep(&psz_cur, seps); 1116 token = strsep(&psz_cur, seps);
1190 1117
1191 /* char *str_delete_phase_fxn */ 1118 /* char *str_delete_phase_fxn */
1192 DBC_REQUIRE(token);
1193 token_len = strlen(token); 1119 token_len = strlen(token);
1194 gen_obj->obj_data.node_obj.str_delete_phase_fxn = 1120 gen_obj->obj_data.node_obj.str_delete_phase_fxn =
1195 kzalloc(token_len + 1, GFP_KERNEL); 1121 kzalloc(token_len + 1, GFP_KERNEL);
@@ -1421,12 +1347,6 @@ static int get_dep_lib_info(struct dcd_manager *hdcd_mgr,
1421 u16 dep_libs = 0; 1347 u16 dep_libs = 0;
1422 int status = 0; 1348 int status = 0;
1423 1349
1424 DBC_REQUIRE(refs > 0);
1425
1426 DBC_REQUIRE(hdcd_mgr);
1427 DBC_REQUIRE(num_libs != NULL);
1428 DBC_REQUIRE(uuid_obj != NULL);
1429
1430 /* Initialize to 0 dependent libraries, if only counting number of 1350 /* Initialize to 0 dependent libraries, if only counting number of
1431 * dependent libraries */ 1351 * dependent libraries */
1432 if (!get_uuids) { 1352 if (!get_uuids) {
diff --git a/drivers/staging/tidspbridge/rmgr/disp.c b/drivers/staging/tidspbridge/rmgr/disp.c
index a9aa22f3b4f..04c88a7d019 100644
--- a/drivers/staging/tidspbridge/rmgr/disp.c
+++ b/drivers/staging/tidspbridge/rmgr/disp.c
@@ -96,11 +96,6 @@ int disp_create(struct disp_object **dispatch_obj,
96 int status = 0; 96 int status = 0;
97 u8 dev_type; 97 u8 dev_type;
98 98
99 DBC_REQUIRE(refs > 0);
100 DBC_REQUIRE(dispatch_obj != NULL);
101 DBC_REQUIRE(disp_attrs != NULL);
102 DBC_REQUIRE(hdev_obj != NULL);
103
104 *dispatch_obj = NULL; 99 *dispatch_obj = NULL;
105 100
106 /* Allocate Node Dispatcher object */ 101 /* Allocate Node Dispatcher object */
@@ -168,8 +163,6 @@ func_cont:
168 else 163 else
169 delete_disp(disp_obj); 164 delete_disp(disp_obj);
170 165
171 DBC_ENSURE((status && *dispatch_obj == NULL) ||
172 (!status && *dispatch_obj));
173 return status; 166 return status;
174} 167}
175 168
@@ -179,9 +172,6 @@ func_cont:
179 */ 172 */
180void disp_delete(struct disp_object *disp_obj) 173void disp_delete(struct disp_object *disp_obj)
181{ 174{
182 DBC_REQUIRE(refs > 0);
183 DBC_REQUIRE(disp_obj);
184
185 delete_disp(disp_obj); 175 delete_disp(disp_obj);
186} 176}
187 177
@@ -191,11 +181,7 @@ void disp_delete(struct disp_object *disp_obj)
191 */ 181 */
192void disp_exit(void) 182void disp_exit(void)
193{ 183{
194 DBC_REQUIRE(refs > 0);
195
196 refs--; 184 refs--;
197
198 DBC_ENSURE(refs >= 0);
199} 185}
200 186
201/* 187/*
@@ -206,12 +192,9 @@ bool disp_init(void)
206{ 192{
207 bool ret = true; 193 bool ret = true;
208 194
209 DBC_REQUIRE(refs >= 0);
210
211 if (ret) 195 if (ret)
212 refs++; 196 refs++;
213 197
214 DBC_ENSURE((ret && (refs > 0)) || (!ret && (refs >= 0)));
215 return ret; 198 return ret;
216} 199}
217 200
@@ -227,10 +210,6 @@ int disp_node_change_priority(struct disp_object *disp_obj,
227 struct rms_command *rms_cmd; 210 struct rms_command *rms_cmd;
228 int status = 0; 211 int status = 0;
229 212
230 DBC_REQUIRE(refs > 0);
231 DBC_REQUIRE(disp_obj);
232 DBC_REQUIRE(hnode != NULL);
233
234 /* Send message to RMS to change priority */ 213 /* Send message to RMS to change priority */
235 rms_cmd = (struct rms_command *)(disp_obj->buf); 214 rms_cmd = (struct rms_command *)(disp_obj->buf);
236 rms_cmd->fxn = (rms_word) (rms_fxn); 215 rms_cmd->fxn = (rms_word) (rms_fxn);
@@ -276,12 +255,6 @@ int disp_node_create(struct disp_object *disp_obj,
276 struct dsp_nodeinfo node_info; 255 struct dsp_nodeinfo node_info;
277 u8 dev_type; 256 u8 dev_type;
278 257
279 DBC_REQUIRE(refs > 0);
280 DBC_REQUIRE(disp_obj);
281 DBC_REQUIRE(hnode != NULL);
282 DBC_REQUIRE(node_get_type(hnode) != NODE_DEVICE);
283 DBC_REQUIRE(node_env != NULL);
284
285 status = dev_get_dev_type(disp_obj->dev_obj, &dev_type); 258 status = dev_get_dev_type(disp_obj->dev_obj, &dev_type);
286 259
287 if (status) 260 if (status)
@@ -292,7 +265,6 @@ int disp_node_create(struct disp_object *disp_obj,
292 __func__, dev_type); 265 __func__, dev_type);
293 goto func_end; 266 goto func_end;
294 } 267 }
295 DBC_REQUIRE(pargs != NULL);
296 node_type = node_get_type(hnode); 268 node_type = node_get_type(hnode);
297 node_msg_args = pargs->asa.node_msg_args; 269 node_msg_args = pargs->asa.node_msg_args;
298 max = disp_obj->bufsize_rms; /*Max # of RMS words that can be sent */ 270 max = disp_obj->bufsize_rms; /*Max # of RMS words that can be sent */
@@ -480,10 +452,6 @@ int disp_node_delete(struct disp_object *disp_obj,
480 int status = 0; 452 int status = 0;
481 u8 dev_type; 453 u8 dev_type;
482 454
483 DBC_REQUIRE(refs > 0);
484 DBC_REQUIRE(disp_obj);
485 DBC_REQUIRE(hnode != NULL);
486
487 status = dev_get_dev_type(disp_obj->dev_obj, &dev_type); 455 status = dev_get_dev_type(disp_obj->dev_obj, &dev_type);
488 456
489 if (!status) { 457 if (!status) {
@@ -521,9 +489,6 @@ int disp_node_run(struct disp_object *disp_obj,
521 struct rms_command *rms_cmd; 489 struct rms_command *rms_cmd;
522 int status = 0; 490 int status = 0;
523 u8 dev_type; 491 u8 dev_type;
524 DBC_REQUIRE(refs > 0);
525 DBC_REQUIRE(disp_obj);
526 DBC_REQUIRE(hnode != NULL);
527 492
528 status = dev_get_dev_type(disp_obj->dev_obj, &dev_type); 493 status = dev_get_dev_type(disp_obj->dev_obj, &dev_type);
529 494
@@ -620,7 +585,6 @@ static int fill_stream_def(rms_word *pdw_buf, u32 *ptotal, u32 offset,
620 * 1 from total. 585 * 1 from total.
621 */ 586 */
622 total += sizeof(struct rms_strm_def) / sizeof(rms_word) - 1; 587 total += sizeof(struct rms_strm_def) / sizeof(rms_word) - 1;
623 DBC_REQUIRE(strm_def.sz_device);
624 dw_length = strlen(strm_def.sz_device) + 1; 588 dw_length = strlen(strm_def.sz_device) + 1;
625 589
626 /* Number of RMS_WORDS needed to hold device name */ 590 /* Number of RMS_WORDS needed to hold device name */
@@ -659,8 +623,6 @@ static int send_message(struct disp_object *disp_obj, u32 timeout,
659 struct chnl_ioc chnl_ioc_obj; 623 struct chnl_ioc chnl_ioc_obj;
660 int status = 0; 624 int status = 0;
661 625
662 DBC_REQUIRE(pdw_arg != NULL);
663
664 *pdw_arg = (u32) NULL; 626 *pdw_arg = (u32) NULL;
665 intf_fxns = disp_obj->intf_fxns; 627 intf_fxns = disp_obj->intf_fxns;
666 chnl_obj = disp_obj->chnl_to_dsp; 628 chnl_obj = disp_obj->chnl_to_dsp;
diff --git a/drivers/staging/tidspbridge/rmgr/drv.c b/drivers/staging/tidspbridge/rmgr/drv.c
index db8215f540d..f3bff1bfcc6 100644
--- a/drivers/staging/tidspbridge/rmgr/drv.c
+++ b/drivers/staging/tidspbridge/rmgr/drv.c
@@ -308,9 +308,6 @@ int drv_create(struct drv_object **drv_obj)
308 struct drv_object *pdrv_object = NULL; 308 struct drv_object *pdrv_object = NULL;
309 struct drv_data *drv_datap = dev_get_drvdata(bridge); 309 struct drv_data *drv_datap = dev_get_drvdata(bridge);
310 310
311 DBC_REQUIRE(drv_obj != NULL);
312 DBC_REQUIRE(refs > 0);
313
314 pdrv_object = kzalloc(sizeof(struct drv_object), GFP_KERNEL); 311 pdrv_object = kzalloc(sizeof(struct drv_object), GFP_KERNEL);
315 if (pdrv_object) { 312 if (pdrv_object) {
316 /* Create and Initialize List of device objects */ 313 /* Create and Initialize List of device objects */
@@ -336,7 +333,6 @@ int drv_create(struct drv_object **drv_obj)
336 kfree(pdrv_object); 333 kfree(pdrv_object);
337 } 334 }
338 335
339 DBC_ENSURE(status || pdrv_object);
340 return status; 336 return status;
341} 337}
342 338
@@ -347,11 +343,7 @@ int drv_create(struct drv_object **drv_obj)
347 */ 343 */
348void drv_exit(void) 344void drv_exit(void)
349{ 345{
350 DBC_REQUIRE(refs > 0);
351
352 refs--; 346 refs--;
353
354 DBC_ENSURE(refs >= 0);
355} 347}
356 348
357/* 349/*
@@ -365,9 +357,6 @@ int drv_destroy(struct drv_object *driver_obj)
365 struct drv_object *pdrv_object = (struct drv_object *)driver_obj; 357 struct drv_object *pdrv_object = (struct drv_object *)driver_obj;
366 struct drv_data *drv_datap = dev_get_drvdata(bridge); 358 struct drv_data *drv_datap = dev_get_drvdata(bridge);
367 359
368 DBC_REQUIRE(refs > 0);
369 DBC_REQUIRE(pdrv_object);
370
371 kfree(pdrv_object); 360 kfree(pdrv_object);
372 /* Update the DRV Object in the driver data */ 361 /* Update the DRV Object in the driver data */
373 if (drv_datap) { 362 if (drv_datap) {
@@ -395,10 +384,6 @@ int drv_get_dev_object(u32 index, struct drv_object *hdrv_obj,
395#endif 384#endif
396 struct dev_object *dev_obj; 385 struct dev_object *dev_obj;
397 u32 i; 386 u32 i;
398 DBC_REQUIRE(pdrv_obj);
399 DBC_REQUIRE(device_obj != NULL);
400 DBC_REQUIRE(index >= 0);
401 DBC_REQUIRE(refs > 0);
402 DBC_ASSERT(!(list_empty(&pdrv_obj->dev_list))); 387 DBC_ASSERT(!(list_empty(&pdrv_obj->dev_list)));
403 388
404 dev_obj = (struct dev_object *)drv_get_first_dev_object(); 389 dev_obj = (struct dev_object *)drv_get_first_dev_object();
@@ -532,13 +517,9 @@ int drv_init(void)
532{ 517{
533 s32 ret = 1; /* function return value */ 518 s32 ret = 1; /* function return value */
534 519
535 DBC_REQUIRE(refs >= 0);
536
537 if (ret) 520 if (ret)
538 refs++; 521 refs++;
539 522
540 DBC_ENSURE((ret && (refs > 0)) || (!ret && (refs >= 0)));
541
542 return ret; 523 return ret;
543} 524}
544 525
@@ -552,10 +533,6 @@ int drv_insert_dev_object(struct drv_object *driver_obj,
552{ 533{
553 struct drv_object *pdrv_object = (struct drv_object *)driver_obj; 534 struct drv_object *pdrv_object = (struct drv_object *)driver_obj;
554 535
555 DBC_REQUIRE(refs > 0);
556 DBC_REQUIRE(hdev_obj != NULL);
557 DBC_REQUIRE(pdrv_object);
558
559 list_add_tail((struct list_head *)hdev_obj, &pdrv_object->dev_list); 536 list_add_tail((struct list_head *)hdev_obj, &pdrv_object->dev_list);
560 537
561 return 0; 538 return 0;
@@ -574,12 +551,6 @@ int drv_remove_dev_object(struct drv_object *driver_obj,
574 struct drv_object *pdrv_object = (struct drv_object *)driver_obj; 551 struct drv_object *pdrv_object = (struct drv_object *)driver_obj;
575 struct list_head *cur_elem; 552 struct list_head *cur_elem;
576 553
577 DBC_REQUIRE(refs > 0);
578 DBC_REQUIRE(pdrv_object);
579 DBC_REQUIRE(hdev_obj != NULL);
580
581 DBC_REQUIRE(!list_empty(&pdrv_object->dev_list));
582
583 /* Search list for p_proc_object: */ 554 /* Search list for p_proc_object: */
584 list_for_each(cur_elem, &pdrv_object->dev_list) { 555 list_for_each(cur_elem, &pdrv_object->dev_list) {
585 /* If found, remove it. */ 556 /* If found, remove it. */
@@ -605,9 +576,6 @@ int drv_request_resources(u32 dw_context, u32 *dev_node_strg)
605 struct drv_ext *pszdev_node; 576 struct drv_ext *pszdev_node;
606 struct drv_data *drv_datap = dev_get_drvdata(bridge); 577 struct drv_data *drv_datap = dev_get_drvdata(bridge);
607 578
608 DBC_REQUIRE(dw_context != 0);
609 DBC_REQUIRE(dev_node_strg != NULL);
610
611 /* 579 /*
612 * Allocate memory to hold the string. This will live until 580 * Allocate memory to hold the string. This will live until
613 * it is freed in the Release resources. Update the driver object 581 * it is freed in the Release resources. Update the driver object
@@ -639,10 +607,6 @@ int drv_request_resources(u32 dw_context, u32 *dev_node_strg)
639 *dev_node_strg = 0; 607 *dev_node_strg = 0;
640 } 608 }
641 609
642 DBC_ENSURE((!status && dev_node_strg != NULL &&
643 !list_empty(&pdrv_object->dev_node_string)) ||
644 (status && *dev_node_strg == 0));
645
646 return status; 610 return status;
647} 611}
648 612
@@ -900,8 +864,6 @@ void *mem_alloc_phys_mem(u32 byte_size, u32 align_mask,
900void mem_free_phys_mem(void *virtual_address, u32 physical_address, 864void mem_free_phys_mem(void *virtual_address, u32 physical_address,
901 u32 byte_size) 865 u32 byte_size)
902{ 866{
903 DBC_REQUIRE(virtual_address != NULL);
904
905 if (!ext_phys_mem_pool_enabled) 867 if (!ext_phys_mem_pool_enabled)
906 dma_free_coherent(NULL, byte_size, virtual_address, 868 dma_free_coherent(NULL, byte_size, virtual_address,
907 physical_address); 869 physical_address);
diff --git a/drivers/staging/tidspbridge/rmgr/drv_interface.c b/drivers/staging/tidspbridge/rmgr/drv_interface.c
index 93fc862c79d..34730de45aa 100644
--- a/drivers/staging/tidspbridge/rmgr/drv_interface.c
+++ b/drivers/staging/tidspbridge/rmgr/drv_interface.c
@@ -212,7 +212,6 @@ static long bridge_ioctl(struct file *filp, unsigned int code,
212 u32 retval = 0; 212 u32 retval = 0;
213 union trapped_args buf_in; 213 union trapped_args buf_in;
214 214
215 DBC_REQUIRE(filp != NULL);
216#ifdef CONFIG_TIDSPBRIDGE_RECOVERY 215#ifdef CONFIG_TIDSPBRIDGE_RECOVERY
217 if (recover) { 216 if (recover) {
218 status = -EIO; 217 status = -EIO;
diff --git a/drivers/staging/tidspbridge/rmgr/dspdrv.c b/drivers/staging/tidspbridge/rmgr/dspdrv.c
index 7a6fc737872..5d2576301f7 100644
--- a/drivers/staging/tidspbridge/rmgr/dspdrv.c
+++ b/drivers/staging/tidspbridge/rmgr/dspdrv.c
@@ -102,8 +102,6 @@ func_cont:
102 } else { 102 } else {
103 dev_dbg(bridge, "%s: Failed\n", __func__); 103 dev_dbg(bridge, "%s: Failed\n", __func__);
104 } /* End api_init_complete2 */ 104 } /* End api_init_complete2 */
105 DBC_ENSURE((!status && drv_obj != NULL) ||
106 (status && drv_obj == NULL));
107 *init_status = status; 105 *init_status = status;
108 /* Return the Driver Object */ 106 /* Return the Driver Object */
109 return (u32) drv_obj; 107 return (u32) drv_obj;
diff --git a/drivers/staging/tidspbridge/rmgr/mgr.c b/drivers/staging/tidspbridge/rmgr/mgr.c
index d635c01c015..1dca953e4d6 100644
--- a/drivers/staging/tidspbridge/rmgr/mgr.c
+++ b/drivers/staging/tidspbridge/rmgr/mgr.c
@@ -62,9 +62,6 @@ int mgr_create(struct mgr_object **mgr_obj,
62 struct mgr_object *pmgr_obj = NULL; 62 struct mgr_object *pmgr_obj = NULL;
63 struct drv_data *drv_datap = dev_get_drvdata(bridge); 63 struct drv_data *drv_datap = dev_get_drvdata(bridge);
64 64
65 DBC_REQUIRE(mgr_obj != NULL);
66 DBC_REQUIRE(refs > 0);
67
68 pmgr_obj = kzalloc(sizeof(struct mgr_object), GFP_KERNEL); 65 pmgr_obj = kzalloc(sizeof(struct mgr_object), GFP_KERNEL);
69 if (pmgr_obj) { 66 if (pmgr_obj) {
70 status = dcd_create_manager(ZLDLLNAME, &pmgr_obj->dcd_mgr); 67 status = dcd_create_manager(ZLDLLNAME, &pmgr_obj->dcd_mgr);
@@ -92,7 +89,6 @@ int mgr_create(struct mgr_object **mgr_obj,
92 status = -ENOMEM; 89 status = -ENOMEM;
93 } 90 }
94 91
95 DBC_ENSURE(status || pmgr_obj);
96 return status; 92 return status;
97} 93}
98 94
@@ -106,9 +102,6 @@ int mgr_destroy(struct mgr_object *hmgr_obj)
106 struct mgr_object *pmgr_obj = (struct mgr_object *)hmgr_obj; 102 struct mgr_object *pmgr_obj = (struct mgr_object *)hmgr_obj;
107 struct drv_data *drv_datap = dev_get_drvdata(bridge); 103 struct drv_data *drv_datap = dev_get_drvdata(bridge);
108 104
109 DBC_REQUIRE(refs > 0);
110 DBC_REQUIRE(hmgr_obj);
111
112 /* Free resources */ 105 /* Free resources */
113 if (hmgr_obj->dcd_mgr) 106 if (hmgr_obj->dcd_mgr)
114 dcd_destroy_manager(hmgr_obj->dcd_mgr); 107 dcd_destroy_manager(hmgr_obj->dcd_mgr);
@@ -140,11 +133,6 @@ int mgr_enum_node_info(u32 node_id, struct dsp_ndbprops *pndb_props,
140 struct mgr_object *pmgr_obj = NULL; 133 struct mgr_object *pmgr_obj = NULL;
141 struct drv_data *drv_datap = dev_get_drvdata(bridge); 134 struct drv_data *drv_datap = dev_get_drvdata(bridge);
142 135
143 DBC_REQUIRE(pndb_props != NULL);
144 DBC_REQUIRE(pu_num_nodes != NULL);
145 DBC_REQUIRE(undb_props_size >= sizeof(struct dsp_ndbprops));
146 DBC_REQUIRE(refs > 0);
147
148 *pu_num_nodes = 0; 136 *pu_num_nodes = 0;
149 /* Get the Manager Object from the driver data */ 137 /* Get the Manager Object from the driver data */
150 if (!drv_datap || !drv_datap->mgr_object) { 138 if (!drv_datap || !drv_datap->mgr_object) {
@@ -205,11 +193,6 @@ int mgr_enum_processor_info(u32 processor_id,
205 struct drv_data *drv_datap = dev_get_drvdata(bridge); 193 struct drv_data *drv_datap = dev_get_drvdata(bridge);
206 bool proc_detect = false; 194 bool proc_detect = false;
207 195
208 DBC_REQUIRE(processor_info != NULL);
209 DBC_REQUIRE(pu_num_procs != NULL);
210 DBC_REQUIRE(processor_info_size >= sizeof(struct dsp_processorinfo));
211 DBC_REQUIRE(refs > 0);
212
213 *pu_num_procs = 0; 196 *pu_num_procs = 0;
214 197
215 /* Retrieve the Object handle from the driver data */ 198 /* Retrieve the Object handle from the driver data */
@@ -310,12 +293,9 @@ func_end:
310 */ 293 */
311void mgr_exit(void) 294void mgr_exit(void)
312{ 295{
313 DBC_REQUIRE(refs > 0);
314 refs--; 296 refs--;
315 if (refs == 0) 297 if (refs == 0)
316 dcd_exit(); 298 dcd_exit();
317
318 DBC_ENSURE(refs >= 0);
319} 299}
320 300
321/* 301/*
@@ -328,16 +308,11 @@ int mgr_get_dcd_handle(struct mgr_object *mgr_handle,
328 int status = -EPERM; 308 int status = -EPERM;
329 struct mgr_object *pmgr_obj = (struct mgr_object *)mgr_handle; 309 struct mgr_object *pmgr_obj = (struct mgr_object *)mgr_handle;
330 310
331 DBC_REQUIRE(refs > 0);
332 DBC_REQUIRE(dcd_handle != NULL);
333
334 *dcd_handle = (u32) NULL; 311 *dcd_handle = (u32) NULL;
335 if (pmgr_obj) { 312 if (pmgr_obj) {
336 *dcd_handle = (u32) pmgr_obj->dcd_mgr; 313 *dcd_handle = (u32) pmgr_obj->dcd_mgr;
337 status = 0; 314 status = 0;
338 } 315 }
339 DBC_ENSURE((!status && *dcd_handle != (u32) NULL) ||
340 (status && *dcd_handle == (u32) NULL));
341 316
342 return status; 317 return status;
343} 318}
@@ -351,8 +326,6 @@ bool mgr_init(void)
351 bool ret = true; 326 bool ret = true;
352 bool init_dcd = false; 327 bool init_dcd = false;
353 328
354 DBC_REQUIRE(refs >= 0);
355
356 if (refs == 0) { 329 if (refs == 0) {
357 init_dcd = dcd_init(); /* DCD Module */ 330 init_dcd = dcd_init(); /* DCD Module */
358 331
@@ -363,8 +336,6 @@ bool mgr_init(void)
363 if (ret) 336 if (ret)
364 refs++; 337 refs++;
365 338
366 DBC_ENSURE((ret && (refs > 0)) || (!ret && (refs >= 0)));
367
368 return ret; 339 return ret;
369} 340}
370 341
@@ -380,8 +351,6 @@ int mgr_wait_for_bridge_events(struct dsp_notification **anotifications,
380 struct sync_object *sync_events[MAX_EVENTS]; 351 struct sync_object *sync_events[MAX_EVENTS];
381 u32 i; 352 u32 i;
382 353
383 DBC_REQUIRE(count < MAX_EVENTS);
384
385 for (i = 0; i < count; i++) 354 for (i = 0; i < count; i++)
386 sync_events[i] = anotifications[i]->handle; 355 sync_events[i] = anotifications[i]->handle;
387 356
diff --git a/drivers/staging/tidspbridge/rmgr/nldr.c b/drivers/staging/tidspbridge/rmgr/nldr.c
index 0e70cba15eb..6fb19ef68a8 100644
--- a/drivers/staging/tidspbridge/rmgr/nldr.c
+++ b/drivers/staging/tidspbridge/rmgr/nldr.c
@@ -313,11 +313,6 @@ int nldr_allocate(struct nldr_object *nldr_obj, void *priv_ref,
313 struct nldr_nodeobject *nldr_node_obj = NULL; 313 struct nldr_nodeobject *nldr_node_obj = NULL;
314 int status = 0; 314 int status = 0;
315 315
316 DBC_REQUIRE(refs > 0);
317 DBC_REQUIRE(node_props != NULL);
318 DBC_REQUIRE(nldr_nodeobj != NULL);
319 DBC_REQUIRE(nldr_obj);
320
321 /* Initialize handle in case of failure */ 316 /* Initialize handle in case of failure */
322 *nldr_nodeobj = NULL; 317 *nldr_nodeobj = NULL;
323 /* Allocate node object */ 318 /* Allocate node object */
@@ -398,8 +393,6 @@ int nldr_allocate(struct nldr_object *nldr_obj, void *priv_ref,
398 if (status && nldr_node_obj) 393 if (status && nldr_node_obj)
399 kfree(nldr_node_obj); 394 kfree(nldr_node_obj);
400 395
401 DBC_ENSURE((!status && *nldr_nodeobj)
402 || (status && *nldr_nodeobj == NULL));
403 return status; 396 return status;
404} 397}
405 398
@@ -425,12 +418,6 @@ int nldr_create(struct nldr_object **nldr,
425 struct rmm_segment *rmm_segs = NULL; 418 struct rmm_segment *rmm_segs = NULL;
426 u16 i; 419 u16 i;
427 int status = 0; 420 int status = 0;
428 DBC_REQUIRE(refs > 0);
429 DBC_REQUIRE(nldr != NULL);
430 DBC_REQUIRE(hdev_obj != NULL);
431 DBC_REQUIRE(pattrs != NULL);
432 DBC_REQUIRE(pattrs->ovly != NULL);
433 DBC_REQUIRE(pattrs->write != NULL);
434 421
435 /* Allocate dynamic loader object */ 422 /* Allocate dynamic loader object */
436 nldr_obj = kzalloc(sizeof(struct nldr_object), GFP_KERNEL); 423 nldr_obj = kzalloc(sizeof(struct nldr_object), GFP_KERNEL);
@@ -583,7 +570,6 @@ int nldr_create(struct nldr_object **nldr,
583 *nldr = NULL; 570 *nldr = NULL;
584 } 571 }
585 /* FIXME:Temp. Fix. Must be removed */ 572 /* FIXME:Temp. Fix. Must be removed */
586 DBC_ENSURE((!status && *nldr) || (status && *nldr == NULL));
587 return status; 573 return status;
588} 574}
589 575
@@ -595,8 +581,6 @@ void nldr_delete(struct nldr_object *nldr_obj)
595 struct ovly_sect *ovly_section; 581 struct ovly_sect *ovly_section;
596 struct ovly_sect *next; 582 struct ovly_sect *next;
597 u16 i; 583 u16 i;
598 DBC_REQUIRE(refs > 0);
599 DBC_REQUIRE(nldr_obj);
600 584
601 nldr_obj->ldr_fxns.exit_fxn(); 585 nldr_obj->ldr_fxns.exit_fxn();
602 if (nldr_obj->rmm) 586 if (nldr_obj->rmm)
@@ -649,14 +633,10 @@ void nldr_delete(struct nldr_object *nldr_obj)
649 */ 633 */
650void nldr_exit(void) 634void nldr_exit(void)
651{ 635{
652 DBC_REQUIRE(refs > 0);
653
654 refs--; 636 refs--;
655 637
656 if (refs == 0) 638 if (refs == 0)
657 rmm_exit(); 639 rmm_exit();
658
659 DBC_ENSURE(refs >= 0);
660} 640}
661 641
662/* 642/*
@@ -671,10 +651,6 @@ int nldr_get_fxn_addr(struct nldr_nodeobject *nldr_node_obj,
671 bool status1 = false; 651 bool status1 = false;
672 s32 i = 0; 652 s32 i = 0;
673 struct lib_node root = { NULL, 0, NULL }; 653 struct lib_node root = { NULL, 0, NULL };
674 DBC_REQUIRE(refs > 0);
675 DBC_REQUIRE(nldr_node_obj);
676 DBC_REQUIRE(addr != NULL);
677 DBC_REQUIRE(str_fxn != NULL);
678 654
679 nldr_obj = nldr_node_obj->nldr_obj; 655 nldr_obj = nldr_node_obj->nldr_obj;
680 /* Called from node_create(), node_delete(), or node_run(). */ 656 /* Called from node_create(), node_delete(), or node_run(). */
@@ -760,7 +736,6 @@ int nldr_get_rmm_manager(struct nldr_object *nldr,
760{ 736{
761 int status = 0; 737 int status = 0;
762 struct nldr_object *nldr_obj = nldr; 738 struct nldr_object *nldr_obj = nldr;
763 DBC_REQUIRE(rmm_mgr != NULL);
764 739
765 if (nldr) { 740 if (nldr) {
766 *rmm_mgr = nldr_obj->rmm; 741 *rmm_mgr = nldr_obj->rmm;
@@ -769,8 +744,6 @@ int nldr_get_rmm_manager(struct nldr_object *nldr,
769 status = -EFAULT; 744 status = -EFAULT;
770 } 745 }
771 746
772 DBC_ENSURE(!status || (rmm_mgr != NULL && *rmm_mgr == NULL));
773
774 return status; 747 return status;
775} 748}
776 749
@@ -780,14 +753,11 @@ int nldr_get_rmm_manager(struct nldr_object *nldr,
780 */ 753 */
781bool nldr_init(void) 754bool nldr_init(void)
782{ 755{
783 DBC_REQUIRE(refs >= 0);
784
785 if (refs == 0) 756 if (refs == 0)
786 rmm_init(); 757 rmm_init();
787 758
788 refs++; 759 refs++;
789 760
790 DBC_ENSURE(refs > 0);
791 return true; 761 return true;
792} 762}
793 763
@@ -801,9 +771,6 @@ int nldr_load(struct nldr_nodeobject *nldr_node_obj,
801 struct dsp_uuid lib_uuid; 771 struct dsp_uuid lib_uuid;
802 int status = 0; 772 int status = 0;
803 773
804 DBC_REQUIRE(refs > 0);
805 DBC_REQUIRE(nldr_node_obj);
806
807 nldr_obj = nldr_node_obj->nldr_obj; 774 nldr_obj = nldr_node_obj->nldr_obj;
808 775
809 if (nldr_node_obj->dynamic) { 776 if (nldr_node_obj->dynamic) {
@@ -863,9 +830,6 @@ int nldr_unload(struct nldr_nodeobject *nldr_node_obj,
863 struct lib_node *root_lib = NULL; 830 struct lib_node *root_lib = NULL;
864 s32 i = 0; 831 s32 i = 0;
865 832
866 DBC_REQUIRE(refs > 0);
867 DBC_REQUIRE(nldr_node_obj);
868
869 if (nldr_node_obj != NULL) { 833 if (nldr_node_obj != NULL) {
870 if (nldr_node_obj->dynamic) { 834 if (nldr_node_obj->dynamic) {
871 if (*nldr_node_obj->phase_split) { 835 if (*nldr_node_obj->phase_split) {
@@ -929,7 +893,6 @@ static int add_ovly_info(void *handle, struct dbll_sect_info *sect_info,
929 /* Find the node it belongs to */ 893 /* Find the node it belongs to */
930 for (i = 0; i < nldr_obj->ovly_nodes; i++) { 894 for (i = 0; i < nldr_obj->ovly_nodes; i++) {
931 node_name = nldr_obj->ovly_table[i].node_name; 895 node_name = nldr_obj->ovly_table[i].node_name;
932 DBC_REQUIRE(node_name);
933 if (strncmp(node_name, sect_name + 1, strlen(node_name)) == 0) { 896 if (strncmp(node_name, sect_name + 1, strlen(node_name)) == 0) {
934 /* Found the node */ 897 /* Found the node */
935 break; 898 break;
@@ -1018,8 +981,6 @@ static int add_ovly_node(struct dsp_uuid *uuid_obj,
1018 /* Add node to table */ 981 /* Add node to table */
1019 nldr_obj->ovly_table[nldr_obj->ovly_nid].uuid = 982 nldr_obj->ovly_table[nldr_obj->ovly_nid].uuid =
1020 *uuid_obj; 983 *uuid_obj;
1021 DBC_REQUIRE(obj_def.obj_data.node_obj.ndb_props.
1022 ac_name);
1023 len = 984 len =
1024 strlen(obj_def.obj_data.node_obj.ndb_props.ac_name); 985 strlen(obj_def.obj_data.node_obj.ndb_props.ac_name);
1025 node_name = obj_def.obj_data.node_obj.ndb_props.ac_name; 986 node_name = obj_def.obj_data.node_obj.ndb_props.ac_name;
@@ -1623,9 +1584,6 @@ static int remote_alloc(void **ref, u16 mem_sect, u32 size,
1623 struct rmm_addr *rmm_addr_obj = (struct rmm_addr *)dsp_address; 1584 struct rmm_addr *rmm_addr_obj = (struct rmm_addr *)dsp_address;
1624 bool mem_load_req = false; 1585 bool mem_load_req = false;
1625 int status = -ENOMEM; /* Set to fail */ 1586 int status = -ENOMEM; /* Set to fail */
1626 DBC_REQUIRE(hnode);
1627 DBC_REQUIRE(mem_sect == DBLL_CODE || mem_sect == DBLL_DATA ||
1628 mem_sect == DBLL_BSS);
1629 nldr_obj = hnode->nldr_obj; 1587 nldr_obj = hnode->nldr_obj;
1630 rmm = nldr_obj->rmm; 1588 rmm = nldr_obj->rmm;
1631 /* Convert size to DSP words */ 1589 /* Convert size to DSP words */
@@ -1736,8 +1694,6 @@ static int remote_free(void **ref, u16 space, u32 dsp_address,
1736 u32 word_size; 1694 u32 word_size;
1737 int status = -ENOMEM; /* Set to fail */ 1695 int status = -ENOMEM; /* Set to fail */
1738 1696
1739 DBC_REQUIRE(nldr_obj);
1740
1741 rmm = nldr_obj->rmm; 1697 rmm = nldr_obj->rmm;
1742 1698
1743 /* Convert size to DSP words */ 1699 /* Convert size to DSP words */
@@ -1897,9 +1853,6 @@ int nldr_find_addr(struct nldr_nodeobject *nldr_node, u32 sym_addr,
1897 bool status1 = false; 1853 bool status1 = false;
1898 s32 i = 0; 1854 s32 i = 0;
1899 struct lib_node root = { NULL, 0, NULL }; 1855 struct lib_node root = { NULL, 0, NULL };
1900 DBC_REQUIRE(refs > 0);
1901 DBC_REQUIRE(offset_output != NULL);
1902 DBC_REQUIRE(sym_name != NULL);
1903 pr_debug("%s(0x%x, 0x%x, 0x%x, 0x%x, %s)\n", __func__, (u32) nldr_node, 1856 pr_debug("%s(0x%x, 0x%x, 0x%x, 0x%x, %s)\n", __func__, (u32) nldr_node,
1904 sym_addr, offset_range, (u32) offset_output, sym_name); 1857 sym_addr, offset_range, (u32) offset_output, sym_name);
1905 1858
diff --git a/drivers/staging/tidspbridge/rmgr/node.c b/drivers/staging/tidspbridge/rmgr/node.c
index 5dadaa445ad..d23d1d07d67 100644
--- a/drivers/staging/tidspbridge/rmgr/node.c
+++ b/drivers/staging/tidspbridge/rmgr/node.c
@@ -326,11 +326,6 @@ int node_allocate(struct proc_object *hprocessor,
326 326
327 void *node_res; 327 void *node_res;
328 328
329 DBC_REQUIRE(refs > 0);
330 DBC_REQUIRE(hprocessor != NULL);
331 DBC_REQUIRE(noderes != NULL);
332 DBC_REQUIRE(node_uuid != NULL);
333
334 *noderes = NULL; 329 *noderes = NULL;
335 330
336 status = proc_get_processor_id(hprocessor, &proc_id); 331 status = proc_get_processor_id(hprocessor, &proc_id);
@@ -673,7 +668,6 @@ func_cont:
673 drv_proc_node_update_heap_status(node_res, true); 668 drv_proc_node_update_heap_status(node_res, true);
674 drv_proc_node_update_status(node_res, true); 669 drv_proc_node_update_status(node_res, true);
675 } 670 }
676 DBC_ENSURE((status && *noderes == NULL) || (!status && *noderes));
677func_end: 671func_end:
678 dev_dbg(bridge, "%s: hprocessor: %p pNodeId: %p pargs: %p attr_in: %p " 672 dev_dbg(bridge, "%s: hprocessor: %p pNodeId: %p pargs: %p attr_in: %p "
679 "node_res: %p status: 0x%x\n", __func__, hprocessor, 673 "node_res: %p status: 0x%x\n", __func__, hprocessor,
@@ -696,11 +690,6 @@ DBAPI node_alloc_msg_buf(struct node_object *hnode, u32 usize,
696 bool set_info; 690 bool set_info;
697 u32 proc_id; 691 u32 proc_id;
698 692
699 DBC_REQUIRE(refs > 0);
700 DBC_REQUIRE(pbuffer != NULL);
701
702 DBC_REQUIRE(usize > 0);
703
704 if (!pnode) 693 if (!pnode)
705 status = -EFAULT; 694 status = -EFAULT;
706 else if (node_get_type(pnode) == NODE_DEVICE) 695 else if (node_get_type(pnode) == NODE_DEVICE)
@@ -782,8 +771,6 @@ int node_change_priority(struct node_object *hnode, s32 prio)
782 int status = 0; 771 int status = 0;
783 u32 proc_id; 772 u32 proc_id;
784 773
785 DBC_REQUIRE(refs > 0);
786
787 if (!hnode || !hnode->node_mgr) { 774 if (!hnode || !hnode->node_mgr) {
788 status = -EFAULT; 775 status = -EFAULT;
789 } else { 776 } else {
@@ -854,7 +841,6 @@ int node_connect(struct node_object *node1, u32 stream1,
854 s8 chnl_mode; 841 s8 chnl_mode;
855 u32 dw_length; 842 u32 dw_length;
856 int status = 0; 843 int status = 0;
857 DBC_REQUIRE(refs > 0);
858 844
859 if (!node1 || !node2) 845 if (!node1 || !node2)
860 return -EFAULT; 846 return -EFAULT;
@@ -1139,7 +1125,6 @@ int node_create(struct node_object *hnode)
1139 omap_dspbridge_dev->dev.platform_data; 1125 omap_dspbridge_dev->dev.platform_data;
1140#endif 1126#endif
1141 1127
1142 DBC_REQUIRE(refs > 0);
1143 if (!pnode) { 1128 if (!pnode) {
1144 status = -EFAULT; 1129 status = -EFAULT;
1145 goto func_end; 1130 goto func_end;
@@ -1291,10 +1276,6 @@ int node_create_mgr(struct node_mgr **node_man,
1291 int status = 0; 1276 int status = 0;
1292 u8 dev_type; 1277 u8 dev_type;
1293 1278
1294 DBC_REQUIRE(refs > 0);
1295 DBC_REQUIRE(node_man != NULL);
1296 DBC_REQUIRE(hdev_obj != NULL);
1297
1298 *node_man = NULL; 1279 *node_man = NULL;
1299 /* Allocate Node manager object */ 1280 /* Allocate Node manager object */
1300 node_mgr_obj = kzalloc(sizeof(struct node_mgr), GFP_KERNEL); 1281 node_mgr_obj = kzalloc(sizeof(struct node_mgr), GFP_KERNEL);
@@ -1375,8 +1356,6 @@ int node_create_mgr(struct node_mgr **node_man,
1375 1356
1376 *node_man = node_mgr_obj; 1357 *node_man = node_mgr_obj;
1377 1358
1378 DBC_ENSURE((status && *node_man == NULL) || (!status && *node_man));
1379
1380 return status; 1359 return status;
1381out_err: 1360out_err:
1382 delete_node_mgr(node_mgr_obj); 1361 delete_node_mgr(node_mgr_obj);
@@ -1409,7 +1388,6 @@ int node_delete(struct node_res_object *noderes,
1409 void *node_res = noderes; 1388 void *node_res = noderes;
1410 1389
1411 struct dsp_processorstate proc_state; 1390 struct dsp_processorstate proc_state;
1412 DBC_REQUIRE(refs > 0);
1413 1391
1414 if (!pnode) { 1392 if (!pnode) {
1415 status = -EFAULT; 1393 status = -EFAULT;
@@ -1554,8 +1532,6 @@ func_end:
1554 */ 1532 */
1555int node_delete_mgr(struct node_mgr *hnode_mgr) 1533int node_delete_mgr(struct node_mgr *hnode_mgr)
1556{ 1534{
1557 DBC_REQUIRE(refs > 0);
1558
1559 if (!hnode_mgr) 1535 if (!hnode_mgr)
1560 return -EFAULT; 1536 return -EFAULT;
1561 1537
@@ -1576,10 +1552,6 @@ int node_enum_nodes(struct node_mgr *hnode_mgr, void **node_tab,
1576 struct node_object *hnode; 1552 struct node_object *hnode;
1577 u32 i = 0; 1553 u32 i = 0;
1578 int status = 0; 1554 int status = 0;
1579 DBC_REQUIRE(refs > 0);
1580 DBC_REQUIRE(node_tab != NULL || node_tab_size == 0);
1581 DBC_REQUIRE(pu_num_nodes != NULL);
1582 DBC_REQUIRE(pu_allocated != NULL);
1583 1555
1584 if (!hnode_mgr) { 1556 if (!hnode_mgr) {
1585 status = -EFAULT; 1557 status = -EFAULT;
@@ -1611,11 +1583,7 @@ func_end:
1611 */ 1583 */
1612void node_exit(void) 1584void node_exit(void)
1613{ 1585{
1614 DBC_REQUIRE(refs > 0);
1615
1616 refs--; 1586 refs--;
1617
1618 DBC_ENSURE(refs >= 0);
1619} 1587}
1620 1588
1621/* 1589/*
@@ -1629,10 +1597,6 @@ int node_free_msg_buf(struct node_object *hnode, u8 * pbuffer,
1629 struct node_object *pnode = (struct node_object *)hnode; 1597 struct node_object *pnode = (struct node_object *)hnode;
1630 int status = 0; 1598 int status = 0;
1631 u32 proc_id; 1599 u32 proc_id;
1632 DBC_REQUIRE(refs > 0);
1633 DBC_REQUIRE(pbuffer != NULL);
1634 DBC_REQUIRE(pnode != NULL);
1635 DBC_REQUIRE(pnode->xlator != NULL);
1636 1600
1637 if (!hnode) { 1601 if (!hnode) {
1638 status = -EFAULT; 1602 status = -EFAULT;
@@ -1669,9 +1633,6 @@ int node_get_attr(struct node_object *hnode,
1669 struct dsp_nodeattr *pattr, u32 attr_size) 1633 struct dsp_nodeattr *pattr, u32 attr_size)
1670{ 1634{
1671 struct node_mgr *hnode_mgr; 1635 struct node_mgr *hnode_mgr;
1672 DBC_REQUIRE(refs > 0);
1673 DBC_REQUIRE(pattr != NULL);
1674 DBC_REQUIRE(attr_size >= sizeof(struct dsp_nodeattr));
1675 1636
1676 if (!hnode) 1637 if (!hnode)
1677 return -EFAULT; 1638 return -EFAULT;
@@ -1713,9 +1674,6 @@ int node_get_channel_id(struct node_object *hnode, u32 dir, u32 index,
1713{ 1674{
1714 enum node_type node_type; 1675 enum node_type node_type;
1715 int status = -EINVAL; 1676 int status = -EINVAL;
1716 DBC_REQUIRE(refs > 0);
1717 DBC_REQUIRE(dir == DSP_TONODE || dir == DSP_FROMNODE);
1718 DBC_REQUIRE(chan_id != NULL);
1719 1677
1720 if (!hnode) { 1678 if (!hnode) {
1721 status = -EFAULT; 1679 status = -EFAULT;
@@ -1761,9 +1719,6 @@ int node_get_message(struct node_object *hnode,
1761 struct dsp_processorstate proc_state; 1719 struct dsp_processorstate proc_state;
1762 struct proc_object *hprocessor; 1720 struct proc_object *hprocessor;
1763 1721
1764 DBC_REQUIRE(refs > 0);
1765 DBC_REQUIRE(message != NULL);
1766
1767 if (!hnode) { 1722 if (!hnode) {
1768 status = -EFAULT; 1723 status = -EFAULT;
1769 goto func_end; 1724 goto func_end;
@@ -1831,14 +1786,12 @@ int node_get_nldr_obj(struct node_mgr *hnode_mgr,
1831{ 1786{
1832 int status = 0; 1787 int status = 0;
1833 struct node_mgr *node_mgr_obj = hnode_mgr; 1788 struct node_mgr *node_mgr_obj = hnode_mgr;
1834 DBC_REQUIRE(nldr_ovlyobj != NULL);
1835 1789
1836 if (!hnode_mgr) 1790 if (!hnode_mgr)
1837 status = -EFAULT; 1791 status = -EFAULT;
1838 else 1792 else
1839 *nldr_ovlyobj = node_mgr_obj->nldr_obj; 1793 *nldr_ovlyobj = node_mgr_obj->nldr_obj;
1840 1794
1841 DBC_ENSURE(!status || (nldr_ovlyobj != NULL && *nldr_ovlyobj == NULL));
1842 return status; 1795 return status;
1843} 1796}
1844 1797
@@ -1852,8 +1805,6 @@ int node_get_strm_mgr(struct node_object *hnode,
1852{ 1805{
1853 int status = 0; 1806 int status = 0;
1854 1807
1855 DBC_REQUIRE(refs > 0);
1856
1857 if (!hnode) 1808 if (!hnode)
1858 status = -EFAULT; 1809 status = -EFAULT;
1859 else 1810 else
@@ -1867,8 +1818,6 @@ int node_get_strm_mgr(struct node_object *hnode,
1867 */ 1818 */
1868enum nldr_loadtype node_get_load_type(struct node_object *hnode) 1819enum nldr_loadtype node_get_load_type(struct node_object *hnode)
1869{ 1820{
1870 DBC_REQUIRE(refs > 0);
1871 DBC_REQUIRE(hnode);
1872 if (!hnode) { 1821 if (!hnode) {
1873 dev_dbg(bridge, "%s: Failed. hnode: %p\n", __func__, hnode); 1822 dev_dbg(bridge, "%s: Failed. hnode: %p\n", __func__, hnode);
1874 return -1; 1823 return -1;
@@ -1884,8 +1833,6 @@ enum nldr_loadtype node_get_load_type(struct node_object *hnode)
1884 */ 1833 */
1885u32 node_get_timeout(struct node_object *hnode) 1834u32 node_get_timeout(struct node_object *hnode)
1886{ 1835{
1887 DBC_REQUIRE(refs > 0);
1888 DBC_REQUIRE(hnode);
1889 if (!hnode) { 1836 if (!hnode) {
1890 dev_dbg(bridge, "%s: failed. hnode: %p\n", __func__, hnode); 1837 dev_dbg(bridge, "%s: failed. hnode: %p\n", __func__, hnode);
1891 return 0; 1838 return 0;
@@ -1921,8 +1868,6 @@ enum node_type node_get_type(struct node_object *hnode)
1921 */ 1868 */
1922bool node_init(void) 1869bool node_init(void)
1923{ 1870{
1924 DBC_REQUIRE(refs >= 0);
1925
1926 refs++; 1871 refs++;
1927 1872
1928 return true; 1873 return true;
@@ -1970,8 +1915,6 @@ int node_pause(struct node_object *hnode)
1970 struct dsp_processorstate proc_state; 1915 struct dsp_processorstate proc_state;
1971 struct proc_object *hprocessor; 1916 struct proc_object *hprocessor;
1972 1917
1973 DBC_REQUIRE(refs > 0);
1974
1975 if (!hnode) { 1918 if (!hnode) {
1976 status = -EFAULT; 1919 status = -EFAULT;
1977 } else { 1920 } else {
@@ -2054,9 +1997,6 @@ int node_put_message(struct node_object *hnode,
2054 struct dsp_processorstate proc_state; 1997 struct dsp_processorstate proc_state;
2055 struct proc_object *hprocessor; 1998 struct proc_object *hprocessor;
2056 1999
2057 DBC_REQUIRE(refs > 0);
2058 DBC_REQUIRE(pmsg != NULL);
2059
2060 if (!hnode) { 2000 if (!hnode) {
2061 status = -EFAULT; 2001 status = -EFAULT;
2062 goto func_end; 2002 goto func_end;
@@ -2146,9 +2086,6 @@ int node_register_notify(struct node_object *hnode, u32 event_mask,
2146 struct bridge_drv_interface *intf_fxns; 2086 struct bridge_drv_interface *intf_fxns;
2147 int status = 0; 2087 int status = 0;
2148 2088
2149 DBC_REQUIRE(refs > 0);
2150 DBC_REQUIRE(hnotification != NULL);
2151
2152 if (!hnode) { 2089 if (!hnode) {
2153 status = -EFAULT; 2090 status = -EFAULT;
2154 } else { 2091 } else {
@@ -2207,8 +2144,6 @@ int node_run(struct node_object *hnode)
2207 struct dsp_processorstate proc_state; 2144 struct dsp_processorstate proc_state;
2208 struct proc_object *hprocessor; 2145 struct proc_object *hprocessor;
2209 2146
2210 DBC_REQUIRE(refs > 0);
2211
2212 if (!hnode) { 2147 if (!hnode) {
2213 status = -EFAULT; 2148 status = -EFAULT;
2214 goto func_end; 2149 goto func_end;
@@ -2326,9 +2261,6 @@ int node_terminate(struct node_object *hnode, int *pstatus)
2326 struct deh_mgr *hdeh_mgr; 2261 struct deh_mgr *hdeh_mgr;
2327 struct dsp_processorstate proc_state; 2262 struct dsp_processorstate proc_state;
2328 2263
2329 DBC_REQUIRE(refs > 0);
2330 DBC_REQUIRE(pstatus != NULL);
2331
2332 if (!hnode || !hnode->node_mgr) { 2264 if (!hnode || !hnode->node_mgr) {
2333 status = -EFAULT; 2265 status = -EFAULT;
2334 goto func_end; 2266 goto func_end;
@@ -2748,9 +2680,6 @@ static int get_fxn_address(struct node_object *hnode, u32 * fxn_addr,
2748 char *pstr_fxn_name = NULL; 2680 char *pstr_fxn_name = NULL;
2749 struct node_mgr *hnode_mgr = hnode->node_mgr; 2681 struct node_mgr *hnode_mgr = hnode->node_mgr;
2750 int status = 0; 2682 int status = 0;
2751 DBC_REQUIRE(node_get_type(hnode) == NODE_TASK ||
2752 node_get_type(hnode) == NODE_DAISSOCKET ||
2753 node_get_type(hnode) == NODE_MESSAGE);
2754 2683
2755 switch (phase) { 2684 switch (phase) {
2756 case CREATEPHASE: 2685 case CREATEPHASE:
@@ -2787,9 +2716,6 @@ void get_node_info(struct node_object *hnode, struct dsp_nodeinfo *node_info)
2787{ 2716{
2788 u32 i; 2717 u32 i;
2789 2718
2790 DBC_REQUIRE(hnode);
2791 DBC_REQUIRE(node_info != NULL);
2792
2793 node_info->cb_struct = sizeof(struct dsp_nodeinfo); 2719 node_info->cb_struct = sizeof(struct dsp_nodeinfo);
2794 node_info->nb_node_database_props = 2720 node_info->nb_node_database_props =
2795 hnode->dcd_props.obj_data.node_obj.ndb_props; 2721 hnode->dcd_props.obj_data.node_obj.ndb_props;
@@ -2848,7 +2774,6 @@ static int get_node_props(struct dcd_manager *hdcd_mgr,
2848 pmsg_args->max_msgs); 2774 pmsg_args->max_msgs);
2849 } else { 2775 } else {
2850 /* Copy device name */ 2776 /* Copy device name */
2851 DBC_REQUIRE(pndb_props->ac_name);
2852 len = strlen(pndb_props->ac_name); 2777 len = strlen(pndb_props->ac_name);
2853 DBC_ASSERT(len < MAXDEVNAMELEN); 2778 DBC_ASSERT(len < MAXDEVNAMELEN);
2854 hnode->str_dev_name = kzalloc(len + 1, GFP_KERNEL); 2779 hnode->str_dev_name = kzalloc(len + 1, GFP_KERNEL);
@@ -2938,10 +2863,6 @@ int node_get_uuid_props(void *hprocessor,
2938 struct dcd_nodeprops dcd_node_props; 2863 struct dcd_nodeprops dcd_node_props;
2939 struct dsp_processorstate proc_state; 2864 struct dsp_processorstate proc_state;
2940 2865
2941 DBC_REQUIRE(refs > 0);
2942 DBC_REQUIRE(hprocessor != NULL);
2943 DBC_REQUIRE(node_uuid != NULL);
2944
2945 if (hprocessor == NULL || node_uuid == NULL) { 2866 if (hprocessor == NULL || node_uuid == NULL) {
2946 status = -EFAULT; 2867 status = -EFAULT;
2947 goto func_end; 2868 goto func_end;
@@ -3063,8 +2984,6 @@ static u32 ovly(void *priv_ref, u32 dsp_run_addr, u32 dsp_load_addr,
3063 /* Function interface to Bridge driver*/ 2984 /* Function interface to Bridge driver*/
3064 struct bridge_drv_interface *intf_fxns; 2985 struct bridge_drv_interface *intf_fxns;
3065 2986
3066 DBC_REQUIRE(hnode);
3067
3068 hnode_mgr = hnode->node_mgr; 2987 hnode_mgr = hnode->node_mgr;
3069 2988
3070 ul_size = ul_num_bytes / hnode_mgr->dsp_word_size; 2989 ul_size = ul_num_bytes / hnode_mgr->dsp_word_size;
@@ -3106,9 +3025,6 @@ static u32 mem_write(void *priv_ref, u32 dsp_add, void *pbuf,
3106 /* Function interface to Bridge driver */ 3025 /* Function interface to Bridge driver */
3107 struct bridge_drv_interface *intf_fxns; 3026 struct bridge_drv_interface *intf_fxns;
3108 3027
3109 DBC_REQUIRE(hnode);
3110 DBC_REQUIRE(mem_space & DBLL_CODE || mem_space & DBLL_DATA);
3111
3112 hnode_mgr = hnode->node_mgr; 3028 hnode_mgr = hnode->node_mgr;
3113 3029
3114 ul_timeout = hnode->timeout; 3030 ul_timeout = hnode->timeout;
diff --git a/drivers/staging/tidspbridge/rmgr/proc.c b/drivers/staging/tidspbridge/rmgr/proc.c
index 242dd139999..4e2f2e450b2 100644
--- a/drivers/staging/tidspbridge/rmgr/proc.c
+++ b/drivers/staging/tidspbridge/rmgr/proc.c
@@ -281,9 +281,6 @@ proc_attach(u32 processor_id,
281 struct drv_data *drv_datap = dev_get_drvdata(bridge); 281 struct drv_data *drv_datap = dev_get_drvdata(bridge);
282 u8 dev_type; 282 u8 dev_type;
283 283
284 DBC_REQUIRE(refs > 0);
285 DBC_REQUIRE(ph_processor != NULL);
286
287 if (pr_ctxt->processor) { 284 if (pr_ctxt->processor) {
288 *ph_processor = pr_ctxt->processor; 285 *ph_processor = pr_ctxt->processor;
289 return status; 286 return status;
@@ -382,10 +379,6 @@ proc_attach(u32 processor_id,
382 kfree(p_proc_object); 379 kfree(p_proc_object);
383 } 380 }
384func_end: 381func_end:
385 DBC_ENSURE((status == -EPERM && *ph_processor == NULL) ||
386 (!status && p_proc_object) ||
387 (status == 0 && p_proc_object));
388
389 return status; 382 return status;
390} 383}
391 384
@@ -445,10 +438,6 @@ int proc_auto_start(struct cfg_devnode *dev_node_obj,
445 struct drv_data *drv_datap = dev_get_drvdata(bridge); 438 struct drv_data *drv_datap = dev_get_drvdata(bridge);
446 u8 dev_type; 439 u8 dev_type;
447 440
448 DBC_REQUIRE(refs > 0);
449 DBC_REQUIRE(dev_node_obj != NULL);
450 DBC_REQUIRE(hdev_obj != NULL);
451
452 /* Create a Dummy PROC Object */ 441 /* Create a Dummy PROC Object */
453 if (!drv_datap || !drv_datap->mgr_object) { 442 if (!drv_datap || !drv_datap->mgr_object) {
454 status = -ENODATA; 443 status = -ENODATA;
@@ -516,8 +505,6 @@ int proc_ctrl(void *hprocessor, u32 dw_cmd, struct dsp_cbdata * arg)
516 struct proc_object *p_proc_object = hprocessor; 505 struct proc_object *p_proc_object = hprocessor;
517 u32 timeout = 0; 506 u32 timeout = 0;
518 507
519 DBC_REQUIRE(refs > 0);
520
521 if (p_proc_object) { 508 if (p_proc_object) {
522 /* intercept PWR deep sleep command */ 509 /* intercept PWR deep sleep command */
523 if (dw_cmd == BRDIOCTL_DEEPSLEEP) { 510 if (dw_cmd == BRDIOCTL_DEEPSLEEP) {
@@ -565,8 +552,6 @@ int proc_detach(struct process_context *pr_ctxt)
565 int status = 0; 552 int status = 0;
566 struct proc_object *p_proc_object = NULL; 553 struct proc_object *p_proc_object = NULL;
567 554
568 DBC_REQUIRE(refs > 0);
569
570 p_proc_object = (struct proc_object *)pr_ctxt->processor; 555 p_proc_object = (struct proc_object *)pr_ctxt->processor;
571 556
572 if (p_proc_object) { 557 if (p_proc_object) {
@@ -607,11 +592,6 @@ int proc_enum_nodes(void *hprocessor, void **node_tab,
607 struct proc_object *p_proc_object = (struct proc_object *)hprocessor; 592 struct proc_object *p_proc_object = (struct proc_object *)hprocessor;
608 struct node_mgr *hnode_mgr = NULL; 593 struct node_mgr *hnode_mgr = NULL;
609 594
610 DBC_REQUIRE(refs > 0);
611 DBC_REQUIRE(node_tab != NULL || node_tab_size == 0);
612 DBC_REQUIRE(pu_num_nodes != NULL);
613 DBC_REQUIRE(pu_allocated != NULL);
614
615 if (p_proc_object) { 595 if (p_proc_object) {
616 if (!(dev_get_node_manager(p_proc_object->dev_obj, 596 if (!(dev_get_node_manager(p_proc_object->dev_obj,
617 &hnode_mgr))) { 597 &hnode_mgr))) {
@@ -768,8 +748,6 @@ int proc_begin_dma(void *hprocessor, void *pmpu_addr, u32 ul_size,
768 struct process_context *pr_ctxt = (struct process_context *) hprocessor; 748 struct process_context *pr_ctxt = (struct process_context *) hprocessor;
769 struct dmm_map_object *map_obj; 749 struct dmm_map_object *map_obj;
770 750
771 DBC_REQUIRE(refs > 0);
772
773 if (!pr_ctxt) { 751 if (!pr_ctxt) {
774 status = -EFAULT; 752 status = -EFAULT;
775 goto err_out; 753 goto err_out;
@@ -810,8 +788,6 @@ int proc_end_dma(void *hprocessor, void *pmpu_addr, u32 ul_size,
810 struct process_context *pr_ctxt = (struct process_context *) hprocessor; 788 struct process_context *pr_ctxt = (struct process_context *) hprocessor;
811 struct dmm_map_object *map_obj; 789 struct dmm_map_object *map_obj;
812 790
813 DBC_REQUIRE(refs > 0);
814
815 if (!pr_ctxt) { 791 if (!pr_ctxt) {
816 status = -EFAULT; 792 status = -EFAULT;
817 goto err_out; 793 goto err_out;
@@ -884,10 +860,6 @@ int proc_get_resource_info(void *hprocessor, u32 resource_type,
884 struct rmm_target_obj *rmm = NULL; 860 struct rmm_target_obj *rmm = NULL;
885 struct io_mgr *hio_mgr = NULL; /* IO manager handle */ 861 struct io_mgr *hio_mgr = NULL; /* IO manager handle */
886 862
887 DBC_REQUIRE(refs > 0);
888 DBC_REQUIRE(resource_info != NULL);
889 DBC_REQUIRE(resource_info_size >= sizeof(struct dsp_resourceinfo));
890
891 if (!p_proc_object) { 863 if (!p_proc_object) {
892 status = -EFAULT; 864 status = -EFAULT;
893 goto func_end; 865 goto func_end;
@@ -947,11 +919,7 @@ func_end:
947 */ 919 */
948void proc_exit(void) 920void proc_exit(void)
949{ 921{
950 DBC_REQUIRE(refs > 0);
951
952 refs--; 922 refs--;
953
954 DBC_ENSURE(refs >= 0);
955} 923}
956 924
957/* 925/*
@@ -966,9 +934,6 @@ int proc_get_dev_object(void *hprocessor,
966 int status = -EPERM; 934 int status = -EPERM;
967 struct proc_object *p_proc_object = (struct proc_object *)hprocessor; 935 struct proc_object *p_proc_object = (struct proc_object *)hprocessor;
968 936
969 DBC_REQUIRE(refs > 0);
970 DBC_REQUIRE(device_obj != NULL);
971
972 if (p_proc_object) { 937 if (p_proc_object) {
973 *device_obj = p_proc_object->dev_obj; 938 *device_obj = p_proc_object->dev_obj;
974 status = 0; 939 status = 0;
@@ -977,9 +942,6 @@ int proc_get_dev_object(void *hprocessor,
977 status = -EFAULT; 942 status = -EFAULT;
978 } 943 }
979 944
980 DBC_ENSURE((!status && *device_obj != NULL) ||
981 (status && *device_obj == NULL));
982
983 return status; 945 return status;
984} 946}
985 947
@@ -996,10 +958,6 @@ int proc_get_state(void *hprocessor,
996 struct proc_object *p_proc_object = (struct proc_object *)hprocessor; 958 struct proc_object *p_proc_object = (struct proc_object *)hprocessor;
997 int brd_status; 959 int brd_status;
998 960
999 DBC_REQUIRE(refs > 0);
1000 DBC_REQUIRE(proc_state_obj != NULL);
1001 DBC_REQUIRE(state_info_size >= sizeof(struct dsp_processorstate));
1002
1003 if (p_proc_object) { 961 if (p_proc_object) {
1004 /* First, retrieve BRD state information */ 962 /* First, retrieve BRD state information */
1005 status = (*p_proc_object->intf_fxns->brd_status) 963 status = (*p_proc_object->intf_fxns->brd_status)
@@ -1063,13 +1021,9 @@ bool proc_init(void)
1063{ 1021{
1064 bool ret = true; 1022 bool ret = true;
1065 1023
1066 DBC_REQUIRE(refs >= 0);
1067
1068 if (ret) 1024 if (ret)
1069 refs++; 1025 refs++;
1070 1026
1071 DBC_ENSURE((ret && (refs > 0)) || (!ret && (refs >= 0)));
1072
1073 return ret; 1027 return ret;
1074} 1028}
1075 1029
@@ -1111,10 +1065,6 @@ int proc_load(void *hprocessor, const s32 argc_index,
1111 omap_dspbridge_dev->dev.platform_data; 1065 omap_dspbridge_dev->dev.platform_data;
1112#endif 1066#endif
1113 1067
1114 DBC_REQUIRE(refs > 0);
1115 DBC_REQUIRE(argc_index > 0);
1116 DBC_REQUIRE(user_args != NULL);
1117
1118#ifdef OPT_LOAD_TIME_INSTRUMENTATION 1068#ifdef OPT_LOAD_TIME_INSTRUMENTATION
1119 do_gettimeofday(&tv1); 1069 do_gettimeofday(&tv1);
1120#endif 1070#endif
@@ -1331,9 +1281,6 @@ func_end:
1331 pr_err("%s: Processor failed to load\n", __func__); 1281 pr_err("%s: Processor failed to load\n", __func__);
1332 proc_stop(p_proc_object); 1282 proc_stop(p_proc_object);
1333 } 1283 }
1334 DBC_ENSURE((!status
1335 && p_proc_object->proc_state == PROC_LOADED)
1336 || status);
1337#ifdef OPT_LOAD_TIME_INSTRUMENTATION 1284#ifdef OPT_LOAD_TIME_INSTRUMENTATION
1338 do_gettimeofday(&tv2); 1285 do_gettimeofday(&tv2);
1339 if (tv2.tv_usec < tv1.tv_usec) { 1286 if (tv2.tv_usec < tv1.tv_usec) {
@@ -1443,9 +1390,6 @@ int proc_register_notify(void *hprocessor, u32 event_mask,
1443 struct proc_object *p_proc_object = (struct proc_object *)hprocessor; 1390 struct proc_object *p_proc_object = (struct proc_object *)hprocessor;
1444 struct deh_mgr *hdeh_mgr; 1391 struct deh_mgr *hdeh_mgr;
1445 1392
1446 DBC_REQUIRE(hnotification != NULL);
1447 DBC_REQUIRE(refs > 0);
1448
1449 /* Check processor handle */ 1393 /* Check processor handle */
1450 if (!p_proc_object) { 1394 if (!p_proc_object) {
1451 status = -EFAULT; 1395 status = -EFAULT;
@@ -1567,7 +1511,6 @@ int proc_start(void *hprocessor)
1567 u32 dw_dsp_addr; /* Loaded code's entry point. */ 1511 u32 dw_dsp_addr; /* Loaded code's entry point. */
1568 int brd_state; 1512 int brd_state;
1569 1513
1570 DBC_REQUIRE(refs > 0);
1571 if (!p_proc_object) { 1514 if (!p_proc_object) {
1572 status = -EFAULT; 1515 status = -EFAULT;
1573 goto func_end; 1516 goto func_end;
@@ -1624,8 +1567,6 @@ func_cont:
1624 } 1567 }
1625 1568
1626func_end: 1569func_end:
1627 DBC_ENSURE((!status && p_proc_object->proc_state ==
1628 PROC_RUNNING) || status);
1629 return status; 1570 return status;
1630} 1571}
1631 1572
@@ -1646,7 +1587,6 @@ int proc_stop(void *hprocessor)
1646 u32 nodes_allocated = 0; 1587 u32 nodes_allocated = 0;
1647 int brd_state; 1588 int brd_state;
1648 1589
1649 DBC_REQUIRE(refs > 0);
1650 if (!p_proc_object) { 1590 if (!p_proc_object) {
1651 status = -EFAULT; 1591 status = -EFAULT;
1652 goto func_end; 1592 goto func_end;
@@ -1822,9 +1762,6 @@ static int proc_monitor(struct proc_object *proc_obj)
1822 struct msg_mgr *hmsg_mgr; 1762 struct msg_mgr *hmsg_mgr;
1823 int brd_state; 1763 int brd_state;
1824 1764
1825 DBC_REQUIRE(refs > 0);
1826 DBC_REQUIRE(proc_obj);
1827
1828 /* This is needed only when Device is loaded when it is 1765 /* This is needed only when Device is loaded when it is
1829 * already 'ACTIVE' */ 1766 * already 'ACTIVE' */
1830 /* Destroy the Node Manager, msg_ctrl Manager */ 1767 /* Destroy the Node Manager, msg_ctrl Manager */
@@ -1845,8 +1782,6 @@ static int proc_monitor(struct proc_object *proc_obj)
1845 DBC_ASSERT(brd_state == BRD_IDLE); 1782 DBC_ASSERT(brd_state == BRD_IDLE);
1846 } 1783 }
1847 1784
1848 DBC_ENSURE((!status && brd_state == BRD_IDLE) ||
1849 status);
1850 return status; 1785 return status;
1851} 1786}
1852 1787
@@ -1880,8 +1815,6 @@ static char **prepend_envp(char **new_envp, char **envp, s32 envp_elems,
1880{ 1815{
1881 char **pp_envp = new_envp; 1816 char **pp_envp = new_envp;
1882 1817
1883 DBC_REQUIRE(new_envp);
1884
1885 /* Prepend new environ var=value string */ 1818 /* Prepend new environ var=value string */
1886 *new_envp++ = sz_var; 1819 *new_envp++ = sz_var;
1887 1820
@@ -1906,9 +1839,6 @@ int proc_notify_clients(void *proc, u32 events)
1906 int status = 0; 1839 int status = 0;
1907 struct proc_object *p_proc_object = (struct proc_object *)proc; 1840 struct proc_object *p_proc_object = (struct proc_object *)proc;
1908 1841
1909 DBC_REQUIRE(p_proc_object);
1910 DBC_REQUIRE(is_valid_proc_event(events));
1911 DBC_REQUIRE(refs > 0);
1912 if (!p_proc_object) { 1842 if (!p_proc_object) {
1913 status = -EFAULT; 1843 status = -EFAULT;
1914 goto func_end; 1844 goto func_end;
@@ -1930,9 +1860,6 @@ int proc_notify_all_clients(void *proc, u32 events)
1930 int status = 0; 1860 int status = 0;
1931 struct proc_object *p_proc_object = (struct proc_object *)proc; 1861 struct proc_object *p_proc_object = (struct proc_object *)proc;
1932 1862
1933 DBC_REQUIRE(is_valid_proc_event(events));
1934 DBC_REQUIRE(refs > 0);
1935
1936 if (!p_proc_object) { 1863 if (!p_proc_object) {
1937 status = -EFAULT; 1864 status = -EFAULT;
1938 goto func_end; 1865 goto func_end;
diff --git a/drivers/staging/tidspbridge/rmgr/rmm.c b/drivers/staging/tidspbridge/rmgr/rmm.c
index f3dc0ddbfac..6b410499c3b 100644
--- a/drivers/staging/tidspbridge/rmgr/rmm.c
+++ b/drivers/staging/tidspbridge/rmgr/rmm.c
@@ -101,12 +101,6 @@ int rmm_alloc(struct rmm_target_obj *target, u32 segid, u32 size,
101 u32 addr; 101 u32 addr;
102 int status = 0; 102 int status = 0;
103 103
104 DBC_REQUIRE(target);
105 DBC_REQUIRE(dsp_address != NULL);
106 DBC_REQUIRE(size > 0);
107 DBC_REQUIRE(reserve || (target->num_segs > 0));
108 DBC_REQUIRE(refs > 0);
109
110 if (!reserve) { 104 if (!reserve) {
111 if (!alloc_block(target, segid, size, align, dsp_address)) { 105 if (!alloc_block(target, segid, size, align, dsp_address)) {
112 status = -ENOMEM; 106 status = -ENOMEM;
@@ -170,9 +164,6 @@ int rmm_create(struct rmm_target_obj **target_obj,
170 s32 i; 164 s32 i;
171 int status = 0; 165 int status = 0;
172 166
173 DBC_REQUIRE(target_obj != NULL);
174 DBC_REQUIRE(num_segs == 0 || seg_tab != NULL);
175
176 /* Allocate DBL target object */ 167 /* Allocate DBL target object */
177 target = kzalloc(sizeof(struct rmm_target_obj), GFP_KERNEL); 168 target = kzalloc(sizeof(struct rmm_target_obj), GFP_KERNEL);
178 169
@@ -235,9 +226,6 @@ func_cont:
235 226
236 } 227 }
237 228
238 DBC_ENSURE((!status && *target_obj)
239 || (status && *target_obj == NULL));
240
241 return status; 229 return status;
242} 230}
243 231
@@ -251,8 +239,6 @@ void rmm_delete(struct rmm_target_obj *target)
251 struct rmm_header *next; 239 struct rmm_header *next;
252 u32 i; 240 u32 i;
253 241
254 DBC_REQUIRE(target);
255
256 kfree(target->seg_tab); 242 kfree(target->seg_tab);
257 243
258 list_for_each_entry_safe(sect, tmp, &target->ovly_list, list_elem) { 244 list_for_each_entry_safe(sect, tmp, &target->ovly_list, list_elem) {
@@ -281,11 +267,7 @@ void rmm_delete(struct rmm_target_obj *target)
281 */ 267 */
282void rmm_exit(void) 268void rmm_exit(void)
283{ 269{
284 DBC_REQUIRE(refs > 0);
285
286 refs--; 270 refs--;
287
288 DBC_ENSURE(refs >= 0);
289} 271}
290 272
291/* 273/*
@@ -297,15 +279,6 @@ bool rmm_free(struct rmm_target_obj *target, u32 segid, u32 dsp_addr, u32 size,
297 struct rmm_ovly_sect *sect, *tmp; 279 struct rmm_ovly_sect *sect, *tmp;
298 bool ret = false; 280 bool ret = false;
299 281
300 DBC_REQUIRE(target);
301
302 DBC_REQUIRE(reserved || segid < target->num_segs);
303 DBC_REQUIRE(reserved || (dsp_addr >= target->seg_tab[segid].base &&
304 (dsp_addr + size) <= (target->seg_tab[segid].
305 base +
306 target->seg_tab[segid].
307 length)));
308
309 /* 282 /*
310 * Free or unreserve memory. 283 * Free or unreserve memory.
311 */ 284 */
@@ -335,8 +308,6 @@ bool rmm_free(struct rmm_target_obj *target, u32 segid, u32 dsp_addr, u32 size,
335 */ 308 */
336bool rmm_init(void) 309bool rmm_init(void)
337{ 310{
338 DBC_REQUIRE(refs >= 0);
339
340 refs++; 311 refs++;
341 312
342 return true; 313 return true;
@@ -354,7 +325,6 @@ bool rmm_stat(struct rmm_target_obj *target, enum dsp_memtype segid,
354 u32 total_free_size = 0; 325 u32 total_free_size = 0;
355 u32 free_blocks = 0; 326 u32 free_blocks = 0;
356 327
357 DBC_REQUIRE(mem_stat_buf != NULL);
358 DBC_ASSERT(target != NULL); 328 DBC_ASSERT(target != NULL);
359 329
360 if ((u32) segid < target->num_segs) { 330 if ((u32) segid < target->num_segs) {
diff --git a/drivers/staging/tidspbridge/rmgr/strm.c b/drivers/staging/tidspbridge/rmgr/strm.c
index 3fae0e9f511..8e2d6493344 100644
--- a/drivers/staging/tidspbridge/rmgr/strm.c
+++ b/drivers/staging/tidspbridge/rmgr/strm.c
@@ -104,9 +104,6 @@ int strm_allocate_buffer(struct strm_res_object *strmres, u32 usize,
104 u32 i; 104 u32 i;
105 struct strm_object *stream_obj = strmres->stream; 105 struct strm_object *stream_obj = strmres->stream;
106 106
107 DBC_REQUIRE(refs > 0);
108 DBC_REQUIRE(ap_buffer != NULL);
109
110 if (stream_obj) { 107 if (stream_obj) {
111 /* 108 /*
112 * Allocate from segment specified at time of stream open. 109 * Allocate from segment specified at time of stream open.
@@ -156,8 +153,6 @@ int strm_close(struct strm_res_object *strmres,
156 int status = 0; 153 int status = 0;
157 struct strm_object *stream_obj = strmres->stream; 154 struct strm_object *stream_obj = strmres->stream;
158 155
159 DBC_REQUIRE(refs > 0);
160
161 if (!stream_obj) { 156 if (!stream_obj) {
162 status = -EFAULT; 157 status = -EFAULT;
163 } else { 158 } else {
@@ -180,9 +175,6 @@ int strm_close(struct strm_res_object *strmres,
180 175
181 idr_remove(pr_ctxt->stream_id, strmres->id); 176 idr_remove(pr_ctxt->stream_id, strmres->id);
182func_end: 177func_end:
183 DBC_ENSURE(status == 0 || status == -EFAULT ||
184 status == -EPIPE || status == -EPERM);
185
186 dev_dbg(bridge, "%s: stream_obj: %p, status 0x%x\n", __func__, 178 dev_dbg(bridge, "%s: stream_obj: %p, status 0x%x\n", __func__,
187 stream_obj, status); 179 stream_obj, status);
188 return status; 180 return status;
@@ -199,10 +191,6 @@ int strm_create(struct strm_mgr **strm_man,
199 struct strm_mgr *strm_mgr_obj; 191 struct strm_mgr *strm_mgr_obj;
200 int status = 0; 192 int status = 0;
201 193
202 DBC_REQUIRE(refs > 0);
203 DBC_REQUIRE(strm_man != NULL);
204 DBC_REQUIRE(dev_obj != NULL);
205
206 *strm_man = NULL; 194 *strm_man = NULL;
207 /* Allocate STRM manager object */ 195 /* Allocate STRM manager object */
208 strm_mgr_obj = kzalloc(sizeof(struct strm_mgr), GFP_KERNEL); 196 strm_mgr_obj = kzalloc(sizeof(struct strm_mgr), GFP_KERNEL);
@@ -226,8 +214,6 @@ int strm_create(struct strm_mgr **strm_man,
226 else 214 else
227 kfree(strm_mgr_obj); 215 kfree(strm_mgr_obj);
228 216
229 DBC_ENSURE((!status && *strm_man) || (status && *strm_man == NULL));
230
231 return status; 217 return status;
232} 218}
233 219
@@ -238,9 +224,6 @@ int strm_create(struct strm_mgr **strm_man,
238 */ 224 */
239void strm_delete(struct strm_mgr *strm_mgr_obj) 225void strm_delete(struct strm_mgr *strm_mgr_obj)
240{ 226{
241 DBC_REQUIRE(refs > 0);
242 DBC_REQUIRE(strm_mgr_obj);
243
244 kfree(strm_mgr_obj); 227 kfree(strm_mgr_obj);
245} 228}
246 229
@@ -251,11 +234,7 @@ void strm_delete(struct strm_mgr *strm_mgr_obj)
251 */ 234 */
252void strm_exit(void) 235void strm_exit(void)
253{ 236{
254 DBC_REQUIRE(refs > 0);
255
256 refs--; 237 refs--;
257
258 DBC_ENSURE(refs >= 0);
259} 238}
260 239
261/* 240/*
@@ -270,9 +249,6 @@ int strm_free_buffer(struct strm_res_object *strmres, u8 ** ap_buffer,
270 u32 i = 0; 249 u32 i = 0;
271 struct strm_object *stream_obj = strmres->stream; 250 struct strm_object *stream_obj = strmres->stream;
272 251
273 DBC_REQUIRE(refs > 0);
274 DBC_REQUIRE(ap_buffer != NULL);
275
276 if (!stream_obj) 252 if (!stream_obj)
277 status = -EFAULT; 253 status = -EFAULT;
278 254
@@ -306,10 +282,6 @@ int strm_get_info(struct strm_object *stream_obj,
306 int status = 0; 282 int status = 0;
307 void *virt_base = NULL; /* NULL if no SM used */ 283 void *virt_base = NULL; /* NULL if no SM used */
308 284
309 DBC_REQUIRE(refs > 0);
310 DBC_REQUIRE(stream_info != NULL);
311 DBC_REQUIRE(stream_info_size >= sizeof(struct stream_info));
312
313 if (!stream_obj) { 285 if (!stream_obj) {
314 status = -EFAULT; 286 status = -EFAULT;
315 } else { 287 } else {
@@ -370,8 +342,6 @@ int strm_idle(struct strm_object *stream_obj, bool flush_data)
370 struct bridge_drv_interface *intf_fxns; 342 struct bridge_drv_interface *intf_fxns;
371 int status = 0; 343 int status = 0;
372 344
373 DBC_REQUIRE(refs > 0);
374
375 if (!stream_obj) { 345 if (!stream_obj) {
376 status = -EFAULT; 346 status = -EFAULT;
377 } else { 347 } else {
@@ -396,13 +366,9 @@ bool strm_init(void)
396{ 366{
397 bool ret = true; 367 bool ret = true;
398 368
399 DBC_REQUIRE(refs >= 0);
400
401 if (ret) 369 if (ret)
402 refs++; 370 refs++;
403 371
404 DBC_ENSURE((ret && (refs > 0)) || (!ret && (refs >= 0)));
405
406 return ret; 372 return ret;
407} 373}
408 374
@@ -418,9 +384,6 @@ int strm_issue(struct strm_object *stream_obj, u8 *pbuf, u32 ul_bytes,
418 int status = 0; 384 int status = 0;
419 void *tmp_buf = NULL; 385 void *tmp_buf = NULL;
420 386
421 DBC_REQUIRE(refs > 0);
422 DBC_REQUIRE(pbuf != NULL);
423
424 if (!stream_obj) { 387 if (!stream_obj) {
425 status = -EFAULT; 388 status = -EFAULT;
426 } else { 389 } else {
@@ -471,9 +434,6 @@ int strm_open(struct node_object *hnode, u32 dir, u32 index,
471 434
472 void *stream_res; 435 void *stream_res;
473 436
474 DBC_REQUIRE(refs > 0);
475 DBC_REQUIRE(strmres != NULL);
476 DBC_REQUIRE(pattr != NULL);
477 *strmres = NULL; 437 *strmres = NULL;
478 if (dir != DSP_TONODE && dir != DSP_FROMNODE) { 438 if (dir != DSP_TONODE && dir != DSP_FROMNODE) {
479 status = -EPERM; 439 status = -EPERM;
@@ -594,12 +554,6 @@ func_cont:
594 (void)delete_strm(strm_obj); 554 (void)delete_strm(strm_obj);
595 } 555 }
596 556
597 /* ensure we return a documented error code */
598 DBC_ENSURE((!status && strm_obj) ||
599 (*strmres == NULL && (status == -EFAULT ||
600 status == -EPERM
601 || status == -EINVAL)));
602
603 dev_dbg(bridge, "%s: hnode: %p dir: 0x%x index: 0x%x pattr: %p " 557 dev_dbg(bridge, "%s: hnode: %p dir: 0x%x index: 0x%x pattr: %p "
604 "strmres: %p status: 0x%x\n", __func__, 558 "strmres: %p status: 0x%x\n", __func__,
605 hnode, dir, index, pattr, strmres, status); 559 hnode, dir, index, pattr, strmres, status);
@@ -619,11 +573,6 @@ int strm_reclaim(struct strm_object *stream_obj, u8 ** buf_ptr,
619 int status = 0; 573 int status = 0;
620 void *tmp_buf = NULL; 574 void *tmp_buf = NULL;
621 575
622 DBC_REQUIRE(refs > 0);
623 DBC_REQUIRE(buf_ptr != NULL);
624 DBC_REQUIRE(nbytes != NULL);
625 DBC_REQUIRE(pdw_arg != NULL);
626
627 if (!stream_obj) { 576 if (!stream_obj) {
628 status = -EFAULT; 577 status = -EFAULT;
629 goto func_end; 578 goto func_end;
@@ -679,11 +628,6 @@ int strm_reclaim(struct strm_object *stream_obj, u8 ** buf_ptr,
679 *buf_ptr = chnl_ioc_obj.buf; 628 *buf_ptr = chnl_ioc_obj.buf;
680 } 629 }
681func_end: 630func_end:
682 /* ensure we return a documented return code */
683 DBC_ENSURE(!status || status == -EFAULT ||
684 status == -ETIME || status == -ESRCH ||
685 status == -EPERM);
686
687 dev_dbg(bridge, "%s: stream_obj: %p buf_ptr: %p nbytes: %p " 631 dev_dbg(bridge, "%s: stream_obj: %p buf_ptr: %p nbytes: %p "
688 "pdw_arg: %p status 0x%x\n", __func__, stream_obj, 632 "pdw_arg: %p status 0x%x\n", __func__, stream_obj,
689 buf_ptr, nbytes, pdw_arg, status); 633 buf_ptr, nbytes, pdw_arg, status);
@@ -702,9 +646,6 @@ int strm_register_notify(struct strm_object *stream_obj, u32 event_mask,
702 struct bridge_drv_interface *intf_fxns; 646 struct bridge_drv_interface *intf_fxns;
703 int status = 0; 647 int status = 0;
704 648
705 DBC_REQUIRE(refs > 0);
706 DBC_REQUIRE(hnotification != NULL);
707
708 if (!stream_obj) { 649 if (!stream_obj) {
709 status = -EFAULT; 650 status = -EFAULT;
710 } else if ((event_mask & ~((DSP_STREAMIOCOMPLETION) | 651 } else if ((event_mask & ~((DSP_STREAMIOCOMPLETION) |
@@ -725,10 +666,7 @@ int strm_register_notify(struct strm_object *stream_obj, u32 event_mask,
725 notify_type, 666 notify_type,
726 hnotification); 667 hnotification);
727 } 668 }
728 /* ensure we return a documented return code */ 669
729 DBC_ENSURE(!status || status == -EFAULT ||
730 status == -ETIME || status == -ESRCH ||
731 status == -ENOSYS || status == -EPERM);
732 return status; 670 return status;
733} 671}
734 672
@@ -747,11 +685,6 @@ int strm_select(struct strm_object **strm_tab, u32 strms,
747 u32 i; 685 u32 i;
748 int status = 0; 686 int status = 0;
749 687
750 DBC_REQUIRE(refs > 0);
751 DBC_REQUIRE(strm_tab != NULL);
752 DBC_REQUIRE(pmask != NULL);
753 DBC_REQUIRE(strms > 0);
754
755 *pmask = 0; 688 *pmask = 0;
756 for (i = 0; i < strms; i++) { 689 for (i = 0; i < strms; i++) {
757 if (!strm_tab[i]) { 690 if (!strm_tab[i]) {
@@ -811,9 +744,6 @@ int strm_select(struct strm_object **strm_tab, u32 strms,
811func_end: 744func_end:
812 kfree(sync_events); 745 kfree(sync_events);
813 746
814 DBC_ENSURE((!status && (*pmask != 0 || utimeout == 0)) ||
815 (status && *pmask == 0));
816
817 return status; 747 return status;
818} 748}
819 749