diff options
Diffstat (limited to 'drivers/mtd/ubi/build.c')
-rw-r--r-- | drivers/mtd/ubi/build.c | 126 |
1 files changed, 67 insertions, 59 deletions
diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c index 6e30a3c280d0..3405be46ebe9 100644 --- a/drivers/mtd/ubi/build.c +++ b/drivers/mtd/ubi/build.c | |||
@@ -166,7 +166,7 @@ int ubi_volume_notify(struct ubi_device *ubi, struct ubi_volume *vol, int ntype) | |||
166 | case UBI_VOLUME_RESIZED: | 166 | case UBI_VOLUME_RESIZED: |
167 | case UBI_VOLUME_RENAMED: | 167 | case UBI_VOLUME_RENAMED: |
168 | if (ubi_update_fastmap(ubi)) { | 168 | if (ubi_update_fastmap(ubi)) { |
169 | ubi_err("Unable to update fastmap!"); | 169 | ubi_err(ubi, "Unable to update fastmap!"); |
170 | ubi_ro_mode(ubi); | 170 | ubi_ro_mode(ubi); |
171 | } | 171 | } |
172 | } | 172 | } |
@@ -517,7 +517,7 @@ static int uif_init(struct ubi_device *ubi, int *ref) | |||
517 | */ | 517 | */ |
518 | err = alloc_chrdev_region(&dev, 0, ubi->vtbl_slots + 1, ubi->ubi_name); | 518 | err = alloc_chrdev_region(&dev, 0, ubi->vtbl_slots + 1, ubi->ubi_name); |
519 | if (err) { | 519 | if (err) { |
520 | ubi_err("cannot register UBI character devices"); | 520 | ubi_err(ubi, "cannot register UBI character devices"); |
521 | return err; | 521 | return err; |
522 | } | 522 | } |
523 | 523 | ||
@@ -528,7 +528,7 @@ static int uif_init(struct ubi_device *ubi, int *ref) | |||
528 | 528 | ||
529 | err = cdev_add(&ubi->cdev, dev, 1); | 529 | err = cdev_add(&ubi->cdev, dev, 1); |
530 | if (err) { | 530 | if (err) { |
531 | ubi_err("cannot add character device"); | 531 | ubi_err(ubi, "cannot add character device"); |
532 | goto out_unreg; | 532 | goto out_unreg; |
533 | } | 533 | } |
534 | 534 | ||
@@ -540,7 +540,7 @@ static int uif_init(struct ubi_device *ubi, int *ref) | |||
540 | if (ubi->volumes[i]) { | 540 | if (ubi->volumes[i]) { |
541 | err = ubi_add_volume(ubi, ubi->volumes[i]); | 541 | err = ubi_add_volume(ubi, ubi->volumes[i]); |
542 | if (err) { | 542 | if (err) { |
543 | ubi_err("cannot add volume %d", i); | 543 | ubi_err(ubi, "cannot add volume %d", i); |
544 | goto out_volumes; | 544 | goto out_volumes; |
545 | } | 545 | } |
546 | } | 546 | } |
@@ -556,7 +556,8 @@ out_sysfs: | |||
556 | cdev_del(&ubi->cdev); | 556 | cdev_del(&ubi->cdev); |
557 | out_unreg: | 557 | out_unreg: |
558 | unregister_chrdev_region(ubi->cdev.dev, ubi->vtbl_slots + 1); | 558 | unregister_chrdev_region(ubi->cdev.dev, ubi->vtbl_slots + 1); |
559 | ubi_err("cannot initialize UBI %s, error %d", ubi->ubi_name, err); | 559 | ubi_err(ubi, "cannot initialize UBI %s, error %d", |
560 | ubi->ubi_name, err); | ||
560 | return err; | 561 | return err; |
561 | } | 562 | } |
562 | 563 | ||
@@ -650,7 +651,7 @@ static int io_init(struct ubi_device *ubi, int max_beb_per1024) | |||
650 | * guess we should just pick the largest region. But this is | 651 | * guess we should just pick the largest region. But this is |
651 | * not implemented. | 652 | * not implemented. |
652 | */ | 653 | */ |
653 | ubi_err("multiple regions, not implemented"); | 654 | ubi_err(ubi, "multiple regions, not implemented"); |
654 | return -EINVAL; | 655 | return -EINVAL; |
655 | } | 656 | } |
656 | 657 | ||
@@ -685,7 +686,7 @@ static int io_init(struct ubi_device *ubi, int max_beb_per1024) | |||
685 | * which allows us to avoid costly division operations. | 686 | * which allows us to avoid costly division operations. |
686 | */ | 687 | */ |
687 | if (!is_power_of_2(ubi->min_io_size)) { | 688 | if (!is_power_of_2(ubi->min_io_size)) { |
688 | ubi_err("min. I/O unit (%d) is not power of 2", | 689 | ubi_err(ubi, "min. I/O unit (%d) is not power of 2", |
689 | ubi->min_io_size); | 690 | ubi->min_io_size); |
690 | return -EINVAL; | 691 | return -EINVAL; |
691 | } | 692 | } |
@@ -702,7 +703,7 @@ static int io_init(struct ubi_device *ubi, int max_beb_per1024) | |||
702 | if (ubi->max_write_size < ubi->min_io_size || | 703 | if (ubi->max_write_size < ubi->min_io_size || |
703 | ubi->max_write_size % ubi->min_io_size || | 704 | ubi->max_write_size % ubi->min_io_size || |
704 | !is_power_of_2(ubi->max_write_size)) { | 705 | !is_power_of_2(ubi->max_write_size)) { |
705 | ubi_err("bad write buffer size %d for %d min. I/O unit", | 706 | ubi_err(ubi, "bad write buffer size %d for %d min. I/O unit", |
706 | ubi->max_write_size, ubi->min_io_size); | 707 | ubi->max_write_size, ubi->min_io_size); |
707 | return -EINVAL; | 708 | return -EINVAL; |
708 | } | 709 | } |
@@ -739,7 +740,7 @@ static int io_init(struct ubi_device *ubi, int max_beb_per1024) | |||
739 | 740 | ||
740 | /* The shift must be aligned to 32-bit boundary */ | 741 | /* The shift must be aligned to 32-bit boundary */ |
741 | if (ubi->vid_hdr_shift % 4) { | 742 | if (ubi->vid_hdr_shift % 4) { |
742 | ubi_err("unaligned VID header shift %d", | 743 | ubi_err(ubi, "unaligned VID header shift %d", |
743 | ubi->vid_hdr_shift); | 744 | ubi->vid_hdr_shift); |
744 | return -EINVAL; | 745 | return -EINVAL; |
745 | } | 746 | } |
@@ -749,7 +750,7 @@ static int io_init(struct ubi_device *ubi, int max_beb_per1024) | |||
749 | ubi->leb_start < ubi->vid_hdr_offset + UBI_VID_HDR_SIZE || | 750 | ubi->leb_start < ubi->vid_hdr_offset + UBI_VID_HDR_SIZE || |
750 | ubi->leb_start > ubi->peb_size - UBI_VID_HDR_SIZE || | 751 | ubi->leb_start > ubi->peb_size - UBI_VID_HDR_SIZE || |
751 | ubi->leb_start & (ubi->min_io_size - 1)) { | 752 | ubi->leb_start & (ubi->min_io_size - 1)) { |
752 | ubi_err("bad VID header (%d) or data offsets (%d)", | 753 | ubi_err(ubi, "bad VID header (%d) or data offsets (%d)", |
753 | ubi->vid_hdr_offset, ubi->leb_start); | 754 | ubi->vid_hdr_offset, ubi->leb_start); |
754 | return -EINVAL; | 755 | return -EINVAL; |
755 | } | 756 | } |
@@ -769,14 +770,14 @@ static int io_init(struct ubi_device *ubi, int max_beb_per1024) | |||
769 | * read-only mode. | 770 | * read-only mode. |
770 | */ | 771 | */ |
771 | if (ubi->vid_hdr_offset + UBI_VID_HDR_SIZE <= ubi->hdrs_min_io_size) { | 772 | if (ubi->vid_hdr_offset + UBI_VID_HDR_SIZE <= ubi->hdrs_min_io_size) { |
772 | ubi_warn("EC and VID headers are in the same minimal I/O unit, switch to read-only mode"); | 773 | ubi_warn(ubi, "EC and VID headers are in the same minimal I/O unit, switch to read-only mode"); |
773 | ubi->ro_mode = 1; | 774 | ubi->ro_mode = 1; |
774 | } | 775 | } |
775 | 776 | ||
776 | ubi->leb_size = ubi->peb_size - ubi->leb_start; | 777 | ubi->leb_size = ubi->peb_size - ubi->leb_start; |
777 | 778 | ||
778 | if (!(ubi->mtd->flags & MTD_WRITEABLE)) { | 779 | if (!(ubi->mtd->flags & MTD_WRITEABLE)) { |
779 | ubi_msg("MTD device %d is write-protected, attach in read-only mode", | 780 | ubi_msg(ubi, "MTD device %d is write-protected, attach in read-only mode", |
780 | ubi->mtd->index); | 781 | ubi->mtd->index); |
781 | ubi->ro_mode = 1; | 782 | ubi->ro_mode = 1; |
782 | } | 783 | } |
@@ -809,7 +810,7 @@ static int autoresize(struct ubi_device *ubi, int vol_id) | |||
809 | int err, old_reserved_pebs = vol->reserved_pebs; | 810 | int err, old_reserved_pebs = vol->reserved_pebs; |
810 | 811 | ||
811 | if (ubi->ro_mode) { | 812 | if (ubi->ro_mode) { |
812 | ubi_warn("skip auto-resize because of R/O mode"); | 813 | ubi_warn(ubi, "skip auto-resize because of R/O mode"); |
813 | return 0; | 814 | return 0; |
814 | } | 815 | } |
815 | 816 | ||
@@ -830,21 +831,22 @@ static int autoresize(struct ubi_device *ubi, int vol_id) | |||
830 | vtbl_rec = ubi->vtbl[vol_id]; | 831 | vtbl_rec = ubi->vtbl[vol_id]; |
831 | err = ubi_change_vtbl_record(ubi, vol_id, &vtbl_rec); | 832 | err = ubi_change_vtbl_record(ubi, vol_id, &vtbl_rec); |
832 | if (err) | 833 | if (err) |
833 | ubi_err("cannot clean auto-resize flag for volume %d", | 834 | ubi_err(ubi, "cannot clean auto-resize flag for volume %d", |
834 | vol_id); | 835 | vol_id); |
835 | } else { | 836 | } else { |
836 | desc.vol = vol; | 837 | desc.vol = vol; |
837 | err = ubi_resize_volume(&desc, | 838 | err = ubi_resize_volume(&desc, |
838 | old_reserved_pebs + ubi->avail_pebs); | 839 | old_reserved_pebs + ubi->avail_pebs); |
839 | if (err) | 840 | if (err) |
840 | ubi_err("cannot auto-resize volume %d", vol_id); | 841 | ubi_err(ubi, "cannot auto-resize volume %d", |
842 | vol_id); | ||
841 | } | 843 | } |
842 | 844 | ||
843 | if (err) | 845 | if (err) |
844 | return err; | 846 | return err; |
845 | 847 | ||
846 | ubi_msg("volume %d (\"%s\") re-sized from %d to %d LEBs", vol_id, | 848 | ubi_msg(ubi, "volume %d (\"%s\") re-sized from %d to %d LEBs", |
847 | vol->name, old_reserved_pebs, vol->reserved_pebs); | 849 | vol_id, vol->name, old_reserved_pebs, vol->reserved_pebs); |
848 | return 0; | 850 | return 0; |
849 | } | 851 | } |
850 | 852 | ||
@@ -885,7 +887,7 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num, | |||
885 | for (i = 0; i < UBI_MAX_DEVICES; i++) { | 887 | for (i = 0; i < UBI_MAX_DEVICES; i++) { |
886 | ubi = ubi_devices[i]; | 888 | ubi = ubi_devices[i]; |
887 | if (ubi && mtd->index == ubi->mtd->index) { | 889 | if (ubi && mtd->index == ubi->mtd->index) { |
888 | ubi_err("mtd%d is already attached to ubi%d", | 890 | ubi_err(ubi, "mtd%d is already attached to ubi%d", |
889 | mtd->index, i); | 891 | mtd->index, i); |
890 | return -EEXIST; | 892 | return -EEXIST; |
891 | } | 893 | } |
@@ -900,7 +902,7 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num, | |||
900 | * no sense to attach emulated MTD devices, so we prohibit this. | 902 | * no sense to attach emulated MTD devices, so we prohibit this. |
901 | */ | 903 | */ |
902 | if (mtd->type == MTD_UBIVOLUME) { | 904 | if (mtd->type == MTD_UBIVOLUME) { |
903 | ubi_err("refuse attaching mtd%d - it is already emulated on top of UBI", | 905 | ubi_err(ubi, "refuse attaching mtd%d - it is already emulated on top of UBI", |
904 | mtd->index); | 906 | mtd->index); |
905 | return -EINVAL; | 907 | return -EINVAL; |
906 | } | 908 | } |
@@ -911,7 +913,7 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num, | |||
911 | if (!ubi_devices[ubi_num]) | 913 | if (!ubi_devices[ubi_num]) |
912 | break; | 914 | break; |
913 | if (ubi_num == UBI_MAX_DEVICES) { | 915 | if (ubi_num == UBI_MAX_DEVICES) { |
914 | ubi_err("only %d UBI devices may be created", | 916 | ubi_err(ubi, "only %d UBI devices may be created", |
915 | UBI_MAX_DEVICES); | 917 | UBI_MAX_DEVICES); |
916 | return -ENFILE; | 918 | return -ENFILE; |
917 | } | 919 | } |
@@ -921,7 +923,7 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num, | |||
921 | 923 | ||
922 | /* Make sure ubi_num is not busy */ | 924 | /* Make sure ubi_num is not busy */ |
923 | if (ubi_devices[ubi_num]) { | 925 | if (ubi_devices[ubi_num]) { |
924 | ubi_err("ubi%d already exists", ubi_num); | 926 | ubi_err(ubi, "ubi%d already exists", ubi_num); |
925 | return -EEXIST; | 927 | return -EEXIST; |
926 | } | 928 | } |
927 | } | 929 | } |
@@ -953,13 +955,14 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num, | |||
953 | 955 | ||
954 | if (!ubi->fm_disabled && (int)mtd_div_by_eb(ubi->mtd->size, ubi->mtd) | 956 | if (!ubi->fm_disabled && (int)mtd_div_by_eb(ubi->mtd->size, ubi->mtd) |
955 | <= UBI_FM_MAX_START) { | 957 | <= UBI_FM_MAX_START) { |
956 | ubi_err("More than %i PEBs are needed for fastmap, sorry.", | 958 | ubi_err(ubi, "More than %i PEBs are needed for fastmap, sorry.", |
957 | UBI_FM_MAX_START); | 959 | UBI_FM_MAX_START); |
958 | ubi->fm_disabled = 1; | 960 | ubi->fm_disabled = 1; |
959 | } | 961 | } |
960 | 962 | ||
961 | ubi_msg("default fastmap pool size: %d", ubi->fm_pool.max_size); | 963 | ubi_msg(ubi, "default fastmap pool size: %d", ubi->fm_pool.max_size); |
962 | ubi_msg("default fastmap WL pool size: %d", ubi->fm_wl_pool.max_size); | 964 | ubi_msg(ubi, "default fastmap WL pool size: %d", |
965 | ubi->fm_wl_pool.max_size); | ||
963 | #else | 966 | #else |
964 | ubi->fm_disabled = 1; | 967 | ubi->fm_disabled = 1; |
965 | #endif | 968 | #endif |
@@ -970,7 +973,7 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num, | |||
970 | mutex_init(&ubi->fm_mutex); | 973 | mutex_init(&ubi->fm_mutex); |
971 | init_rwsem(&ubi->fm_sem); | 974 | init_rwsem(&ubi->fm_sem); |
972 | 975 | ||
973 | ubi_msg("attaching mtd%d to ubi%d", mtd->index, ubi_num); | 976 | ubi_msg(ubi, "attaching mtd%d to ubi%d", mtd->index, ubi_num); |
974 | 977 | ||
975 | err = io_init(ubi, max_beb_per1024); | 978 | err = io_init(ubi, max_beb_per1024); |
976 | if (err) | 979 | if (err) |
@@ -989,7 +992,8 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num, | |||
989 | #endif | 992 | #endif |
990 | err = ubi_attach(ubi, 0); | 993 | err = ubi_attach(ubi, 0); |
991 | if (err) { | 994 | if (err) { |
992 | ubi_err("failed to attach mtd%d, error %d", mtd->index, err); | 995 | ubi_err(ubi, "failed to attach mtd%d, error %d", |
996 | mtd->index, err); | ||
993 | goto out_free; | 997 | goto out_free; |
994 | } | 998 | } |
995 | 999 | ||
@@ -1010,28 +1014,28 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num, | |||
1010 | ubi->bgt_thread = kthread_create(ubi_thread, ubi, "%s", ubi->bgt_name); | 1014 | ubi->bgt_thread = kthread_create(ubi_thread, ubi, "%s", ubi->bgt_name); |
1011 | if (IS_ERR(ubi->bgt_thread)) { | 1015 | if (IS_ERR(ubi->bgt_thread)) { |
1012 | err = PTR_ERR(ubi->bgt_thread); | 1016 | err = PTR_ERR(ubi->bgt_thread); |
1013 | ubi_err("cannot spawn \"%s\", error %d", ubi->bgt_name, | 1017 | ubi_err(ubi, "cannot spawn \"%s\", error %d", |
1014 | err); | 1018 | ubi->bgt_name, err); |
1015 | goto out_debugfs; | 1019 | goto out_debugfs; |
1016 | } | 1020 | } |
1017 | 1021 | ||
1018 | ubi_msg("attached mtd%d (name \"%s\", size %llu MiB) to ubi%d", | 1022 | ubi_msg(ubi, "attached mtd%d (name \"%s\", size %llu MiB)", |
1019 | mtd->index, mtd->name, ubi->flash_size >> 20, ubi_num); | 1023 | mtd->index, mtd->name, ubi->flash_size >> 20); |
1020 | ubi_msg("PEB size: %d bytes (%d KiB), LEB size: %d bytes", | 1024 | ubi_msg(ubi, "PEB size: %d bytes (%d KiB), LEB size: %d bytes", |
1021 | ubi->peb_size, ubi->peb_size >> 10, ubi->leb_size); | 1025 | ubi->peb_size, ubi->peb_size >> 10, ubi->leb_size); |
1022 | ubi_msg("min./max. I/O unit sizes: %d/%d, sub-page size %d", | 1026 | ubi_msg(ubi, "min./max. I/O unit sizes: %d/%d, sub-page size %d", |
1023 | ubi->min_io_size, ubi->max_write_size, ubi->hdrs_min_io_size); | 1027 | ubi->min_io_size, ubi->max_write_size, ubi->hdrs_min_io_size); |
1024 | ubi_msg("VID header offset: %d (aligned %d), data offset: %d", | 1028 | ubi_msg(ubi, "VID header offset: %d (aligned %d), data offset: %d", |
1025 | ubi->vid_hdr_offset, ubi->vid_hdr_aloffset, ubi->leb_start); | 1029 | ubi->vid_hdr_offset, ubi->vid_hdr_aloffset, ubi->leb_start); |
1026 | ubi_msg("good PEBs: %d, bad PEBs: %d, corrupted PEBs: %d", | 1030 | ubi_msg(ubi, "good PEBs: %d, bad PEBs: %d, corrupted PEBs: %d", |
1027 | ubi->good_peb_count, ubi->bad_peb_count, ubi->corr_peb_count); | 1031 | ubi->good_peb_count, ubi->bad_peb_count, ubi->corr_peb_count); |
1028 | ubi_msg("user volume: %d, internal volumes: %d, max. volumes count: %d", | 1032 | ubi_msg(ubi, "user volume: %d, internal volumes: %d, max. volumes count: %d", |
1029 | ubi->vol_count - UBI_INT_VOL_COUNT, UBI_INT_VOL_COUNT, | 1033 | ubi->vol_count - UBI_INT_VOL_COUNT, UBI_INT_VOL_COUNT, |
1030 | ubi->vtbl_slots); | 1034 | ubi->vtbl_slots); |
1031 | ubi_msg("max/mean erase counter: %d/%d, WL threshold: %d, image sequence number: %u", | 1035 | ubi_msg(ubi, "max/mean erase counter: %d/%d, WL threshold: %d, image sequence number: %u", |
1032 | ubi->max_ec, ubi->mean_ec, CONFIG_MTD_UBI_WL_THRESHOLD, | 1036 | ubi->max_ec, ubi->mean_ec, CONFIG_MTD_UBI_WL_THRESHOLD, |
1033 | ubi->image_seq); | 1037 | ubi->image_seq); |
1034 | ubi_msg("available PEBs: %d, total reserved PEBs: %d, PEBs reserved for bad PEB handling: %d", | 1038 | ubi_msg(ubi, "available PEBs: %d, total reserved PEBs: %d, PEBs reserved for bad PEB handling: %d", |
1035 | ubi->avail_pebs, ubi->rsvd_pebs, ubi->beb_rsvd_pebs); | 1039 | ubi->avail_pebs, ubi->rsvd_pebs, ubi->beb_rsvd_pebs); |
1036 | 1040 | ||
1037 | /* | 1041 | /* |
@@ -1100,7 +1104,7 @@ int ubi_detach_mtd_dev(int ubi_num, int anyway) | |||
1100 | return -EBUSY; | 1104 | return -EBUSY; |
1101 | } | 1105 | } |
1102 | /* This may only happen if there is a bug */ | 1106 | /* This may only happen if there is a bug */ |
1103 | ubi_err("%s reference count %d, destroy anyway", | 1107 | ubi_err(ubi, "%s reference count %d, destroy anyway", |
1104 | ubi->ubi_name, ubi->ref_count); | 1108 | ubi->ubi_name, ubi->ref_count); |
1105 | } | 1109 | } |
1106 | ubi_devices[ubi_num] = NULL; | 1110 | ubi_devices[ubi_num] = NULL; |
@@ -1108,7 +1112,7 @@ int ubi_detach_mtd_dev(int ubi_num, int anyway) | |||
1108 | 1112 | ||
1109 | ubi_assert(ubi_num == ubi->ubi_num); | 1113 | ubi_assert(ubi_num == ubi->ubi_num); |
1110 | ubi_notify_all(ubi, UBI_VOLUME_REMOVED, NULL); | 1114 | ubi_notify_all(ubi, UBI_VOLUME_REMOVED, NULL); |
1111 | ubi_msg("detaching mtd%d from ubi%d", ubi->mtd->index, ubi_num); | 1115 | ubi_msg(ubi, "detaching mtd%d", ubi->mtd->index); |
1112 | #ifdef CONFIG_MTD_UBI_FASTMAP | 1116 | #ifdef CONFIG_MTD_UBI_FASTMAP |
1113 | /* If we don't write a new fastmap at detach time we lose all | 1117 | /* If we don't write a new fastmap at detach time we lose all |
1114 | * EC updates that have been made since the last written fastmap. */ | 1118 | * EC updates that have been made since the last written fastmap. */ |
@@ -1136,7 +1140,7 @@ int ubi_detach_mtd_dev(int ubi_num, int anyway) | |||
1136 | put_mtd_device(ubi->mtd); | 1140 | put_mtd_device(ubi->mtd); |
1137 | vfree(ubi->peb_buf); | 1141 | vfree(ubi->peb_buf); |
1138 | vfree(ubi->fm_buf); | 1142 | vfree(ubi->fm_buf); |
1139 | ubi_msg("mtd%d is detached from ubi%d", ubi->mtd->index, ubi->ubi_num); | 1143 | ubi_msg(ubi, "mtd%d is detached", ubi->mtd->index); |
1140 | put_device(&ubi->dev); | 1144 | put_device(&ubi->dev); |
1141 | return 0; | 1145 | return 0; |
1142 | } | 1146 | } |
@@ -1218,7 +1222,8 @@ static int __init ubi_init(void) | |||
1218 | BUILD_BUG_ON(sizeof(struct ubi_vid_hdr) != 64); | 1222 | BUILD_BUG_ON(sizeof(struct ubi_vid_hdr) != 64); |
1219 | 1223 | ||
1220 | if (mtd_devs > UBI_MAX_DEVICES) { | 1224 | if (mtd_devs > UBI_MAX_DEVICES) { |
1221 | ubi_err("too many MTD devices, maximum is %d", UBI_MAX_DEVICES); | 1225 | pr_err("UBI error: too many MTD devices, maximum is %d", |
1226 | UBI_MAX_DEVICES); | ||
1222 | return -EINVAL; | 1227 | return -EINVAL; |
1223 | } | 1228 | } |
1224 | 1229 | ||
@@ -1226,19 +1231,19 @@ static int __init ubi_init(void) | |||
1226 | ubi_class = class_create(THIS_MODULE, UBI_NAME_STR); | 1231 | ubi_class = class_create(THIS_MODULE, UBI_NAME_STR); |
1227 | if (IS_ERR(ubi_class)) { | 1232 | if (IS_ERR(ubi_class)) { |
1228 | err = PTR_ERR(ubi_class); | 1233 | err = PTR_ERR(ubi_class); |
1229 | ubi_err("cannot create UBI class"); | 1234 | pr_err("UBI error: cannot create UBI class"); |
1230 | goto out; | 1235 | goto out; |
1231 | } | 1236 | } |
1232 | 1237 | ||
1233 | err = class_create_file(ubi_class, &ubi_version); | 1238 | err = class_create_file(ubi_class, &ubi_version); |
1234 | if (err) { | 1239 | if (err) { |
1235 | ubi_err("cannot create sysfs file"); | 1240 | pr_err("UBI error: cannot create sysfs file"); |
1236 | goto out_class; | 1241 | goto out_class; |
1237 | } | 1242 | } |
1238 | 1243 | ||
1239 | err = misc_register(&ubi_ctrl_cdev); | 1244 | err = misc_register(&ubi_ctrl_cdev); |
1240 | if (err) { | 1245 | if (err) { |
1241 | ubi_err("cannot register device"); | 1246 | pr_err("UBI error: cannot register device"); |
1242 | goto out_version; | 1247 | goto out_version; |
1243 | } | 1248 | } |
1244 | 1249 | ||
@@ -1265,7 +1270,8 @@ static int __init ubi_init(void) | |||
1265 | mtd = open_mtd_device(p->name); | 1270 | mtd = open_mtd_device(p->name); |
1266 | if (IS_ERR(mtd)) { | 1271 | if (IS_ERR(mtd)) { |
1267 | err = PTR_ERR(mtd); | 1272 | err = PTR_ERR(mtd); |
1268 | ubi_err("cannot open mtd %s, error %d", p->name, err); | 1273 | pr_err("UBI error: cannot open mtd %s, error %d", |
1274 | p->name, err); | ||
1269 | /* See comment below re-ubi_is_module(). */ | 1275 | /* See comment below re-ubi_is_module(). */ |
1270 | if (ubi_is_module()) | 1276 | if (ubi_is_module()) |
1271 | goto out_detach; | 1277 | goto out_detach; |
@@ -1277,7 +1283,8 @@ static int __init ubi_init(void) | |||
1277 | p->vid_hdr_offs, p->max_beb_per1024); | 1283 | p->vid_hdr_offs, p->max_beb_per1024); |
1278 | mutex_unlock(&ubi_devices_mutex); | 1284 | mutex_unlock(&ubi_devices_mutex); |
1279 | if (err < 0) { | 1285 | if (err < 0) { |
1280 | ubi_err("cannot attach mtd%d", mtd->index); | 1286 | pr_err("UBI error: cannot attach mtd%d", |
1287 | mtd->index); | ||
1281 | put_mtd_device(mtd); | 1288 | put_mtd_device(mtd); |
1282 | 1289 | ||
1283 | /* | 1290 | /* |
@@ -1300,7 +1307,7 @@ static int __init ubi_init(void) | |||
1300 | 1307 | ||
1301 | err = ubiblock_init(); | 1308 | err = ubiblock_init(); |
1302 | if (err) { | 1309 | if (err) { |
1303 | ubi_err("block: cannot initialize, error %d", err); | 1310 | pr_err("UBI error: block: cannot initialize, error %d", err); |
1304 | 1311 | ||
1305 | /* See comment above re-ubi_is_module(). */ | 1312 | /* See comment above re-ubi_is_module(). */ |
1306 | if (ubi_is_module()) | 1313 | if (ubi_is_module()) |
@@ -1326,7 +1333,7 @@ out_version: | |||
1326 | out_class: | 1333 | out_class: |
1327 | class_destroy(ubi_class); | 1334 | class_destroy(ubi_class); |
1328 | out: | 1335 | out: |
1329 | ubi_err("cannot initialize UBI, error %d", err); | 1336 | pr_err("UBI error: cannot initialize UBI, error %d", err); |
1330 | return err; | 1337 | return err; |
1331 | } | 1338 | } |
1332 | late_initcall(ubi_init); | 1339 | late_initcall(ubi_init); |
@@ -1365,7 +1372,7 @@ static int __init bytes_str_to_int(const char *str) | |||
1365 | 1372 | ||
1366 | result = simple_strtoul(str, &endp, 0); | 1373 | result = simple_strtoul(str, &endp, 0); |
1367 | if (str == endp || result >= INT_MAX) { | 1374 | if (str == endp || result >= INT_MAX) { |
1368 | ubi_err("incorrect bytes count: \"%s\"\n", str); | 1375 | pr_err("UBI error: incorrect bytes count: \"%s\"\n", str); |
1369 | return -EINVAL; | 1376 | return -EINVAL; |
1370 | } | 1377 | } |
1371 | 1378 | ||
@@ -1381,7 +1388,7 @@ static int __init bytes_str_to_int(const char *str) | |||
1381 | case '\0': | 1388 | case '\0': |
1382 | break; | 1389 | break; |
1383 | default: | 1390 | default: |
1384 | ubi_err("incorrect bytes count: \"%s\"\n", str); | 1391 | pr_err("UBI error: incorrect bytes count: \"%s\"\n", str); |
1385 | return -EINVAL; | 1392 | return -EINVAL; |
1386 | } | 1393 | } |
1387 | 1394 | ||
@@ -1408,20 +1415,20 @@ static int __init ubi_mtd_param_parse(const char *val, struct kernel_param *kp) | |||
1408 | return -EINVAL; | 1415 | return -EINVAL; |
1409 | 1416 | ||
1410 | if (mtd_devs == UBI_MAX_DEVICES) { | 1417 | if (mtd_devs == UBI_MAX_DEVICES) { |
1411 | ubi_err("too many parameters, max. is %d\n", | 1418 | pr_err("UBI error: too many parameters, max. is %d\n", |
1412 | UBI_MAX_DEVICES); | 1419 | UBI_MAX_DEVICES); |
1413 | return -EINVAL; | 1420 | return -EINVAL; |
1414 | } | 1421 | } |
1415 | 1422 | ||
1416 | len = strnlen(val, MTD_PARAM_LEN_MAX); | 1423 | len = strnlen(val, MTD_PARAM_LEN_MAX); |
1417 | if (len == MTD_PARAM_LEN_MAX) { | 1424 | if (len == MTD_PARAM_LEN_MAX) { |
1418 | ubi_err("parameter \"%s\" is too long, max. is %d\n", | 1425 | pr_err("UBI error: parameter \"%s\" is too long, max. is %d\n", |
1419 | val, MTD_PARAM_LEN_MAX); | 1426 | val, MTD_PARAM_LEN_MAX); |
1420 | return -EINVAL; | 1427 | return -EINVAL; |
1421 | } | 1428 | } |
1422 | 1429 | ||
1423 | if (len == 0) { | 1430 | if (len == 0) { |
1424 | pr_warn("UBI warning: empty 'mtd=' parameter - ignored\n"); | 1431 | pr_err("UBI warning: empty 'mtd=' parameter - ignored\n"); |
1425 | return 0; | 1432 | return 0; |
1426 | } | 1433 | } |
1427 | 1434 | ||
@@ -1435,7 +1442,7 @@ static int __init ubi_mtd_param_parse(const char *val, struct kernel_param *kp) | |||
1435 | tokens[i] = strsep(&pbuf, ","); | 1442 | tokens[i] = strsep(&pbuf, ","); |
1436 | 1443 | ||
1437 | if (pbuf) { | 1444 | if (pbuf) { |
1438 | ubi_err("too many arguments at \"%s\"\n", val); | 1445 | pr_err("UBI error: too many arguments at \"%s\"\n", val); |
1439 | return -EINVAL; | 1446 | return -EINVAL; |
1440 | } | 1447 | } |
1441 | 1448 | ||
@@ -1455,8 +1462,8 @@ static int __init ubi_mtd_param_parse(const char *val, struct kernel_param *kp) | |||
1455 | int err = kstrtoint(token, 10, &p->max_beb_per1024); | 1462 | int err = kstrtoint(token, 10, &p->max_beb_per1024); |
1456 | 1463 | ||
1457 | if (err) { | 1464 | if (err) { |
1458 | ubi_err("bad value for max_beb_per1024 parameter: %s", | 1465 | pr_err("UBI error: bad value for max_beb_per1024 parameter: %s", |
1459 | token); | 1466 | token); |
1460 | return -EINVAL; | 1467 | return -EINVAL; |
1461 | } | 1468 | } |
1462 | } | 1469 | } |
@@ -1466,7 +1473,8 @@ static int __init ubi_mtd_param_parse(const char *val, struct kernel_param *kp) | |||
1466 | int err = kstrtoint(token, 10, &p->ubi_num); | 1473 | int err = kstrtoint(token, 10, &p->ubi_num); |
1467 | 1474 | ||
1468 | if (err) { | 1475 | if (err) { |
1469 | ubi_err("bad value for ubi_num parameter: %s", token); | 1476 | pr_err("UBI error: bad value for ubi_num parameter: %s", |
1477 | token); | ||
1470 | return -EINVAL; | 1478 | return -EINVAL; |
1471 | } | 1479 | } |
1472 | } else | 1480 | } else |