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-5.7-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core

Pull driver core fixes from Greg KH:
"So, turns out the kobject fix didn't quite work, so here are four
patches that in the end, result in just two driver core fixes for
reported issues that no one has had problems with.

The kobject patch that was originally in here has now been reverted,
as Guenter reported boot problems with it on some of his systems"

* tag 'driver-core-5.7-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core:
Revert "kobject: Make sure the parent does not get released before its children"
kobject: Make sure the parent does not get released before its children
driver core: Fix handling of SYNC_STATE_ONLY + STATELESS device links
driver core: Fix SYNC_STATE_ONLY device link implementation

+37 -18
+37 -18
drivers/base/core.c
··· 365 365 link->flags |= DL_FLAG_STATELESS; 366 366 goto reorder; 367 367 } else { 368 + link->flags |= DL_FLAG_STATELESS; 368 369 goto out; 369 370 } 370 371 } ··· 434 433 flags & DL_FLAG_PM_RUNTIME) 435 434 pm_runtime_resume(supplier); 436 435 436 + list_add_tail_rcu(&link->s_node, &supplier->links.consumers); 437 + list_add_tail_rcu(&link->c_node, &consumer->links.suppliers); 438 + 437 439 if (flags & DL_FLAG_SYNC_STATE_ONLY) { 438 440 dev_dbg(consumer, 439 441 "Linked as a sync state only consumer to %s\n", 440 442 dev_name(supplier)); 441 443 goto out; 442 444 } 445 + 443 446 reorder: 444 447 /* 445 448 * Move the consumer and all of the devices depending on it to the end ··· 454 449 */ 455 450 device_reorder_to_tail(consumer, NULL); 456 451 457 - list_add_tail_rcu(&link->s_node, &supplier->links.consumers); 458 - list_add_tail_rcu(&link->c_node, &consumer->links.suppliers); 459 - 460 452 dev_dbg(consumer, "Linked as a consumer to %s\n", dev_name(supplier)); 461 453 462 - out: 454 + out: 463 455 device_pm_unlock(); 464 456 device_links_write_unlock(); 465 457 ··· 831 829 list_add_tail(&sup->links.defer_sync, &deferred_sync); 832 830 } 833 831 832 + static void device_link_drop_managed(struct device_link *link) 833 + { 834 + link->flags &= ~DL_FLAG_MANAGED; 835 + WRITE_ONCE(link->status, DL_STATE_NONE); 836 + kref_put(&link->kref, __device_link_del); 837 + } 838 + 834 839 /** 835 840 * device_links_driver_bound - Update device links after probing its driver. 836 841 * @dev: Device to update the links for. ··· 851 842 */ 852 843 void device_links_driver_bound(struct device *dev) 853 844 { 854 - struct device_link *link; 845 + struct device_link *link, *ln; 855 846 LIST_HEAD(sync_list); 856 847 857 848 /* ··· 891 882 else 892 883 __device_links_queue_sync_state(dev, &sync_list); 893 884 894 - list_for_each_entry(link, &dev->links.suppliers, c_node) { 885 + list_for_each_entry_safe(link, ln, &dev->links.suppliers, c_node) { 886 + struct device *supplier; 887 + 895 888 if (!(link->flags & DL_FLAG_MANAGED)) 896 889 continue; 897 890 898 - WARN_ON(link->status != DL_STATE_CONSUMER_PROBE); 899 - WRITE_ONCE(link->status, DL_STATE_ACTIVE); 891 + supplier = link->supplier; 892 + if (link->flags & DL_FLAG_SYNC_STATE_ONLY) { 893 + /* 894 + * When DL_FLAG_SYNC_STATE_ONLY is set, it means no 895 + * other DL_MANAGED_LINK_FLAGS have been set. So, it's 896 + * save to drop the managed link completely. 897 + */ 898 + device_link_drop_managed(link); 899 + } else { 900 + WARN_ON(link->status != DL_STATE_CONSUMER_PROBE); 901 + WRITE_ONCE(link->status, DL_STATE_ACTIVE); 902 + } 900 903 904 + /* 905 + * This needs to be done even for the deleted 906 + * DL_FLAG_SYNC_STATE_ONLY device link in case it was the last 907 + * device link that was preventing the supplier from getting a 908 + * sync_state() call. 909 + */ 901 910 if (defer_sync_state_count) 902 - __device_links_supplier_defer_sync(link->supplier); 911 + __device_links_supplier_defer_sync(supplier); 903 912 else 904 - __device_links_queue_sync_state(link->supplier, 905 - &sync_list); 913 + __device_links_queue_sync_state(supplier, &sync_list); 906 914 } 907 915 908 916 dev->links.status = DL_DEV_DRIVER_BOUND; ··· 927 901 device_links_write_unlock(); 928 902 929 903 device_links_flush_sync_list(&sync_list, dev); 930 - } 931 - 932 - static void device_link_drop_managed(struct device_link *link) 933 - { 934 - link->flags &= ~DL_FLAG_MANAGED; 935 - WRITE_ONCE(link->status, DL_STATE_NONE); 936 - kref_put(&link->kref, __device_link_del); 937 904 } 938 905 939 906 /**