[PATCH] driver: add dev_name inline

Jean-Christophe PLAGNIOL-VILLARD plagnioj at jcrosoft.com
Fri Oct 30 17:55:23 EDT 2009


Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj at jcrosoft.com>
---
 include/driver.h |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/include/driver.h b/include/driver.h
index 2ee7fb1..91a3aaa 100644
--- a/include/driver.h
+++ b/include/driver.h
@@ -177,6 +177,11 @@ int get_free_deviceid(const char *name_template);
 
 char *deviceid_from_spec_str(const char *str, char **endp);
 
+static inline const char *dev_name(const struct device_d *dev)
+{
+	return dev->name;
+}
+
 /* linear list over all available devices
  */
 extern struct list_head device_list;
@@ -238,7 +243,7 @@ static inline int dev_close_default(struct device_d *dev, struct filep *f)
 extern const char *dev_id(const struct device_d *dev);
 
 #define dev_printf(dev, format, arg...)	\
-	printf("%s@%s: " format , (dev)->name , \
+	printf("%s@%s: " format , dev_name(dev) , \
 	       dev_id(dev) , ## arg)
 
 #define dev_emerg(dev, format, arg...)		\
-- 
1.6.5





More information about the u-boot-v2 mailing list