diff options
Diffstat (limited to 'drivers/mtd/mtdpart.c')
-rw-r--r-- | drivers/mtd/mtdpart.c | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c index b8043a9ba32d..dc6558568876 100644 --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c | |||
@@ -1,12 +1,24 @@ | |||
1 | /* | 1 | /* |
2 | * Simple MTD partitioning layer | 2 | * Simple MTD partitioning layer |
3 | * | 3 | * |
4 | * (C) 2000 Nicolas Pitre <nico@fluxnic.net> | 4 | * Copyright © 2000 Nicolas Pitre <nico@fluxnic.net> |
5 | * Copyright © 2002 Thomas Gleixner <gleixner@linutronix.de> | ||
6 | * Copyright © 2000-2010 David Woodhouse <dwmw2@infradead.org> | ||
5 | * | 7 | * |
6 | * This code is GPL | 8 | * This program is free software; you can redistribute it and/or modify |
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
7 | * | 21 | * |
8 | * 02-21-2002 Thomas Gleixner <gleixner@autronix.de> | ||
9 | * added support for read_oob, write_oob | ||
10 | */ | 22 | */ |
11 | 23 | ||
12 | #include <linux/module.h> | 24 | #include <linux/module.h> |
@@ -17,7 +29,6 @@ | |||
17 | #include <linux/kmod.h> | 29 | #include <linux/kmod.h> |
18 | #include <linux/mtd/mtd.h> | 30 | #include <linux/mtd/mtd.h> |
19 | #include <linux/mtd/partitions.h> | 31 | #include <linux/mtd/partitions.h> |
20 | #include <linux/mtd/compatmac.h> | ||
21 | 32 | ||
22 | /* Our partition linked list */ | 33 | /* Our partition linked list */ |
23 | static LIST_HEAD(mtd_partitions); | 34 | static LIST_HEAD(mtd_partitions); |
@@ -264,6 +275,14 @@ static int part_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len) | |||
264 | return part->master->unlock(part->master, ofs + part->offset, len); | 275 | return part->master->unlock(part->master, ofs + part->offset, len); |
265 | } | 276 | } |
266 | 277 | ||
278 | static int part_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t len) | ||
279 | { | ||
280 | struct mtd_part *part = PART(mtd); | ||
281 | if ((len + ofs) > mtd->size) | ||
282 | return -EINVAL; | ||
283 | return part->master->is_locked(part->master, ofs + part->offset, len); | ||
284 | } | ||
285 | |||
267 | static void part_sync(struct mtd_info *mtd) | 286 | static void part_sync(struct mtd_info *mtd) |
268 | { | 287 | { |
269 | struct mtd_part *part = PART(mtd); | 288 | struct mtd_part *part = PART(mtd); |
@@ -402,6 +421,8 @@ static struct mtd_part *add_one_partition(struct mtd_info *master, | |||
402 | slave->mtd.lock = part_lock; | 421 | slave->mtd.lock = part_lock; |
403 | if (master->unlock) | 422 | if (master->unlock) |
404 | slave->mtd.unlock = part_unlock; | 423 | slave->mtd.unlock = part_unlock; |
424 | if (master->is_locked) | ||
425 | slave->mtd.is_locked = part_is_locked; | ||
405 | if (master->block_isbad) | 426 | if (master->block_isbad) |
406 | slave->mtd.block_isbad = part_block_isbad; | 427 | slave->mtd.block_isbad = part_block_isbad; |
407 | if (master->block_markbad) | 428 | if (master->block_markbad) |