summaryrefslogtreecommitdiff
path: root/target/linux/generic/patches-3.10/413-mtd-ubi-forced-detach.patch
blob: 0d4fff1ee5789e898a80fd17ef21c9f8bc586f27 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
--- a/drivers/mtd/ubi/cdev.c
+++ b/drivers/mtd/ubi/cdev.c
@@ -974,7 +974,7 @@ static long ubi_cdev_ioctl(struct file *
 static long ctrl_cdev_ioctl(struct file *file, unsigned int cmd,
 			    unsigned long arg)
 {
-	int err = 0;
+	int err = 0, force = 0;
 	void __user *argp = (void __user *)arg;
 
 	if (!capable(CAP_SYS_RESOURCE))
@@ -1024,6 +1024,10 @@ static long ctrl_cdev_ioctl(struct file
 	}
 
 	/* Detach an MTD device command */
+	case UBI_IOCFDET:
+		force = 1;
+		/* no break */
+
 	case UBI_IOCDET:
 	{
 		int ubi_num;
@@ -1036,7 +1040,7 @@ static long ctrl_cdev_ioctl(struct file
 		}
 
 		mutex_lock(&ubi_devices_mutex);
-		err = ubi_detach_mtd_dev(ubi_num, 0);
+		err = ubi_detach_mtd_dev(ubi_num, force);
 		mutex_unlock(&ubi_devices_mutex);
 		break;
 	}
--- a/include/uapi/mtd/ubi-user.h
+++ b/include/uapi/mtd/ubi-user.h
@@ -168,6 +168,7 @@
 #define UBI_IOCATT _IOW(UBI_CTRL_IOC_MAGIC, 64, struct ubi_attach_req)
 /* Detach an MTD device */
 #define UBI_IOCDET _IOW(UBI_CTRL_IOC_MAGIC, 65, __s32)
+#define UBI_IOCFDET _IOW(UBI_CTRL_IOC_MAGIC, 99, __s32)
 
 /* ioctl commands of UBI volume character devices */