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

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'driver-core-6.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/driver-core/driver-core

Pull driver core updates from Greg KH:
"Here are the driver core / kernfs changes for 6.16-rc1.

Not a huge number of changes this development cycle, here's the
summary of what is included in here:

- kernfs locking tweaks, pushing some global locks down into a per-fs
image lock

- rust driver core and pci device bindings added for new features.

- sysfs const work for bin_attributes.

The final churn of switching away from and removing the
transitional struct members, "read_new", "write_new" and
"bin_attrs_new" will come after the merge window to avoid
unnecesary merge conflicts.

- auxbus device creation helpers added

- fauxbus fix for creating sysfs files after the probe completed
properly

- other tiny updates for driver core things.

All of these have been in linux-next for over a week with no reported
issues"

* tag 'driver-core-6.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/driver-core/driver-core:
kernfs: Relax constraint in draining guard
Documentation: embargoed-hardware-issues.rst: Remove myself
drivers: hv: fix up const issue with vmbus_chan_bin_attrs
firmware_loader: use SHA-256 library API instead of crypto_shash API
docs: debugfs: do not recommend debugfs_remove_recursive
PM: wakeup: Do not expose 4 device wakeup source APIs
kernfs: switch global kernfs_rename_lock to per-fs lock
kernfs: switch global kernfs_idr_lock to per-fs lock
driver core: auxiliary bus: Fix IS_ERR() vs NULL mixup in __devm_auxiliary_device_create()
sysfs: constify attribute_group::bin_attrs
sysfs: constify bin_attribute argument of bin_attribute::read/write()
software node: Correct a OOB check in software_node_get_reference_args()
devres: simplify devm_kstrdup() using devm_kmemdup()
platform: replace magic number with macro PLATFORM_DEVID_NONE
component: do not try to unbind unbound components
driver core: auxiliary bus: add device creation helpers
driver core: faux: Add sysfs groups after probing

