aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-01-17 22:48:18 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-01-17 22:48:18 -0500
commited408f7c0fab7ecc72f94f204f0d2607b2749f69 (patch)
tree8c85eb47814fff6c9ea0aa6177e47555c0f9c5b1 /drivers/base
parent52f7a82b59ff385da86a3ed17c8d9f6a83531004 (diff)
parent7d1f9aeff1ee4a20b1aeb377dd0f579fe9647619 (diff)
Merge 3.9-rc4 into driver-core-next
This is to fix up a build problem with a wireless driver due to the dynamic-debug patches in this branch. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
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.c53
3 files changed, 42 insertions, 15 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..46a213a596e2 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,34 @@ 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 } else {
125 return base;
126 }
127
128 /*
129 * This should never happen; we return above if we fail to
130 * allocate and we should never be in this code if there are
131 * no registers at all.
132 */
133 if (list_empty(&map->debugfs_off_cache)) {
134 WARN_ON(list_empty(&map->debugfs_off_cache));
135 return base;
136 }
137
104 /* Find the relevant block */ 138 /* Find the relevant block */
105 list_for_each_entry(c, &map->debugfs_off_cache, list) { 139 list_for_each_entry(c, &map->debugfs_off_cache, list) {
106 if (*pos >= c->min && *pos <= c->max) { 140 if (from >= c->min && from <= c->max) {
107 *pos = c->min; 141 *pos = c->min;
108 return c->base_reg; 142 return c->base_reg;
109 } 143 }
110 144
111 ret = c->max; 145 *pos = c->min;
146 ret = c->base_reg;
112 } 147 }
113 148
114 return ret; 149 return ret;
@@ -387,16 +422,8 @@ void regmap_debugfs_init(struct regmap *map, const char *name)
387 422
388void regmap_debugfs_exit(struct regmap *map) 423void regmap_debugfs_exit(struct regmap *map)
389{ 424{
390 struct regmap_debugfs_off_cache *c;
391
392 debugfs_remove_recursive(map->debugfs); 425 debugfs_remove_recursive(map->debugfs);
393 while (!list_empty(&map->debugfs_off_cache)) { 426 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); 427 kfree(map->debugfs_name);
401} 428}
402 429