[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1342690265-4518-1-git-send-email-dp@opensource.wolfsonmicro.com>
Date: Thu, 19 Jul 2012 10:31:05 +0100
From: Dimitris Papastamos <dp@...nsource.wolfsonmicro.com>
To: Mark Brown <broonie@...nsource.wolfsonmicro.com>
Cc: linux-kernel@...r.kernel.org, patches@...nsource.wolfsonmicro.com
Subject: [PATCH] regmap: Fallback to dev_name(map->dev) in case there is no `driver'
This is useful when we want to use regmap with character devices.
Signed-off-by: Dimitris Papastamos <dp@...nsource.wolfsonmicro.com>
---
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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists