serial: core: Preserve termios c_cflag for console resume
[firefly-linux-kernel-4.4.55.git] / drivers / md / dm-sysfs.c
index f91b40942e07885a1d2265de3c41e6abf6465fc7..c62c5ab6aed52018f6018f84f633124f6356e821 100644 (file)
@@ -75,7 +75,7 @@ static struct attribute *dm_attrs[] = {
        NULL,
 };
 
-static struct sysfs_ops dm_sysfs_ops = {
+static const struct sysfs_ops dm_sysfs_ops = {
        .show   = dm_attr_show,
 };
 
@@ -86,6 +86,7 @@ static struct sysfs_ops dm_sysfs_ops = {
 static struct kobj_type dm_ktype = {
        .sysfs_ops      = &dm_sysfs_ops,
        .default_attrs  = dm_attrs,
+       .release        = dm_kobject_release,
 };
 
 /*
@@ -104,5 +105,7 @@ int dm_sysfs_init(struct mapped_device *md)
  */
 void dm_sysfs_exit(struct mapped_device *md)
 {
-       kobject_put(dm_kobject(md));
+       struct kobject *kobj = dm_kobject(md);
+       kobject_put(kobj);
+       wait_for_completion(dm_get_completion_from_kobject(kobj));
 }