aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorOlof Johansson <olof@lixom.net>2013-02-05 01:56:41 -0500
committerOlof Johansson <olof@lixom.net>2013-02-05 01:56:41 -0500
commit469da62096e23adc755c1268b00b5fc7a214151b (patch)
treefefd055fdae584e38d551f44d1339eb22cee4ed9 /drivers/base
parent4227961650884a06757f80877d5dce0bddc723d4 (diff)
parent88b62b915b0b7e25870eb0604ed9a92ba4bfc9f7 (diff)
Merge tag 'v3.8-rc6' into next/soc
Linux 3.8-rc6
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/cpu.c2
-rw-r--r--drivers/base/firmware_class.c2
-rw-r--r--drivers/base/regmap/regmap-debugfs.c51
-rw-r--r--drivers/base/regmap/regmap.c2
4 files changed, 41 insertions, 16 deletions
diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
index 63452943abd1..fb10728f6372 100644
--- a/drivers/base/cpu.c
+++ b/drivers/base/cpu.c
@@ -224,7 +224,7 @@ static void cpu_device_release(struct device *dev)
224 * by the cpu device. 224 * by the cpu device.
225 * 225 *
226 * Never copy this way of doing things, or you too will be made fun of 226 * Never copy this way of doing things, or you too will be made fun of
227 * on the linux-kerenl list, you have been warned. 227 * on the linux-kernel list, you have been warned.
228 */ 228 */
229} 229}
230 230
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
index d81460309182..b392b353be39 100644
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -305,7 +305,7 @@ static bool fw_read_file_contents(struct file *file, struct firmware_buf *fw_buf
305 char *buf; 305 char *buf;
306 306
307 size = fw_file_size(file); 307 size = fw_file_size(file);
308 if (size < 0) 308 if (size <= 0)
309 return false; 309 return false;
310 buf = vmalloc(size); 310 buf = vmalloc(size);
311 if (!buf) 311 if (!buf)
diff --git a/drivers/base/regmap/regmap-debugfs.c b/drivers/base/regmap/regmap-debugfs.c
index 07aad786f817..d9a6c94ce423 100644
--- a/drivers/base/regmap/regmap-debugfs.c
+++ b/drivers/base/regmap/regmap-debugfs.c
@@ -56,6 +56,19 @@ static const struct file_operations regmap_name_fops = {
56 .llseek = default_llseek, 56 .llseek = default_llseek,
57}; 57};
58 58
59static void regmap_debugfs_free_dump_cache(struct regmap *map)
60{
61 struct regmap_debugfs_off_cache *c;
62
63 while (!list_empty(&map->debugfs_off_cache)) {
64 c = list_first_entry(&map->debugfs_off_cache,
65 struct regmap_debugfs_off_cache,
66 list);
67 list_del(&c->list);
68 kfree(c);
69 }
70}
71
59/* 72/*
60 * Work out where the start offset maps into register numbers, bearing 73 * Work out where the start offset maps into register numbers, bearing
61 * in mind that we suppress hidden registers. 74 * in mind that we suppress hidden registers.
@@ -91,8 +104,10 @@ static unsigned int regmap_debugfs_get_dump_start(struct regmap *map,
91 /* No cache entry? Start a new one */ 104 /* No cache entry? Start a new one */
92 if (!c) { 105 if (!c) {
93 c = kzalloc(sizeof(*c), GFP_KERNEL); 106 c = kzalloc(sizeof(*c), GFP_KERNEL);
94 if (!c) 107 if (!c) {
95 break; 108 regmap_debugfs_free_dump_cache(map);
109 return base;
110 }
96 c->min = p; 111 c->min = p;
97 c->base_reg = i; 112 c->base_reg = i;
98 } 113 }
@@ -101,14 +116,32 @@ static unsigned int regmap_debugfs_get_dump_start(struct regmap *map,
101 } 116 }
102 } 117 }
103 118
119 /* Close the last entry off if we didn't scan beyond it */
120 if (c) {
121 c->max = p - 1;
122 list_add_tail(&c->list,
123 &map->debugfs_off_cache);
124 }
125
126 /*
127 * This should never happen; we return above if we fail to
128 * allocate and we should never be in this code if there are
129 * no registers at all.
130 */
131 if (list_empty(&map->debugfs_off_cache)) {
132 WARN_ON(list_empty(&map->debugfs_off_cache));
133 return base;
134 }
135
104 /* Find the relevant block */ 136 /* Find the relevant block */
105 list_for_each_entry(c, &map->debugfs_off_cache, list) { 137 list_for_each_entry(c, &map->debugfs_off_cache, list) {
106 if (*pos >= c->min && *pos <= c->max) { 138 if (from >= c->min && from <= c->max) {
107 *pos = c->min; 139 *pos = c->min;
108 return c->base_reg; 140 return c->base_reg;
109 } 141 }
110 142
111 ret = c->max; 143 *pos = c->min;
144 ret = c->base_reg;
112 } 145 }
113 146
114 return ret; 147 return ret;
@@ -387,16 +420,8 @@ void regmap_debugfs_init(struct regmap *map, const char *name)
387 420
388void regmap_debugfs_exit(struct regmap *map) 421void regmap_debugfs_exit(struct regmap *map)
389{ 422{
390 struct regmap_debugfs_off_cache *c;
391
392 debugfs_remove_recursive(map->debugfs); 423 debugfs_remove_recursive(map->debugfs);
393 while (!list_empty(&map->debugfs_off_cache)) { 424 regmap_debugfs_free_dump_cache(map);
394 c = list_first_entry(&map->debugfs_off_cache,
395 struct regmap_debugfs_off_cache,
396 list);
397 list_del(&c->list);
398 kfree(c);
399 }
400 kfree(map->debugfs_name); 425 kfree(map->debugfs_name);
401} 426}
402 427
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 42d5cb0f503f..f00b059c057a 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -1106,7 +1106,7 @@ EXPORT_SYMBOL_GPL(regmap_raw_write);
1106 * @val_count: Number of registers to write 1106 * @val_count: Number of registers to write
1107 * 1107 *
1108 * This function is intended to be used for writing a large block of 1108 * This function is intended to be used for writing a large block of
1109 * data to be device either in single transfer or multiple transfer. 1109 * data to the device either in single transfer or multiple transfer.
1110 * 1110 *
1111 * A value of zero will be returned on success, a negative errno will 1111 * A value of zero will be returned on success, a negative errno will
1112 * be returned in error cases. 1112 * be returned in error cases.