From afe0eaee4323e9211c37b9a57b963dc843296980 Mon Sep 17 00:00:00 2001 From: Marc Kleine-Budde Date: Fri, 16 Nov 2007 16:49:51 +0100 Subject: 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 --- lib/driver.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/driver.c b/lib/driver.c index d3d3dc4458..27971e883c 100644 --- a/lib/driver.c +++ b/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); + + if (strncmp(npath, "/dev/", 5)) + goto out; + + dev = get_device_by_id(npath + 5); - return get_device_by_id(path + 5); + out: + free(npath); + return dev; } EXPORT_SYMBOL(get_device_by_path); -- cgit v1.2.3