mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-25 08:31:33 +00:00
UBI: Enable re-initializing of the "ubi part" command
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>
This commit is contained in:
parent
9def12cae3
commit
2ee951ba2a
3 changed files with 13 additions and 0 deletions
|
@ -31,6 +31,7 @@
|
||||||
/* Private own data */
|
/* Private own data */
|
||||||
static struct ubi_device *ubi;
|
static struct ubi_device *ubi;
|
||||||
static char buffer[80];
|
static char buffer[80];
|
||||||
|
static int ubi_initialized;
|
||||||
|
|
||||||
struct selected_dev {
|
struct selected_dev {
|
||||||
char dev_name[32]; /* NAND/OneNAND etc */
|
char dev_name[32]; /* NAND/OneNAND etc */
|
||||||
|
@ -428,6 +429,8 @@ static int ubi_dev_scan(struct mtd_info *info, char *ubidev)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ubi_initialized = 1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -463,6 +466,14 @@ static int do_ubi(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
|
||||||
/* todo: get dev number for NAND... */
|
/* todo: get dev number for NAND... */
|
||||||
ubi_dev.nr = 0;
|
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
|
* Check for nand|onenand selection
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1059,6 +1059,7 @@ void __exit ubi_exit(void)
|
||||||
misc_deregister(&ubi_ctrl_cdev);
|
misc_deregister(&ubi_ctrl_cdev);
|
||||||
class_remove_file(ubi_class, &ubi_version);
|
class_remove_file(ubi_class, &ubi_version);
|
||||||
class_destroy(ubi_class);
|
class_destroy(ubi_class);
|
||||||
|
mtd_devs = 0;
|
||||||
}
|
}
|
||||||
module_exit(ubi_exit);
|
module_exit(ubi_exit);
|
||||||
|
|
||||||
|
|
|
@ -211,6 +211,7 @@ static inline long IS_ERR(const void *ptr)
|
||||||
/* functions */
|
/* functions */
|
||||||
extern int ubi_mtd_param_parse(const char *val, struct kernel_param *kp);
|
extern int ubi_mtd_param_parse(const char *val, struct kernel_param *kp);
|
||||||
extern int ubi_init(void);
|
extern int ubi_init(void);
|
||||||
|
extern void ubi_exit(void);
|
||||||
|
|
||||||
extern struct ubi_device *ubi_devices[];
|
extern struct ubi_device *ubi_devices[];
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue