diff options
Diffstat (limited to 'drivers/base/driver.c')
-rw-r--r-- | drivers/base/driver.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/base/driver.c b/drivers/base/driver.c index a2674d607b..2d206f934d 100644 --- a/drivers/base/driver.c +++ b/drivers/base/driver.c @@ -103,7 +103,7 @@ int register_device(struct device_d *new_device) { struct driver_d *drv; - if (new_device->id < 0) { + if (new_device->id == DEVICE_ID_DYNAMIC) { new_device->id = get_free_deviceid(new_device->name); } else { if (get_device_by_name_id(new_device->name, new_device->id)) { @@ -302,7 +302,10 @@ const char *dev_id(const struct device_d *dev) { static char buf[MAX_DRIVER_NAME + 16]; - snprintf(buf, sizeof(buf), FORMAT_DRIVER_NAME_ID, dev->name, dev->id); + if (dev->id != DEVICE_ID_SINGLE) + snprintf(buf, sizeof(buf), FORMAT_DRIVER_NAME_ID, dev->name, dev->id); + else + snprintf(buf, sizeof(buf), "%s", dev->name); return buf; } |