Changeset 0ca16307 in mainline for uspace/drv/root/root.c
- Timestamp:
- 2010-11-29T23:52:22Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 6f9e7fea
- Parents:
- 0d6915f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/root/root.c
r0d6915f r0ca16307 1 1 /* 2 2 * Copyright (c) 2010 Lenka Trochtova 3 * Copyright (c) 2010 Vojtech Horky 3 4 * All rights reserved. 4 5 * … … 52 53 #define NAME "root" 53 54 55 #define PLATFORM_DEVICE_NAME "hw" 56 #define PLATFORM_DEVICE_MATCH_ID STRING(UARCH) 57 #define PLATFORM_DEVICE_MATCH_SCORE 100 58 54 59 static int root_add_device(device_t *dev); 55 60 … … 73 78 { 74 79 printf(NAME ": adding new child for platform device.\n"); 80 printf(NAME ": device node is `%s' (%d %s)\n", PLATFORM_DEVICE_NAME, 81 PLATFORM_DEVICE_MATCH_SCORE, PLATFORM_DEVICE_MATCH_ID); 75 82 76 int res = EOK; 77 device_t *platform = NULL; 78 match_id_t *match_id = NULL; 79 80 /* Create new device. */ 81 platform = create_device(); 82 if (NULL == platform) { 83 res = ENOMEM; 84 goto failure; 85 } 86 87 platform->name = "hw"; 88 printf(NAME ": the new device's name is %s.\n", platform->name); 89 90 /* Initialize match id list. */ 91 match_id = create_match_id(); 92 if (NULL == match_id) { 93 res = ENOMEM; 94 goto failure; 95 } 96 97 /* TODO - replace this with some better solution (sysinfo ?) */ 98 match_id->id = STRING(UARCH); 99 match_id->score = 100; 100 add_match_id(&platform->match_ids, match_id); 101 102 /* Register child device. */ 103 res = child_device_register(platform, parent); 104 if (EOK != res) 105 goto failure; 106 107 return res; 108 109 failure: 110 if (NULL != match_id) 111 match_id->id = NULL; 112 113 if (NULL != platform) { 114 platform->name = NULL; 115 delete_device(platform); 116 } 117 83 int res = child_device_register_wrapper(parent, PLATFORM_DEVICE_NAME, 84 PLATFORM_DEVICE_MATCH_ID, PLATFORM_DEVICE_MATCH_SCORE); 85 118 86 return res; 119 87 }
Note:
See TracChangeset
for help on using the changeset viewer.