Changes in uspace/drv/root/root.c [eff1f033:9f6c5ef0] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/root/root.c
reff1f033 r9f6c5ef0 47 47 #include <macros.h> 48 48 #include <inttypes.h> 49 #include <sysinfo.h>50 49 51 50 #include <driver.h> … … 56 55 57 56 #define PLATFORM_DEVICE_NAME "hw" 58 #define PLATFORM_DEVICE_MATCH_ID _FMT "platform/%s"57 #define PLATFORM_DEVICE_MATCH_ID STRING(UARCH) 59 58 #define PLATFORM_DEVICE_MATCH_SCORE 100 60 59 … … 88 87 89 88 int res = child_device_register_wrapper(parent, VIRTUAL_DEVICE_NAME, 90 VIRTUAL_DEVICE_MATCH_ID, VIRTUAL_DEVICE_MATCH_SCORE); 89 VIRTUAL_DEVICE_MATCH_ID, VIRTUAL_DEVICE_MATCH_SCORE, 90 NULL); 91 91 92 92 return res; … … 100 100 static int add_platform_child(device_t *parent) 101 101 { 102 char *match_id;103 char *platform;104 size_t platform_size;105 int res;106 107 /* Get platform name from sysinfo. */108 109 platform = sysinfo_get_data("platform", &platform_size);110 if (platform == NULL) {111 printf(NAME ": Failed to obtain platform name.\n");112 return ENOENT;113 }114 115 /* Null-terminate string. */116 platform = realloc(platform, platform_size + 1);117 if (platform == NULL) {118 printf(NAME ": Memory allocation failed.\n");119 return ENOMEM;120 }121 122 platform[platform_size] = '\0';123 124 /* Construct match ID. */125 126 if (asprintf(&match_id, PLATFORM_DEVICE_MATCH_ID_FMT, platform) == -1) {127 printf(NAME ": Memory allocation failed.\n");128 return ENOMEM;129 }130 131 /* Add child. */132 133 102 printf(NAME ": adding new child for platform device.\n"); 134 103 printf(NAME ": device node is `%s' (%d %s)\n", PLATFORM_DEVICE_NAME, 135 PLATFORM_DEVICE_MATCH_SCORE, match_id); 136 137 res = child_device_register_wrapper(parent, PLATFORM_DEVICE_NAME, 138 match_id, PLATFORM_DEVICE_MATCH_SCORE); 104 PLATFORM_DEVICE_MATCH_SCORE, PLATFORM_DEVICE_MATCH_ID); 105 106 int res = child_device_register_wrapper(parent, PLATFORM_DEVICE_NAME, 107 PLATFORM_DEVICE_MATCH_ID, PLATFORM_DEVICE_MATCH_SCORE, 108 NULL); 139 109 140 110 return res;
Note:
See TracChangeset
for help on using the changeset viewer.