get_device_by_path now obeys cwd
With this patch get_device_by_path obeys the cwd, which allows a more intuitive devinfo command. Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
This commit is contained in:
parent
7b498d9838
commit
afe0eaee43
13
lib/driver.c
13
lib/driver.c
|
@ -182,10 +182,17 @@ EXPORT_SYMBOL(register_driver);
|
|||
*/
|
||||
struct device_d *get_device_by_path(const char *path)
|
||||
{
|
||||
if (strncmp(path, "/dev/", 5))
|
||||
return NULL;
|
||||
struct device_d *dev = NULL;
|
||||
char *npath = normalise_path(path);
|
||||
|
||||
return get_device_by_id(path + 5);
|
||||
if (strncmp(npath, "/dev/", 5))
|
||||
goto out;
|
||||
|
||||
dev = get_device_by_id(npath + 5);
|
||||
|
||||
out:
|
||||
free(npath);
|
||||
return dev;
|
||||
}
|
||||
EXPORT_SYMBOL(get_device_by_path);
|
||||
|
||||
|
|
Loading…
Reference in New Issue