vfio/mdev as last user of class_compat has inlined the needed functionality. So all class_compat code can be removed now. Signed-off-by: Heiner Kallweit <hkallweit1@xxxxxxxxx> --- drivers/base/class.c | 87 ------------------------------------ include/linux/device/class.h | 7 --- 2 files changed, 94 deletions(-) diff --git a/drivers/base/class.c b/drivers/base/class.c index f812236e2..525512d05 100644 --- a/drivers/base/class.c +++ b/drivers/base/class.c @@ -551,33 +551,6 @@ ssize_t show_class_attr_string(const struct class *class, EXPORT_SYMBOL_GPL(show_class_attr_string); -struct class_compat { - struct kobject *kobj; -}; - -/** - * class_compat_register - register a compatibility class - * @name: the name of the class - * - * Compatibility class are meant as a temporary user-space compatibility - * workaround when converting a family of class devices to a bus devices. - */ -struct class_compat *class_compat_register(const char *name) -{ - struct class_compat *cls; - - cls = kmalloc(sizeof(struct class_compat), GFP_KERNEL); - if (!cls) - return NULL; - cls->kobj = kobject_create_and_add(name, &class_kset->kobj); - if (!cls->kobj) { - kfree(cls); - return NULL; - } - return cls; -} -EXPORT_SYMBOL_GPL(class_compat_register); - /** * class_pseudo_register - create a pseudo class entry in sysfs * @name: the name of the child @@ -592,66 +565,6 @@ struct kobject *class_pseudo_register(const char *name) } EXPORT_SYMBOL_GPL(class_pseudo_register); -/** - * class_compat_unregister - unregister a compatibility class - * @cls: the class to unregister - */ -void class_compat_unregister(struct class_compat *cls) -{ - kobject_put(cls->kobj); - kfree(cls); -} -EXPORT_SYMBOL_GPL(class_compat_unregister); - -/** - * class_compat_create_link - create a compatibility class device link to - * a bus device - * @cls: the compatibility class - * @dev: the target bus device - * @device_link: an optional device to which a "device" link should be created - */ -int class_compat_create_link(struct class_compat *cls, struct device *dev, - struct device *device_link) -{ - int error; - - error = sysfs_create_link(cls->kobj, &dev->kobj, dev_name(dev)); - if (error) - return error; - - /* - * Optionally add a "device" link (typically to the parent), as a - * class device would have one and we want to provide as much - * backwards compatibility as possible. - */ - if (device_link) { - error = sysfs_create_link(&dev->kobj, &device_link->kobj, - "device"); - if (error) - sysfs_remove_link(cls->kobj, dev_name(dev)); - } - - return error; -} -EXPORT_SYMBOL_GPL(class_compat_create_link); - -/** - * class_compat_remove_link - remove a compatibility class device link to - * a bus device - * @cls: the compatibility class - * @dev: the target bus device - * @device_link: an optional device to which a "device" link was previously - * created - */ -void class_compat_remove_link(struct class_compat *cls, struct device *dev, - struct device *device_link) -{ - if (device_link) - sysfs_remove_link(&dev->kobj, "device"); - sysfs_remove_link(cls->kobj, dev_name(dev)); -} -EXPORT_SYMBOL_GPL(class_compat_remove_link); - /** * class_is_registered - determine if at this moment in time, a class is * registered in the driver core or not. diff --git a/include/linux/device/class.h b/include/linux/device/class.h index 8b6e890c7..85b036d0a 100644 --- a/include/linux/device/class.h +++ b/include/linux/device/class.h @@ -79,13 +79,6 @@ int __must_check class_register(const struct class *class); void class_unregister(const struct class *class); bool class_is_registered(const struct class *class); -struct class_compat; -struct class_compat *class_compat_register(const char *name); -void class_compat_unregister(struct class_compat *cls); -int class_compat_create_link(struct class_compat *cls, struct device *dev, - struct device *device_link); -void class_compat_remove_link(struct class_compat *cls, struct device *dev, - struct device *device_link); struct kobject *class_pseudo_register(const char *name); void class_dev_iter_init(struct class_dev_iter *iter, const struct class *class, -- 2.47.1