Changeset 4f87a85a in mainline
- Timestamp:
- 2018-12-10T14:29:35Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ca4c5596
- Parents:
- 433d52f
- git-author:
- Jiri Svoboda <jiri@…> (2018-12-10 07:39:07)
- git-committer:
- Jiri Svoboda <jiri@…> (2018-12-10 14:29:35)
- Location:
- uspace
- Files:
-
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/audio/hdaudio/hdaudio.c
r433d52f r4f87a85a 151 151 { 152 152 ddf_fun_t *fun_pcm = NULL; 153 bool bound = false; 153 154 hda_t *hda = NULL; 154 155 hw_res_list_parsed_t res; … … 299 300 } 300 301 301 ddf_fun_add_to_category(fun_pcm, "audio-pcm"); 302 bound = true; 303 304 rc = ddf_fun_add_to_category(fun_pcm, "audio-pcm"); 305 if (rc != EOK) { 306 ddf_msg(LVL_ERROR, "Failed adding function to audio-pcm category."); 307 goto error; 308 } 302 309 303 310 hw_res_list_parsed_clean(&res); 304 311 return EOK; 305 312 error: 313 if (bound) 314 ddf_fun_unbind(fun_pcm); 306 315 if (fun_pcm != NULL) 307 316 ddf_fun_destroy(fun_pcm); -
uspace/drv/block/ata_bd/main.c
r433d52f r4f87a85a 162 162 ddf_fun_t *fun = NULL; 163 163 ata_fun_t *afun = NULL; 164 bool bound = false; 164 165 165 166 fun_name = ata_fun_name(disk); … … 202 203 } 203 204 204 ddf_fun_add_to_category(fun, "disk"); 205 bound = true; 206 207 rc = ddf_fun_add_to_category(fun, "disk"); 208 if (rc != EOK) { 209 ddf_msg(LVL_ERROR, "Failed adding function %s to " 210 "category 'disk': %s", fun_name, str_error(rc)); 211 goto error; 212 } 205 213 206 214 free(fun_name); … … 208 216 return EOK; 209 217 error: 218 if (bound) 219 ddf_fun_unbind(fun); 210 220 if (fun != NULL) 211 221 ddf_fun_destroy(fun); -
uspace/drv/block/ddisk/ddisk.c
r433d52f r4f87a85a 319 319 errno_t rc; 320 320 ddf_fun_t *fun = NULL; 321 bool bound = false; 321 322 322 323 fun = ddf_fun_create(ddisk->dev, fun_exposed, DDISK_FUN_NAME); … … 337 338 } 338 339 339 ddf_fun_add_to_category(fun, "disk"); 340 bound = true; 341 342 rc = ddf_fun_add_to_category(fun, "disk"); 343 if (rc != EOK) { 344 ddf_msg(LVL_ERROR, "Failed adding function %s to category " 345 "'disk': %s.\n", DDISK_FUN_NAME, str_error(rc)); 346 goto error; 347 } 340 348 ddisk->fun = fun; 341 349 342 350 return EOK; 343 351 error: 352 if (bound) 353 ddf_fun_unbind(fun); 344 354 if (fun != NULL) 345 355 ddf_fun_destroy(fun); -
uspace/drv/block/usbmast/main.c
r433d52f r4f87a85a 223 223 ddf_fun_t *fun = NULL; 224 224 usbmast_fun_t *mfun = NULL; 225 bool bound = false; 225 226 226 227 if (asprintf(&fun_name, "l%u", lun) < 0) { … … 299 300 } 300 301 301 ddf_fun_add_to_category(fun, "disk"); 302 bound = true; 303 304 rc = ddf_fun_add_to_category(fun, "disk"); 305 if (rc != EOK) { 306 usb_log_error("Failed to add function %s to category 'disk': %s.", 307 fun_name, str_error(rc)); 308 goto error; 309 } 302 310 303 311 free(fun_name); … … 308 316 /* Error cleanup */ 309 317 error: 318 if (bound) 319 ddf_fun_unbind(fun); 310 320 if (fun != NULL) 311 321 ddf_fun_destroy(fun); -
uspace/drv/char/msim-con/msim-con.c
r433d52f r4f87a85a 85 85 irq_cmd_t *msim_cmds = NULL; 86 86 errno_t rc; 87 bool bound = false; 87 88 88 89 circ_buf_init(&con->cbuf, con->buf, msim_con_buf_size, 1); … … 143 144 } 144 145 145 ddf_fun_add_to_category(fun, "console"); 146 bound = true; 147 148 rc = ddf_fun_add_to_category(fun, "console"); 149 if (rc != EOK) { 150 ddf_msg(LVL_ERROR, "Error adding function 'a' to category " 151 "'console'."); 152 goto error; 153 } 146 154 147 155 return EOK; … … 149 157 if (CAP_HANDLE_VALID(con->irq_handle)) 150 158 async_irq_unsubscribe(con->irq_handle); 159 if (bound) 160 ddf_fun_unbind(fun); 151 161 if (fun != NULL) 152 162 ddf_fun_destroy(fun); -
uspace/drv/char/ns8250/ns8250.c
r433d52f r4f87a85a 829 829 bool need_cleanup = false; 830 830 bool need_unreg_intr_handler = false; 831 bool bound = false; 831 832 errno_t rc; 832 833 … … 909 910 } 910 911 912 bound = true; 911 913 ns->fun = fun; 912 914 913 ddf_fun_add_to_category(fun, "serial"); 915 rc = ddf_fun_add_to_category(fun, "serial"); 916 if (rc != EOK) { 917 ddf_msg(LVL_ERROR, "Error adding function to category 'serial'."); 918 goto fail; 919 } 914 920 915 921 ddf_msg(LVL_NOTE, "Device %s successfully initialized.", … … 918 924 return EOK; 919 925 fail: 926 if (bound) 927 ddf_fun_unbind(fun); 920 928 if (fun != NULL) 921 929 ddf_fun_destroy(fun); -
uspace/drv/char/ski-con/ski-con.c
r433d52f r4f87a85a 112 112 } 113 113 114 ddf_fun_add_to_category(fun, "console");115 116 114 bound = true; 115 116 rc = ddf_fun_add_to_category(fun, "console"); 117 if (rc != EOK) { 118 ddf_msg(LVL_ERROR, "Error adding function 'a' to category " 119 "'console'."); 120 goto error; 121 } 117 122 118 123 fid = fibril_create(ski_con_fibril, con); -
uspace/drv/char/sun4v-con/sun4v-con.c
r433d52f r4f87a85a 74 74 ddf_fun_t *fun = NULL; 75 75 errno_t rc; 76 bool bound = false; 76 77 77 78 con->res = *res; … … 113 114 } 114 115 115 ddf_fun_add_to_category(fun, "console"); 116 bound = true; 117 118 rc = ddf_fun_add_to_category(fun, "console"); 119 if (rc != EOK) { 120 ddf_msg(LVL_ERROR, "Error adding function 'a' to category " 121 "'console'."); 122 goto error; 123 } 116 124 117 125 return EOK; … … 122 130 if (con->output_buffer != (niagara_output_buffer_t *) AS_AREA_ANY) 123 131 physmem_unmap((void *) con->output_buffer); 132 133 if (bound) 134 ddf_fun_unbind(fun); 124 135 125 136 if (fun != NULL) -
uspace/drv/fb/amdm37x_dispc/main.c
r433d52f r4f87a85a 60 60 ddf_fun_t *fun = ddf_fun_create(dev, fun_exposed, "viz"); 61 61 if (!fun) { 62 ddf_log_error("Failed to create visualizer function \n");62 ddf_log_error("Failed to create visualizer function."); 63 63 return ENOMEM; 64 64 } … … 66 66 visualizer_t *vis = ddf_fun_data_alloc(fun, sizeof(visualizer_t)); 67 67 if (!vis) { 68 ddf_log_error("Failed to allocate visualizer structure \n");68 ddf_log_error("Failed to allocate visualizer structure."); 69 69 ddf_fun_destroy(fun); 70 70 return ENOMEM; … … 79 79 ddf_dev_data_alloc(dev, sizeof(amdm37x_dispc_t)); 80 80 if (!dispc) { 81 ddf_log_error("Failed to allocate dispc structure \n");81 ddf_log_error("Failed to allocate dispc structure."); 82 82 ddf_fun_destroy(fun); 83 83 return ENOMEM; 84 84 } 85 85 86 errno_t r et= amdm37x_dispc_init(dispc, vis);87 if (r et!= EOK) {88 ddf_log_error("Failed to init dispc: %s \n", str_error(ret));86 errno_t rc = amdm37x_dispc_init(dispc, vis); 87 if (rc != EOK) { 88 ddf_log_error("Failed to init dispc: %s.", str_error(rc)); 89 89 ddf_fun_destroy(fun); 90 return r et;90 return rc; 91 91 } 92 92 93 93 /* Bind function */ 94 r et= ddf_fun_bind(fun);95 if (r et!= EOK) {96 ddf_log_error("Failed to bind function: %s \n", str_error(ret));94 rc = ddf_fun_bind(fun); 95 if (rc != EOK) { 96 ddf_log_error("Failed to bind function: %s.", str_error(rc)); 97 97 amdm37x_dispc_fini(dispc); 98 98 ddf_fun_destroy(fun); 99 return r et;99 return rc; 100 100 } 101 ddf_fun_add_to_category(fun, "visualizer");102 101 103 ddf_log_note("Added device `%s'\n", ddf_dev_get_name(dev)); 102 rc = ddf_fun_add_to_category(fun, "visualizer"); 103 if (rc != EOK) { 104 ddf_log_error("Failed to add function: %s to visualizer " 105 "category.", str_error(rc)); 106 amdm37x_dispc_fini(dispc); 107 ddf_fun_unbind(fun); 108 ddf_fun_destroy(fun); 109 return rc; 110 } 111 112 ddf_log_note("Added device `%s'", ddf_dev_get_name(dev)); 104 113 return EOK; 105 114 } -
uspace/drv/fb/kfb/port.c
r433d52f r4f87a85a 348 348 349 349 vs->reg_svc_handle = ddf_fun_get_handle(fun_vs); 350 ddf_fun_add_to_category(fun_vs, "visualizer"); 350 rc = ddf_fun_add_to_category(fun_vs, "visualizer"); 351 if (rc != EOK) { 352 list_remove(&pixel_mode.link); 353 ddf_fun_unbind(fun_vs); 354 ddf_fun_destroy(fun_vs); 355 as_area_destroy(kfb.addr); 356 return rc; 357 } 351 358 352 359 return EOK; -
uspace/drv/intctl/apic/apic.c
r433d52f r4f87a85a 212 212 void *regs; 213 213 errno_t rc; 214 bool bound = false; 214 215 215 216 if ((sysinfo_get_value("apic", &have_apic) != EOK) || (!have_apic)) { … … 241 242 } 242 243 244 bound = true; 245 243 246 rc = ddf_fun_add_to_category(fun_a, "irc"); 244 247 if (rc != EOK) … … 247 250 return EOK; 248 251 error: 252 if (bound) 253 ddf_fun_unbind(fun_a); 249 254 if (fun_a != NULL) 250 255 ddf_fun_destroy(fun_a); -
uspace/drv/intctl/i8259/i8259.c
r433d52f r4f87a85a 142 142 ddf_fun_t *fun_a = NULL; 143 143 errno_t rc; 144 bool bound = false; 144 145 145 146 if ((sysinfo_get_value("i8259", &have_i8259) != EOK) || (!have_i8259)) { … … 174 175 } 175 176 177 bound = true; 178 176 179 rc = ddf_fun_add_to_category(fun_a, "irc"); 177 180 if (rc != EOK) … … 180 183 return EOK; 181 184 error: 185 if (bound) 186 ddf_fun_unbind(fun_a); 182 187 if (fun_a != NULL) 183 188 ddf_fun_destroy(fun_a); -
uspace/drv/intctl/icp-ic/icp-ic.c
r433d52f r4f87a85a 116 116 void *regs; 117 117 errno_t rc; 118 bool bound = false; 118 119 119 120 rc = pio_enable((void *)res->base, sizeof(icpic_regs_t), ®s); … … 146 147 return EOK; 147 148 error: 149 if (bound) 150 ddf_fun_unbind(fun_a); 148 151 if (fun_a != NULL) 149 152 ddf_fun_destroy(fun_a); -
uspace/drv/intctl/obio/obio.c
r433d52f r4f87a85a 118 118 ddf_fun_t *fun_a = NULL; 119 119 errno_t rc; 120 bool bound = false; 120 121 121 122 rc = pio_enable((void *)res->base, OBIO_SIZE, (void **) &obio->regs); … … 149 150 return EOK; 150 151 error: 152 if (bound) 153 ddf_fun_unbind(fun_a); 151 154 if (fun_a != NULL) 152 155 ddf_fun_destroy(fun_a); -
uspace/drv/test/test1/test1.c
r433d52f r4f87a85a 176 176 } 177 177 178 ddf_fun_add_to_category(fun_a, "virtual"); 178 rc = ddf_fun_add_to_category(fun_a, "virtual"); 179 if (rc != EOK) { 180 ddf_msg(LVL_ERROR, "Failed adding function 'a' to category " 181 "'virtual'."); 182 ddf_fun_unbind(fun_a); 183 ddf_fun_destroy(fun_a); 184 goto error; 185 } 179 186 180 187 if (str_cmp(dev_name, "test1") == 0) { -
uspace/drv/test/test2/test2.c
r433d52f r4f87a85a 140 140 rc = ddf_fun_bind(fun_a); 141 141 if (rc != EOK) { 142 ddf_fun_destroy(fun_a); 142 143 ddf_msg(LVL_ERROR, "Failed binding function 'a'."); 143 144 return rc; 144 145 } 145 146 146 ddf_fun_add_to_category(fun_a, "virtual"); 147 rc = ddf_fun_add_to_category(fun_a, "virtual"); 148 if (rc != EOK) { 149 ddf_fun_unbind(fun_a); 150 ddf_fun_destroy(fun_a); 151 ddf_msg(LVL_ERROR, "Failed adding function 'a' to category " 152 "'virtual'."); 153 return rc; 154 } 155 147 156 test2->fun_a = fun_a; 148 157 -
uspace/drv/test/test3/test3.c
r433d52f r4f87a85a 70 70 errno_t rc; 71 71 char *fun_name = NULL; 72 bool bound = false; 72 73 73 74 if (asprintf(&fun_name, "%s%zu", base_name, index) < 0) { … … 91 92 } 92 93 93 ddf_fun_add_to_category(fun, class_name); 94 bound = true; 95 96 rc = ddf_fun_add_to_category(fun, class_name); 97 if (rc != EOK) { 98 ddf_msg(LVL_ERROR, "Failed addning function %s to category %s: " 99 "%s", fun_name, class_name, str_error(rc)); 100 goto leave; 101 } 94 102 95 103 ddf_msg(LVL_NOTE, "Registered exposed function `%s'.", fun_name); … … 98 106 free(fun_name); 99 107 108 if (bound) 109 ddf_fun_unbind(fun); 100 110 if ((rc != EOK) && (fun != NULL)) { 101 111 ddf_fun_destroy(fun); -
uspace/drv/time/cmos-rtc/cmos-rtc.c
r433d52f r4f87a85a 588 588 errno_t rc; 589 589 bool need_cleanup = false; 590 bool bound = false; 590 591 591 592 ddf_msg(LVL_DEBUG, "rtc_dev_add %s (handle = %d)", … … 624 625 } 625 626 627 bound = true; 626 628 rtc->fun = fun; 627 629 628 ddf_fun_add_to_category(fun, "clock"); 630 rc = ddf_fun_add_to_category(fun, "clock"); 631 if (rc != EOK) { 632 ddf_msg(LVL_ERROR, "Failed adding service to clock category."); 633 goto error; 634 } 629 635 630 636 ddf_msg(LVL_NOTE, "Device %s successfully initialized", … … 634 640 635 641 error: 642 if (bound) 643 ddf_fun_unbind(fun); 636 644 if (fun) 637 645 ddf_fun_destroy(fun); … … 754 762 755 763 rc = ddf_fun_online(fun); 756 if (rc == EOK) 757 ddf_fun_add_to_category(fun, "clock"); 764 if (rc == EOK) { 765 // XXX This should be probably handled by the framework 766 rc = ddf_fun_add_to_category(fun, "clock"); 767 } 758 768 759 769 return rc; -
uspace/lib/ieee80211/src/ieee80211.c
r433d52f r4f87a85a 803 803 if (rc != EOK) { 804 804 ddf_fun_unbind(fun); 805 ddf_fun_destroy(fun); 805 806 return rc; 806 807 } … … 809 810 if (rc != EOK) { 810 811 ddf_fun_unbind(fun); 812 ddf_fun_destroy(fun); 811 813 return rc; 812 814 }
Note:
See TracChangeset
for help on using the changeset viewer.