Skip to content

Commit e12fa4d

Browse files
committed
Merge tag 'driver-core-6.10-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
Pull driver core and sysfs fixes from Greg KH: "Here are three small changes for 6.10-rc4 that resolve reported problems, and finally drop an unused api call. These are: - removal of devm_device_add_groups(), all the callers of this are finally gone after the 6.10-rc1 merge (changes came in through different trees), so it's safe to remove. - much reported sysfs build error fixed up for systems that did not have sysfs enabled - driver core sync issue fix for a many reported issue over the years that no one really paid much attention to, until Dirk finally tracked down the real issue and made the "obviously correct and simple" fix for it. All of these have been in linux-next for over a week with no reported problems" * tag 'driver-core-6.10-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: drivers: core: synchronize really_probe() and dev_uevent() sysfs: Unbreak the build around sysfs_bin_attr_simple_read() driver core: remove devm_device_add_groups()
2 parents 33f855c + c0a4009 commit e12fa4d

File tree

3 files changed

+12
-47
lines changed

3 files changed

+12
-47
lines changed

drivers/base/core.c

Lines changed: 3 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2739,8 +2739,11 @@ static ssize_t uevent_show(struct device *dev, struct device_attribute *attr,
27392739
if (!env)
27402740
return -ENOMEM;
27412741

2742+
/* Synchronize with really_probe() */
2743+
device_lock(dev);
27422744
/* let the kset specific function add its keys */
27432745
retval = kset->uevent_ops->uevent(&dev->kobj, env);
2746+
device_unlock(dev);
27442747
if (retval)
27452748
goto out;
27462749

@@ -2845,15 +2848,6 @@ static void devm_attr_group_remove(struct device *dev, void *res)
28452848
sysfs_remove_group(&dev->kobj, group);
28462849
}
28472850

2848-
static void devm_attr_groups_remove(struct device *dev, void *res)
2849-
{
2850-
union device_attr_group_devres *devres = res;
2851-
const struct attribute_group **groups = devres->groups;
2852-
2853-
dev_dbg(dev, "%s: removing groups %p\n", __func__, groups);
2854-
sysfs_remove_groups(&dev->kobj, groups);
2855-
}
2856-
28572851
/**
28582852
* devm_device_add_group - given a device, create a managed attribute group
28592853
* @dev: The device to create the group for
@@ -2886,42 +2880,6 @@ int devm_device_add_group(struct device *dev, const struct attribute_group *grp)
28862880
}
28872881
EXPORT_SYMBOL_GPL(devm_device_add_group);
28882882

2889-
/**
2890-
* devm_device_add_groups - create a bunch of managed attribute groups
2891-
* @dev: The device to create the group for
2892-
* @groups: The attribute groups to create, NULL terminated
2893-
*
2894-
* This function creates a bunch of managed attribute groups. If an error
2895-
* occurs when creating a group, all previously created groups will be
2896-
* removed, unwinding everything back to the original state when this
2897-
* function was called. It will explicitly warn and error if any of the
2898-
* attribute files being created already exist.
2899-
*
2900-
* Returns 0 on success or error code from sysfs_create_group on failure.
2901-
*/
2902-
int devm_device_add_groups(struct device *dev,
2903-
const struct attribute_group **groups)
2904-
{
2905-
union device_attr_group_devres *devres;
2906-
int error;
2907-
2908-
devres = devres_alloc(devm_attr_groups_remove,
2909-
sizeof(*devres), GFP_KERNEL);
2910-
if (!devres)
2911-
return -ENOMEM;
2912-
2913-
error = sysfs_create_groups(&dev->kobj, groups);
2914-
if (error) {
2915-
devres_free(devres);
2916-
return error;
2917-
}
2918-
2919-
devres->groups = groups;
2920-
devres_add(dev, devres);
2921-
return 0;
2922-
}
2923-
EXPORT_SYMBOL_GPL(devm_device_add_groups);
2924-
29252883
static int device_add_attrs(struct device *dev)
29262884
{
29272885
const struct class *class = dev->class;

include/linux/device.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,8 +1220,6 @@ static inline void device_remove_group(struct device *dev,
12201220
return device_remove_groups(dev, groups);
12211221
}
12221222

1223-
int __must_check devm_device_add_groups(struct device *dev,
1224-
const struct attribute_group **groups);
12251223
int __must_check devm_device_add_group(struct device *dev,
12261224
const struct attribute_group *grp);
12271225

include/linux/sysfs.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,15 @@ static inline int sysfs_emit_at(char *buf, int at, const char *fmt, ...)
750750
{
751751
return 0;
752752
}
753+
754+
static inline ssize_t sysfs_bin_attr_simple_read(struct file *file,
755+
struct kobject *kobj,
756+
struct bin_attribute *attr,
757+
char *buf, loff_t off,
758+
size_t count)
759+
{
760+
return 0;
761+
}
753762
#endif /* CONFIG_SYSFS */
754763

755764
static inline int __must_check sysfs_create_file(struct kobject *kobj,

0 commit comments

Comments
 (0)