aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/ubi
diff options
context:
space:
mode:
authorKevin Cernekee <cernekee@gmail.com>2010-04-13 16:30:12 -0400
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2010-05-03 02:08:13 -0400
commit70d38b9625edba52a809308427f78831c3963f52 (patch)
treeef5e519bd672c4ec2a80b7a78adfb66251a1193c /drivers/mtd/ubi
parent01bf0b64579ead8a82e7cfc32ae44bc667e7ad0f (diff)
UBI: remove reboot notifier
The UBI reboot notifier causes problems with hibernation. Move this functionality into the low-level MTD driver instead. Signed-off-by: Kevin Cernekee <cernekee@gmail.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'drivers/mtd/ubi')
-rw-r--r--drivers/mtd/ubi/build.c35
-rw-r--r--drivers/mtd/ubi/ubi.h2
2 files changed, 0 insertions, 37 deletions
diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
index 55c726dde942..3a59a1d0045e 100644
--- a/drivers/mtd/ubi/build.c
+++ b/drivers/mtd/ubi/build.c
@@ -42,7 +42,6 @@
42#include <linux/miscdevice.h> 42#include <linux/miscdevice.h>
43#include <linux/log2.h> 43#include <linux/log2.h>
44#include <linux/kthread.h> 44#include <linux/kthread.h>
45#include <linux/reboot.h>
46#include <linux/kernel.h> 45#include <linux/kernel.h>
47#include <linux/slab.h> 46#include <linux/slab.h>
48#include "ubi.h" 47#include "ubi.h"
@@ -832,34 +831,6 @@ static int autoresize(struct ubi_device *ubi, int vol_id)
832} 831}
833 832
834/** 833/**
835 * ubi_reboot_notifier - halt UBI transactions immediately prior to a reboot.
836 * @n: reboot notifier object
837 * @state: SYS_RESTART, SYS_HALT, or SYS_POWER_OFF
838 * @cmd: pointer to command string for RESTART2
839 *
840 * This function stops the UBI background thread so that the flash device
841 * remains quiescent when Linux restarts the system. Any queued work will be
842 * discarded, but this function will block until do_work() finishes if an
843 * operation is already in progress.
844 *
845 * This function solves a real-life problem observed on NOR flashes when an
846 * PEB erase operation starts, then the system is rebooted before the erase is
847 * finishes, and the boot loader gets confused and dies. So we prefer to finish
848 * the ongoing operation before rebooting.
849 */
850static int ubi_reboot_notifier(struct notifier_block *n, unsigned long state,
851 void *cmd)
852{
853 struct ubi_device *ubi;
854
855 ubi = container_of(n, struct ubi_device, reboot_notifier);
856 if (ubi->bgt_thread)
857 kthread_stop(ubi->bgt_thread);
858 ubi_sync(ubi->ubi_num);
859 return NOTIFY_DONE;
860}
861
862/**
863 * ubi_attach_mtd_dev - attach an MTD device. 834 * ubi_attach_mtd_dev - attach an MTD device.
864 * @mtd: MTD device description object 835 * @mtd: MTD device description object
865 * @ubi_num: number to assign to the new UBI device 836 * @ubi_num: number to assign to the new UBI device
@@ -1016,11 +987,6 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num, int vid_hdr_offset)
1016 wake_up_process(ubi->bgt_thread); 987 wake_up_process(ubi->bgt_thread);
1017 spin_unlock(&ubi->wl_lock); 988 spin_unlock(&ubi->wl_lock);
1018 989
1019 /* Flash device priority is 0 - UBI needs to shut down first */
1020 ubi->reboot_notifier.priority = 1;
1021 ubi->reboot_notifier.notifier_call = ubi_reboot_notifier;
1022 register_reboot_notifier(&ubi->reboot_notifier);
1023
1024 ubi_devices[ubi_num] = ubi; 990 ubi_devices[ubi_num] = ubi;
1025 ubi_notify_all(ubi, UBI_VOLUME_ADDED, NULL); 991 ubi_notify_all(ubi, UBI_VOLUME_ADDED, NULL);
1026 return ubi_num; 992 return ubi_num;
@@ -1091,7 +1057,6 @@ int ubi_detach_mtd_dev(int ubi_num, int anyway)
1091 * Before freeing anything, we have to stop the background thread to 1057 * Before freeing anything, we have to stop the background thread to
1092 * prevent it from doing anything on this device while we are freeing. 1058 * prevent it from doing anything on this device while we are freeing.
1093 */ 1059 */
1094 unregister_reboot_notifier(&ubi->reboot_notifier);
1095 if (ubi->bgt_thread) 1060 if (ubi->bgt_thread)
1096 kthread_stop(ubi->bgt_thread); 1061 kthread_stop(ubi->bgt_thread);
1097 1062
diff --git a/drivers/mtd/ubi/ubi.h b/drivers/mtd/ubi/ubi.h
index 5176d4886518..a637f0283add 100644
--- a/drivers/mtd/ubi/ubi.h
+++ b/drivers/mtd/ubi/ubi.h
@@ -350,7 +350,6 @@ struct ubi_wl_entry;
350 * @bgt_thread: background thread description object 350 * @bgt_thread: background thread description object
351 * @thread_enabled: if the background thread is enabled 351 * @thread_enabled: if the background thread is enabled
352 * @bgt_name: background thread name 352 * @bgt_name: background thread name
353 * @reboot_notifier: notifier to terminate background thread before rebooting
354 * 353 *
355 * @flash_size: underlying MTD device size (in bytes) 354 * @flash_size: underlying MTD device size (in bytes)
356 * @peb_count: count of physical eraseblocks on the MTD device 355 * @peb_count: count of physical eraseblocks on the MTD device
@@ -436,7 +435,6 @@ struct ubi_device {
436 struct task_struct *bgt_thread; 435 struct task_struct *bgt_thread;
437 int thread_enabled; 436 int thread_enabled;
438 char bgt_name[sizeof(UBI_BGT_NAME_PATTERN)+2]; 437 char bgt_name[sizeof(UBI_BGT_NAME_PATTERN)+2];
439 struct notifier_block reboot_notifier;
440 438
441 /* I/O sub-system's stuff */ 439 /* I/O sub-system's stuff */
442 long long flash_size; 440 long long flash_size;