Skip to content

Commit 827ed8b

Browse files
hkallweitgregkh
authored andcommitted
drivers: core: remove device_link argument from class_compat_[create|remove]_link
After 7e72208 ("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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent f554b68 commit 827ed8b

File tree

3 files changed

+7
-34
lines changed

3 files changed

+7
-34
lines changed

drivers/base/class.c

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -601,30 +601,10 @@ EXPORT_SYMBOL_GPL(class_compat_unregister);
601601
* a bus device
602602
* @cls: the compatibility class
603603
* @dev: the target bus device
604-
* @device_link: an optional device to which a "device" link should be created
605604
*/
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)
608606
{
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));
628608
}
629609
EXPORT_SYMBOL_GPL(class_compat_create_link);
630610

@@ -633,14 +613,9 @@ EXPORT_SYMBOL_GPL(class_compat_create_link);
633613
* a bus device
634614
* @cls: the compatibility class
635615
* @dev: the target bus device
636-
* @device_link: an optional device to which a "device" link was previously
637-
* created
638616
*/
639-
void class_compat_remove_link(struct class_compat *cls, struct device *dev,
640-
struct device *device_link)
617+
void class_compat_remove_link(struct class_compat *cls, struct device *dev)
641618
{
642-
if (device_link)
643-
sysfs_remove_link(&dev->kobj, "device");
644619
sysfs_remove_link(cls->kobj, dev_name(dev));
645620
}
646621
EXPORT_SYMBOL_GPL(class_compat_remove_link);

drivers/vfio/mdev/mdev_core.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ int mdev_register_parent(struct mdev_parent *parent, struct device *dev,
7676
if (ret)
7777
return ret;
7878

79-
ret = class_compat_create_link(mdev_bus_compat_class, dev, NULL);
79+
ret = class_compat_create_link(mdev_bus_compat_class, dev);
8080
if (ret)
8181
dev_warn(dev, "Failed to create compatibility class link\n");
8282

@@ -98,7 +98,7 @@ void mdev_unregister_parent(struct mdev_parent *parent)
9898
dev_info(parent->dev, "MDEV: Unregistering\n");
9999

100100
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);
102102
device_for_each_child(parent->dev, NULL, mdev_device_remove_cb);
103103
parent_remove_sysfs_files(parent);
104104
up_write(&parent->unreg_sem);

include/linux/device/class.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,8 @@ bool class_is_registered(const struct class *class);
8282
struct class_compat;
8383
struct class_compat *class_compat_register(const char *name);
8484
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);
8987

9088
void class_dev_iter_init(struct class_dev_iter *iter, const struct class *class,
9189
const struct device *start, const struct device_type *type);

0 commit comments

Comments
 (0)