Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drivers: core: remove device_link argument from class_compat_[create|remove]_link

After 7e722083fcc3 ("i2c: Remove I2C_COMPAT config symbol and related
code") there's no caller left passing a non-null device_link argument.
So remove this argument to simplify the code.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Link: https://lore.kernel.org/r/db49131d-fd79-4f23-93f2-0ab541a345fa@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Heiner Kallweit and committed by
Greg Kroah-Hartman
827ed8b1 f554b68e

+7 -34
+3 -28
drivers/base/class.c
··· 601 601 * a bus device 602 602 * @cls: the compatibility class 603 603 * @dev: the target bus device 604 - * @device_link: an optional device to which a "device" link should be created 605 604 */ 606 - int class_compat_create_link(struct class_compat *cls, struct device *dev, 607 - struct device *device_link) 605 + int class_compat_create_link(struct class_compat *cls, struct device *dev) 608 606 { 609 - int error; 610 - 611 - error = sysfs_create_link(cls->kobj, &dev->kobj, dev_name(dev)); 612 - if (error) 613 - return error; 614 - 615 - /* 616 - * Optionally add a "device" link (typically to the parent), as a 617 - * class device would have one and we want to provide as much 618 - * backwards compatibility as possible. 619 - */ 620 - if (device_link) { 621 - error = sysfs_create_link(&dev->kobj, &device_link->kobj, 622 - "device"); 623 - if (error) 624 - sysfs_remove_link(cls->kobj, dev_name(dev)); 625 - } 626 - 627 - return error; 607 + return sysfs_create_link(cls->kobj, &dev->kobj, dev_name(dev)); 628 608 } 629 609 EXPORT_SYMBOL_GPL(class_compat_create_link); 630 610 ··· 613 633 * a bus device 614 634 * @cls: the compatibility class 615 635 * @dev: the target bus device 616 - * @device_link: an optional device to which a "device" link was previously 617 - * created 618 636 */ 619 - void class_compat_remove_link(struct class_compat *cls, struct device *dev, 620 - struct device *device_link) 637 + void class_compat_remove_link(struct class_compat *cls, struct device *dev) 621 638 { 622 - if (device_link) 623 - sysfs_remove_link(&dev->kobj, "device"); 624 639 sysfs_remove_link(cls->kobj, dev_name(dev)); 625 640 } 626 641 EXPORT_SYMBOL_GPL(class_compat_remove_link);
+2 -2
drivers/vfio/mdev/mdev_core.c
··· 76 76 if (ret) 77 77 return ret; 78 78 79 - ret = class_compat_create_link(mdev_bus_compat_class, dev, NULL); 79 + ret = class_compat_create_link(mdev_bus_compat_class, dev); 80 80 if (ret) 81 81 dev_warn(dev, "Failed to create compatibility class link\n"); 82 82 ··· 98 98 dev_info(parent->dev, "MDEV: Unregistering\n"); 99 99 100 100 down_write(&parent->unreg_sem); 101 - class_compat_remove_link(mdev_bus_compat_class, parent->dev, NULL); 101 + class_compat_remove_link(mdev_bus_compat_class, parent->dev); 102 102 device_for_each_child(parent->dev, NULL, mdev_device_remove_cb); 103 103 parent_remove_sysfs_files(parent); 104 104 up_write(&parent->unreg_sem);
+2 -4
include/linux/device/class.h
··· 82 82 struct class_compat; 83 83 struct class_compat *class_compat_register(const char *name); 84 84 void class_compat_unregister(struct class_compat *cls); 85 - int class_compat_create_link(struct class_compat *cls, struct device *dev, 86 - struct device *device_link); 87 - void class_compat_remove_link(struct class_compat *cls, struct device *dev, 88 - struct device *device_link); 85 + int class_compat_create_link(struct class_compat *cls, struct device *dev); 86 + void class_compat_remove_link(struct class_compat *cls, struct device *dev); 89 87 90 88 void class_dev_iter_init(struct class_dev_iter *iter, const struct class *class, 91 89 const struct device *start, const struct device_type *type);