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

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

Pull driver core updates from Greg KH:
"Here is the "big" set of changes to the driver core, and some drivers
using the changes, for 5.9-rc1.

"Biggest" thing in here is the device link exposure in sysfs, to help
to tame the madness that is SoC device tree representations and driver
interactions with it.

Other stuff in here that is interesting is:

- device probe log helper so that drivers can report problems in a
unified way easier.

- devres functions added

- DEVICE_ATTR_ADMIN_* macro added to make it harder to write
incorrect sysfs file permissions

- documentation cleanups

- ability for debugfs to be present in the kernel, yet not exposed to
userspace. Needed for systems that want it enabled, but do not
trust users, so they can still use some kernel functions that were
otherwise disabled.

- other minor fixes and cleanups

The patches outside of drivers/base/ all have acks from the respective
subsystem maintainers to go through this tree instead of theirs.

All of these have been in linux-next with no reported issues"

* tag 'driver-core-5.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (39 commits)
drm/bridge: lvds-codec: simplify error handling
drm/bridge/sii8620: fix resource acquisition error handling
driver core: add deferring probe reason to devices_deferred property
driver core: add device probe log helper
driver core: Avoid binding drivers to dead devices
Revert "test_firmware: Test platform fw loading on non-EFI systems"
firmware_loader: EFI firmware loader must handle pre-allocated buffer
selftest/firmware: Add selftest timeout in settings
test_firmware: Test platform fw loading on non-EFI systems
driver core: Change delimiter in devlink device's name to "--"
debugfs: Add access restriction option
tracefs: Remove unnecessary debug_fs checks.
driver core: Fix probe_count imbalance in really_probe()
kobject: remove unused KOBJ_MAX action
driver core: Fix sleeping in invalid context during device link deletion
driver core: Add waiting_for_supplier sysfs file for devices
driver core: Add state_synced sysfs file for devices that support it
driver core: Expose device link details in sysfs
driver core: Drop mention of obsolete bus rwsem from kernel-doc
debugfs: file: Remove unnecessary cast in kfree()
...

