9
0
Fork 0

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:
Marc Kleine-Budde 2007-11-16 16:49:51 +01:00
parent 7b498d9838
commit afe0eaee43
1 changed files with 10 additions and 3 deletions

View File

@ -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);