summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>2010-08-30 00:17:52 +0800
committerSascha Hauer <s.hauer@pengutronix.de>2010-09-20 08:56:37 +0200
commitc33a2e503c32696bbf5f2388599cabc5d4d45c01 (patch)
tree7bdb091040a852377b0b4671c0655137119fad1e /include
parente34c1d4fccda53fe7f83dba57d1102e4ba2baf91 (diff)
downloadbarebox-c33a2e503c32696bbf5f2388599cabc5d4d45c01.tar.gz
barebox-c33a2e503c32696bbf5f2388599cabc5d4d45c01.tar.xz
device: fix dev_name
dev_name is supposed to return the name of the device plus the id currently we use %s%d format where in the kernel the use %s.%d we may think to switch to this format for the device name and keeping the %s%d for the devfs this will be usefull to not modify the clock device name as example Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Diffstat (limited to 'include')
-rw-r--r--include/driver.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/include/driver.h b/include/driver.h
index ee0749d48b..b9edca0e7f 100644
--- a/include/driver.h
+++ b/include/driver.h
@@ -25,7 +25,8 @@
#include <linux/list.h>
-#define MAX_DRIVER_NAME 32
+#define MAX_DRIVER_NAME 32
+#define FORMAT_DRIVER_MANE_ID "%s%d"
#include <param.h>
@@ -176,9 +177,11 @@ int get_free_deviceid(const char *name_template);
char *deviceid_from_spec_str(const char *str, char **endp);
+extern const char *dev_id(const struct device_d *dev);
+
static inline const char *dev_name(const struct device_d *dev)
{
- return dev->name;
+ return dev_id(dev);
}
/* linear list over all available devices
@@ -239,11 +242,10 @@ static inline int dev_close_default(struct device_d *dev, struct filep *f)
}
/* debugging and troubleshooting/diagnostic helpers. */
-extern const char *dev_id(const struct device_d *dev);
#define dev_printf(dev, format, arg...) \
- printf("%s@%s: " format , dev_name(dev) , \
- dev_id(dev) , ## arg)
+ printf("%s@%s: " format , (dev)->name , \
+ dev_name(dev) , ## arg)
#define dev_emerg(dev, format, arg...) \
dev_printf((dev) , format , ## arg)