Changeset c5be39b in mainline
- Timestamp:
- 2011-08-29T21:53:18Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 5f6e25e
- Parents:
- bfe7867
- Location:
- uspace
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/test/test1/test1.c
rbfe7867 rc5be39b 148 148 dev->name, (int) dev->handle); 149 149 150 test1 = calloc(1, sizeof(test1_t));150 test1 = ddf_dev_data_alloc(dev, sizeof(test1_t)); 151 151 if (test1 == NULL) { 152 ddf_msg(LVL_ERROR, "Failed allocating soft state.\n");152 ddf_msg(LVL_ERROR, "Failed allocating soft state.\n"); 153 153 return ENOMEM; 154 154 } … … 159 159 return ENOMEM; 160 160 } 161 162 test1->fun_a = fun_a; 161 163 162 164 rc = ddf_fun_bind(fun_a); … … 187 189 ddf_msg(LVL_DEBUG, "Device `%s' accepted.", dev->name); 188 190 189 test1->fun_a = fun_a;190 dev->driver_data = test1;191 191 return EOK; 192 192 } -
uspace/lib/drv/generic/driver.c
rbfe7867 rc5be39b 699 699 } 700 700 701 /** Allocate driver-specific device data. */ 702 extern void *ddf_dev_data_alloc(ddf_dev_t *dev, size_t size) 703 { 704 void *data; 705 706 assert(dev->driver_data == NULL); 707 708 data = calloc(1, size); 709 if (data == NULL) 710 return NULL; 711 712 dev->driver_data = data; 713 return data; 714 } 715 701 716 /** Create a DDF function node. 702 717 * … … 744 759 745 760 return fun; 761 } 762 763 /** Allocate driver-specific function data. */ 764 extern void *ddf_fun_data_alloc(ddf_fun_t *fun, size_t size) 765 { 766 void *data; 767 768 assert(fun->bound == false); 769 assert(fun->driver_data == NULL); 770 771 data = calloc(1, size); 772 if (data == NULL) 773 return NULL; 774 775 fun->driver_data = data; 776 return data; 746 777 } 747 778 -
uspace/lib/drv/include/ddf/driver.h
rbfe7867 rc5be39b 155 155 extern int ddf_driver_main(driver_t *); 156 156 157 extern void *ddf_dev_data_alloc(ddf_dev_t *, size_t); 157 158 extern ddf_fun_t *ddf_fun_create(ddf_dev_t *, fun_type_t, const char *); 158 159 extern void ddf_fun_destroy(ddf_fun_t *); 160 extern void *ddf_fun_data_alloc(ddf_fun_t *, size_t); 159 161 extern int ddf_fun_bind(ddf_fun_t *); 160 162 extern int ddf_fun_unbind(ddf_fun_t *);
Note:
See TracChangeset
for help on using the changeset viewer.