vfio/mdev: Use the driver core to create the 'remove' file
[linux-2.6-microblaze.git] / drivers / vfio / mdev / mdev_sysfs.c
index 5a3873d..0ccfeb3 100644 (file)
@@ -244,11 +244,20 @@ static ssize_t remove_store(struct device *dev, struct device_attribute *attr,
 
 static DEVICE_ATTR_WO(remove);
 
-static const struct attribute *mdev_device_attrs[] = {
+static struct attribute *mdev_device_attrs[] = {
        &dev_attr_remove.attr,
        NULL,
 };
 
+static const struct attribute_group mdev_device_group = {
+       .attrs = mdev_device_attrs,
+};
+
+const struct attribute_group *mdev_device_groups[] = {
+       &mdev_device_group,
+       NULL
+};
+
 int mdev_create_sysfs_files(struct mdev_device *mdev)
 {
        struct mdev_type *type = mdev->type;
@@ -262,15 +271,8 @@ int mdev_create_sysfs_files(struct mdev_device *mdev)
        ret = sysfs_create_link(kobj, &type->kobj, "mdev_type");
        if (ret)
                goto type_link_failed;
-
-       ret = sysfs_create_files(kobj, mdev_device_attrs);
-       if (ret)
-               goto create_files_failed;
-
        return ret;
 
-create_files_failed:
-       sysfs_remove_link(kobj, "mdev_type");
 type_link_failed:
        sysfs_remove_link(mdev->type->devices_kobj, dev_name(&mdev->dev));
        return ret;
@@ -280,7 +282,6 @@ void mdev_remove_sysfs_files(struct mdev_device *mdev)
 {
        struct kobject *kobj = &mdev->dev.kobj;
 
-       sysfs_remove_files(kobj, mdev_device_attrs);
        sysfs_remove_link(kobj, "mdev_type");
        sysfs_remove_link(mdev->type->devices_kobj, dev_name(&mdev->dev));
 }