Migrate device configuration regardless of what instance it is.
This commit is contained in:
14
src/device.c
14
src/device.c
@@ -97,14 +97,12 @@ device_set_context(device_context_t *c, const device_t *dev, int inst)
|
|||||||
if (inst) {
|
if (inst) {
|
||||||
sprintf(c->name, "%s #%i", dev->name, inst);
|
sprintf(c->name, "%s #%i", dev->name, inst);
|
||||||
|
|
||||||
/* If this is the first instance and a numbered section is not present, but a non-numbered
|
/* If a numbered section is not present, but a non-numbered of the same name
|
||||||
section of the same name is, rename the non-numbered section to numbered. */
|
is, rename the non-numbered section to numbered. */
|
||||||
if (inst == 1) {
|
const void *sec = config_find_section(c->name);
|
||||||
const void *sec = config_find_section(c->name);
|
void * single_sec = config_find_section((char *) dev->name);
|
||||||
void * single_sec = config_find_section((char *) dev->name);
|
if ((sec == NULL) && (single_sec != NULL))
|
||||||
if ((sec == NULL) && (single_sec != NULL))
|
config_rename_section(single_sec, c->name);
|
||||||
config_rename_section(single_sec, c->name);
|
|
||||||
}
|
|
||||||
} else
|
} else
|
||||||
sprintf(c->name, "%s", dev->name);
|
sprintf(c->name, "%s", dev->name);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user