diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-02-22 14:38:22 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-02-22 14:38:22 -0500 |
commit | e30aee9e10bb5168579e047f05c3d13d09e23356 (patch) | |
tree | 12371bdcd52d2427cad838201997479e31b6a9c9 /drivers/misc/sram.c | |
parent | 8ff546b801e5cca0337c0f0a7234795d0a6309a1 (diff) | |
parent | 6cf18e6927c0b224f972e3042fb85770d63cb9f8 (diff) |
Merge tag 'char-misc-4.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
Pull char/misc driver updates from Greg KH:
"Here is the big char/misc driver patchset for 4.11-rc1.
Lots of different driver subsystems updated here: rework for the
hyperv subsystem to handle new platforms better, mei and w1 and extcon
driver updates, as well as a number of other "minor" driver updates.
All of these have been in linux-next for a while with no reported
issues"
* tag 'char-misc-4.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (169 commits)
goldfish: Sanitize the broken interrupt handler
x86/platform/goldfish: Prevent unconditional loading
vmbus: replace modulus operation with subtraction
vmbus: constify parameters where possible
vmbus: expose hv_begin/end_read
vmbus: remove conditional locking of vmbus_write
vmbus: add direct isr callback mode
vmbus: change to per channel tasklet
vmbus: put related per-cpu variable together
vmbus: callback is in softirq not workqueue
binder: Add support for file-descriptor arrays
binder: Add support for scatter-gather
binder: Add extra size to allocator
binder: Refactor binder_transact()
binder: Support multiple /dev instances
binder: Deal with contexts in debugfs
binder: Support multiple context managers
binder: Split flat_binder_object
auxdisplay: ht16k33: remove private workqueue
auxdisplay: ht16k33: rework input device initialization
...
Diffstat (limited to 'drivers/misc/sram.c')
-rw-r--r-- | drivers/misc/sram.c | 55 |
1 files changed, 24 insertions, 31 deletions
diff --git a/drivers/misc/sram.c b/drivers/misc/sram.c index b33ab8ce47ab..d1185b78cf9a 100644 --- a/drivers/misc/sram.c +++ b/drivers/misc/sram.c | |||
@@ -31,35 +31,9 @@ | |||
31 | #include <linux/mfd/syscon.h> | 31 | #include <linux/mfd/syscon.h> |
32 | #include <soc/at91/atmel-secumod.h> | 32 | #include <soc/at91/atmel-secumod.h> |
33 | 33 | ||
34 | #define SRAM_GRANULARITY 32 | 34 | #include "sram.h" |
35 | |||
36 | struct sram_partition { | ||
37 | void __iomem *base; | ||
38 | |||
39 | struct gen_pool *pool; | ||
40 | struct bin_attribute battr; | ||
41 | struct mutex lock; | ||
42 | }; | ||
43 | |||
44 | struct sram_dev { | ||
45 | struct device *dev; | ||
46 | void __iomem *virt_base; | ||
47 | |||
48 | struct gen_pool *pool; | ||
49 | struct clk *clk; | ||
50 | 35 | ||
51 | struct sram_partition *partition; | 36 | #define SRAM_GRANULARITY 32 |
52 | u32 partitions; | ||
53 | }; | ||
54 | |||
55 | struct sram_reserve { | ||
56 | struct list_head list; | ||
57 | u32 start; | ||
58 | u32 size; | ||
59 | bool export; | ||
60 | bool pool; | ||
61 | const char *label; | ||
62 | }; | ||
63 | 37 | ||
64 | static ssize_t sram_read(struct file *filp, struct kobject *kobj, | 38 | static ssize_t sram_read(struct file *filp, struct kobject *kobj, |
65 | struct bin_attribute *attr, | 39 | struct bin_attribute *attr, |
@@ -148,6 +122,18 @@ static int sram_add_partition(struct sram_dev *sram, struct sram_reserve *block, | |||
148 | if (ret) | 122 | if (ret) |
149 | return ret; | 123 | return ret; |
150 | } | 124 | } |
125 | if (block->protect_exec) { | ||
126 | ret = sram_check_protect_exec(sram, block, part); | ||
127 | if (ret) | ||
128 | return ret; | ||
129 | |||
130 | ret = sram_add_pool(sram, block, start, part); | ||
131 | if (ret) | ||
132 | return ret; | ||
133 | |||
134 | sram_add_protect_exec(part); | ||
135 | } | ||
136 | |||
151 | sram->partitions++; | 137 | sram->partitions++; |
152 | 138 | ||
153 | return 0; | 139 | return 0; |
@@ -233,7 +219,11 @@ static int sram_reserve_regions(struct sram_dev *sram, struct resource *res) | |||
233 | if (of_find_property(child, "pool", NULL)) | 219 | if (of_find_property(child, "pool", NULL)) |
234 | block->pool = true; | 220 | block->pool = true; |
235 | 221 | ||
236 | if ((block->export || block->pool) && block->size) { | 222 | if (of_find_property(child, "protect-exec", NULL)) |
223 | block->protect_exec = true; | ||
224 | |||
225 | if ((block->export || block->pool || block->protect_exec) && | ||
226 | block->size) { | ||
237 | exports++; | 227 | exports++; |
238 | 228 | ||
239 | label = NULL; | 229 | label = NULL; |
@@ -249,8 +239,10 @@ static int sram_reserve_regions(struct sram_dev *sram, struct resource *res) | |||
249 | 239 | ||
250 | block->label = devm_kstrdup(sram->dev, | 240 | block->label = devm_kstrdup(sram->dev, |
251 | label, GFP_KERNEL); | 241 | label, GFP_KERNEL); |
252 | if (!block->label) | 242 | if (!block->label) { |
243 | ret = -ENOMEM; | ||
253 | goto err_chunks; | 244 | goto err_chunks; |
245 | } | ||
254 | 246 | ||
255 | dev_dbg(sram->dev, "found %sblock '%s' 0x%x-0x%x\n", | 247 | dev_dbg(sram->dev, "found %sblock '%s' 0x%x-0x%x\n", |
256 | block->export ? "exported " : "", block->label, | 248 | block->export ? "exported " : "", block->label, |
@@ -293,7 +285,8 @@ static int sram_reserve_regions(struct sram_dev *sram, struct resource *res) | |||
293 | goto err_chunks; | 285 | goto err_chunks; |
294 | } | 286 | } |
295 | 287 | ||
296 | if ((block->export || block->pool) && block->size) { | 288 | if ((block->export || block->pool || block->protect_exec) && |
289 | block->size) { | ||
297 | ret = sram_add_partition(sram, block, | 290 | ret = sram_add_partition(sram, block, |
298 | res->start + block->start); | 291 | res->start + block->start); |
299 | if (ret) { | 292 | if (ret) { |