summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--util/sconfig/main.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/util/sconfig/main.c b/util/sconfig/main.c
index 9e44dc72ca..685da9dbfe 100644
--- a/util/sconfig/main.c
+++ b/util/sconfig/main.c
@@ -1088,8 +1088,16 @@ static void pass0(FILE *fil, FILE *head, struct device *ptr, struct device *next
return;
}
- char *name = S_ALLOC(10);
- sprintf(name, "_dev%d", dev_id++);
+ char *name;
+
+ if (ptr->alias) {
+ name = S_ALLOC(6 + strlen(ptr->alias));
+ sprintf(name, "_dev_%s", ptr->alias);
+ } else {
+ name = S_ALLOC(11);
+ sprintf(name, "_dev_%d", dev_id++);
+ }
+
ptr->name = name;
fprintf(fil, "STORAGE struct device %s;\n", ptr->name);
@@ -1325,6 +1333,12 @@ static void expose_device_names(FILE *fil, FILE *head, struct device *ptr, struc
fprintf(fil, "DEVTREE_CONST struct device *const __pnp_%04x_%02x = &%s;\n",
ptr->path_a, ptr->path_b, ptr->name);
}
+
+ if (ptr->alias) {
+ fprintf(head, "extern DEVTREE_CONST struct device *const %s_ptr;\n", ptr->name);
+ fprintf(fil, "DEVTREE_CONST struct device *const %s_ptr = &%s;\n",
+ ptr->name, ptr->name);
+ }
}
static void add_siblings_to_queue(struct queue_entry **bfs_q_head,