mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-26 15:28:50 +00:00
remoteproc: uclass: Modify uc_pdata->name to use combination of device name and device's parent name
uc_pdata->name is populated from device tree property "remoteproc-name". For those devcices that don't set "remoteproc-name", uc_pdata->name falls back to dev->name. If two devices have same name, this will result into uc_pdata->name not being unique and rproc_init() will fail. Fix this by using combination of dev->name and dev->parent->name instead of using just the dev->name to populate uc_pdata->name. Signed-off-by: MD Danish Anwar <danishanwar@ti.com> Reviewed-by: Roger Quadros <rogerq@kernel.org> Reviewed-by: Andrew Davis <afd@ti.com>
This commit is contained in:
parent
a7026b0003
commit
6dd95456f7
1 changed files with 13 additions and 3 deletions
|
@ -158,9 +158,19 @@ static int rproc_pre_probe(struct udevice *dev)
|
||||||
uc_pdata->driver_plat_data = pdata->driver_plat_data;
|
uc_pdata->driver_plat_data = pdata->driver_plat_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Else try using device Name */
|
/* Else try using a combination of device Name and devices's parent's name */
|
||||||
if (!uc_pdata->name)
|
if (!uc_pdata->name) {
|
||||||
uc_pdata->name = dev->name;
|
/* 2 in the rproc_name_size indicates 1 for null and one for '-' */
|
||||||
|
int rproc_name_size = strlen(dev->name) + strlen(dev->parent->name) + 2;
|
||||||
|
char *buf;
|
||||||
|
|
||||||
|
buf = malloc(rproc_name_size);
|
||||||
|
if (!buf)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
|
snprintf(buf, rproc_name_size, "%s-%s", dev->name, dev->parent->name);
|
||||||
|
uc_pdata->name = buf;
|
||||||
|
}
|
||||||
if (!uc_pdata->name) {
|
if (!uc_pdata->name) {
|
||||||
debug("Unnamed device!");
|
debug("Unnamed device!");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
Loading…
Add table
Reference in a new issue