diff options
Diffstat (limited to 'drivers/mtd/mtdconcat.c')
-rw-r--r-- | drivers/mtd/mtdconcat.c | 38 |
1 files changed, 28 insertions, 10 deletions
diff --git a/drivers/mtd/mtdconcat.c b/drivers/mtd/mtdconcat.c index 7e075621bbf4..bf8de0943103 100644 --- a/drivers/mtd/mtdconcat.c +++ b/drivers/mtd/mtdconcat.c | |||
@@ -1,11 +1,25 @@ | |||
1 | /* | 1 | /* |
2 | * MTD device concatenation layer | 2 | * MTD device concatenation layer |
3 | * | 3 | * |
4 | * (C) 2002 Robert Kaiser <rkaiser@sysgo.de> | 4 | * Copyright © 2002 Robert Kaiser <rkaiser@sysgo.de> |
5 | * Copyright © 2002-2010 David Woodhouse <dwmw2@infradead.org> | ||
5 | * | 6 | * |
6 | * NAND support by Christian Gan <cgan@iders.ca> | 7 | * NAND support by Christian Gan <cgan@iders.ca> |
7 | * | 8 | * |
8 | * This code is GPL | 9 | * This program is free software; you can redistribute it and/or modify |
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
22 | * | ||
9 | */ | 23 | */ |
10 | 24 | ||
11 | #include <linux/kernel.h> | 25 | #include <linux/kernel.h> |
@@ -540,10 +554,12 @@ static int concat_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len) | |||
540 | else | 554 | else |
541 | size = len; | 555 | size = len; |
542 | 556 | ||
543 | err = subdev->lock(subdev, ofs, size); | 557 | if (subdev->lock) { |
544 | 558 | err = subdev->lock(subdev, ofs, size); | |
545 | if (err) | 559 | if (err) |
546 | break; | 560 | break; |
561 | } else | ||
562 | err = -EOPNOTSUPP; | ||
547 | 563 | ||
548 | len -= size; | 564 | len -= size; |
549 | if (len == 0) | 565 | if (len == 0) |
@@ -578,10 +594,12 @@ static int concat_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len) | |||
578 | else | 594 | else |
579 | size = len; | 595 | size = len; |
580 | 596 | ||
581 | err = subdev->unlock(subdev, ofs, size); | 597 | if (subdev->unlock) { |
582 | 598 | err = subdev->unlock(subdev, ofs, size); | |
583 | if (err) | 599 | if (err) |
584 | break; | 600 | break; |
601 | } else | ||
602 | err = -EOPNOTSUPP; | ||
585 | 603 | ||
586 | len -= size; | 604 | len -= size; |
587 | if (len == 0) | 605 | if (len == 0) |