Merge tag 'driver-core-5.0-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core

Pull driver core fixes from Greg KH:
"Here is one small sysfs change, and a documentation update for 5.0-rc2

The sysfs change moves from using BUG_ON to WARN_ON, as discussed in
an email thread on lkml while trying to track down another driver bug.
sysfs should not be crashing and preventing people from seeing where
they went wrong. Now it properly recovers and warns the developer.

The documentation update removes the use of BUS_ATTR() as the kernel
is moving away from this to use the specific BUS_ATTR_RW() and friends
instead. There are pending patches in all of the different subsystems
to remove the last users of this macro, but for now, don't advertise
it should be used anymore to keep new ones from being introduced.

Both have been in linux-next with no reported issues"

* tag 'driver-core-5.0-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core:
Documentation: driver core: remove use of BUS_ATTR
sysfs: convert BUG_ON to WARN_ON

Changed files
+17 -10
Documentation
driver-model
filesystems
fs
+4 -4
Documentation/driver-model/bus.txt
··· 124 ssize_t (*store)(struct bus_type *, const char * buf, size_t count); 125 }; 126 127 - Bus drivers can export attributes using the BUS_ATTR macro that works 128 - similarly to the DEVICE_ATTR macro for devices. For example, a definition 129 - like this: 130 131 - static BUS_ATTR(debug,0644,show_debug,store_debug); 132 133 is equivalent to declaring: 134
··· 124 ssize_t (*store)(struct bus_type *, const char * buf, size_t count); 125 }; 126 127 + Bus drivers can export attributes using the BUS_ATTR_RW macro that works 128 + similarly to the DEVICE_ATTR_RW macro for devices. For example, a 129 + definition like this: 130 131 + static BUS_ATTR_RW(debug); 132 133 is equivalent to declaring: 134
+3 -1
Documentation/filesystems/sysfs.txt
··· 344 345 Declaring: 346 347 - BUS_ATTR(_name, _mode, _show, _store) 348 349 Creation/Removal: 350
··· 344 345 Declaring: 346 347 + static BUS_ATTR_RW(name); 348 + static BUS_ATTR_RO(name); 349 + static BUS_ATTR_WO(name); 350 351 Creation/Removal: 352
+2 -1
fs/sysfs/dir.c
··· 43 kuid_t uid; 44 kgid_t gid; 45 46 - BUG_ON(!kobj); 47 48 if (kobj->parent) 49 parent = kobj->parent->sd;
··· 43 kuid_t uid; 44 kgid_t gid; 45 46 + if (WARN_ON(!kobj)) 47 + return -EINVAL; 48 49 if (kobj->parent) 50 parent = kobj->parent->sd;
+4 -2
fs/sysfs/file.c
··· 325 kuid_t uid; 326 kgid_t gid; 327 328 - BUG_ON(!kobj || !kobj->sd || !attr); 329 330 kobject_get_ownership(kobj, &uid, &gid); 331 return sysfs_add_file_mode_ns(kobj->sd, attr, false, attr->mode, ··· 538 kuid_t uid; 539 kgid_t gid; 540 541 - BUG_ON(!kobj || !kobj->sd || !attr); 542 543 kobject_get_ownership(kobj, &uid, &gid); 544 return sysfs_add_file_mode_ns(kobj->sd, &attr->attr, true,
··· 325 kuid_t uid; 326 kgid_t gid; 327 328 + if (WARN_ON(!kobj || !kobj->sd || !attr)) 329 + return -EINVAL; 330 331 kobject_get_ownership(kobj, &uid, &gid); 332 return sysfs_add_file_mode_ns(kobj->sd, attr, false, attr->mode, ··· 537 kuid_t uid; 538 kgid_t gid; 539 540 + if (WARN_ON(!kobj || !kobj->sd || !attr)) 541 + return -EINVAL; 542 543 kobject_get_ownership(kobj, &uid, &gid); 544 return sysfs_add_file_mode_ns(kobj->sd, &attr->attr, true,
+2 -1
fs/sysfs/group.c
··· 112 kgid_t gid; 113 int error; 114 115 - BUG_ON(!kobj || (!update && !kobj->sd)); 116 117 /* Updates may happen before the object has been instantiated */ 118 if (unlikely(update && !kobj->sd))
··· 112 kgid_t gid; 113 int error; 114 115 + if (WARN_ON(!kobj || (!update && !kobj->sd))) 116 + return -EINVAL; 117 118 /* Updates may happen before the object has been instantiated */ 119 if (unlikely(update && !kobj->sd))
+2 -1
fs/sysfs/symlink.c
··· 23 { 24 struct kernfs_node *kn, *target = NULL; 25 26 - BUG_ON(!name || !parent); 27 28 /* 29 * We don't own @target_kobj and it may be removed at any time.
··· 23 { 24 struct kernfs_node *kn, *target = NULL; 25 26 + if (WARN_ON(!name || !parent)) 27 + return -EINVAL; 28 29 /* 30 * We don't own @target_kobj and it may be removed at any time.