1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (c) International Business Machines Corp., 2006
5 * Author: Artem Bityutskiy (Битюцкий Артём)
8 /* This file mostly implements UBI kernel API functions */
11 #include <dm/devres.h>
12 #include <linux/module.h>
13 #include <linux/slab.h>
14 #include <linux/namei.h>
16 #include <asm/div64.h>
18 #include <ubi_uboot.h>
20 #include <linux/err.h>
25 * ubi_do_get_device_info - get information about UBI device.
26 * @ubi: UBI device description object
27 * @di: the information is stored here
29 * This function is the same as 'ubi_get_device_info()', but it assumes the UBI
30 * device is locked and cannot disappear.
32 void ubi_do_get_device_info(struct ubi_device *ubi, struct ubi_device_info *di)
34 di->ubi_num = ubi->ubi_num;
35 di->leb_size = ubi->leb_size;
36 di->leb_start = ubi->leb_start;
37 di->min_io_size = ubi->min_io_size;
38 di->max_write_size = ubi->max_write_size;
39 di->ro_mode = ubi->ro_mode;
41 di->cdev = ubi->cdev.dev;
44 EXPORT_SYMBOL_GPL(ubi_do_get_device_info);
47 * ubi_get_device_info - get information about UBI device.
48 * @ubi_num: UBI device number
49 * @di: the information is stored here
51 * This function returns %0 in case of success, %-EINVAL if the UBI device
52 * number is invalid, and %-ENODEV if there is no such UBI device.
54 int ubi_get_device_info(int ubi_num, struct ubi_device_info *di)
56 struct ubi_device *ubi;
58 if (ubi_num < 0 || ubi_num >= UBI_MAX_DEVICES)
60 ubi = ubi_get_device(ubi_num);
63 ubi_do_get_device_info(ubi, di);
67 EXPORT_SYMBOL_GPL(ubi_get_device_info);
70 * ubi_do_get_volume_info - get information about UBI volume.
71 * @ubi: UBI device description object
72 * @vol: volume description object
73 * @vi: the information is stored here
75 void ubi_do_get_volume_info(struct ubi_device *ubi, struct ubi_volume *vol,
76 struct ubi_volume_info *vi)
78 vi->vol_id = vol->vol_id;
79 vi->ubi_num = ubi->ubi_num;
80 vi->size = vol->reserved_pebs;
81 vi->used_bytes = vol->used_bytes;
82 vi->vol_type = vol->vol_type;
83 vi->corrupted = vol->corrupted;
84 vi->upd_marker = vol->upd_marker;
85 vi->alignment = vol->alignment;
86 vi->usable_leb_size = vol->usable_leb_size;
87 vi->name_len = vol->name_len;
89 vi->cdev = vol->cdev.dev;
93 * ubi_get_volume_info - get information about UBI volume.
94 * @desc: volume descriptor
95 * @vi: the information is stored here
97 void ubi_get_volume_info(struct ubi_volume_desc *desc,
98 struct ubi_volume_info *vi)
100 ubi_do_get_volume_info(desc->vol->ubi, desc->vol, vi);
102 EXPORT_SYMBOL_GPL(ubi_get_volume_info);
105 * ubi_open_volume - open UBI volume.
106 * @ubi_num: UBI device number
110 * The @mode parameter specifies if the volume should be opened in read-only
111 * mode, read-write mode, or exclusive mode. The exclusive mode guarantees that
112 * nobody else will be able to open this volume. UBI allows to have many volume
113 * readers and one writer at a time.
115 * If a static volume is being opened for the first time since boot, it will be
116 * checked by this function, which means it will be fully read and the CRC
117 * checksum of each logical eraseblock will be checked.
119 * This function returns volume descriptor in case of success and a negative
120 * error code in case of failure.
122 struct ubi_volume_desc *ubi_open_volume(int ubi_num, int vol_id, int mode)
125 struct ubi_volume_desc *desc;
126 struct ubi_device *ubi;
127 struct ubi_volume *vol;
129 dbg_gen("open device %d, volume %d, mode %d", ubi_num, vol_id, mode);
131 if (ubi_num < 0 || ubi_num >= UBI_MAX_DEVICES)
132 return ERR_PTR(-EINVAL);
134 if (mode != UBI_READONLY && mode != UBI_READWRITE &&
135 mode != UBI_EXCLUSIVE && mode != UBI_METAONLY)
136 return ERR_PTR(-EINVAL);
139 * First of all, we have to get the UBI device to prevent its removal.
141 ubi = ubi_get_device(ubi_num);
143 return ERR_PTR(-ENODEV);
145 if (vol_id < 0 || vol_id >= ubi->vtbl_slots) {
150 desc = kmalloc(sizeof(struct ubi_volume_desc), GFP_KERNEL);
157 if (!try_module_get(THIS_MODULE))
160 spin_lock(&ubi->volumes_lock);
161 vol = ubi->volumes[vol_id];
174 if (vol->exclusive || vol->writers > 0)
180 if (vol->exclusive || vol->writers || vol->readers ||
187 if (vol->metaonly || vol->exclusive)
192 get_device(&vol->dev);
194 spin_unlock(&ubi->volumes_lock);
199 mutex_lock(&ubi->ckvol_mutex);
200 if (!vol->checked && !vol->skip_check) {
201 /* This is the first open - check the volume */
202 err = ubi_check_volume(ubi, vol_id);
204 mutex_unlock(&ubi->ckvol_mutex);
205 ubi_close_volume(desc);
209 ubi_warn(ubi, "volume %d on UBI device %d is corrupted",
210 vol_id, ubi->ubi_num);
215 mutex_unlock(&ubi->ckvol_mutex);
220 spin_unlock(&ubi->volumes_lock);
221 module_put(THIS_MODULE);
226 ubi_err(ubi, "cannot open device %d, volume %d, error %d",
227 ubi_num, vol_id, err);
230 EXPORT_SYMBOL_GPL(ubi_open_volume);
233 * ubi_open_volume_nm - open UBI volume by name.
234 * @ubi_num: UBI device number
238 * This function is similar to 'ubi_open_volume()', but opens a volume by name.
240 struct ubi_volume_desc *ubi_open_volume_nm(int ubi_num, const char *name,
243 int i, vol_id = -1, len;
244 struct ubi_device *ubi;
245 struct ubi_volume_desc *ret;
247 dbg_gen("open device %d, volume %s, mode %d", ubi_num, name, mode);
250 return ERR_PTR(-EINVAL);
252 len = strnlen(name, UBI_VOL_NAME_MAX + 1);
253 if (len > UBI_VOL_NAME_MAX)
254 return ERR_PTR(-EINVAL);
256 if (ubi_num < 0 || ubi_num >= UBI_MAX_DEVICES)
257 return ERR_PTR(-EINVAL);
259 ubi = ubi_get_device(ubi_num);
261 return ERR_PTR(-ENODEV);
263 spin_lock(&ubi->volumes_lock);
264 /* Walk all volumes of this UBI device */
265 for (i = 0; i < ubi->vtbl_slots; i++) {
266 struct ubi_volume *vol = ubi->volumes[i];
268 if (vol && len == vol->name_len && !strcmp(name, vol->name)) {
273 spin_unlock(&ubi->volumes_lock);
276 ret = ubi_open_volume(ubi_num, vol_id, mode);
278 ret = ERR_PTR(-ENODEV);
281 * We should put the UBI device even in case of success, because
282 * 'ubi_open_volume()' took a reference as well.
287 EXPORT_SYMBOL_GPL(ubi_open_volume_nm);
291 * ubi_open_volume_path - open UBI volume by its character device node path.
292 * @pathname: volume character device node path
295 * This function is similar to 'ubi_open_volume()', but opens a volume the path
296 * to its character device node.
298 struct ubi_volume_desc *ubi_open_volume_path(const char *pathname, int mode)
300 int error, ubi_num, vol_id, mod;
304 dbg_gen("open volume %s, mode %d", pathname, mode);
306 if (!pathname || !*pathname)
307 return ERR_PTR(-EINVAL);
309 error = kern_path(pathname, LOOKUP_FOLLOW, &path);
311 return ERR_PTR(error);
313 inode = d_backing_inode(path.dentry);
315 ubi_num = ubi_major2num(imajor(inode));
316 vol_id = iminor(inode) - 1;
320 return ERR_PTR(-EINVAL);
321 if (vol_id >= 0 && ubi_num >= 0)
322 return ubi_open_volume(ubi_num, vol_id, mode);
323 return ERR_PTR(-ENODEV);
325 EXPORT_SYMBOL_GPL(ubi_open_volume_path);
329 * ubi_close_volume - close UBI volume.
330 * @desc: volume descriptor
332 void ubi_close_volume(struct ubi_volume_desc *desc)
334 struct ubi_volume *vol = desc->vol;
335 struct ubi_device *ubi = vol->ubi;
337 dbg_gen("close device %d, volume %d, mode %d",
338 ubi->ubi_num, vol->vol_id, desc->mode);
340 spin_lock(&ubi->volumes_lock);
341 switch (desc->mode) {
356 spin_unlock(&ubi->volumes_lock);
359 put_device(&vol->dev);
361 module_put(THIS_MODULE);
363 EXPORT_SYMBOL_GPL(ubi_close_volume);
366 * leb_read_sanity_check - does sanity checks on read requests.
367 * @desc: volume descriptor
368 * @lnum: logical eraseblock number to read from
369 * @offset: offset within the logical eraseblock to read from
370 * @len: how many bytes to read
372 * This function is used by ubi_leb_read() and ubi_leb_read_sg()
373 * to perform sanity checks.
375 static int leb_read_sanity_check(struct ubi_volume_desc *desc, int lnum,
378 struct ubi_volume *vol = desc->vol;
379 struct ubi_device *ubi = vol->ubi;
380 int vol_id = vol->vol_id;
382 if (vol_id < 0 || vol_id >= ubi->vtbl_slots || lnum < 0 ||
383 lnum >= vol->used_ebs || offset < 0 || len < 0 ||
384 offset + len > vol->usable_leb_size)
387 if (vol->vol_type == UBI_STATIC_VOLUME) {
388 if (vol->used_ebs == 0)
389 /* Empty static UBI volume */
391 if (lnum == vol->used_ebs - 1 &&
392 offset + len > vol->last_eb_bytes)
403 * ubi_leb_read - read data.
404 * @desc: volume descriptor
405 * @lnum: logical eraseblock number to read from
406 * @buf: buffer where to store the read data
407 * @offset: offset within the logical eraseblock to read from
408 * @len: how many bytes to read
409 * @check: whether UBI has to check the read data's CRC or not.
411 * This function reads data from offset @offset of logical eraseblock @lnum and
412 * stores the data at @buf. When reading from static volumes, @check specifies
413 * whether the data has to be checked or not. If yes, the whole logical
414 * eraseblock will be read and its CRC checksum will be checked (i.e., the CRC
415 * checksum is per-eraseblock). So checking may substantially slow down the
416 * read speed. The @check argument is ignored for dynamic volumes.
418 * In case of success, this function returns zero. In case of failure, this
419 * function returns a negative error code.
421 * %-EBADMSG error code is returned:
422 * o for both static and dynamic volumes if MTD driver has detected a data
423 * integrity problem (unrecoverable ECC checksum mismatch in case of NAND);
424 * o for static volumes in case of data CRC mismatch.
426 * If the volume is damaged because of an interrupted update this function just
427 * returns immediately with %-EBADF error code.
429 int ubi_leb_read(struct ubi_volume_desc *desc, int lnum, char *buf, int offset,
432 struct ubi_volume *vol = desc->vol;
433 struct ubi_device *ubi = vol->ubi;
434 int err, vol_id = vol->vol_id;
436 dbg_gen("read %d bytes from LEB %d:%d:%d", len, vol_id, lnum, offset);
438 err = leb_read_sanity_check(desc, lnum, offset, len);
445 err = ubi_eba_read_leb(ubi, vol, lnum, buf, offset, len, check);
446 if (err && mtd_is_eccerr(err) && vol->vol_type == UBI_STATIC_VOLUME) {
447 ubi_warn(ubi, "mark volume %d as corrupted", vol_id);
453 EXPORT_SYMBOL_GPL(ubi_leb_read);
457 * ubi_leb_read_sg - read data into a scatter gather list.
458 * @desc: volume descriptor
459 * @lnum: logical eraseblock number to read from
460 * @buf: buffer where to store the read data
461 * @offset: offset within the logical eraseblock to read from
462 * @len: how many bytes to read
463 * @check: whether UBI has to check the read data's CRC or not.
465 * This function works exactly like ubi_leb_read_sg(). But instead of
466 * storing the read data into a buffer it writes to an UBI scatter gather
469 int ubi_leb_read_sg(struct ubi_volume_desc *desc, int lnum, struct ubi_sgl *sgl,
470 int offset, int len, int check)
472 struct ubi_volume *vol = desc->vol;
473 struct ubi_device *ubi = vol->ubi;
474 int err, vol_id = vol->vol_id;
476 dbg_gen("read %d bytes from LEB %d:%d:%d", len, vol_id, lnum, offset);
478 err = leb_read_sanity_check(desc, lnum, offset, len);
485 err = ubi_eba_read_leb_sg(ubi, vol, sgl, lnum, offset, len, check);
486 if (err && mtd_is_eccerr(err) && vol->vol_type == UBI_STATIC_VOLUME) {
487 ubi_warn(ubi, "mark volume %d as corrupted", vol_id);
493 EXPORT_SYMBOL_GPL(ubi_leb_read_sg);
497 * ubi_leb_write - write data.
498 * @desc: volume descriptor
499 * @lnum: logical eraseblock number to write to
500 * @buf: data to write
501 * @offset: offset within the logical eraseblock where to write
502 * @len: how many bytes to write
504 * This function writes @len bytes of data from @buf to offset @offset of
505 * logical eraseblock @lnum.
507 * This function takes care of physical eraseblock write failures. If write to
508 * the physical eraseblock write operation fails, the logical eraseblock is
509 * re-mapped to another physical eraseblock, the data is recovered, and the
510 * write finishes. UBI has a pool of reserved physical eraseblocks for this.
512 * If all the data were successfully written, zero is returned. If an error
513 * occurred and UBI has not been able to recover from it, this function returns
514 * a negative error code. Note, in case of an error, it is possible that
515 * something was still written to the flash media, but that may be some
518 * If the volume is damaged because of an interrupted update this function just
519 * returns immediately with %-EBADF code.
521 int ubi_leb_write(struct ubi_volume_desc *desc, int lnum, const void *buf,
524 struct ubi_volume *vol = desc->vol;
525 struct ubi_device *ubi = vol->ubi;
526 int vol_id = vol->vol_id;
528 dbg_gen("write %d bytes to LEB %d:%d:%d", len, vol_id, lnum, offset);
530 if (vol_id < 0 || vol_id >= ubi->vtbl_slots)
533 if (desc->mode == UBI_READONLY || vol->vol_type == UBI_STATIC_VOLUME)
536 if (lnum < 0 || lnum >= vol->reserved_pebs || offset < 0 || len < 0 ||
537 offset + len > vol->usable_leb_size ||
538 offset & (ubi->min_io_size - 1) || len & (ubi->min_io_size - 1))
547 return ubi_eba_write_leb(ubi, vol, lnum, buf, offset, len);
549 EXPORT_SYMBOL_GPL(ubi_leb_write);
552 * ubi_leb_change - change logical eraseblock atomically.
553 * @desc: volume descriptor
554 * @lnum: logical eraseblock number to change
555 * @buf: data to write
556 * @len: how many bytes to write
558 * This function changes the contents of a logical eraseblock atomically. @buf
559 * has to contain new logical eraseblock data, and @len - the length of the
560 * data, which has to be aligned. The length may be shorter than the logical
561 * eraseblock size, ant the logical eraseblock may be appended to more times
562 * later on. This function guarantees that in case of an unclean reboot the old
563 * contents is preserved. Returns zero in case of success and a negative error
564 * code in case of failure.
566 int ubi_leb_change(struct ubi_volume_desc *desc, int lnum, const void *buf,
569 struct ubi_volume *vol = desc->vol;
570 struct ubi_device *ubi = vol->ubi;
571 int vol_id = vol->vol_id;
573 dbg_gen("atomically write %d bytes to LEB %d:%d", len, vol_id, lnum);
575 if (vol_id < 0 || vol_id >= ubi->vtbl_slots)
578 if (desc->mode == UBI_READONLY || vol->vol_type == UBI_STATIC_VOLUME)
581 if (lnum < 0 || lnum >= vol->reserved_pebs || len < 0 ||
582 len > vol->usable_leb_size || len & (ubi->min_io_size - 1))
591 return ubi_eba_atomic_leb_change(ubi, vol, lnum, buf, len);
593 EXPORT_SYMBOL_GPL(ubi_leb_change);
596 * ubi_leb_erase - erase logical eraseblock.
597 * @desc: volume descriptor
598 * @lnum: logical eraseblock number
600 * This function un-maps logical eraseblock @lnum and synchronously erases the
601 * correspondent physical eraseblock. Returns zero in case of success and a
602 * negative error code in case of failure.
604 * If the volume is damaged because of an interrupted update this function just
605 * returns immediately with %-EBADF code.
607 int ubi_leb_erase(struct ubi_volume_desc *desc, int lnum)
609 struct ubi_volume *vol = desc->vol;
610 struct ubi_device *ubi = vol->ubi;
613 dbg_gen("erase LEB %d:%d", vol->vol_id, lnum);
615 if (desc->mode == UBI_READONLY || vol->vol_type == UBI_STATIC_VOLUME)
618 if (lnum < 0 || lnum >= vol->reserved_pebs)
624 err = ubi_eba_unmap_leb(ubi, vol, lnum);
628 return ubi_wl_flush(ubi, vol->vol_id, lnum);
630 EXPORT_SYMBOL_GPL(ubi_leb_erase);
633 * ubi_leb_unmap - un-map logical eraseblock.
634 * @desc: volume descriptor
635 * @lnum: logical eraseblock number
637 * This function un-maps logical eraseblock @lnum and schedules the
638 * corresponding physical eraseblock for erasure, so that it will eventually be
639 * physically erased in background. This operation is much faster than the
642 * Unlike erase, the un-map operation does not guarantee that the logical
643 * eraseblock will contain all 0xFF bytes when UBI is initialized again. For
644 * example, if several logical eraseblocks are un-mapped, and an unclean reboot
645 * happens after this, the logical eraseblocks will not necessarily be
646 * un-mapped again when this MTD device is attached. They may actually be
647 * mapped to the same physical eraseblocks again. So, this function has to be
650 * In other words, when un-mapping a logical eraseblock, UBI does not store
651 * any information about this on the flash media, it just marks the logical
652 * eraseblock as "un-mapped" in RAM. If UBI is detached before the physical
653 * eraseblock is physically erased, it will be mapped again to the same logical
654 * eraseblock when the MTD device is attached again.
656 * The main and obvious use-case of this function is when the contents of a
657 * logical eraseblock has to be re-written. Then it is much more efficient to
658 * first un-map it, then write new data, rather than first erase it, then write
659 * new data. Note, once new data has been written to the logical eraseblock,
660 * UBI guarantees that the old contents has gone forever. In other words, if an
661 * unclean reboot happens after the logical eraseblock has been un-mapped and
662 * then written to, it will contain the last written data.
664 * This function returns zero in case of success and a negative error code in
665 * case of failure. If the volume is damaged because of an interrupted update
666 * this function just returns immediately with %-EBADF code.
668 int ubi_leb_unmap(struct ubi_volume_desc *desc, int lnum)
670 struct ubi_volume *vol = desc->vol;
671 struct ubi_device *ubi = vol->ubi;
673 dbg_gen("unmap LEB %d:%d", vol->vol_id, lnum);
675 if (desc->mode == UBI_READONLY || vol->vol_type == UBI_STATIC_VOLUME)
678 if (lnum < 0 || lnum >= vol->reserved_pebs)
684 return ubi_eba_unmap_leb(ubi, vol, lnum);
686 EXPORT_SYMBOL_GPL(ubi_leb_unmap);
689 * ubi_leb_map - map logical eraseblock to a physical eraseblock.
690 * @desc: volume descriptor
691 * @lnum: logical eraseblock number
693 * This function maps an un-mapped logical eraseblock @lnum to a physical
694 * eraseblock. This means, that after a successful invocation of this
695 * function the logical eraseblock @lnum will be empty (contain only %0xFF
696 * bytes) and be mapped to a physical eraseblock, even if an unclean reboot
699 * This function returns zero in case of success, %-EBADF if the volume is
700 * damaged because of an interrupted update, %-EBADMSG if the logical
701 * eraseblock is already mapped, and other negative error codes in case of
704 int ubi_leb_map(struct ubi_volume_desc *desc, int lnum)
706 struct ubi_volume *vol = desc->vol;
707 struct ubi_device *ubi = vol->ubi;
709 dbg_gen("unmap LEB %d:%d", vol->vol_id, lnum);
711 if (desc->mode == UBI_READONLY || vol->vol_type == UBI_STATIC_VOLUME)
714 if (lnum < 0 || lnum >= vol->reserved_pebs)
720 if (vol->eba_tbl[lnum] >= 0)
723 return ubi_eba_write_leb(ubi, vol, lnum, NULL, 0, 0);
725 EXPORT_SYMBOL_GPL(ubi_leb_map);
728 * ubi_is_mapped - check if logical eraseblock is mapped.
729 * @desc: volume descriptor
730 * @lnum: logical eraseblock number
732 * This function checks if logical eraseblock @lnum is mapped to a physical
733 * eraseblock. If a logical eraseblock is un-mapped, this does not necessarily
734 * mean it will still be un-mapped after the UBI device is re-attached. The
735 * logical eraseblock may become mapped to the physical eraseblock it was last
738 * This function returns %1 if the LEB is mapped, %0 if not, and a negative
739 * error code in case of failure. If the volume is damaged because of an
740 * interrupted update this function just returns immediately with %-EBADF error
743 int ubi_is_mapped(struct ubi_volume_desc *desc, int lnum)
745 struct ubi_volume *vol = desc->vol;
747 dbg_gen("test LEB %d:%d", vol->vol_id, lnum);
749 if (lnum < 0 || lnum >= vol->reserved_pebs)
755 return vol->eba_tbl[lnum] >= 0;
757 EXPORT_SYMBOL_GPL(ubi_is_mapped);
760 * ubi_sync - synchronize UBI device buffers.
761 * @ubi_num: UBI device to synchronize
763 * The underlying MTD device may cache data in hardware or in software. This
764 * function ensures the caches are flushed. Returns zero in case of success and
765 * a negative error code in case of failure.
767 int ubi_sync(int ubi_num)
769 struct ubi_device *ubi;
771 ubi = ubi_get_device(ubi_num);
779 EXPORT_SYMBOL_GPL(ubi_sync);
782 * ubi_flush - flush UBI work queue.
783 * @ubi_num: UBI device to flush work queue
784 * @vol_id: volume id to flush for
785 * @lnum: logical eraseblock number to flush for
787 * This function executes all pending works for a particular volume id / logical
788 * eraseblock number pair. If either value is set to %UBI_ALL, then it acts as
789 * a wildcard for all of the corresponding volume numbers or logical
790 * eraseblock numbers. It returns zero in case of success and a negative error
791 * code in case of failure.
793 int ubi_flush(int ubi_num, int vol_id, int lnum)
795 struct ubi_device *ubi;
798 ubi = ubi_get_device(ubi_num);
802 err = ubi_wl_flush(ubi, vol_id, lnum);
806 EXPORT_SYMBOL_GPL(ubi_flush);
809 BLOCKING_NOTIFIER_HEAD(ubi_notifiers);
812 * ubi_register_volume_notifier - register a volume notifier.
813 * @nb: the notifier description object
814 * @ignore_existing: if non-zero, do not send "added" notification for all
815 * already existing volumes
817 * This function registers a volume notifier, which means that
818 * 'nb->notifier_call()' will be invoked when an UBI volume is created,
819 * removed, re-sized, re-named, or updated. The first argument of the function
820 * is the notification type. The second argument is pointer to a
821 * &struct ubi_notification object which describes the notification event.
822 * Using UBI API from the volume notifier is prohibited.
824 * This function returns zero in case of success and a negative error code
825 * in case of failure.
827 int ubi_register_volume_notifier(struct notifier_block *nb,
832 err = blocking_notifier_chain_register(&ubi_notifiers, nb);
839 * We are going to walk all UBI devices and all volumes, and
840 * notify the user about existing volumes by the %UBI_VOLUME_ADDED
841 * event. We have to lock the @ubi_devices_mutex to make sure UBI
842 * devices do not disappear.
844 mutex_lock(&ubi_devices_mutex);
845 ubi_enumerate_volumes(nb);
846 mutex_unlock(&ubi_devices_mutex);
850 EXPORT_SYMBOL_GPL(ubi_register_volume_notifier);
853 * ubi_unregister_volume_notifier - unregister the volume notifier.
854 * @nb: the notifier description object
856 * This function unregisters volume notifier @nm and returns zero in case of
857 * success and a negative error code in case of failure.
859 int ubi_unregister_volume_notifier(struct notifier_block *nb)
861 return blocking_notifier_chain_unregister(&ubi_notifiers, nb);
863 EXPORT_SYMBOL_GPL(ubi_unregister_volume_notifier);