+205 -132
+6 -13
Documentation/filesystems/debugfs.rst
··· 229 229 will be a lot of stale pointers and no end of highly antisocial behavior. 230 230 So all debugfs users - at least those which can be built as modules - must 231 231 be prepared to remove all files and directories they create there. A file 232 - can be removed with:: 232 + or directory can be removed with:: 233 233 234 234 void debugfs_remove(struct dentry *dentry); 235 235 236 236 The dentry value can be NULL or an error value, in which case nothing will 237 - be removed. 238 - 239 - Once upon a time, debugfs users were required to remember the dentry 240 - pointer for every debugfs file they created so that all files could be 241 - cleaned up. We live in more civilized times now, though, and debugfs users 242 - can call:: 243 - 244 - void debugfs_remove_recursive(struct dentry *dentry); 245 - 246 - If this function is passed a pointer for the dentry corresponding to the 247 - top-level directory, the entire hierarchy below that directory will be 248 - removed. 237 + be removed. Note that this function will recursively remove all files and 238 + directories underneath it. Previously, debugfs_remove_recursive() was used 239 + to perform that task, but this function is now just an alias to 240 + debugfs_remove(). debugfs_remove_recursive() should be considered 241 + deprecated. 249 242 250 243 .. [1] http://lwn.net/Articles/309298/
+1 -1
Documentation/process/debugging/driver_development_debugging_guide.rst
··· 155 155 ``my_variable`` 156 156 157 157 - Clean up the directory when removing the device 158 - (``debugfs_remove_recursive(parent);``) 158 + (``debugfs_remove(parent);``) 159 159 160 160 For the full documentation see :doc:`/filesystems/debugfs`. 161 161
-1
Documentation/process/embargoed-hardware-issues.rst
··· 290 290 AMD Tom Lendacky <thomas.lendacky@amd.com> 291 291 Ampere Darren Hart <darren@os.amperecomputing.com> 292 292 ARM Catalin Marinas <catalin.marinas@arm.com> 293 - IBM Power Michael Ellerman <ellerman@au.ibm.com> 294 293 IBM Z Christian Borntraeger <borntraeger@de.ibm.com> 295 294 Intel Tony Luck <tony.luck@intel.com> 296 295 Qualcomm Trilok Soni <quic_tsoni@quicinc.com>
+108
drivers/base/auxiliary.c
··· 395 395 } 396 396 EXPORT_SYMBOL_GPL(auxiliary_driver_unregister); 397 397 398 + static void auxiliary_device_release(struct device *dev) 399 + { 400 + struct auxiliary_device *auxdev = to_auxiliary_dev(dev); 401 + 402 + kfree(auxdev); 403 + } 404 + 405 + /** 406 + * auxiliary_device_create - create a device on the auxiliary bus 407 + * @dev: parent device 408 + * @modname: module name used to create the auxiliary driver name. 409 + * @devname: auxiliary bus device name 410 + * @platform_data: auxiliary bus device platform data 411 + * @id: auxiliary bus device id 412 + * 413 + * Helper to create an auxiliary bus device. 414 + * The device created matches driver 'modname.devname' on the auxiliary bus. 415 + */ 416 + struct auxiliary_device *auxiliary_device_create(struct device *dev, 417 + const char *modname, 418 + const char *devname, 419 + void *platform_data, 420 + int id) 421 + { 422 + struct auxiliary_device *auxdev; 423 + int ret; 424 + 425 + auxdev = kzalloc(sizeof(*auxdev), GFP_KERNEL); 426 + if (!auxdev) 427 + return NULL; 428 + 429 + auxdev->id = id; 430 + auxdev->name = devname; 431 + auxdev->dev.parent = dev; 432 + auxdev->dev.platform_data = platform_data; 433 + auxdev->dev.release = auxiliary_device_release; 434 + device_set_of_node_from_dev(&auxdev->dev, dev); 435 + 436 + ret = auxiliary_device_init(auxdev); 437 + if (ret) { 438 + kfree(auxdev); 439 + return NULL; 440 + } 441 + 442 + ret = __auxiliary_device_add(auxdev, modname); 443 + if (ret) { 444 + /* 445 + * It may look odd but auxdev should not be freed here. 446 + * auxiliary_device_uninit() calls device_put() which call 447 + * the device release function, freeing auxdev. 448 + */ 449 + auxiliary_device_uninit(auxdev); 450 + return NULL; 451 + } 452 + 453 + return auxdev; 454 + } 455 + EXPORT_SYMBOL_GPL(auxiliary_device_create); 456 + 457 + /** 458 + * auxiliary_device_destroy - remove an auxiliary device 459 + * @auxdev: pointer to the auxdev to be removed 460 + * 461 + * Helper to remove an auxiliary device created with 462 + * auxiliary_device_create() 463 + */ 464 + void auxiliary_device_destroy(void *auxdev) 465 + { 466 + struct auxiliary_device *_auxdev = auxdev; 467 + 468 + auxiliary_device_delete(_auxdev); 469 + auxiliary_device_uninit(_auxdev); 470 + } 471 + EXPORT_SYMBOL_GPL(auxiliary_device_destroy); 472 + 473 + /** 474 + * __devm_auxiliary_device_create - create a managed device on the auxiliary bus 475 + * @dev: parent device 476 + * @modname: module name used to create the auxiliary driver name. 477 + * @devname: auxiliary bus device name 478 + * @platform_data: auxiliary bus device platform data 479 + * @id: auxiliary bus device id 480 + * 481 + * Device managed helper to create an auxiliary bus device. 482 + * The device created matches driver 'modname.devname' on the auxiliary bus. 483 + */ 484 + struct auxiliary_device *__devm_auxiliary_device_create(struct device *dev, 485 + const char *modname, 486 + const char *devname, 487 + void *platform_data, 488 + int id) 489 + { 490 + struct auxiliary_device *auxdev; 491 + int ret; 492 + 493 + auxdev = auxiliary_device_create(dev, modname, devname, platform_data, id); 494 + if (!auxdev) 495 + return NULL; 496 + 497 + ret = devm_add_action_or_reset(dev, auxiliary_device_destroy, 498 + auxdev); 499 + if (ret) 500 + return NULL; 501 + 502 + return auxdev; 503 + } 504 + EXPORT_SYMBOL_GPL(__devm_auxiliary_device_create); 505 + 398 506 void __init auxiliary_bus_init(void) 399 507 { 400 508 WARN_ON(bus_register(&auxiliary_bus_type));
+2 -1
drivers/base/component.c
··· 586 586 static void component_unbind(struct component *component, 587 587 struct aggregate_device *adev, void *data) 588 588 { 589 - WARN_ON(!component->bound); 589 + if (WARN_ON(!component->bound)) 590 + return; 590 591 591 592 dev_dbg(adev->parent, "unbinding %s component %p (ops %ps)\n", 592 593 dev_name(component->dev), component, component->ops);
+1 -8
drivers/base/devres.c
··· 987 987 */ 988 988 char *devm_kstrdup(struct device *dev, const char *s, gfp_t gfp) 989 989 { 990 - size_t size; 991 - char *buf; 992 - 993 990 if (!s) 994 991 return NULL; 995 992 996 - size = strlen(s) + 1; 997 - buf = devm_kmalloc(dev, size, gfp); 998 - if (buf) 999 - memcpy(buf, s, size); 1000 - return buf; 993 + return devm_kmemdup(dev, s, strlen(s) + 1, gfp); 1001 994 } 1002 995 EXPORT_SYMBOL_GPL(devm_kstrdup); 1003 996
+18 -4
drivers/base/faux.c
··· 25 25 struct faux_object { 26 26 struct faux_device faux_dev; 27 27 const struct faux_device_ops *faux_ops; 28 + const struct attribute_group **groups; 28 29 }; 29 30 #define to_faux_object(dev) container_of_const(dev, struct faux_object, faux_dev.dev) 30 31 ··· 44 43 struct faux_object *faux_obj = to_faux_object(dev); 45 44 struct faux_device *faux_dev = &faux_obj->faux_dev; 46 45 const struct faux_device_ops *faux_ops = faux_obj->faux_ops; 47 - int ret = 0; 46 + int ret; 48 47 49 - if (faux_ops && faux_ops->probe) 48 + if (faux_ops && faux_ops->probe) { 50 49 ret = faux_ops->probe(faux_dev); 50 + if (ret) 51 + return ret; 52 + } 53 + 54 + /* 55 + * Add groups after the probe succeeds to ensure resources are 56 + * initialized correctly 57 + */ 58 + ret = device_add_groups(dev, faux_obj->groups); 59 + if (ret && faux_ops && faux_ops->remove) 60 + faux_ops->remove(faux_dev); 51 61 52 62 return ret; 53 63 } ··· 68 56 struct faux_object *faux_obj = to_faux_object(dev); 69 57 struct faux_device *faux_dev = &faux_obj->faux_dev; 70 58 const struct faux_device_ops *faux_ops = faux_obj->faux_ops; 59 + 60 + device_remove_groups(dev, faux_obj->groups); 71 61 72 62 if (faux_ops && faux_ops->remove) 73 63 faux_ops->remove(faux_dev); ··· 138 124 if (!faux_obj) 139 125 return NULL; 140 126 141 - /* Save off the callbacks so we can use them in the future */ 127 + /* Save off the callbacks and groups so we can use them in the future */ 142 128 faux_obj->faux_ops = faux_ops; 129 + faux_obj->groups = groups; 143 130 144 131 /* Initialize the device portion and register it with the driver core */ 145 132 faux_dev = &faux_obj->faux_dev; ··· 153 138 else 154 139 dev->parent = &faux_bus_root; 155 140 dev->bus = &faux_bus_type; 156 - dev->groups = groups; 157 141 dev_set_name(dev, "%s", name); 158 142 159 143 ret = device_add(dev);
+1 -3
drivers/base/firmware_loader/Kconfig
··· 3 3 4 4 config FW_LOADER 5 5 tristate "Firmware loading facility" if EXPERT 6 - select CRYPTO_HASH if FW_LOADER_DEBUG 7 - select CRYPTO_SHA256 if FW_LOADER_DEBUG 6 + select CRYPTO_LIB_SHA256 if FW_LOADER_DEBUG 8 7 default y 9 8 help 10 9 This enables the firmware loading facility in the kernel. The kernel ··· 27 28 28 29 config FW_LOADER_DEBUG 29 30 bool "Log filenames and checksums for loaded firmware" 30 - depends on CRYPTO = FW_LOADER || CRYPTO=y 31 31 depends on DYNAMIC_DEBUG 32 32 depends on FW_LOADER 33 33 default FW_LOADER
+4 -30
drivers/base/firmware_loader/main.c
··· 806 806 } 807 807 808 808 #if defined(CONFIG_FW_LOADER_DEBUG) 809 - #include <crypto/hash.h> 810 809 #include <crypto/sha2.h> 811 810 812 811 static void fw_log_firmware_info(const struct firmware *fw, const char *name, struct device *device) 813 812 { 814 - struct shash_desc *shash; 815 - struct crypto_shash *alg; 816 - u8 *sha256buf; 817 - char *outbuf; 813 + u8 digest[SHA256_DIGEST_SIZE]; 818 814 819 - alg = crypto_alloc_shash("sha256", 0, 0); 820 - if (IS_ERR(alg)) 821 - return; 822 - 823 - sha256buf = kmalloc(SHA256_DIGEST_SIZE, GFP_KERNEL); 824 - outbuf = kmalloc(SHA256_BLOCK_SIZE + 1, GFP_KERNEL); 825 - shash = kmalloc(sizeof(*shash) + crypto_shash_descsize(alg), GFP_KERNEL); 826 - if (!sha256buf || !outbuf || !shash) 827 - goto out_free; 828 - 829 - shash->tfm = alg; 830 - 831 - if (crypto_shash_digest(shash, fw->data, fw->size, sha256buf) < 0) 832 - goto out_free; 833 - 834 - for (int i = 0; i < SHA256_DIGEST_SIZE; i++) 835 - sprintf(&outbuf[i * 2], "%02x", sha256buf[i]); 836 - outbuf[SHA256_BLOCK_SIZE] = 0; 837 - dev_dbg(device, "Loaded FW: %s, sha256: %s\n", name, outbuf); 838 - 839 - out_free: 840 - kfree(shash); 841 - kfree(outbuf); 842 - kfree(sha256buf); 843 - crypto_free_shash(alg); 815 + sha256(fw->data, fw->size, digest); 816 + dev_dbg(device, "Loaded FW: %s, sha256: %*phN\n", 817 + name, SHA256_DIGEST_SIZE, digest); 844 818 } 845 819 #else 846 820 static void fw_log_firmware_info(const struct firmware *fw, const char *name,
+1 -1
drivers/base/platform.c
··· 982 982 struct platform_device *pdev; 983 983 int error; 984 984 985 - pdev = platform_device_alloc(driver->driver.name, -1); 985 + pdev = platform_device_alloc(driver->driver.name, PLATFORM_DEVID_NONE); 986 986 if (!pdev) { 987 987 error = -ENOMEM; 988 988 goto err_out;
+4 -8
drivers/base/power/wakeup.c
··· 77 77 * wakeup_source_create - Create a struct wakeup_source object. 78 78 * @name: Name of the new wakeup source. 79 79 */ 80 - struct wakeup_source *wakeup_source_create(const char *name) 80 + static struct wakeup_source *wakeup_source_create(const char *name) 81 81 { 82 82 struct wakeup_source *ws; 83 83 const char *ws_name; ··· 106 106 err_ws: 107 107 return NULL; 108 108 } 109 - EXPORT_SYMBOL_GPL(wakeup_source_create); 110 109 111 110 /* 112 111 * Record wakeup_source statistics being deleted into a dummy wakeup_source. ··· 148 149 * 149 150 * Use only for wakeup source objects created with wakeup_source_create(). 150 151 */ 151 - void wakeup_source_destroy(struct wakeup_source *ws) 152 + static void wakeup_source_destroy(struct wakeup_source *ws) 152 153 { 153 154 if (!ws) 154 155 return; ··· 157 158 wakeup_source_record(ws); 158 159 wakeup_source_free(ws); 159 160 } 160 - EXPORT_SYMBOL_GPL(wakeup_source_destroy); 161 161 162 162 /** 163 163 * wakeup_source_add - Add given object to the list of wakeup sources. 164 164 * @ws: Wakeup source object to add to the list. 165 165 */ 166 - void wakeup_source_add(struct wakeup_source *ws) 166 + static void wakeup_source_add(struct wakeup_source *ws) 167 167 { 168 168 unsigned long flags; 169 169 ··· 177 179 list_add_rcu(&ws->entry, &wakeup_sources); 178 180 raw_spin_unlock_irqrestore(&events_lock, flags); 179 181 } 180 - EXPORT_SYMBOL_GPL(wakeup_source_add); 181 182 182 183 /** 183 184 * wakeup_source_remove - Remove given object from the wakeup sources list. 184 185 * @ws: Wakeup source object to remove from the list. 185 186 */ 186 - void wakeup_source_remove(struct wakeup_source *ws) 187 + static void wakeup_source_remove(struct wakeup_source *ws) 187 188 { 188 189 unsigned long flags; 189 190 ··· 201 204 */ 202 205 ws->timer.function = NULL; 203 206 } 204 - EXPORT_SYMBOL_GPL(wakeup_source_remove); 205 207 206 208 /** 207 209 * wakeup_source_register - Create wakeup source and add it to the list.
+1 -1
drivers/base/swnode.c
··· 529 529 if (prop->is_inline) 530 530 return -EINVAL; 531 531 532 - if (index * sizeof(*ref) >= prop->length) 532 + if ((index + 1) * sizeof(*ref) > prop->length) 533 533 return -ENOENT; 534 534 535 535 ref_array = prop->pointer;
+1 -1
drivers/hv/vmbus_drv.c
··· 1841 1841 NULL 1842 1842 }; 1843 1843 1844 - static struct bin_attribute *vmbus_chan_bin_attrs[] = { 1844 + static const struct bin_attribute *vmbus_chan_bin_attrs[] = { 1845 1845 &chan_attr_ring_buffer, 1846 1846 NULL 1847 1847 };
+18 -15
fs/kernfs/dir.c
··· 17 17 18 18 #include "kernfs-internal.h" 19 19 20 - DEFINE_RWLOCK(kernfs_rename_lock); /* kn->parent and ->name */ 21 20 /* 22 21 * Don't use rename_lock to piggy back on pr_cont_buf. We don't want to 23 22 * call pr_cont() while holding rename_lock. Because sometimes pr_cont() ··· 26 27 */ 27 28 static DEFINE_SPINLOCK(kernfs_pr_cont_lock); 28 29 static char kernfs_pr_cont_buf[PATH_MAX]; /* protected by pr_cont_lock */ 29 - static DEFINE_SPINLOCK(kernfs_idr_lock); /* root->ino_idr */ 30 30 31 31 #define rb_to_kn(X) rb_entry((X), struct kernfs_node, rb) 32 32 ··· 227 229 if (to) { 228 230 root = kernfs_root(to); 229 231 if (!(root->flags & KERNFS_ROOT_INVARIANT_PARENT)) { 230 - guard(read_lock_irqsave)(&kernfs_rename_lock); 232 + guard(read_lock_irqsave)(&root->kernfs_rename_lock); 231 233 return kernfs_path_from_node_locked(to, from, buf, buflen); 232 234 } 233 235 } ··· 294 296 struct kernfs_node *kernfs_get_parent(struct kernfs_node *kn) 295 297 { 296 298 struct kernfs_node *parent; 299 + struct kernfs_root *root; 297 300 unsigned long flags; 298 301 299 - read_lock_irqsave(&kernfs_rename_lock, flags); 302 + root = kernfs_root(kn); 303 + read_lock_irqsave(&root->kernfs_rename_lock, flags); 300 304 parent = kernfs_parent(kn); 301 305 kernfs_get(parent); 302 - read_unlock_irqrestore(&kernfs_rename_lock, flags); 306 + read_unlock_irqrestore(&root->kernfs_rename_lock, flags); 303 307 304 308 return parent; 305 309 } ··· 584 584 if (kernfs_type(kn) == KERNFS_LINK) 585 585 kernfs_put(kn->symlink.target_kn); 586 586 587 - spin_lock(&kernfs_idr_lock); 587 + spin_lock(&root->kernfs_idr_lock); 588 588 idr_remove(&root->ino_idr, (u32)kernfs_ino(kn)); 589 - spin_unlock(&kernfs_idr_lock); 589 + spin_unlock(&root->kernfs_idr_lock); 590 590 591 591 call_rcu(&kn->rcu, kernfs_free_rcu); 592 592 ··· 639 639 goto err_out1; 640 640 641 641 idr_preload(GFP_KERNEL); 642 - spin_lock(&kernfs_idr_lock); 642 + spin_lock(&root->kernfs_idr_lock); 643 643 ret = idr_alloc_cyclic(&root->ino_idr, kn, 1, 0, GFP_ATOMIC); 644 644 if (ret >= 0 && ret < root->last_id_lowbits) 645 645 root->id_highbits++; 646 646 id_highbits = root->id_highbits; 647 647 root->last_id_lowbits = ret; 648 - spin_unlock(&kernfs_idr_lock); 648 + spin_unlock(&root->kernfs_idr_lock); 649 649 idr_preload_end(); 650 650 if (ret < 0) 651 651 goto err_out2; ··· 681 681 return kn; 682 682 683 683 err_out3: 684 - spin_lock(&kernfs_idr_lock); 684 + spin_lock(&root->kernfs_idr_lock); 685 685 idr_remove(&root->ino_idr, (u32)kernfs_ino(kn)); 686 - spin_unlock(&kernfs_idr_lock); 686 + spin_unlock(&root->kernfs_idr_lock); 687 687 err_out2: 688 688 kmem_cache_free(kernfs_node_cache, kn); 689 689 err_out1: ··· 989 989 return ERR_PTR(-ENOMEM); 990 990 991 991 idr_init(&root->ino_idr); 992 + spin_lock_init(&root->kernfs_idr_lock); 992 993 init_rwsem(&root->kernfs_rwsem); 993 994 init_rwsem(&root->kernfs_iattr_rwsem); 994 995 init_rwsem(&root->kernfs_supers_rwsem); 995 996 INIT_LIST_HEAD(&root->supers); 997 + rwlock_init(&root->kernfs_rename_lock); 996 998 997 999 /* 998 1000 * On 64bit ino setups, id is ino. On 32bit, low 32bits are ino. ··· 1582 1580 * invoked before finishing the kernfs operation. Note that while this 1583 1581 * function restores the active reference, it doesn't and can't actually 1584 1582 * restore the active protection - @kn may already or be in the process of 1585 - * being removed. Once kernfs_break_active_protection() is invoked, that 1586 - * protection is irreversibly gone for the kernfs operation instance. 1583 + * being drained and removed. Once kernfs_break_active_protection() is 1584 + * invoked, that protection is irreversibly gone for the kernfs operation 1585 + * instance. 1587 1586 * 1588 1587 * While this function may be called at any point after 1589 1588 * kernfs_break_active_protection() is invoked, its most useful location ··· 1792 1789 /* rename_lock protects ->parent accessors */ 1793 1790 if (old_parent != new_parent) { 1794 1791 kernfs_get(new_parent); 1795 - write_lock_irq(&kernfs_rename_lock); 1792 + write_lock_irq(&root->kernfs_rename_lock); 1796 1793 1797 1794 rcu_assign_pointer(kn->__parent, new_parent); 1798 1795 ··· 1800 1797 if (new_name) 1801 1798 rcu_assign_pointer(kn->name, new_name); 1802 1799 1803 - write_unlock_irq(&kernfs_rename_lock); 1800 + write_unlock_irq(&root->kernfs_rename_lock); 1804 1801 kernfs_put(old_parent); 1805 1802 } else { 1806 1803 /* name assignment is RCU protected, parent is the same */
+2 -1
fs/kernfs/file.c
··· 778 778 /* 779 779 * @kn being deactivated guarantees that @kn->attr.open can't change 780 780 * beneath us making the lockless test below safe. 781 + * Callers post kernfs_unbreak_active_protection may be counted in 782 + * kn->active by now, do not WARN_ON because of them. 781 783 */ 782 - WARN_ON_ONCE(atomic_read(&kn->active) != KN_DEACTIVATED_BIAS); 783 784 784 785 rcu_read_lock(); 785 786 on = rcu_dereference(kn->attr.open);
+12 -4
fs/kernfs/kernfs-internal.h
··· 19 19 #include <linux/kernfs.h> 20 20 #include <linux/fs_context.h> 21 21 22 - extern rwlock_t kernfs_rename_lock; 23 - 24 22 struct kernfs_iattrs { 25 23 kuid_t ia_uid; 26 24 kgid_t ia_gid; ··· 38 40 39 41 /* private fields, do not use outside kernfs proper */ 40 42 struct idr ino_idr; 43 + spinlock_t kernfs_idr_lock; /* root->ino_idr */ 41 44 u32 last_id_lowbits; 42 45 u32 id_highbits; 43 46 struct kernfs_syscall_ops *syscall_ops; ··· 50 51 struct rw_semaphore kernfs_rwsem; 51 52 struct rw_semaphore kernfs_iattr_rwsem; 52 53 struct rw_semaphore kernfs_supers_rwsem; 54 + 55 + /* kn->parent and kn->name */ 56 + rwlock_t kernfs_rename_lock; 53 57 54 58 struct rcu_head rcu; 55 59 }; ··· 109 107 return lockdep_is_held(&kernfs_root(kn)->kernfs_rwsem); 110 108 } 111 109 110 + static inline bool kernfs_rename_is_locked(const struct kernfs_node *kn) 111 + { 112 + return lockdep_is_held(&kernfs_root(kn)->kernfs_rename_lock); 113 + } 114 + 112 115 static inline const char *kernfs_rcu_name(const struct kernfs_node *kn) 113 116 { 114 117 return rcu_dereference_check(kn->name, kernfs_root_is_locked(kn)); ··· 124 117 /* 125 118 * The kernfs_node::__parent remains valid within a RCU section. The kn 126 119 * can be reparented (and renamed) which changes the entry. This can be 127 - * avoided by locking kernfs_root::kernfs_rwsem or kernfs_rename_lock. 120 + * avoided by locking kernfs_root::kernfs_rwsem or 121 + * kernfs_root::kernfs_rename_lock. 128 122 * Both locks can be used to obtain a reference on __parent. Once the 129 123 * reference count reaches 0 then the node is about to be freed 130 124 * and can not be renamed (or become a different parent) anymore. 131 125 */ 132 126 return rcu_dereference_check(kn->__parent, 133 127 kernfs_root_is_locked(kn) || 134 - lockdep_is_held(&kernfs_rename_lock) || 128 + kernfs_rename_is_locked(kn) || 135 129 !atomic_read(&kn->count)); 136 130 } 137 131
+3 -3
fs/sysfs/group.c
··· 21 21 const struct attribute_group *grp) 22 22 { 23 23 struct attribute *const *attr; 24 - struct bin_attribute *const *bin_attr; 24 + const struct bin_attribute *const *bin_attr; 25 25 26 26 if (grp->attrs) 27 27 for (attr = grp->attrs; *attr; attr++) ··· 47 47 const struct attribute_group *grp, int update) 48 48 { 49 49 struct attribute *const *attr; 50 - struct bin_attribute *const *bin_attr; 50 + const struct bin_attribute *const *bin_attr; 51 51 int error = 0, i; 52 52 53 53 if (grp->attrs) { ··· 521 521 } 522 522 523 523 if (grp->bin_attrs) { 524 - struct bin_attribute *const *bin_attr; 524 + const struct bin_attribute *const *bin_attr; 525 525 526 526 for (bin_attr = grp->bin_attrs; *bin_attr; bin_attr++) { 527 527 kn = kernfs_find_and_get(grp_kn, (*bin_attr)->attr.name);
+17
include/linux/auxiliary_bus.h
··· 254 254 255 255 void auxiliary_driver_unregister(struct auxiliary_driver *auxdrv); 256 256 257 + struct auxiliary_device *auxiliary_device_create(struct device *dev, 258 + const char *modname, 259 + const char *devname, 260 + void *platform_data, 261 + int id); 262 + void auxiliary_device_destroy(void *auxdev); 263 + 264 + struct auxiliary_device *__devm_auxiliary_device_create(struct device *dev, 265 + const char *modname, 266 + const char *devname, 267 + void *platform_data, 268 + int id); 269 + 270 + #define devm_auxiliary_device_create(dev, devname, platform_data) \ 271 + __devm_auxiliary_device_create(dev, KBUILD_MODNAME, devname, \ 272 + platform_data, 0) 273 + 257 274 /** 258 275 * module_auxiliary_driver() - Helper macro for registering an auxiliary driver 259 276 * @__auxiliary_driver: auxiliary driver struct
-15
include/linux/pm_wakeup.h
··· 95 95 } 96 96 97 97 /* drivers/base/power/wakeup.c */ 98 - extern struct wakeup_source *wakeup_source_create(const char *name); 99 - extern void wakeup_source_destroy(struct wakeup_source *ws); 100 - extern void wakeup_source_add(struct wakeup_source *ws); 101 - extern void wakeup_source_remove(struct wakeup_source *ws); 102 98 extern struct wakeup_source *wakeup_source_register(struct device *dev, 103 99 const char *name); 104 100 extern void wakeup_source_unregister(struct wakeup_source *ws); ··· 124 128 { 125 129 return dev->power.can_wakeup; 126 130 } 127 - 128 - static inline struct wakeup_source *wakeup_source_create(const char *name) 129 - { 130 - return NULL; 131 - } 132 - 133 - static inline void wakeup_source_destroy(struct wakeup_source *ws) {} 134 - 135 - static inline void wakeup_source_add(struct wakeup_source *ws) {} 136 - 137 - static inline void wakeup_source_remove(struct wakeup_source *ws) {} 138 131 139 132 static inline struct wakeup_source *wakeup_source_register(struct device *dev, 140 133 const char *name)
+5 -22
include/linux/sysfs.h
··· 107 107 int); 108 108 struct attribute **attrs; 109 109 union { 110 - struct bin_attribute **bin_attrs; 110 + const struct bin_attribute *const *bin_attrs; 111 111 const struct bin_attribute *const *bin_attrs_new; 112 112 }; 113 113 }; ··· 306 306 size_t size; 307 307 void *private; 308 308 struct address_space *(*f_mapping)(void); 309 - ssize_t (*read)(struct file *, struct kobject *, struct bin_attribute *, 309 + ssize_t (*read)(struct file *, struct kobject *, const struct bin_attribute *, 310 310 char *, loff_t, size_t); 311 311 ssize_t (*read_new)(struct file *, struct kobject *, const struct bin_attribute *, 312 312 char *, loff_t, size_t); 313 - ssize_t (*write)(struct file *, struct kobject *, struct bin_attribute *, 313 + ssize_t (*write)(struct file *, struct kobject *, const struct bin_attribute *, 314 314 char *, loff_t, size_t); 315 315 ssize_t (*write_new)(struct file *, struct kobject *, 316 316 const struct bin_attribute *, char *, loff_t, size_t); ··· 332 332 */ 333 333 #define sysfs_bin_attr_init(bin_attr) sysfs_attr_init(&(bin_attr)->attr) 334 334 335 - typedef ssize_t __sysfs_bin_rw_handler_new(struct file *, struct kobject *, 336 - const struct bin_attribute *, char *, loff_t, size_t); 337 - 338 335 /* macros to create static binary attributes easier */ 339 336 #define __BIN_ATTR(_name, _mode, _read, _write, _size) { \ 340 337 .attr = { .name = __stringify(_name), .mode = _mode }, \ 341 - .read = _Generic(_read, \ 342 - __sysfs_bin_rw_handler_new * : NULL, \ 343 - default : _read \ 344 - ), \ 345 - .read_new = _Generic(_read, \ 346 - __sysfs_bin_rw_handler_new * : _read, \ 347 - default : NULL \ 348 - ), \ 349 - .write = _Generic(_write, \ 350 - __sysfs_bin_rw_handler_new * : NULL, \ 351 - default : _write \ 352 - ), \ 353 - .write_new = _Generic(_write, \ 354 - __sysfs_bin_rw_handler_new * : _write, \ 355 - default : NULL \ 356 - ), \ 338 + .read = _read, \ 339 + .write = _write, \ 357 340 .size = _size, \ 358 341 } 359 342