Changeset df747b9c in mainline for uspace/srv/drivers/root/root.c
- Timestamp:
- 2010-04-23T11:30:25Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 5af21c5
- Parents:
- a78fa2a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/drivers/root/root.c
ra78fa2a rdf747b9c 52 52 #define NAME "root" 53 53 54 static boolroot_add_device(device_t *dev);54 static int root_add_device(device_t *dev); 55 55 56 56 /** The root device driver's standard operations. … … 67 67 }; 68 68 69 /** Create the device which represents the root of HW device tree. 69 /** Create the device which represents the root of HW device tree. 70 * 70 71 * @param parent parent of the newly created device. 72 * @return 0 on success, negative error number otherwise. 71 73 */ 72 static booladd_platform_child(device_t *parent) {74 static int add_platform_child(device_t *parent) { 73 75 printf(NAME ": adding new child for platform device.\n"); 74 76 77 int res = EOK; 75 78 device_t *platform = NULL; 76 79 match_id_t *match_id = NULL; … … 78 81 // create new device 79 82 if (NULL == (platform = create_device())) { 83 res = ENOMEM; 80 84 goto failure; 81 85 } … … 86 90 // initialize match id list 87 91 if (NULL == (match_id = create_match_id())) { 92 res = ENOMEM; 88 93 goto failure; 89 94 } … … 95 100 96 101 // register child device 97 if (!child_device_register(platform, parent)) { 102 res = child_device_register(platform, parent); 103 if (EOK != res) { 98 104 goto failure; 99 105 } 100 106 101 return true;107 return res; 102 108 103 109 failure: … … 111 117 } 112 118 113 return false;119 return res; 114 120 } 115 121 … … 117 123 * @param dev the device which is root of the whole device tree (both of HW and pseudo devices). 118 124 */ 119 static boolroot_add_device(device_t *dev)125 static int root_add_device(device_t *dev) 120 126 { 121 127 printf(NAME ": root_add_device, device handle = %d\n", dev->handle); 122 128 123 129 // register root device's children 124 if (!add_platform_child(dev)) { 130 int res = add_platform_child(dev); 131 if (EOK != res) { 125 132 printf(NAME ": failed to add child device for platform.\n"); 126 return false;127 133 } 128 134 129 return true;135 return res; 130 136 } 131 137
Note:
See TracChangeset
for help on using the changeset viewer.