With this patch now, the user can call "ubi part" multiple times to
re-connect the UBI device to another MTD partition.
Signed-off-by: Stefan Roese <sr@denx.de>
/* Private own data */
static struct ubi_device *ubi;
static char buffer[80];
+static int ubi_initialized;
struct selected_dev {
char dev_name[32]; /* NAND/OneNAND etc */
return err;
}
+ ubi_initialized = 1;
+
return 0;
}
/* todo: get dev number for NAND... */
ubi_dev.nr = 0;
+ /*
+ * Call ubi_exit() before re-initializing the UBI subsystem
+ */
+ if (ubi_initialized) {
+ ubi_exit();
+ del_mtd_partitions(ubi_dev.mtd_info);
+ }
+
/*
* Check for nand|onenand selection
*/
misc_deregister(&ubi_ctrl_cdev);
class_remove_file(ubi_class, &ubi_version);
class_destroy(ubi_class);
+ mtd_devs = 0;
}
module_exit(ubi_exit);
/* functions */
extern int ubi_mtd_param_parse(const char *val, struct kernel_param *kp);
extern int ubi_init(void);
+extern void ubi_exit(void);
extern struct ubi_device *ubi_devices[];