1 --- a/drivers/mtd/ubi/cdev.c
2 +++ b/drivers/mtd/ubi/cdev.c
3 @@ -974,7 +974,7 @@ static long ubi_cdev_ioctl(struct file *
4 static long ctrl_cdev_ioctl(struct file *file, unsigned int cmd,
8 + int err = 0, force = 0;
9 void __user *argp = (void __user *)arg;
11 if (!capable(CAP_SYS_RESOURCE))
12 @@ -1024,6 +1024,10 @@ static long ctrl_cdev_ioctl(struct file
15 /* Detach an MTD device command */
23 @@ -1036,7 +1040,7 @@ static long ctrl_cdev_ioctl(struct file
26 mutex_lock(&ubi_devices_mutex);
27 - err = ubi_detach_mtd_dev(ubi_num, 0);
28 + err = ubi_detach_mtd_dev(ubi_num, force);
29 mutex_unlock(&ubi_devices_mutex);
32 --- a/include/uapi/mtd/ubi-user.h
33 +++ b/include/uapi/mtd/ubi-user.h
35 #define UBI_IOCATT _IOW(UBI_CTRL_IOC_MAGIC, 64, struct ubi_attach_req)
36 /* Detach an MTD device */
37 #define UBI_IOCDET _IOW(UBI_CTRL_IOC_MAGIC, 65, __s32)
38 +#define UBI_IOCFDET _IOW(UBI_CTRL_IOC_MAGIC, 99, __s32)
40 /* ioctl commands of UBI volume character devices */