+944 -253
+10
Documentation/ABI/testing/sysfs-bus-platform
··· 18 18 devices to opt-out of driver binding using a driver_override 19 19 name such as "none". Only a single driver may be specified in 20 20 the override, there is no support for parsing delimiters. 21 + 22 + What: /sys/bus/platform/devices/.../numa_node 23 + Date: June 2020 24 + Contact: Barry Song <song.bao.hua@hisilicon.com> 25 + Description: 26 + This file contains the NUMA node to which the platform device 27 + is attached. It won't be visible if the node is unknown. The 28 + value comes from an ACPI _PXM method or a similar firmware 29 + source. Initial users for this file would be devices like 30 + arm smmu which are populated by arm64 acpi_iort.
+8
Documentation/ABI/testing/sysfs-devices-consumer
··· 1 + What: /sys/devices/.../consumer:<consumer> 2 + Date: May 2020 3 + Contact: Saravana Kannan <saravanak@google.com> 4 + Description: 5 + The /sys/devices/.../consumer:<consumer> are symlinks to device 6 + links where this device is the supplier. <consumer> denotes the 7 + name of the consumer in that device link. There can be zero or 8 + more of these symlinks for a given device.
+24
Documentation/ABI/testing/sysfs-devices-state_synced
··· 1 + What: /sys/devices/.../state_synced 2 + Date: May 2020 3 + Contact: Saravana Kannan <saravanak@google.com> 4 + Description: 5 + The /sys/devices/.../state_synced attribute is only present for 6 + devices whose bus types or driver provides the .sync_state() 7 + callback. The number read from it (0 or 1) reflects the value 8 + of the device's 'state_synced' field. A value of 0 means the 9 + .sync_state() callback hasn't been called yet. A value of 1 10 + means the .sync_state() callback has been called. 11 + 12 + Generally, if a device has sync_state() support and has some of 13 + the resources it provides enabled at the time the kernel starts 14 + (Eg: enabled by hardware reset or bootloader or anything that 15 + run before the kernel starts), then it'll keep those resources 16 + enabled and in a state that's compatible with the state they 17 + were in at the start of the kernel. The device will stop doing 18 + this only when the sync_state() callback has been called -- 19 + which happens only when all its consumer devices are registered 20 + and have probed successfully. Resources that were left disabled 21 + at the time the kernel starts are not affected or limited in 22 + any way by sync_state() callbacks. 23 + 24 +
+8
Documentation/ABI/testing/sysfs-devices-supplier
··· 1 + What: /sys/devices/.../supplier:<supplier> 2 + Date: May 2020 3 + Contact: Saravana Kannan <saravanak@google.com> 4 + Description: 5 + The /sys/devices/.../supplier:<supplier> are symlinks to device 6 + links where this device is the consumer. <supplier> denotes the 7 + name of the supplier in that device link. There can be zero or 8 + more of these symlinks for a given device.
+17
Documentation/ABI/testing/sysfs-devices-waiting_for_supplier
··· 1 + What: /sys/devices/.../waiting_for_supplier 2 + Date: May 2020 3 + Contact: Saravana Kannan <saravanak@google.com> 4 + Description: 5 + The /sys/devices/.../waiting_for_supplier attribute is only 6 + present when fw_devlink kernel command line option is enabled 7 + and is set to something stricter than "permissive". It is 8 + removed once a device probes successfully (because the 9 + information is no longer relevant). The number read from it (0 10 + or 1) reflects whether the device is waiting for one or more 11 + suppliers to be added and then linked to using device links 12 + before the device can probe. 13 + 14 + A value of 0 means the device is not waiting for any suppliers 15 + to be added before it can probe. A value of 1 means the device 16 + is waiting for one or more suppliers to be added before it can 17 + probe.
+15
Documentation/admin-guide/kernel-parameters.txt
··· 832 832 useful to also enable the page_owner functionality. 833 833 on: enable the feature 834 834 835 + debugfs= [KNL] This parameter enables what is exposed to userspace 836 + and debugfs internal clients. 837 + Format: { on, no-mount, off } 838 + on: All functions are enabled. 839 + no-mount: 840 + Filesystem is not registered but kernel clients can 841 + access APIs and a crashkernel can be used to read 842 + its content. There is nothing to mount. 843 + off: Filesystem is not registered and clients 844 + get a -EPERM as result when trying to register files 845 + or directories within debugfs. 846 + This is equivalent of the runtime functionality if 847 + debugfs was not enabled in the kernel at all. 848 + Default value is set in build-time with a kernel configuration. 849 + 835 850 debugpat [X86] Enable PAT debugging 836 851 837 852 decnet.addr= [HW,NET]
+1 -1
Documentation/driver-api/driver-model/platform.rst
··· 108 108 109 109 Embedded systems frequently need one or more clocks for platform devices, 110 110 which are normally kept off until they're actively needed (to save power). 111 - System setup also associates those clocks with the device, so that that 111 + System setup also associates those clocks with the device, so that 112 112 calls to clk_get(&pdev->dev, clock_name) return them as needed. 113 113 114 114
+3
drivers/base/base.h
··· 93 93 struct klist_node knode_class; 94 94 struct list_head deferred_probe; 95 95 struct device_driver *async_driver; 96 + char *deferred_probe_reason; 96 97 struct device *device; 97 98 u8 dead:1; 98 99 }; ··· 135 134 extern void driver_detach(struct device_driver *drv); 136 135 extern int driver_probe_device(struct device_driver *drv, struct device *dev); 137 136 extern void driver_deferred_probe_del(struct device *dev); 137 + extern void device_set_deferred_probe_reason(const struct device *dev, 138 + struct va_format *vaf); 138 139 static inline int driver_match_device(struct device_driver *drv, 139 140 struct device *dev) 140 141 {
+300 -24
drivers/base/core.c
··· 236 236 device_links_read_unlock(idx); 237 237 } 238 238 239 + #define to_devlink(dev) container_of((dev), struct device_link, link_dev) 240 + 241 + static ssize_t status_show(struct device *dev, 242 + struct device_attribute *attr, char *buf) 243 + { 244 + char *status; 245 + 246 + switch (to_devlink(dev)->status) { 247 + case DL_STATE_NONE: 248 + status = "not tracked"; break; 249 + case DL_STATE_DORMANT: 250 + status = "dormant"; break; 251 + case DL_STATE_AVAILABLE: 252 + status = "available"; break; 253 + case DL_STATE_CONSUMER_PROBE: 254 + status = "consumer probing"; break; 255 + case DL_STATE_ACTIVE: 256 + status = "active"; break; 257 + case DL_STATE_SUPPLIER_UNBIND: 258 + status = "supplier unbinding"; break; 259 + default: 260 + status = "unknown"; break; 261 + } 262 + return sprintf(buf, "%s\n", status); 263 + } 264 + static DEVICE_ATTR_RO(status); 265 + 266 + static ssize_t auto_remove_on_show(struct device *dev, 267 + struct device_attribute *attr, char *buf) 268 + { 269 + struct device_link *link = to_devlink(dev); 270 + char *str; 271 + 272 + if (link->flags & DL_FLAG_AUTOREMOVE_SUPPLIER) 273 + str = "supplier unbind"; 274 + else if (link->flags & DL_FLAG_AUTOREMOVE_CONSUMER) 275 + str = "consumer unbind"; 276 + else 277 + str = "never"; 278 + 279 + return sprintf(buf, "%s\n", str); 280 + } 281 + static DEVICE_ATTR_RO(auto_remove_on); 282 + 283 + static ssize_t runtime_pm_show(struct device *dev, 284 + struct device_attribute *attr, char *buf) 285 + { 286 + struct device_link *link = to_devlink(dev); 287 + 288 + return sprintf(buf, "%d\n", !!(link->flags & DL_FLAG_PM_RUNTIME)); 289 + } 290 + static DEVICE_ATTR_RO(runtime_pm); 291 + 292 + static ssize_t sync_state_only_show(struct device *dev, 293 + struct device_attribute *attr, char *buf) 294 + { 295 + struct device_link *link = to_devlink(dev); 296 + 297 + return sprintf(buf, "%d\n", !!(link->flags & DL_FLAG_SYNC_STATE_ONLY)); 298 + } 299 + static DEVICE_ATTR_RO(sync_state_only); 300 + 301 + static struct attribute *devlink_attrs[] = { 302 + &dev_attr_status.attr, 303 + &dev_attr_auto_remove_on.attr, 304 + &dev_attr_runtime_pm.attr, 305 + &dev_attr_sync_state_only.attr, 306 + NULL, 307 + }; 308 + ATTRIBUTE_GROUPS(devlink); 309 + 310 + static void device_link_free(struct device_link *link) 311 + { 312 + while (refcount_dec_not_one(&link->rpm_active)) 313 + pm_runtime_put(link->supplier); 314 + 315 + put_device(link->consumer); 316 + put_device(link->supplier); 317 + kfree(link); 318 + } 319 + 320 + #ifdef CONFIG_SRCU 321 + static void __device_link_free_srcu(struct rcu_head *rhead) 322 + { 323 + device_link_free(container_of(rhead, struct device_link, rcu_head)); 324 + } 325 + 326 + static void devlink_dev_release(struct device *dev) 327 + { 328 + struct device_link *link = to_devlink(dev); 329 + 330 + call_srcu(&device_links_srcu, &link->rcu_head, __device_link_free_srcu); 331 + } 332 + #else 333 + static void devlink_dev_release(struct device *dev) 334 + { 335 + device_link_free(to_devlink(dev)); 336 + } 337 + #endif 338 + 339 + static struct class devlink_class = { 340 + .name = "devlink", 341 + .owner = THIS_MODULE, 342 + .dev_groups = devlink_groups, 343 + .dev_release = devlink_dev_release, 344 + }; 345 + 346 + static int devlink_add_symlinks(struct device *dev, 347 + struct class_interface *class_intf) 348 + { 349 + int ret; 350 + size_t len; 351 + struct device_link *link = to_devlink(dev); 352 + struct device *sup = link->supplier; 353 + struct device *con = link->consumer; 354 + char *buf; 355 + 356 + len = max(strlen(dev_name(sup)), strlen(dev_name(con))); 357 + len += strlen("supplier:") + 1; 358 + buf = kzalloc(len, GFP_KERNEL); 359 + if (!buf) 360 + return -ENOMEM; 361 + 362 + ret = sysfs_create_link(&link->link_dev.kobj, &sup->kobj, "supplier"); 363 + if (ret) 364 + goto out; 365 + 366 + ret = sysfs_create_link(&link->link_dev.kobj, &con->kobj, "consumer"); 367 + if (ret) 368 + goto err_con; 369 + 370 + snprintf(buf, len, "consumer:%s", dev_name(con)); 371 + ret = sysfs_create_link(&sup->kobj, &link->link_dev.kobj, buf); 372 + if (ret) 373 + goto err_con_dev; 374 + 375 + snprintf(buf, len, "supplier:%s", dev_name(sup)); 376 + ret = sysfs_create_link(&con->kobj, &link->link_dev.kobj, buf); 377 + if (ret) 378 + goto err_sup_dev; 379 + 380 + goto out; 381 + 382 + err_sup_dev: 383 + snprintf(buf, len, "consumer:%s", dev_name(con)); 384 + sysfs_remove_link(&sup->kobj, buf); 385 + err_con_dev: 386 + sysfs_remove_link(&link->link_dev.kobj, "consumer"); 387 + err_con: 388 + sysfs_remove_link(&link->link_dev.kobj, "supplier"); 389 + out: 390 + kfree(buf); 391 + return ret; 392 + } 393 + 394 + static void devlink_remove_symlinks(struct device *dev, 395 + struct class_interface *class_intf) 396 + { 397 + struct device_link *link = to_devlink(dev); 398 + size_t len; 399 + struct device *sup = link->supplier; 400 + struct device *con = link->consumer; 401 + char *buf; 402 + 403 + sysfs_remove_link(&link->link_dev.kobj, "consumer"); 404 + sysfs_remove_link(&link->link_dev.kobj, "supplier"); 405 + 406 + len = max(strlen(dev_name(sup)), strlen(dev_name(con))); 407 + len += strlen("supplier:") + 1; 408 + buf = kzalloc(len, GFP_KERNEL); 409 + if (!buf) { 410 + WARN(1, "Unable to properly free device link symlinks!\n"); 411 + return; 412 + } 413 + 414 + snprintf(buf, len, "supplier:%s", dev_name(sup)); 415 + sysfs_remove_link(&con->kobj, buf); 416 + snprintf(buf, len, "consumer:%s", dev_name(con)); 417 + sysfs_remove_link(&sup->kobj, buf); 418 + kfree(buf); 419 + } 420 + 421 + static struct class_interface devlink_class_intf = { 422 + .class = &devlink_class, 423 + .add_dev = devlink_add_symlinks, 424 + .remove_dev = devlink_remove_symlinks, 425 + }; 426 + 427 + static int __init devlink_class_init(void) 428 + { 429 + int ret; 430 + 431 + ret = class_register(&devlink_class); 432 + if (ret) 433 + return ret; 434 + 435 + ret = class_interface_register(&devlink_class_intf); 436 + if (ret) 437 + class_unregister(&devlink_class); 438 + 439 + return ret; 440 + } 441 + postcore_initcall(devlink_class_init); 442 + 239 443 #define DL_MANAGED_LINK_FLAGS (DL_FLAG_AUTOREMOVE_CONSUMER | \ 240 444 DL_FLAG_AUTOREMOVE_SUPPLIER | \ 241 445 DL_FLAG_AUTOPROBE_CONSUMER | \ ··· 612 408 613 409 refcount_set(&link->rpm_active, 1); 614 410 615 - if (flags & DL_FLAG_PM_RUNTIME) { 616 - if (flags & DL_FLAG_RPM_ACTIVE) 617 - refcount_inc(&link->rpm_active); 618 - 619 - pm_runtime_new_link(consumer); 620 - } 621 - 622 411 get_device(supplier); 623 412 link->supplier = supplier; 624 413 INIT_LIST_HEAD(&link->s_node); ··· 620 423 INIT_LIST_HEAD(&link->c_node); 621 424 link->flags = flags; 622 425 kref_init(&link->kref); 426 + 427 + link->link_dev.class = &devlink_class; 428 + device_set_pm_not_required(&link->link_dev); 429 + dev_set_name(&link->link_dev, "%s--%s", 430 + dev_name(supplier), dev_name(consumer)); 431 + if (device_register(&link->link_dev)) { 432 + put_device(consumer); 433 + put_device(supplier); 434 + kfree(link); 435 + link = NULL; 436 + goto out; 437 + } 438 + 439 + if (flags & DL_FLAG_PM_RUNTIME) { 440 + if (flags & DL_FLAG_RPM_ACTIVE) 441 + refcount_inc(&link->rpm_active); 442 + 443 + pm_runtime_new_link(consumer); 444 + } 623 445 624 446 /* Determine the initial link state. */ 625 447 if (flags & DL_FLAG_STATELESS) ··· 755 539 mutex_unlock(&wfs_lock); 756 540 } 757 541 758 - static void device_link_free(struct device_link *link) 759 - { 760 - while (refcount_dec_not_one(&link->rpm_active)) 761 - pm_runtime_put(link->supplier); 762 - 763 - put_device(link->consumer); 764 - put_device(link->supplier); 765 - kfree(link); 766 - } 767 - 768 542 #ifdef CONFIG_SRCU 769 - static void __device_link_free_srcu(struct rcu_head *rhead) 770 - { 771 - device_link_free(container_of(rhead, struct device_link, rcu_head)); 772 - } 773 - 774 543 static void __device_link_del(struct kref *kref) 775 544 { 776 545 struct device_link *link = container_of(kref, struct device_link, kref); ··· 768 567 769 568 list_del_rcu(&link->s_node); 770 569 list_del_rcu(&link->c_node); 771 - call_srcu(&device_links_srcu, &link->rcu_head, __device_link_free_srcu); 570 + device_unregister(&link->link_dev); 772 571 } 773 572 #else /* !CONFIG_SRCU */ 774 573 static void __device_link_del(struct kref *kref) ··· 783 582 784 583 list_del(&link->s_node); 785 584 list_del(&link->c_node); 786 - device_link_free(link); 585 + device_unregister(&link->link_dev); 787 586 } 788 587 #endif /* !CONFIG_SRCU */ 789 588 ··· 1051 850 kref_put(&link->kref, __device_link_del); 1052 851 } 1053 852 853 + static ssize_t waiting_for_supplier_show(struct device *dev, 854 + struct device_attribute *attr, 855 + char *buf) 856 + { 857 + bool val; 858 + 859 + device_lock(dev); 860 + mutex_lock(&wfs_lock); 861 + val = !list_empty(&dev->links.needs_suppliers) 862 + && dev->links.need_for_probe; 863 + mutex_unlock(&wfs_lock); 864 + device_unlock(dev); 865 + return sprintf(buf, "%u\n", val); 866 + } 867 + static DEVICE_ATTR_RO(waiting_for_supplier); 868 + 1054 869 /** 1055 870 * device_links_driver_bound - Update device links after probing its driver. 1056 871 * @dev: Device to update the links for. ··· 1091 874 mutex_lock(&wfs_lock); 1092 875 list_del_init(&dev->links.needs_suppliers); 1093 876 mutex_unlock(&wfs_lock); 877 + device_remove_file(dev, &dev_attr_waiting_for_supplier); 1094 878 1095 879 device_links_write_lock(); 1096 880 ··· 1377 1159 static void device_links_purge(struct device *dev) 1378 1160 { 1379 1161 struct device_link *link, *ln; 1162 + 1163 + if (dev->class == &devlink_class) 1164 + return; 1380 1165 1381 1166 mutex_lock(&wfs_lock); 1382 1167 list_del(&dev->links.needs_suppliers); ··· 2190 1969 goto err_remove_dev_groups; 2191 1970 } 2192 1971 1972 + if (fw_devlink_flags && !fw_devlink_is_permissive()) { 1973 + error = device_create_file(dev, &dev_attr_waiting_for_supplier); 1974 + if (error) 1975 + goto err_remove_dev_online; 1976 + } 1977 + 2193 1978 return 0; 2194 1979 1980 + err_remove_dev_online: 1981 + device_remove_file(dev, &dev_attr_online); 2195 1982 err_remove_dev_groups: 2196 1983 device_remove_groups(dev, dev->groups); 2197 1984 err_remove_type_groups: ··· 2217 1988 struct class *class = dev->class; 2218 1989 const struct device_type *type = dev->type; 2219 1990 1991 + device_remove_file(dev, &dev_attr_waiting_for_supplier); 2220 1992 device_remove_file(dev, &dev_attr_online); 2221 1993 device_remove_groups(dev, dev->groups); 2222 1994 ··· 4202 3972 define_dev_printk_level(_dev_info, KERN_INFO); 4203 3973 4204 3974 #endif 3975 + 3976 + /** 3977 + * dev_err_probe - probe error check and log helper 3978 + * @dev: the pointer to the struct device 3979 + * @err: error value to test 3980 + * @fmt: printf-style format string 3981 + * @...: arguments as specified in the format string 3982 + * 3983 + * This helper implements common pattern present in probe functions for error 3984 + * checking: print debug or error message depending if the error value is 3985 + * -EPROBE_DEFER and propagate error upwards. 3986 + * In case of -EPROBE_DEFER it sets also defer probe reason, which can be 3987 + * checked later by reading devices_deferred debugfs attribute. 3988 + * It replaces code sequence: 3989 + * if (err != -EPROBE_DEFER) 3990 + * dev_err(dev, ...); 3991 + * else 3992 + * dev_dbg(dev, ...); 3993 + * return err; 3994 + * with 3995 + * return dev_err_probe(dev, err, ...); 3996 + * 3997 + * Returns @err. 3998 + * 3999 + */ 4000 + int dev_err_probe(const struct device *dev, int err, const char *fmt, ...) 4001 + { 4002 + struct va_format vaf; 4003 + va_list args; 4004 + 4005 + va_start(args, fmt); 4006 + vaf.fmt = fmt; 4007 + vaf.va = &args; 4008 + 4009 + if (err != -EPROBE_DEFER) { 4010 + dev_err(dev, "error %d: %pV", err, &vaf); 4011 + } else { 4012 + device_set_deferred_probe_reason(dev, &vaf); 4013 + dev_dbg(dev, "error %d: %pV", err, &vaf); 4014 + } 4015 + 4016 + va_end(args); 4017 + 4018 + return err; 4019 + } 4020 + EXPORT_SYMBOL_GPL(dev_err_probe); 4205 4021 4206 4022 static inline bool fwnode_is_primary(struct fwnode_handle *fwnode) 4207 4023 {
+54 -9
drivers/base/dd.c
··· 27 27 #include <linux/async.h> 28 28 #include <linux/pm_runtime.h> 29 29 #include <linux/pinctrl/devinfo.h> 30 + #include <linux/slab.h> 30 31 31 32 #include "base.h" 32 33 #include "power/power.h" ··· 137 136 if (!list_empty(&dev->p->deferred_probe)) { 138 137 dev_dbg(dev, "Removed from deferred list\n"); 139 138 list_del_init(&dev->p->deferred_probe); 139 + kfree(dev->p->deferred_probe_reason); 140 + dev->p->deferred_probe_reason = NULL; 140 141 } 141 142 mutex_unlock(&deferred_probe_mutex); 142 143 } ··· 209 206 driver_deferred_probe_trigger(); 210 207 } 211 208 209 + /** 210 + * device_set_deferred_probe_reason() - Set defer probe reason message for device 211 + * @dev: the pointer to the struct device 212 + * @vaf: the pointer to va_format structure with message 213 + */ 214 + void device_set_deferred_probe_reason(const struct device *dev, struct va_format *vaf) 215 + { 216 + const char *drv = dev_driver_string(dev); 217 + 218 + mutex_lock(&deferred_probe_mutex); 219 + 220 + kfree(dev->p->deferred_probe_reason); 221 + dev->p->deferred_probe_reason = kasprintf(GFP_KERNEL, "%s: %pV", drv, vaf); 222 + 223 + mutex_unlock(&deferred_probe_mutex); 224 + } 225 + 212 226 /* 213 227 * deferred_devs_show() - Show the devices in the deferred probe pending list. 214 228 */ ··· 236 216 mutex_lock(&deferred_probe_mutex); 237 217 238 218 list_for_each_entry(curr, &deferred_probe_pending_list, deferred_probe) 239 - seq_printf(s, "%s\n", dev_name(curr->device)); 219 + seq_printf(s, "%s\t%s", dev_name(curr->device), 220 + curr->device->p->deferred_probe_reason ?: "\n"); 240 221 241 222 mutex_unlock(&deferred_probe_mutex); 242 223 ··· 297 276 298 277 list_for_each_entry_safe(private, p, &deferred_probe_pending_list, deferred_probe) 299 278 dev_info(private->device, "deferred probe pending\n"); 300 - wake_up(&probe_timeout_waitqueue); 279 + wake_up_all(&probe_timeout_waitqueue); 301 280 } 302 281 static DECLARE_DELAYED_WORK(deferred_probe_timeout_work, deferred_probe_timeout_work_func); 303 282 ··· 446 425 * Allow manual attachment of a driver to a device. 447 426 * Caller must have already set @dev->driver. 448 427 * 449 - * Note that this does not modify the bus reference count 450 - * nor take the bus's rwsem. Please verify those are accounted 451 - * for before calling this. (It is ok to call with no other effort 452 - * from a driver's probe() method.) 428 + * Note that this does not modify the bus reference count. 429 + * Please verify that is accounted for before calling this. 430 + * (It is ok to call with no other effort from a driver's probe() method.) 453 431 * 454 432 * This function must be called with the device lock held. 455 433 */ ··· 477 457 if (local_trigger_count != atomic_read(&deferred_trigger_count)) 478 458 driver_deferred_probe_trigger(); 479 459 } 460 + 461 + static ssize_t state_synced_show(struct device *dev, 462 + struct device_attribute *attr, char *buf) 463 + { 464 + bool val; 465 + 466 + device_lock(dev); 467 + val = dev->state_synced; 468 + device_unlock(dev); 469 + return sprintf(buf, "%u\n", val); 470 + } 471 + static DEVICE_ATTR_RO(state_synced); 480 472 481 473 static int really_probe(struct device *dev, struct device_driver *drv) 482 474 { ··· 519 487 drv->bus->name, __func__, drv->name, dev_name(dev)); 520 488 if (!list_empty(&dev->devres_head)) { 521 489 dev_crit(dev, "Resources present before probing\n"); 522 - return -EBUSY; 490 + ret = -EBUSY; 491 + goto done; 523 492 } 524 493 525 494 re_probe: ··· 564 531 goto dev_groups_failed; 565 532 } 566 533 534 + if (dev_has_sync_state(dev) && 535 + device_create_file(dev, &dev_attr_state_synced)) { 536 + dev_err(dev, "state_synced sysfs add failed\n"); 537 + goto dev_sysfs_state_synced_failed; 538 + } 539 + 567 540 if (test_remove) { 568 541 test_remove = false; 569 542 543 + device_remove_file(dev, &dev_attr_state_synced); 570 544 device_remove_groups(dev, drv->dev_groups); 571 545 572 546 if (dev->bus->remove) ··· 603 563 drv->bus->name, __func__, dev_name(dev), drv->name); 604 564 goto done; 605 565 566 + dev_sysfs_state_synced_failed: 567 + device_remove_groups(dev, drv->dev_groups); 606 568 dev_groups_failed: 607 569 if (dev->bus->remove) 608 570 dev->bus->remove(dev); ··· 649 607 ret = 0; 650 608 done: 651 609 atomic_dec(&probe_count); 652 - wake_up(&probe_waitqueue); 610 + wake_up_all(&probe_waitqueue); 653 611 return ret; 654 612 } 655 613 ··· 885 843 int ret = 0; 886 844 887 845 device_lock(dev); 888 - if (dev->driver) { 846 + if (dev->p->dead) { 847 + goto out_unlock; 848 + } else if (dev->driver) { 889 849 if (device_is_bound(dev)) { 890 850 ret = 1; 891 851 goto out_unlock; ··· 1144 1100 1145 1101 pm_runtime_put_sync(dev); 1146 1102 1103 + device_remove_file(dev, &dev_attr_state_synced); 1147 1104 device_remove_groups(dev, drv->dev_groups); 1148 1105 1149 1106 if (dev->bus && dev->bus->remove)
+18 -7
drivers/base/devres.c
··· 89 89 return NULL; 90 90 } 91 91 92 + static bool check_dr_size(size_t size, size_t *tot_size) 93 + { 94 + /* We must catch any near-SIZE_MAX cases that could overflow. */ 95 + if (unlikely(check_add_overflow(sizeof(struct devres), 96 + size, tot_size))) 97 + return false; 98 + 99 + return true; 100 + } 101 + 92 102 static __always_inline struct devres * alloc_dr(dr_release_t release, 93 103 size_t size, gfp_t gfp, int nid) 94 104 { 95 105 size_t tot_size; 96 106 struct devres *dr; 97 107 98 - /* We must catch any near-SIZE_MAX cases that could overflow. */ 99 - if (unlikely(check_add_overflow(sizeof(struct devres), size, 100 - &tot_size))) 108 + if (!check_dr_size(size, &tot_size)) 101 109 return NULL; 102 110 103 111 dr = kmalloc_node_track_caller(tot_size, gfp, nid); ··· 815 807 * RETURNS: 816 808 * Pointer to allocated memory on success, NULL on failure. 817 809 */ 818 - void * devm_kmalloc(struct device *dev, size_t size, gfp_t gfp) 810 + void *devm_kmalloc(struct device *dev, size_t size, gfp_t gfp) 819 811 { 820 812 struct devres *dr; 813 + 814 + if (unlikely(!size)) 815 + return ZERO_SIZE_PTR; 821 816 822 817 /* use raw alloc_dr for kmalloc caller tracing */ 823 818 dr = alloc_dr(devm_kmalloc_release, size, gfp, dev_to_node(dev)); ··· 953 942 int rc; 954 943 955 944 /* 956 - * Special case: pointer to a string in .rodata returned by 957 - * devm_kstrdup_const(). 945 + * Special cases: pointer to a string in .rodata returned by 946 + * devm_kstrdup_const() or NULL/ZERO ptr. 958 947 */ 959 - if (unlikely(is_kernel_rodata((unsigned long)p))) 948 + if (unlikely(is_kernel_rodata((unsigned long)p) || ZERO_OR_NULL_PTR(p))) 960 949 return; 961 950 962 951 rc = devres_destroy(dev, devm_kmalloc_release,
+2 -2
drivers/base/driver.c
··· 158 158 if ((drv->bus->probe && drv->probe) || 159 159 (drv->bus->remove && drv->remove) || 160 160 (drv->bus->shutdown && drv->shutdown)) 161 - printk(KERN_WARNING "Driver '%s' needs updating - please use " 161 + pr_warn("Driver '%s' needs updating - please use " 162 162 "bus_type methods\n", drv->name); 163 163 164 164 other = driver_find(drv->name, drv->bus); 165 165 if (other) { 166 - printk(KERN_ERR "Error: Driver '%s' is already registered, " 166 + pr_err("Error: Driver '%s' is already registered, " 167 167 "aborting...\n", drv->name); 168 168 return -EBUSY; 169 169 }
+4 -1
drivers/base/firmware_loader/fallback_platform.c
··· 25 25 if (rc) 26 26 return rc; /* rc == -ENOENT when the fw was not found */ 27 27 28 - fw_priv->data = vmalloc(size); 28 + if (fw_priv->data && size > fw_priv->allocated_size) 29 + return -ENOMEM; 30 + if (!fw_priv->data) 31 + fw_priv->data = vmalloc(size); 29 32 if (!fw_priv->data) 30 33 return -ENOMEM; 31 34
+6 -6
drivers/base/firmware_loader/main.c
··· 838 838 * @name: name of firmware file 839 839 * @device: device for which firmware is being loaded 840 840 * 841 - * This function is similar in behaviour to request_firmware(), except 842 - * it doesn't produce warning messages when the file is not found. 843 - * The sysfs fallback mechanism is enabled if direct filesystem lookup fails, 844 - * however, however failures to find the firmware file with it are still 845 - * suppressed. It is therefore up to the driver to check for the return value 846 - * of this call and to decide when to inform the users of errors. 841 + * This function is similar in behaviour to request_firmware(), except it 842 + * doesn't produce warning messages when the file is not found. The sysfs 843 + * fallback mechanism is enabled if direct filesystem lookup fails. However, 844 + * failures to find the firmware file with it are still suppressed. It is 845 + * therefore up to the driver to check for the return value of this call and to 846 + * decide when to inform the users of errors. 847 847 **/ 848 848 int firmware_request_nowarn(const struct firmware **firmware, const char *name, 849 849 struct device *device)
+6 -9
drivers/base/memory.c
··· 50 50 51 51 static int sections_per_block; 52 52 53 - static inline unsigned long base_memory_block_id(unsigned long section_nr) 53 + static inline unsigned long memory_block_id(unsigned long section_nr) 54 54 { 55 55 return section_nr / sections_per_block; 56 56 } 57 57 58 58 static inline unsigned long pfn_to_block_id(unsigned long pfn) 59 59 { 60 - return base_memory_block_id(pfn_to_section_nr(pfn)); 60 + return memory_block_id(pfn_to_section_nr(pfn)); 61 61 } 62 62 63 63 static inline unsigned long phys_to_block_id(unsigned long phys) ··· 517 517 */ 518 518 struct memory_block *find_memory_block(struct mem_section *section) 519 519 { 520 - unsigned long block_id = base_memory_block_id(__section_nr(section)); 520 + unsigned long block_id = memory_block_id(__section_nr(section)); 521 521 522 522 return find_memory_block_by_id(block_id); 523 523 } ··· 570 570 return ret; 571 571 } 572 572 573 - static int init_memory_block(struct memory_block **memory, 574 - unsigned long block_id, unsigned long state) 573 + static int init_memory_block(unsigned long block_id, unsigned long state) 575 574 { 576 575 struct memory_block *mem; 577 576 unsigned long start_pfn; ··· 593 594 594 595 ret = register_memory(mem); 595 596 596 - *memory = mem; 597 597 return ret; 598 598 } 599 599 600 600 static int add_memory_block(unsigned long base_section_nr) 601 601 { 602 602 int section_count = 0; 603 - struct memory_block *mem; 604 603 unsigned long nr; 605 604 606 605 for (nr = base_section_nr; nr < base_section_nr + sections_per_block; ··· 608 611 609 612 if (section_count == 0) 610 613 return 0; 611 - return init_memory_block(&mem, base_memory_block_id(base_section_nr), 614 + return init_memory_block(memory_block_id(base_section_nr), 612 615 MEM_ONLINE); 613 616 } 614 617 ··· 644 647 return -EINVAL; 645 648 646 649 for (block_id = start_block_id; block_id != end_block_id; block_id++) { 647 - ret = init_memory_block(&mem, block_id, MEM_OFFLINE); 650 + ret = init_memory_block(block_id, MEM_OFFLINE); 648 651 if (ret) 649 652 break; 650 653 }
+26 -2
drivers/base/platform.c
··· 1019 1019 if (len != -ENODEV) 1020 1020 return len; 1021 1021 1022 - len = acpi_device_modalias(dev, buf, PAGE_SIZE -1); 1022 + len = acpi_device_modalias(dev, buf, PAGE_SIZE - 1); 1023 1023 if (len != -ENODEV) 1024 1024 return len; 1025 1025 ··· 1076 1076 } 1077 1077 static DEVICE_ATTR_RW(driver_override); 1078 1078 1079 + static ssize_t numa_node_show(struct device *dev, 1080 + struct device_attribute *attr, char *buf) 1081 + { 1082 + return sprintf(buf, "%d\n", dev_to_node(dev)); 1083 + } 1084 + static DEVICE_ATTR_RO(numa_node); 1085 + 1086 + static umode_t platform_dev_attrs_visible(struct kobject *kobj, struct attribute *a, 1087 + int n) 1088 + { 1089 + struct device *dev = container_of(kobj, typeof(*dev), kobj); 1090 + 1091 + if (a == &dev_attr_numa_node.attr && 1092 + dev_to_node(dev) == NUMA_NO_NODE) 1093 + return 0; 1094 + 1095 + return a->mode; 1096 + } 1079 1097 1080 1098 static struct attribute *platform_dev_attrs[] = { 1081 1099 &dev_attr_modalias.attr, 1100 + &dev_attr_numa_node.attr, 1082 1101 &dev_attr_driver_override.attr, 1083 1102 NULL, 1084 1103 }; 1085 - ATTRIBUTE_GROUPS(platform_dev); 1104 + 1105 + static struct attribute_group platform_dev_group = { 1106 + .attrs = platform_dev_attrs, 1107 + .is_visible = platform_dev_attrs_visible, 1108 + }; 1109 + __ATTRIBUTE_GROUPS(platform_dev); 1086 1110 1087 1111 static int platform_uevent(struct device *dev, struct kobj_uevent_env *env) 1088 1112 {
+2 -6
drivers/base/swnode.c
··· 761 761 */ 762 762 void software_node_unregister_node_group(const struct software_node **node_group) 763 763 { 764 - struct swnode *swnode; 765 764 unsigned int i; 766 765 767 766 if (!node_group) 768 767 return; 769 768 770 - for (i = 0; node_group[i]; i++) { 771 - swnode = software_node_to_swnode(node_group[i]); 772 - if (swnode) 773 - fwnode_remove_software_node(&swnode->fwnode); 774 - } 769 + for (i = 0; node_group[i]; i++) 770 + software_node_unregister(node_group[i]); 775 771 } 776 772 EXPORT_SYMBOL_GPL(software_node_unregister_node_group); 777 773
+1 -1
drivers/base/topology.c
··· 133 133 return 0; 134 134 } 135 135 136 - static int topology_sysfs_init(void) 136 + static int __init topology_sysfs_init(void) 137 137 { 138 138 return cpuhp_setup_state(CPUHP_TOPOLOGY_PREPARE, 139 139 "base/topology:prepare", topology_add_dev,
+3 -7
drivers/gpu/drm/bridge/lvds-codec.c
··· 71 71 lvds_codec->connector_type = (uintptr_t)of_device_get_match_data(dev); 72 72 lvds_codec->powerdown_gpio = devm_gpiod_get_optional(dev, "powerdown", 73 73 GPIOD_OUT_HIGH); 74 - if (IS_ERR(lvds_codec->powerdown_gpio)) { 75 - int err = PTR_ERR(lvds_codec->powerdown_gpio); 76 - 77 - if (err != -EPROBE_DEFER) 78 - dev_err(dev, "powerdown GPIO failure: %d\n", err); 79 - return err; 80 - } 74 + if (IS_ERR(lvds_codec->powerdown_gpio)) 75 + return dev_err_probe(dev, PTR_ERR(lvds_codec->powerdown_gpio), 76 + "powerdown GPIO failure\n"); 81 77 82 78 /* Locate the panel DT node. */ 83 79 panel_node = of_graph_get_remote_node(dev->of_node, 1, 0);
+9 -12
drivers/gpu/drm/bridge/sil-sii8620.c
··· 2299 2299 INIT_LIST_HEAD(&ctx->mt_queue); 2300 2300 2301 2301 ctx->clk_xtal = devm_clk_get(dev, "xtal"); 2302 - if (IS_ERR(ctx->clk_xtal)) { 2303 - dev_err(dev, "failed to get xtal clock from DT\n"); 2304 - return PTR_ERR(ctx->clk_xtal); 2305 - } 2302 + if (IS_ERR(ctx->clk_xtal)) 2303 + return dev_err_probe(dev, PTR_ERR(ctx->clk_xtal), 2304 + "failed to get xtal clock from DT\n"); 2306 2305 2307 2306 if (!client->irq) { 2308 2307 dev_err(dev, "no irq provided\n"); ··· 2312 2313 sii8620_irq_thread, 2313 2314 IRQF_TRIGGER_HIGH | IRQF_ONESHOT, 2314 2315 "sii8620", ctx); 2315 - if (ret < 0) { 2316 - dev_err(dev, "failed to install IRQ handler\n"); 2317 - return ret; 2318 - } 2316 + if (ret < 0) 2317 + return dev_err_probe(dev, ret, 2318 + "failed to install IRQ handler\n"); 2319 2319 2320 2320 ctx->gpio_reset = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH); 2321 - if (IS_ERR(ctx->gpio_reset)) { 2322 - dev_err(dev, "failed to get reset gpio from DT\n"); 2323 - return PTR_ERR(ctx->gpio_reset); 2324 - } 2321 + if (IS_ERR(ctx->gpio_reset)) 2322 + return dev_err_probe(dev, PTR_ERR(ctx->gpio_reset), 2323 + "failed to get reset gpio from DT\n"); 2325 2324 2326 2325 ctx->supplies[0].supply = "cvcc10"; 2327 2326 ctx->supplies[1].supply = "iovcc18";
+1 -1
fs/debugfs/file.c
··· 273 273 r = real_fops->release(inode, filp); 274 274 275 275 replace_fops(filp, d_inode(dentry)->i_fop); 276 - kfree((void *)proxy_fops); 276 + kfree(proxy_fops); 277 277 fops_put(real_fops); 278 278 return r; 279 279 }
+39
fs/debugfs/inode.c
··· 35 35 static struct vfsmount *debugfs_mount; 36 36 static int debugfs_mount_count; 37 37 static bool debugfs_registered; 38 + static unsigned int debugfs_allow = DEFAULT_DEBUGFS_ALLOW_BITS; 38 39 39 40 /* 40 41 * Don't allow access attributes to be changed whilst the kernel is locked down ··· 267 266 int flags, const char *dev_name, 268 267 void *data) 269 268 { 269 + if (!(debugfs_allow & DEBUGFS_ALLOW_API)) 270 + return ERR_PTR(-EPERM); 271 + 270 272 return mount_single(fs_type, flags, data, debug_fill_super); 271 273 } 272 274 ··· 314 310 { 315 311 struct dentry *dentry; 316 312 int error; 313 + 314 + if (!(debugfs_allow & DEBUGFS_ALLOW_API)) 315 + return ERR_PTR(-EPERM); 317 316 318 317 pr_debug("creating file '%s'\n", name); 319 318 ··· 391 384 392 385 if (IS_ERR(dentry)) 393 386 return dentry; 387 + 388 + if (!(debugfs_allow & DEBUGFS_ALLOW_API)) { 389 + failed_creating(dentry); 390 + return ERR_PTR(-EPERM); 391 + } 394 392 395 393 inode = debugfs_get_inode(dentry->d_sb); 396 394 if (unlikely(!inode)) { ··· 553 541 if (IS_ERR(dentry)) 554 542 return dentry; 555 543 544 + if (!(debugfs_allow & DEBUGFS_ALLOW_API)) { 545 + failed_creating(dentry); 546 + return ERR_PTR(-EPERM); 547 + } 548 + 556 549 inode = debugfs_get_inode(dentry->d_sb); 557 550 if (unlikely(!inode)) { 558 551 pr_err("out of free dentries, can not create directory '%s'\n", ··· 599 582 600 583 if (IS_ERR(dentry)) 601 584 return dentry; 585 + 586 + if (!(debugfs_allow & DEBUGFS_ALLOW_API)) { 587 + failed_creating(dentry); 588 + return ERR_PTR(-EPERM); 589 + } 602 590 603 591 inode = debugfs_get_inode(dentry->d_sb); 604 592 if (unlikely(!inode)) { ··· 808 786 } 809 787 EXPORT_SYMBOL_GPL(debugfs_initialized); 810 788 789 + static int __init debugfs_kernel(char *str) 790 + { 791 + if (str) { 792 + if (!strcmp(str, "on")) 793 + debugfs_allow = DEBUGFS_ALLOW_API | DEBUGFS_ALLOW_MOUNT; 794 + else if (!strcmp(str, "no-mount")) 795 + debugfs_allow = DEBUGFS_ALLOW_API; 796 + else if (!strcmp(str, "off")) 797 + debugfs_allow = 0; 798 + } 799 + 800 + return 0; 801 + } 802 + early_param("debugfs", debugfs_kernel); 811 803 static int __init debugfs_init(void) 812 804 { 813 805 int retval; 806 + 807 + if (!(debugfs_allow & DEBUGFS_ALLOW_MOUNT)) 808 + return -EPERM; 814 809 815 810 retval = sysfs_create_mount_point(kernel_kobj, "debug"); 816 811 if (retval)
+14
fs/debugfs/internal.h
··· 29 29 */ 30 30 #define DEBUGFS_FSDATA_IS_REAL_FOPS_BIT BIT(0) 31 31 32 + /* Access BITS */ 33 + #define DEBUGFS_ALLOW_API BIT(0) 34 + #define DEBUGFS_ALLOW_MOUNT BIT(1) 35 + 36 + #ifdef CONFIG_DEBUG_FS_ALLOW_ALL 37 + #define DEFAULT_DEBUGFS_ALLOW_BITS (DEBUGFS_ALLOW_MOUNT | DEBUGFS_ALLOW_API) 38 + #endif 39 + #ifdef CONFIG_DEBUG_FS_DISALLOW_MOUNT 40 + #define DEFAULT_DEBUGFS_ALLOW_BITS (DEBUGFS_ALLOW_API) 41 + #endif 42 + #ifdef CONFIG_DEBUG_FS_ALLOW_NONE 43 + #define DEFAULT_DEBUGFS_ALLOW_BITS (0) 44 + #endif 45 + 32 46 #endif /* _DEBUGFS_INTERNAL_H_ */
+143 -143
include/linux/device.h
··· 129 129 __ATTR_PREALLOC(_name, _mode, _show, _store) 130 130 #define DEVICE_ATTR_RW(_name) \ 131 131 struct device_attribute dev_attr_##_name = __ATTR_RW(_name) 132 + #define DEVICE_ATTR_ADMIN_RW(_name) \ 133 + struct device_attribute dev_attr_##_name = __ATTR_RW_MODE(_name, 0600) 132 134 #define DEVICE_ATTR_RO(_name) \ 133 135 struct device_attribute dev_attr_##_name = __ATTR_RO(_name) 136 + #define DEVICE_ATTR_ADMIN_RO(_name) \ 137 + struct device_attribute dev_attr_##_name = __ATTR_RO_MODE(_name, 0400) 134 138 #define DEVICE_ATTR_WO(_name) \ 135 139 struct device_attribute dev_attr_##_name = __ATTR_WO(_name) 136 140 #define DEVICE_ULONG_ATTR(_name, _mode, _var) \ ··· 150 146 struct device_attribute dev_attr_##_name = \ 151 147 __ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store) 152 148 153 - extern int device_create_file(struct device *device, 154 - const struct device_attribute *entry); 155 - extern void device_remove_file(struct device *dev, 156 - const struct device_attribute *attr); 157 - extern bool device_remove_file_self(struct device *dev, 158 - const struct device_attribute *attr); 159 - extern int __must_check device_create_bin_file(struct device *dev, 149 + int device_create_file(struct device *device, 150 + const struct device_attribute *entry); 151 + void device_remove_file(struct device *dev, 152 + const struct device_attribute *attr); 153 + bool device_remove_file_self(struct device *dev, 154 + const struct device_attribute *attr); 155 + int __must_check device_create_bin_file(struct device *dev, 160 156 const struct bin_attribute *attr); 161 - extern void device_remove_bin_file(struct device *dev, 162 - const struct bin_attribute *attr); 157 + void device_remove_bin_file(struct device *dev, 158 + const struct bin_attribute *attr); 163 159 164 160 /* device resource management */ 165 161 typedef void (*dr_release_t)(struct device *dev, void *res); 166 162 typedef int (*dr_match_t)(struct device *dev, void *res, void *match_data); 167 163 168 164 #ifdef CONFIG_DEBUG_DEVRES 169 - extern void *__devres_alloc_node(dr_release_t release, size_t size, gfp_t gfp, 170 - int nid, const char *name) __malloc; 165 + void *__devres_alloc_node(dr_release_t release, size_t size, gfp_t gfp, 166 + int nid, const char *name) __malloc; 171 167 #define devres_alloc(release, size, gfp) \ 172 168 __devres_alloc_node(release, size, gfp, NUMA_NO_NODE, #release) 173 169 #define devres_alloc_node(release, size, gfp, nid) \ 174 170 __devres_alloc_node(release, size, gfp, nid, #release) 175 171 #else 176 - extern void *devres_alloc_node(dr_release_t release, size_t size, gfp_t gfp, 177 - int nid) __malloc; 172 + void *devres_alloc_node(dr_release_t release, size_t size, 173 + gfp_t gfp, int nid) __malloc; 178 174 static inline void *devres_alloc(dr_release_t release, size_t size, gfp_t gfp) 179 175 { 180 176 return devres_alloc_node(release, size, gfp, NUMA_NO_NODE); 181 177 } 182 178 #endif 183 179 184 - extern void devres_for_each_res(struct device *dev, dr_release_t release, 185 - dr_match_t match, void *match_data, 186 - void (*fn)(struct device *, void *, void *), 187 - void *data); 188 - extern void devres_free(void *res); 189 - extern void devres_add(struct device *dev, void *res); 190 - extern void *devres_find(struct device *dev, dr_release_t release, 191 - dr_match_t match, void *match_data); 192 - extern void *devres_get(struct device *dev, void *new_res, 193 - dr_match_t match, void *match_data); 194 - extern void *devres_remove(struct device *dev, dr_release_t release, 195 - dr_match_t match, void *match_data); 196 - extern int devres_destroy(struct device *dev, dr_release_t release, 197 - dr_match_t match, void *match_data); 198 - extern int devres_release(struct device *dev, dr_release_t release, 199 - dr_match_t match, void *match_data); 180 + void devres_for_each_res(struct device *dev, dr_release_t release, 181 + dr_match_t match, void *match_data, 182 + void (*fn)(struct device *, void *, void *), 183 + void *data); 184 + void devres_free(void *res); 185 + void devres_add(struct device *dev, void *res); 186 + void *devres_find(struct device *dev, dr_release_t release, 187 + dr_match_t match, void *match_data); 188 + void *devres_get(struct device *dev, void *new_res, 189 + dr_match_t match, void *match_data); 190 + void *devres_remove(struct device *dev, dr_release_t release, 191 + dr_match_t match, void *match_data); 192 + int devres_destroy(struct device *dev, dr_release_t release, 193 + dr_match_t match, void *match_data); 194 + int devres_release(struct device *dev, dr_release_t release, 195 + dr_match_t match, void *match_data); 200 196 201 197 /* devres group */ 202 - extern void * __must_check devres_open_group(struct device *dev, void *id, 203 - gfp_t gfp); 204 - extern void devres_close_group(struct device *dev, void *id); 205 - extern void devres_remove_group(struct device *dev, void *id); 206 - extern int devres_release_group(struct device *dev, void *id); 198 + void * __must_check devres_open_group(struct device *dev, void *id, gfp_t gfp); 199 + void devres_close_group(struct device *dev, void *id); 200 + void devres_remove_group(struct device *dev, void *id); 201 + int devres_release_group(struct device *dev, void *id); 207 202 208 203 /* managed devm_k.alloc/kfree for device drivers */ 209 - extern void *devm_kmalloc(struct device *dev, size_t size, gfp_t gfp) __malloc; 210 - extern __printf(3, 0) 211 - char *devm_kvasprintf(struct device *dev, gfp_t gfp, const char *fmt, 212 - va_list ap) __malloc; 213 - extern __printf(3, 4) 214 - char *devm_kasprintf(struct device *dev, gfp_t gfp, const char *fmt, ...) __malloc; 204 + void *devm_kmalloc(struct device *dev, size_t size, gfp_t gfp) __malloc; 205 + __printf(3, 0) char *devm_kvasprintf(struct device *dev, gfp_t gfp, 206 + const char *fmt, va_list ap) __malloc; 207 + __printf(3, 4) char *devm_kasprintf(struct device *dev, gfp_t gfp, 208 + const char *fmt, ...) __malloc; 215 209 static inline void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp) 216 210 { 217 211 return devm_kmalloc(dev, size, gfp | __GFP_ZERO); ··· 229 227 { 230 228 return devm_kmalloc_array(dev, n, size, flags | __GFP_ZERO); 231 229 } 232 - extern void devm_kfree(struct device *dev, const void *p); 233 - extern char *devm_kstrdup(struct device *dev, const char *s, gfp_t gfp) __malloc; 234 - extern const char *devm_kstrdup_const(struct device *dev, 235 - const char *s, gfp_t gfp); 236 - extern void *devm_kmemdup(struct device *dev, const void *src, size_t len, 237 - gfp_t gfp); 230 + void devm_kfree(struct device *dev, const void *p); 231 + char *devm_kstrdup(struct device *dev, const char *s, gfp_t gfp) __malloc; 232 + const char *devm_kstrdup_const(struct device *dev, const char *s, gfp_t gfp); 233 + void *devm_kmemdup(struct device *dev, const void *src, size_t len, gfp_t gfp); 238 234 239 - extern unsigned long devm_get_free_pages(struct device *dev, 240 - gfp_t gfp_mask, unsigned int order); 241 - extern void devm_free_pages(struct device *dev, unsigned long addr); 235 + unsigned long devm_get_free_pages(struct device *dev, 236 + gfp_t gfp_mask, unsigned int order); 237 + void devm_free_pages(struct device *dev, unsigned long addr); 242 238 243 239 void __iomem *devm_ioremap_resource(struct device *dev, 244 240 const struct resource *res); ··· 386 386 #define DL_FLAG_AUTOPROBE_CONSUMER BIT(5) 387 387 #define DL_FLAG_MANAGED BIT(6) 388 388 #define DL_FLAG_SYNC_STATE_ONLY BIT(7) 389 - 390 - /** 391 - * struct device_link - Device link representation. 392 - * @supplier: The device on the supplier end of the link. 393 - * @s_node: Hook to the supplier device's list of links to consumers. 394 - * @consumer: The device on the consumer end of the link. 395 - * @c_node: Hook to the consumer device's list of links to suppliers. 396 - * @status: The state of the link (with respect to the presence of drivers). 397 - * @flags: Link flags. 398 - * @rpm_active: Whether or not the consumer device is runtime-PM-active. 399 - * @kref: Count repeated addition of the same link. 400 - * @rcu_head: An RCU head to use for deferred execution of SRCU callbacks. 401 - * @supplier_preactivated: Supplier has been made active before consumer probe. 402 - */ 403 - struct device_link { 404 - struct device *supplier; 405 - struct list_head s_node; 406 - struct device *consumer; 407 - struct list_head c_node; 408 - enum device_link_state status; 409 - u32 flags; 410 - refcount_t rpm_active; 411 - struct kref kref; 412 - #ifdef CONFIG_SRCU 413 - struct rcu_head rcu_head; 414 - #endif 415 - bool supplier_preactivated; /* Owned by consumer probe. */ 416 - }; 417 389 418 390 /** 419 391 * enum dl_dev_state - Device driver presence tracking information. ··· 611 639 #endif 612 640 }; 613 641 642 + /** 643 + * struct device_link - Device link representation. 644 + * @supplier: The device on the supplier end of the link. 645 + * @s_node: Hook to the supplier device's list of links to consumers. 646 + * @consumer: The device on the consumer end of the link. 647 + * @c_node: Hook to the consumer device's list of links to suppliers. 648 + * @link_dev: device used to expose link details in sysfs 649 + * @status: The state of the link (with respect to the presence of drivers). 650 + * @flags: Link flags. 651 + * @rpm_active: Whether or not the consumer device is runtime-PM-active. 652 + * @kref: Count repeated addition of the same link. 653 + * @rcu_head: An RCU head to use for deferred execution of SRCU callbacks. 654 + * @supplier_preactivated: Supplier has been made active before consumer probe. 655 + */ 656 + struct device_link { 657 + struct device *supplier; 658 + struct list_head s_node; 659 + struct device *consumer; 660 + struct list_head c_node; 661 + struct device link_dev; 662 + enum device_link_state status; 663 + u32 flags; 664 + refcount_t rpm_active; 665 + struct kref kref; 666 + #ifdef CONFIG_SRCU 667 + struct rcu_head rcu_head; 668 + #endif 669 + bool supplier_preactivated; /* Owned by consumer probe. */ 670 + }; 671 + 614 672 static inline struct device *kobj_to_dev(struct kobject *kobj) 615 673 { 616 674 return container_of(kobj, struct device, kobj); ··· 668 666 return kobject_name(&dev->kobj); 669 667 } 670 668 671 - extern __printf(2, 3) 672 - int dev_set_name(struct device *dev, const char *name, ...); 669 + __printf(2, 3) int dev_set_name(struct device *dev, const char *name, ...); 673 670 674 671 #ifdef CONFIG_NUMA 675 672 static inline int dev_to_node(struct device *dev) ··· 825 824 /* 826 825 * High level routines for use by the bus drivers 827 826 */ 828 - extern int __must_check device_register(struct device *dev); 829 - extern void device_unregister(struct device *dev); 830 - extern void device_initialize(struct device *dev); 831 - extern int __must_check device_add(struct device *dev); 832 - extern void device_del(struct device *dev); 833 - extern int device_for_each_child(struct device *dev, void *data, 834 - int (*fn)(struct device *dev, void *data)); 835 - extern int device_for_each_child_reverse(struct device *dev, void *data, 836 - int (*fn)(struct device *dev, void *data)); 837 - extern struct device *device_find_child(struct device *dev, void *data, 838 - int (*match)(struct device *dev, void *data)); 839 - extern struct device *device_find_child_by_name(struct device *parent, 840 - const char *name); 841 - extern int device_rename(struct device *dev, const char *new_name); 842 - extern int device_move(struct device *dev, struct device *new_parent, 843 - enum dpm_order dpm_order); 844 - extern int device_change_owner(struct device *dev, kuid_t kuid, kgid_t kgid); 845 - extern const char *device_get_devnode(struct device *dev, 846 - umode_t *mode, kuid_t *uid, kgid_t *gid, 847 - const char **tmp); 827 + int __must_check device_register(struct device *dev); 828 + void device_unregister(struct device *dev); 829 + void device_initialize(struct device *dev); 830 + int __must_check device_add(struct device *dev); 831 + void device_del(struct device *dev); 832 + int device_for_each_child(struct device *dev, void *data, 833 + int (*fn)(struct device *dev, void *data)); 834 + int device_for_each_child_reverse(struct device *dev, void *data, 835 + int (*fn)(struct device *dev, void *data)); 836 + struct device *device_find_child(struct device *dev, void *data, 837 + int (*match)(struct device *dev, void *data)); 838 + struct device *device_find_child_by_name(struct device *parent, 839 + const char *name); 840 + int device_rename(struct device *dev, const char *new_name); 841 + int device_move(struct device *dev, struct device *new_parent, 842 + enum dpm_order dpm_order); 843 + int device_change_owner(struct device *dev, kuid_t kuid, kgid_t kgid); 844 + const char *device_get_devnode(struct device *dev, umode_t *mode, kuid_t *uid, 845 + kgid_t *gid, const char **tmp); 848 846 849 847 static inline bool device_supports_offline(struct device *dev) 850 848 { 851 849 return dev->bus && dev->bus->offline && dev->bus->online; 852 850 } 853 851 854 - extern void lock_device_hotplug(void); 855 - extern void unlock_device_hotplug(void); 856 - extern int lock_device_hotplug_sysfs(void); 857 - extern int device_offline(struct device *dev); 858 - extern int device_online(struct device *dev); 859 - extern void set_primary_fwnode(struct device *dev, struct fwnode_handle *fwnode); 860 - extern void set_secondary_fwnode(struct device *dev, struct fwnode_handle *fwnode); 852 + void lock_device_hotplug(void); 853 + void unlock_device_hotplug(void); 854 + int lock_device_hotplug_sysfs(void); 855 + int device_offline(struct device *dev); 856 + int device_online(struct device *dev); 857 + void set_primary_fwnode(struct device *dev, struct fwnode_handle *fwnode); 858 + void set_secondary_fwnode(struct device *dev, struct fwnode_handle *fwnode); 861 859 void device_set_of_node_from_dev(struct device *dev, const struct device *dev2); 862 860 863 861 static inline int dev_num_vf(struct device *dev) ··· 869 869 /* 870 870 * Root device objects for grouping under /sys/devices 871 871 */ 872 - extern struct device *__root_device_register(const char *name, 873 - struct module *owner); 872 + struct device *__root_device_register(const char *name, struct module *owner); 874 873 875 874 /* This is a macro to avoid include problems with THIS_MODULE */ 876 875 #define root_device_register(name) \ 877 876 __root_device_register(name, THIS_MODULE) 878 877 879 - extern void root_device_unregister(struct device *root); 878 + void root_device_unregister(struct device *root); 880 879 881 880 static inline void *dev_get_platdata(const struct device *dev) 882 881 { ··· 886 887 * Manual binding of a device to driver. See drivers/base/bus.c 887 888 * for information on use. 888 889 */ 889 - extern int __must_check device_bind_driver(struct device *dev); 890 - extern void device_release_driver(struct device *dev); 891 - extern int __must_check device_attach(struct device *dev); 892 - extern int __must_check driver_attach(struct device_driver *drv); 893 - extern void device_initial_probe(struct device *dev); 894 - extern int __must_check device_reprobe(struct device *dev); 890 + int __must_check device_bind_driver(struct device *dev); 891 + void device_release_driver(struct device *dev); 892 + int __must_check device_attach(struct device *dev); 893 + int __must_check driver_attach(struct device_driver *drv); 894 + void device_initial_probe(struct device *dev); 895 + int __must_check device_reprobe(struct device *dev); 895 896 896 - extern bool device_is_bound(struct device *dev); 897 + bool device_is_bound(struct device *dev); 897 898 898 899 /* 899 900 * Easy functions for dynamically creating devices on the fly 900 901 */ 901 - extern __printf(5, 6) 902 - struct device *device_create(struct class *cls, struct device *parent, 903 - dev_t devt, void *drvdata, 904 - const char *fmt, ...); 905 - extern __printf(6, 7) 906 - struct device *device_create_with_groups(struct class *cls, 907 - struct device *parent, dev_t devt, void *drvdata, 908 - const struct attribute_group **groups, 909 - const char *fmt, ...); 910 - extern void device_destroy(struct class *cls, dev_t devt); 902 + __printf(5, 6) struct device * 903 + device_create(struct class *cls, struct device *parent, dev_t devt, 904 + void *drvdata, const char *fmt, ...); 905 + __printf(6, 7) struct device * 906 + device_create_with_groups(struct class *cls, struct device *parent, dev_t devt, 907 + void *drvdata, const struct attribute_group **groups, 908 + const char *fmt, ...); 909 + void device_destroy(struct class *cls, dev_t devt); 911 910 912 - extern int __must_check device_add_groups(struct device *dev, 913 - const struct attribute_group **groups); 914 - extern void device_remove_groups(struct device *dev, 915 - const struct attribute_group **groups); 911 + int __must_check device_add_groups(struct device *dev, 912 + const struct attribute_group **groups); 913 + void device_remove_groups(struct device *dev, 914 + const struct attribute_group **groups); 916 915 917 916 static inline int __must_check device_add_group(struct device *dev, 918 917 const struct attribute_group *grp) ··· 928 931 return device_remove_groups(dev, groups); 929 932 } 930 933 931 - extern int __must_check devm_device_add_groups(struct device *dev, 934 + int __must_check devm_device_add_groups(struct device *dev, 932 935 const struct attribute_group **groups); 933 - extern void devm_device_remove_groups(struct device *dev, 934 - const struct attribute_group **groups); 935 - extern int __must_check devm_device_add_group(struct device *dev, 936 - const struct attribute_group *grp); 937 - extern void devm_device_remove_group(struct device *dev, 938 - const struct attribute_group *grp); 936 + void devm_device_remove_groups(struct device *dev, 937 + const struct attribute_group **groups); 938 + int __must_check devm_device_add_group(struct device *dev, 939 + const struct attribute_group *grp); 940 + void devm_device_remove_group(struct device *dev, 941 + const struct attribute_group *grp); 939 942 940 943 /* 941 944 * Platform "fixup" functions - allow the platform to have their say ··· 952 955 * get_device - atomically increment the reference count for the device. 953 956 * 954 957 */ 955 - extern struct device *get_device(struct device *dev); 956 - extern void put_device(struct device *dev); 957 - extern bool kill_device(struct device *dev); 958 + struct device *get_device(struct device *dev); 959 + void put_device(struct device *dev); 960 + bool kill_device(struct device *dev); 958 961 959 962 #ifdef CONFIG_DEVTMPFS 960 - extern int devtmpfs_mount(void); 963 + int devtmpfs_mount(void); 961 964 #else 962 965 static inline int devtmpfs_mount(void) { return 0; } 963 966 #endif 964 967 965 968 /* drivers/base/power/shutdown.c */ 966 - extern void device_shutdown(void); 969 + void device_shutdown(void); 967 970 968 971 /* debugging and troubleshooting/diagnostic helpers. */ 969 - extern const char *dev_driver_string(const struct device *dev); 972 + const char *dev_driver_string(const struct device *dev); 970 973 971 974 /* Device links interface. */ 972 975 struct device_link *device_link_add(struct device *consumer, ··· 975 978 void device_link_remove(void *consumer, struct device *supplier); 976 979 void device_links_supplier_sync_state_pause(void); 977 980 void device_links_supplier_sync_state_resume(void); 981 + 982 + extern __printf(3, 4) 983 + int dev_err_probe(const struct device *dev, int err, const char *fmt, ...); 978 984 979 985 /* Create alias, so I can be autoloaded. */ 980 986 #define MODULE_ALIAS_CHARDEV(major,minor) \
-1
include/linux/kobject.h
··· 59 59 KOBJ_OFFLINE, 60 60 KOBJ_BIND, 61 61 KOBJ_UNBIND, 62 - KOBJ_MAX 63 62 }; 64 63 65 64 struct kobject {
+7
include/linux/sysfs.h
··· 123 123 .show = _name##_show, \ 124 124 } 125 125 126 + #define __ATTR_RW_MODE(_name, _mode) { \ 127 + .attr = { .name = __stringify(_name), \ 128 + .mode = VERIFY_OCTAL_PERMISSIONS(_mode) }, \ 129 + .show = _name##_show, \ 130 + .store = _name##_store, \ 131 + } 132 + 126 133 #define __ATTR_WO(_name) { \ 127 134 .attr = { .name = __stringify(_name), .mode = 0200 }, \ 128 135 .store = _name##_store, \
+1 -3
kernel/trace/trace.c
··· 8945 8945 if (tr->dir) 8946 8946 return NULL; 8947 8947 8948 - if (WARN_ON(!tracefs_initialized()) || 8949 - (IS_ENABLED(CONFIG_DEBUG_FS) && 8950 - WARN_ON(!debugfs_initialized()))) 8948 + if (WARN_ON(!tracefs_initialized())) 8951 8949 return ERR_PTR(-ENODEV); 8952 8950 8953 8951 /*
+36 -4
lib/Kconfig.debug
··· 476 476 477 477 If unsure, say N. 478 478 479 + choice 480 + prompt "Debugfs default access" 481 + depends on DEBUG_FS 482 + default DEBUG_FS_ALLOW_ALL 483 + help 484 + This selects the default access restrictions for debugfs. 485 + It can be overridden with kernel command line option 486 + debugfs=[on,no-mount,off]. The restrictions apply for API access 487 + and filesystem registration. 488 + 489 + config DEBUG_FS_ALLOW_ALL 490 + bool "Access normal" 491 + help 492 + No restrictions apply. Both API and filesystem registration 493 + is on. This is the normal default operation. 494 + 495 + config DEBUG_FS_DISALLOW_MOUNT 496 + bool "Do not register debugfs as filesystem" 497 + help 498 + The API is open but filesystem is not loaded. Clients can still do 499 + their work and read with debug tools that do not need 500 + debugfs filesystem. 501 + 502 + config DEBUG_FS_ALLOW_NONE 503 + bool "No access" 504 + help 505 + Access is off. Clients get -PERM when trying to create nodes in 506 + debugfs tree and debugfs is not registered as a filesystem. 507 + Client can then back-off or continue without debugfs access. 508 + 509 + endchoice 510 + 479 511 source "lib/Kconfig.kgdb" 480 512 481 513 source "lib/Kconfig.ubsan" ··· 876 844 bool "Debug shared IRQ handlers" 877 845 depends on DEBUG_KERNEL 878 846 help 879 - Enable this to generate a spurious interrupt as soon as a shared 880 - interrupt handler is registered, and just before one is deregistered. 881 - Drivers ought to be able to handle interrupts coming in at those 882 - points; some don't and need to be caught. 847 + Enable this to generate a spurious interrupt just before a shared 848 + interrupt handler is deregistered (generating one when registering 849 + is currently disabled). Drivers need to handle this correctly. Some 850 + don't and need to be caught. 883 851 884 852 menu "Debug Oops, Lockups and Hangs" 885 853
+16 -1
lib/devres.c
··· 119 119 { 120 120 resource_size_t size; 121 121 void __iomem *dest_ptr; 122 + char *pretty_name; 122 123 123 124 BUG_ON(!dev); 124 125 ··· 130 129 131 130 size = resource_size(res); 132 131 133 - if (!devm_request_mem_region(dev, res->start, size, dev_name(dev))) { 132 + if (res->name) 133 + pretty_name = devm_kasprintf(dev, GFP_KERNEL, "%s %s", 134 + dev_name(dev), res->name); 135 + else 136 + pretty_name = devm_kstrdup(dev, dev_name(dev), GFP_KERNEL); 137 + if (!pretty_name) 138 + return IOMEM_ERR_PTR(-ENOMEM); 139 + 140 + if (!devm_request_mem_region(dev, res->start, size, pretty_name)) { 134 141 dev_err(dev, "can't request region for resource %pR\n", res); 135 142 return IOMEM_ERR_PTR(-EBUSY); 136 143 } ··· 213 204 * base = devm_of_iomap(&pdev->dev, node, 0, NULL); 214 205 * if (IS_ERR(base)) 215 206 * return PTR_ERR(base); 207 + * 208 + * Please Note: This is not a one-to-one replacement for of_iomap() because the 209 + * of_iomap() function does not track whether the region is already mapped. If 210 + * two drivers try to map the same memory, the of_iomap() function will succeed 211 + * but the the devm_of_iomap() function will return -EBUSY. 212 + * 216 213 */ 217 214 void __iomem *devm_of_iomap(struct device *dev, struct device_node *node, int index, 218 215 resource_size_t *size)
+23 -10
lib/kobject.c
··· 599 599 } 600 600 EXPORT_SYMBOL_GPL(kobject_move); 601 601 602 - /** 603 - * kobject_del() - Unlink kobject from hierarchy. 604 - * @kobj: object. 605 - * 606 - * This is the function that should be called to delete an object 607 - * successfully added via kobject_add(). 608 - */ 609 - void kobject_del(struct kobject *kobj) 602 + static void __kobject_del(struct kobject *kobj) 610 603 { 611 604 struct kernfs_node *sd; 612 605 const struct kobj_type *ktype; ··· 625 632 626 633 kobj->state_in_sysfs = 0; 627 634 kobj_kset_leave(kobj); 628 - kobject_put(kobj->parent); 629 635 kobj->parent = NULL; 636 + } 637 + 638 + /** 639 + * kobject_del() - Unlink kobject from hierarchy. 640 + * @kobj: object. 641 + * 642 + * This is the function that should be called to delete an object 643 + * successfully added via kobject_add(). 644 + */ 645 + void kobject_del(struct kobject *kobj) 646 + { 647 + struct kobject *parent = kobj->parent; 648 + 649 + __kobject_del(kobj); 650 + kobject_put(parent); 630 651 } 631 652 EXPORT_SYMBOL(kobject_del); 632 653 ··· 677 670 */ 678 671 static void kobject_cleanup(struct kobject *kobj) 679 672 { 673 + struct kobject *parent = kobj->parent; 680 674 struct kobj_type *t = get_ktype(kobj); 681 675 const char *name = kobj->name; 682 676 ··· 692 684 if (kobj->state_in_sysfs) { 693 685 pr_debug("kobject: '%s' (%p): auto cleanup kobject_del\n", 694 686 kobject_name(kobj), kobj); 695 - kobject_del(kobj); 687 + __kobject_del(kobj); 688 + } else { 689 + /* avoid dropping the parent reference unnecessarily */ 690 + parent = NULL; 696 691 } 697 692 698 693 if (t && t->release) { ··· 709 698 pr_debug("kobject: '%s': free name\n", name); 710 699 kfree_const(name); 711 700 } 701 + 702 + kobject_put(parent); 712 703 } 713 704 714 705 #ifdef CONFIG_DEBUG_KOBJECT_RELEASE
+7 -1
scripts/coccinelle/misc/add_namespace.cocci
··· 6 6 /// add a missing namespace tag to a module source file. 7 7 /// 8 8 9 + virtual nsdeps 9 10 virtual report 10 11 11 12 @has_ns_import@ ··· 17 16 18 17 // Add missing imports, but only adjacent to a MODULE_LICENSE statement. 19 18 // That ensures we are adding it only to the main module source file. 20 - @do_import depends on !has_ns_import@ 19 + @do_import depends on !has_ns_import && nsdeps@ 21 20 declarer name MODULE_LICENSE; 22 21 expression license; 23 22 identifier virtual.ns; 24 23 @@ 25 24 MODULE_LICENSE(license); 26 25 + MODULE_IMPORT_NS(ns); 26 + 27 + // Dummy rule for report mode that would otherwise be empty and make spatch 28 + // fail ("No rules apply.") 29 + @script:python depends on report@ 30 + @@
+1 -1
scripts/nsdeps
··· 29 29 30 30 generate_deps_for_ns() { 31 31 $SPATCH --very-quiet --in-place --sp-file \ 32 - $srctree/scripts/coccinelle/misc/add_namespace.cocci -D ns=$1 $2 32 + $srctree/scripts/coccinelle/misc/add_namespace.cocci -D nsdeps -D ns=$1 $2 33 33 } 34 34 35 35 generate_deps() {
+8
tools/testing/selftests/firmware/settings
··· 1 + # The async firmware timeout is set to 1 second (but ends up being effectively 2 + # 2 seconds). There are 3 test configs, each done with and without firmware 3 + # present, each with 2 "nowait" functions tested 5 times. Expected time for a 4 + # normal execution should be 2 * 3 * 2 * 2 * 5 = 120 seconds for those alone. 5 + # Additionally, fw_fallback may take 5 seconds for internal timeouts in each 6 + # of the 3 configs, so at least another 15 seconds are needed. Add another 7 + # 10 seconds for each testing config: 120 + 15 + 30 8 + timeout=165
+5 -1
tools/testing/selftests/kselftest/runner.sh
··· 53 53 settings="$BASE_DIR/$DIR/settings" 54 54 if [ -r "$settings" ] ; then 55 55 while read line ; do 56 + # Skip comments. 57 + if echo "$line" | grep -q '^#'; then 58 + continue 59 + fi 56 60 field=$(echo "$line" | cut -d= -f1) 57 61 value=$(echo "$line" | cut -d= -f2-) 58 62 eval "kselftest_$field"="$value" ··· 84 80 echo "ok $test_num $TEST_HDR_MSG # SKIP" 85 81 elif [ $rc -eq $timeout_rc ]; then \ 86 82 echo "#" 87 - echo "not ok $test_num $TEST_HDR_MSG # TIMEOUT" 83 + echo "not ok $test_num $TEST_HDR_MSG # TIMEOUT $kselftest_timeout seconds" 88 84 else 89 85 echo "not ok $test_num $TEST_HDR_MSG # exit=$rc" 90 86 fi)