Changeset bab6388 in mainline
- Timestamp:
- 2011-02-13T20:23:37Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 7df0477e
- Parents:
- 68414f4a
- Location:
- uspace/drv
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/isa/isa.c
r68414f4a rbab6388 341 341 } 342 342 343 val = skip_spaces(end); 343 val = skip_spaces(end); 344 344 get_match_id(&id, val); 345 345 if (id == NULL) { -
uspace/drv/ns8250/ns8250.c
r68414f4a rbab6388 133 133 static void ns8250_delete(ns8250_t *ns) 134 134 { 135 assert(ns != NULL); 135 136 free(ns); 136 137 } … … 405 406 */ 406 407 static inline void ns8250_port_interrupts_enable(ioport8_t *port) 407 { 408 { 408 409 pio_write_8(port + 1, 0x1); /* Interrupt when data received. */ 409 410 pio_write_8(port + 4, 0xB); … … 803 804 } 804 805 fibril_mutex_unlock(&data->mutex); 805 806 806 807 return res; 807 808 } -
uspace/drv/pciintel/pci.c
r68414f4a rbab6388 111 111 pci_bus_t *bus; 112 112 113 bus = (pci_bus_t *) malloc(sizeof(pci_bus_t)); 114 if (bus != NULL) { 115 memset(bus, 0, sizeof(pci_bus_t)); 116 fibril_mutex_initialize(&bus->conf_mutex); 117 } 118 113 bus = (pci_bus_t *) calloc(1, sizeof(pci_bus_t)); 114 if (bus == NULL) 115 return NULL; 116 117 fibril_mutex_initialize(&bus->conf_mutex); 119 118 return bus; 120 119 } … … 122 121 static void pci_bus_delete(pci_bus_t *bus) 123 122 { 123 assert(bus != NULL); 124 124 free(bus); 125 125 } … … 228 228 add_match_id(&fun->fnode->match_ids, match_id); 229 229 } 230 230 231 231 /* TODO add more ids (with subsys ids, using class id etc.) */ 232 232 } … … 266 266 */ 267 267 int pci_read_bar(pci_fun_t *fun, int addr) 268 { 268 { 269 269 /* Value of the BAR */ 270 270 uint32_t val, mask; … … 369 369 bool multi; 370 370 uint8_t header_type; 371 371 372 372 /* We need this early, before registering. */ 373 373 fun->fnode = fnode; … … 485 485 async_hangup(dnode->parent_phone); 486 486 return rc; 487 } 487 } 488 488 489 489 printf(NAME ": conf_addr = %" PRIx64 ".\n", … … 531 531 pci_fun_t *pci_fun_new(void) 532 532 { 533 pci_fun_t *res = (pci_fun_t *) malloc(sizeof(pci_fun_t)); 534 535 if (res != NULL) 536 memset(res, 0, sizeof(pci_fun_t)); 533 pci_fun_t *res; 534 535 res = (pci_fun_t *) calloc(1, sizeof(pci_fun_t)); 537 536 return res; 538 537 } … … 547 546 void pci_fun_delete(pci_fun_t *fun) 548 547 { 549 if (fun != NULL) { 550 hw_res_clean_resource_list(&fun->hw_resources); 551 free(fun); 552 } 548 assert(fun != NULL); 549 hw_res_clean_resource_list(&fun->hw_resources); 550 free(fun); 553 551 } 554 552 -
uspace/drv/root/root.c
r68414f4a rbab6388 148 148 printf(NAME ": root_add_device, device handle=%" PRIun "\n", 149 149 dev->handle); 150 150 151 151 /* 152 152 * Register virtual devices root. … … 160 160 if (EOK != res) 161 161 printf(NAME ": failed to add child device for platform.\n"); 162 162 163 163 return res; 164 164 } -
uspace/drv/rootvirt/rootvirt.c
r68414f4a rbab6388 110 110 111 111 printf(NAME ": add_device(handle=%d)\n", (int)dev->handle); 112 112 113 113 /* 114 114 * Go through all virtual functions and try to add them. -
uspace/drv/test1/test1.c
r68414f4a rbab6388 36 36 #include "test1.h" 37 37 38 static int add_device(device_t *dev);38 static int test1_add_device(device_t *dev); 39 39 40 40 static driver_ops_t driver_ops = { 41 .add_device = & add_device41 .add_device = &test1_add_device 42 42 }; 43 43 44 static driver_t t he_driver = {44 static driver_t test1_driver = { 45 45 .name = NAME, 46 46 .driver_ops = &driver_ops … … 55 55 * @param score Device match score. 56 56 */ 57 static void register_ child_verbose(device_t *parent, const char *message,57 static void register_fun_verbose(device_t *parent, const char *message, 58 58 const char *name, const char *match_id, int match_score) 59 59 { … … 89 89 * @return Error code reporting success of the operation. 90 90 */ 91 static int add_device(device_t *dev)91 static int test1_add_device(device_t *dev) 92 92 { 93 93 function_t *fun_a; … … 108 108 add_function_to_class(fun_a, "virt-null"); 109 109 } else if (str_cmp(dev->name, "test1") == 0) { 110 register_ child_verbose(dev, "cloning myself ;-)", "clone",110 register_fun_verbose(dev, "cloning myself ;-)", "clone", 111 111 "virtual&test1", 10); 112 112 } else if (str_cmp(dev->name, "clone") == 0) { 113 register_ child_verbose(dev, "run by the same task", "child",113 register_fun_verbose(dev, "run by the same task", "child", 114 114 "virtual&test1&child", 10); 115 115 } … … 123 123 { 124 124 printf(NAME ": HelenOS test1 virtual device driver\n"); 125 return driver_main(&t he_driver);125 return driver_main(&test1_driver); 126 126 } 127 127 -
uspace/drv/test2/test2.c
r68414f4a rbab6388 38 38 #define NAME "test2" 39 39 40 static int add_device(device_t *dev);40 static int test2_add_device(device_t *dev); 41 41 42 42 static driver_ops_t driver_ops = { 43 .add_device = & add_device43 .add_device = &test2_add_device 44 44 }; 45 45 46 static driver_t t he_driver = {46 static driver_t test2_driver = { 47 47 .name = NAME, 48 48 .driver_ops = &driver_ops … … 102 102 } 103 103 104 static int add_device(device_t *dev)104 static int test2_add_device(device_t *dev) 105 105 { 106 printf(NAME ": add_device(name=\"%s\", handle=%d)\n",106 printf(NAME ": test2_add_device(name=\"%s\", handle=%d)\n", 107 107 dev->name, (int) dev->handle); 108 108 … … 125 125 { 126 126 printf(NAME ": HelenOS test2 virtual device driver\n"); 127 return driver_main(&t he_driver);127 return driver_main(&test2_driver); 128 128 } 129 129
Note:
See TracChangeset
for help on using the changeset viewer.