diff options
author | Richard Weinberger <richard@nod.at> | 2012-05-14 11:55:51 -0400 |
---|---|---|
committer | Artem Bityutskiy <artem.bityutskiy@linux.intel.com> | 2012-05-20 13:25:59 -0400 |
commit | b36a261e8c0ab323d04db9cdd1f6bb4c273c4b32 (patch) | |
tree | 00c90c5fa556f335338f4f61c808d4dfe502bb74 /drivers/mtd/ubi/kapi.c | |
parent | 0964f6a27b3574d9210c59ec883cbb3fff78a78d (diff) |
UBI: Kill data type hint
We do not need this feature and to our shame it even was not working
and there was a bug found very recently.
-- Artem Bityutskiy
Without the data type hint UBI2 (fastmap) will be easier to implement.
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Diffstat (limited to 'drivers/mtd/ubi/kapi.c')
-rw-r--r-- | drivers/mtd/ubi/kapi.c | 30 |
1 files changed, 7 insertions, 23 deletions
diff --git a/drivers/mtd/ubi/kapi.c b/drivers/mtd/ubi/kapi.c index 9fdb35367fe0..33ede23769db 100644 --- a/drivers/mtd/ubi/kapi.c +++ b/drivers/mtd/ubi/kapi.c | |||
@@ -426,11 +426,9 @@ EXPORT_SYMBOL_GPL(ubi_leb_read); | |||
426 | * @buf: data to write | 426 | * @buf: data to write |
427 | * @offset: offset within the logical eraseblock where to write | 427 | * @offset: offset within the logical eraseblock where to write |
428 | * @len: how many bytes to write | 428 | * @len: how many bytes to write |
429 | * @dtype: expected data type | ||
430 | * | 429 | * |
431 | * This function writes @len bytes of data from @buf to offset @offset of | 430 | * This function writes @len bytes of data from @buf to offset @offset of |
432 | * logical eraseblock @lnum. The @dtype argument describes expected lifetime of | 431 | * logical eraseblock @lnum. |
433 | * the data. | ||
434 | * | 432 | * |
435 | * This function takes care of physical eraseblock write failures. If write to | 433 | * This function takes care of physical eraseblock write failures. If write to |
436 | * the physical eraseblock write operation fails, the logical eraseblock is | 434 | * the physical eraseblock write operation fails, the logical eraseblock is |
@@ -447,7 +445,7 @@ EXPORT_SYMBOL_GPL(ubi_leb_read); | |||
447 | * returns immediately with %-EBADF code. | 445 | * returns immediately with %-EBADF code. |
448 | */ | 446 | */ |
449 | int ubi_leb_write(struct ubi_volume_desc *desc, int lnum, const void *buf, | 447 | int ubi_leb_write(struct ubi_volume_desc *desc, int lnum, const void *buf, |
450 | int offset, int len, int dtype) | 448 | int offset, int len) |
451 | { | 449 | { |
452 | struct ubi_volume *vol = desc->vol; | 450 | struct ubi_volume *vol = desc->vol; |
453 | struct ubi_device *ubi = vol->ubi; | 451 | struct ubi_device *ubi = vol->ubi; |
@@ -466,17 +464,13 @@ int ubi_leb_write(struct ubi_volume_desc *desc, int lnum, const void *buf, | |||
466 | offset & (ubi->min_io_size - 1) || len & (ubi->min_io_size - 1)) | 464 | offset & (ubi->min_io_size - 1) || len & (ubi->min_io_size - 1)) |
467 | return -EINVAL; | 465 | return -EINVAL; |
468 | 466 | ||
469 | if (dtype != UBI_LONGTERM && dtype != UBI_SHORTTERM && | ||
470 | dtype != UBI_UNKNOWN) | ||
471 | return -EINVAL; | ||
472 | |||
473 | if (vol->upd_marker) | 467 | if (vol->upd_marker) |
474 | return -EBADF; | 468 | return -EBADF; |
475 | 469 | ||
476 | if (len == 0) | 470 | if (len == 0) |
477 | return 0; | 471 | return 0; |
478 | 472 | ||
479 | return ubi_eba_write_leb(ubi, vol, lnum, buf, offset, len, dtype); | 473 | return ubi_eba_write_leb(ubi, vol, lnum, buf, offset, len); |
480 | } | 474 | } |
481 | EXPORT_SYMBOL_GPL(ubi_leb_write); | 475 | EXPORT_SYMBOL_GPL(ubi_leb_write); |
482 | 476 | ||
@@ -486,7 +480,6 @@ EXPORT_SYMBOL_GPL(ubi_leb_write); | |||
486 | * @lnum: logical eraseblock number to change | 480 | * @lnum: logical eraseblock number to change |
487 | * @buf: data to write | 481 | * @buf: data to write |
488 | * @len: how many bytes to write | 482 | * @len: how many bytes to write |
489 | * @dtype: expected data type | ||
490 | * | 483 | * |
491 | * This function changes the contents of a logical eraseblock atomically. @buf | 484 | * This function changes the contents of a logical eraseblock atomically. @buf |
492 | * has to contain new logical eraseblock data, and @len - the length of the | 485 | * has to contain new logical eraseblock data, and @len - the length of the |
@@ -497,7 +490,7 @@ EXPORT_SYMBOL_GPL(ubi_leb_write); | |||
497 | * code in case of failure. | 490 | * code in case of failure. |
498 | */ | 491 | */ |
499 | int ubi_leb_change(struct ubi_volume_desc *desc, int lnum, const void *buf, | 492 | int ubi_leb_change(struct ubi_volume_desc *desc, int lnum, const void *buf, |
500 | int len, int dtype) | 493 | int len) |
501 | { | 494 | { |
502 | struct ubi_volume *vol = desc->vol; | 495 | struct ubi_volume *vol = desc->vol; |
503 | struct ubi_device *ubi = vol->ubi; | 496 | struct ubi_device *ubi = vol->ubi; |
@@ -515,17 +508,13 @@ int ubi_leb_change(struct ubi_volume_desc *desc, int lnum, const void *buf, | |||
515 | len > vol->usable_leb_size || len & (ubi->min_io_size - 1)) | 508 | len > vol->usable_leb_size || len & (ubi->min_io_size - 1)) |
516 | return -EINVAL; | 509 | return -EINVAL; |
517 | 510 | ||
518 | if (dtype != UBI_LONGTERM && dtype != UBI_SHORTTERM && | ||
519 | dtype != UBI_UNKNOWN) | ||
520 | return -EINVAL; | ||
521 | |||
522 | if (vol->upd_marker) | 511 | if (vol->upd_marker) |
523 | return -EBADF; | 512 | return -EBADF; |
524 | 513 | ||
525 | if (len == 0) | 514 | if (len == 0) |
526 | return 0; | 515 | return 0; |
527 | 516 | ||
528 | return ubi_eba_atomic_leb_change(ubi, vol, lnum, buf, len, dtype); | 517 | return ubi_eba_atomic_leb_change(ubi, vol, lnum, buf, len); |
529 | } | 518 | } |
530 | EXPORT_SYMBOL_GPL(ubi_leb_change); | 519 | EXPORT_SYMBOL_GPL(ubi_leb_change); |
531 | 520 | ||
@@ -626,7 +615,6 @@ EXPORT_SYMBOL_GPL(ubi_leb_unmap); | |||
626 | * ubi_leb_map - map logical eraseblock to a physical eraseblock. | 615 | * ubi_leb_map - map logical eraseblock to a physical eraseblock. |
627 | * @desc: volume descriptor | 616 | * @desc: volume descriptor |
628 | * @lnum: logical eraseblock number | 617 | * @lnum: logical eraseblock number |
629 | * @dtype: expected data type | ||
630 | * | 618 | * |
631 | * This function maps an un-mapped logical eraseblock @lnum to a physical | 619 | * This function maps an un-mapped logical eraseblock @lnum to a physical |
632 | * eraseblock. This means, that after a successful invocation of this | 620 | * eraseblock. This means, that after a successful invocation of this |
@@ -639,7 +627,7 @@ EXPORT_SYMBOL_GPL(ubi_leb_unmap); | |||
639 | * eraseblock is already mapped, and other negative error codes in case of | 627 | * eraseblock is already mapped, and other negative error codes in case of |
640 | * other failures. | 628 | * other failures. |
641 | */ | 629 | */ |
642 | int ubi_leb_map(struct ubi_volume_desc *desc, int lnum, int dtype) | 630 | int ubi_leb_map(struct ubi_volume_desc *desc, int lnum) |
643 | { | 631 | { |
644 | struct ubi_volume *vol = desc->vol; | 632 | struct ubi_volume *vol = desc->vol; |
645 | struct ubi_device *ubi = vol->ubi; | 633 | struct ubi_device *ubi = vol->ubi; |
@@ -652,17 +640,13 @@ int ubi_leb_map(struct ubi_volume_desc *desc, int lnum, int dtype) | |||
652 | if (lnum < 0 || lnum >= vol->reserved_pebs) | 640 | if (lnum < 0 || lnum >= vol->reserved_pebs) |
653 | return -EINVAL; | 641 | return -EINVAL; |
654 | 642 | ||
655 | if (dtype != UBI_LONGTERM && dtype != UBI_SHORTTERM && | ||
656 | dtype != UBI_UNKNOWN) | ||
657 | return -EINVAL; | ||
658 | |||
659 | if (vol->upd_marker) | 643 | if (vol->upd_marker) |
660 | return -EBADF; | 644 | return -EBADF; |
661 | 645 | ||
662 | if (vol->eba_tbl[lnum] >= 0) | 646 | if (vol->eba_tbl[lnum] >= 0) |
663 | return -EBADMSG; | 647 | return -EBADMSG; |
664 | 648 | ||
665 | return ubi_eba_write_leb(ubi, vol, lnum, NULL, 0, 0, dtype); | 649 | return ubi_eba_write_leb(ubi, vol, lnum, NULL, 0, 0); |
666 | } | 650 | } |
667 | EXPORT_SYMBOL_GPL(ubi_leb_map); | 651 | EXPORT_SYMBOL_GPL(ubi_leb_map); |
668 | 652 | ||