[PATCH] regmap: Fallback to dev_name(map->dev) in case there is no `driver'
From: Dimitris Papastamos
Date: Thu Jul 19 2012 - 05:31:06 EST
This is useful when we want to use regmap with character devices.
Signed-off-by: Dimitris Papastamos <dp@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
---
drivers/base/regmap/regmap-debugfs.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/base/regmap/regmap-debugfs.c b/drivers/base/regmap/regmap-debugfs.c
index bb1ff17..c2fbf57 100644
--- a/drivers/base/regmap/regmap-debugfs.c
+++ b/drivers/base/regmap/regmap-debugfs.c
@@ -39,7 +39,10 @@ static ssize_t regmap_name_read_file(struct file *file,
if (!buf)
return -ENOMEM;
- ret = snprintf(buf, PAGE_SIZE, "%s\n", map->dev->driver->name);
+ if (map->dev->driver && map->dev->driver->name)
+ ret = snprintf(buf, PAGE_SIZE, "%s\n", map->dev->driver->name);
+ else
+ ret = snprintf(buf, PAGE_SIZE, "%s\n", dev_name(map->dev));
if (ret < 0) {
kfree(buf);
return ret;
--
1.7.11.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/