Pull driver core updates from Greg KH: "Here is the big driver core patchset for 5.1-rc1 More patches than "normal" here this merge window, due to some work in the driver core by Alexander Duyck to rework the async probe functionality to work better for a number of devices, and independant work from Rafael for the device link functionality to make it work "correctly". Also in here is: - lots of BUS_ATTR() removals, the macro is about to go away - firmware test fixups - ihex fixups and simplification - component additions (also includes i915 patches) - lots of minor coding style fixups and cleanups. All of these have been in linux-next for a while with no reported issues" * tag 'driver-core-5.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (65 commits) driver core: platform: remove misleading err_alloc label platform: set of_node in platform_device_register_full() firmware: hardcode the debug message for -ENOENT driver core: Add missing description of new struct device_link field driver core: Fix PM-runtime for links added during consumer probe drivers/component: kerneldoc polish async: Add cmdline option to specify drivers to be async probed driver core: Fix possible supplier PM-usage counter imbalance PM-runtime: Fix __pm_runtime_set_status() race with runtime resume driver: platform: Support parsing GpioInt 0 in platform_get_irq() selftests: firmware: fix verify_reqs() return value Revert "selftests: firmware: remove use of non-standard diff -Z option" Revert "selftests: firmware: add CONFIG_FW_LOADER_USER_HELPER_FALLBACK to config" device: Fix comment for driver_data in struct device kernfs: Allocating memory for kernfs_iattrs with kmem_cache. sysfs: remove unused include of kernfs-internal.h driver core: Postpone DMA tear-down until after devres release driver core: Document limitation related to DL_FLAG_RPM_ACTIVE PM-runtime: Take suppliers into account in __pm_runtime_set_status() device.h: Add __cold to dev_<level> logging functions ...
Showing the changes to include/linux (6 of 52 files). Show all
Unified · Split
| @@ -14,6 +14,8 @@ · 13 unmodified lines | ||
| 14 | 14 | |
| 15 | 15 | #include <linux/types.h> |
| 16 | 16 | #include <linux/list.h> |
| 17 | +#include <linux/numa.h> | |
| 18 | +#include <linux/device.h> | |
| 17 | 19 | |
| 18 | 20 | typedef u64 async_cookie_t; |
| 19 | 21 | typedef void (*async_func_t) (void *data, async_cookie_t cookie); |
| @@ -37,9 +39,83 @@ struct async_domain { · 17 unmodified lines | ||
| 37 | 39 | struct async_domain _name = { .pending = LIST_HEAD_INIT(_name.pending), \ |
| 38 | 40 | .registered = 0 } |
| 39 | 41 | |
| 40 | −extern async_cookie_t async_schedule(async_func_t func, void *data); | |
| 41 | −extern async_cookie_t async_schedule_domain(async_func_t func, void *data, | |
| 42 | − struct async_domain *domain); | |
| 42 | +async_cookie_t async_schedule_node(async_func_t func, void *data, | |
| 43 | + int node); | |
| 44 | +async_cookie_t async_schedule_node_domain(async_func_t func, void *data, | |
| 45 | + int node, | |
| 46 | + struct async_domain *domain); | |
| 47 | + | |
| 48 | +/** | |
| 49 | + * async_schedule - schedule a function for asynchronous execution | |
| 50 | + * @func: function to execute asynchronously | |
| 51 | + * @data: data pointer to pass to the function | |
| 52 | + * | |
| 53 | + * Returns an async_cookie_t that may be used for checkpointing later. | |
| 54 | + * Note: This function may be called from atomic or non-atomic contexts. | |
| 55 | + */ | |
| 56 | +static inline async_cookie_t async_schedule(async_func_t func, void *data) | |
| 57 | +{ | |
| 58 | + return async_schedule_node(func, data, NUMA_NO_NODE); | |
| 59 | +} | |
| 60 | + | |
| 61 | +/** | |
| 62 | + * async_schedule_domain - schedule a function for asynchronous execution within a certain domain | |
| 63 | + * @func: function to execute asynchronously | |
| 64 | + * @data: data pointer to pass to the function | |
| 65 | + * @domain: the domain | |
| 66 | + * | |
| 67 | + * Returns an async_cookie_t that may be used for checkpointing later. | |
| 68 | + * @domain may be used in the async_synchronize_*_domain() functions to | |
| 69 | + * wait within a certain synchronization domain rather than globally. | |
| 70 | + * Note: This function may be called from atomic or non-atomic contexts. | |
| 71 | + */ | |
| 72 | +static inline async_cookie_t | |
| 73 | +async_schedule_domain(async_func_t func, void *data, | |
| 74 | + struct async_domain *domain) | |
| 75 | +{ | |
| 76 | + return async_schedule_node_domain(func, data, NUMA_NO_NODE, domain); | |
| 77 | +} | |
| 78 | + | |
| 79 | +/** | |
| 80 | + * async_schedule_dev - A device specific version of async_schedule | |
| 81 | + * @func: function to execute asynchronously | |
| 82 | + * @dev: device argument to be passed to function | |
| 83 | + * | |
| 84 | + * Returns an async_cookie_t that may be used for checkpointing later. | |
| 85 | + * @dev is used as both the argument for the function and to provide NUMA | |
| 86 | + * context for where to run the function. By doing this we can try to | |
| 87 | + * provide for the best possible outcome by operating on the device on the | |
| 88 | + * CPUs closest to the device. | |
| 89 | + * Note: This function may be called from atomic or non-atomic contexts. | |
| 90 | + */ | |
| 91 | +static inline async_cookie_t | |
| 92 | +async_schedule_dev(async_func_t func, struct device *dev) | |
| 93 | +{ | |
| 94 | + return async_schedule_node(func, dev, dev_to_node(dev)); | |
| 95 | +} | |
| 96 | + | |
| 97 | +/** | |
| 98 | + * async_schedule_dev_domain - A device specific version of async_schedule_domain | |
| 99 | + * @func: function to execute asynchronously | |
| 100 | + * @dev: device argument to be passed to function | |
| 101 | + * @domain: the domain | |
| 102 | + * | |
| 103 | + * Returns an async_cookie_t that may be used for checkpointing later. | |
| 104 | + * @dev is used as both the argument for the function and to provide NUMA | |
| 105 | + * context for where to run the function. By doing this we can try to | |
| 106 | + * provide for the best possible outcome by operating on the device on the | |
| 107 | + * CPUs closest to the device. | |
| 108 | + * @domain may be used in the async_synchronize_*_domain() functions to | |
| 109 | + * wait within a certain synchronization domain rather than globally. | |
| 110 | + * Note: This function may be called from atomic or non-atomic contexts. | |
| 111 | + */ | |
| 112 | +static inline async_cookie_t | |
| 113 | +async_schedule_dev_domain(async_func_t func, struct device *dev, | |
| 114 | + struct async_domain *domain) | |
| 115 | +{ | |
| 116 | + return async_schedule_node_domain(func, dev, dev_to_node(dev), domain); | |
| 117 | +} | |
| 118 | + | |
| 43 | 119 | void async_unregister_domain(struct async_domain *domain); |
| 44 | 120 | extern void async_synchronize_full(void); |
| 45 | 121 | extern void async_synchronize_full_domain(struct async_domain *domain); |
| @@ -98,7 +98,7 @@ void component_match_add_typed(struct device *master, · 97 unmodified lines | ||
| 98 | 98 | int (*compare_typed)(struct device *, int, void *), void *compare_data); |
| 99 | 99 | |
| 100 | 100 | /** |
| 101 | − * component_match_add - add a compent match | |
| 101 | + * component_match_add - add a component match entry | |
| 102 | 102 | * @master: device with the aggregate driver |
| 103 | 103 | * @matchptr: pointer to the list of component matches |
| 104 | 104 | * @compare: compare function to match against all components |
| @@ -341,6 +341,7 @@ struct device *driver_find_device(struct device_driver *drv, · 340 unmodified lines | ||
| 341 | 341 | struct device *start, void *data, |
| 342 | 342 | int (*match)(struct device *dev, void *data)); |
| 343 | 343 | |
| 344 | +void driver_deferred_probe_add(struct device *dev); | |
| 344 | 345 | int driver_deferred_probe_check_state(struct device *dev); |
| 345 | 346 | |
| 346 | 347 | /** |
| @@ -827,12 +828,14 @@ enum device_link_state { · 480 unmodified lines | ||
| 827 | 828 | * PM_RUNTIME: If set, the runtime PM framework will use this link. |
| 828 | 829 | * RPM_ACTIVE: Run pm_runtime_get_sync() on the supplier during link creation. |
| 829 | 830 | * AUTOREMOVE_SUPPLIER: Remove the link automatically on supplier driver unbind. |
| 831 | + * AUTOPROBE_CONSUMER: Probe consumer driver automatically after supplier binds. | |
| 830 | 832 | */ |
| 831 | 833 | #define DL_FLAG_STATELESS BIT(0) |
| 832 | 834 | #define DL_FLAG_AUTOREMOVE_CONSUMER BIT(1) |
| 833 | 835 | #define DL_FLAG_PM_RUNTIME BIT(2) |
| 834 | 836 | #define DL_FLAG_RPM_ACTIVE BIT(3) |
| 835 | 837 | #define DL_FLAG_AUTOREMOVE_SUPPLIER BIT(4) |
| 838 | +#define DL_FLAG_AUTOPROBE_CONSUMER BIT(5) | |
| 836 | 839 | |
| 837 | 840 | /** |
| 838 | 841 | * struct device_link - Device link representation. |
| @@ -845,6 +848,7 @@ enum device_link_state { · 6 unmodified lines | ||
| 845 | 848 | * @rpm_active: Whether or not the consumer device is runtime-PM-active. |
| 846 | 849 | * @kref: Count repeated addition of the same link. |
| 847 | 850 | * @rcu_head: An RCU head to use for deferred execution of SRCU callbacks. |
| 851 | + * @supplier_preactivated: Supplier has been made active before consumer probe. | |
| 848 | 852 | */ |
| 849 | 853 | struct device_link { |
| 850 | 854 | struct device *supplier; |
| @@ -853,11 +857,12 @@ struct device_link { · 2 unmodified lines | ||
| 853 | 857 | struct list_head c_node; |
| 854 | 858 | enum device_link_state status; |
| 855 | 859 | u32 flags; |
| 856 | − bool rpm_active; | |
| 860 | + refcount_t rpm_active; | |
| 857 | 861 | struct kref kref; |
| 858 | 862 | #ifdef CONFIG_SRCU |
| 859 | 863 | struct rcu_head rcu_head; |
| 860 | 864 | #endif |
| 865 | + bool supplier_preactivated; /* Owned by consumer probe. */ | |
| 861 | 866 | }; |
| 862 | 867 | |
| 863 | 868 | /** |
| @@ -985,7 +990,7 @@ struct device { · 121 unmodified lines | ||
| 985 | 990 | void *platform_data; /* Platform specific data, device |
| 986 | 991 | core doesn't touch it */ |
| 987 | 992 | void *driver_data; /* Driver data, set and get with |
| 988 | − dev_set/get_drvdata */ | |
| 993 | + dev_set_drvdata/dev_get_drvdata */ | |
| 989 | 994 | struct dev_links_info links; |
| 990 | 995 | struct dev_pm_info power; |
| 991 | 996 | struct dev_pm_domain *pm_domain; |
| @@ -1035,7 +1040,6 @@ struct device { · 43 unmodified lines | ||
| 1035 | 1040 | spinlock_t devres_lock; |
| 1036 | 1041 | struct list_head devres_head; |
| 1037 | 1042 | |
| 1038 | − struct klist_node knode_class; | |
| 1039 | 1043 | struct class *class; |
| 1040 | 1044 | const struct attribute_group **groups; /* optional groups */ |
| 1041 | 1045 | |
| @@ -1392,28 +1396,28 @@ void device_link_remove(void *consumer, struct device *supplier); · 350 unmodified lines | ||
| 1392 | 1396 | |
| 1393 | 1397 | #ifdef CONFIG_PRINTK |
| 1394 | 1398 | |
| 1395 | −__printf(3, 0) | |
| 1399 | +__printf(3, 0) __cold | |
| 1396 | 1400 | int dev_vprintk_emit(int level, const struct device *dev, |
| 1397 | 1401 | const char *fmt, va_list args); |
| 1398 | −__printf(3, 4) | |
| 1402 | +__printf(3, 4) __cold | |
| 1399 | 1403 | int dev_printk_emit(int level, const struct device *dev, const char *fmt, ...); |
| 1400 | 1404 | |
| 1401 | −__printf(3, 4) | |
| 1405 | +__printf(3, 4) __cold | |
| 1402 | 1406 | void dev_printk(const char *level, const struct device *dev, |
| 1403 | 1407 | const char *fmt, ...); |
| 1404 | −__printf(2, 3) | |
| 1408 | +__printf(2, 3) __cold | |
| 1405 | 1409 | void _dev_emerg(const struct device *dev, const char *fmt, ...); |
| 1406 | −__printf(2, 3) | |
| 1410 | +__printf(2, 3) __cold | |
| 1407 | 1411 | void _dev_alert(const struct device *dev, const char *fmt, ...); |
| 1408 | −__printf(2, 3) | |
| 1412 | +__printf(2, 3) __cold | |
| 1409 | 1413 | void _dev_crit(const struct device *dev, const char *fmt, ...); |
| 1410 | −__printf(2, 3) | |
| 1414 | +__printf(2, 3) __cold | |
| 1411 | 1415 | void _dev_err(const struct device *dev, const char *fmt, ...); |
| 1412 | −__printf(2, 3) | |
| 1416 | +__printf(2, 3) __cold | |
| 1413 | 1417 | void _dev_warn(const struct device *dev, const char *fmt, ...); |
| 1414 | −__printf(2, 3) | |
| 1418 | +__printf(2, 3) __cold | |
| 1415 | 1419 | void _dev_notice(const struct device *dev, const char *fmt, ...); |
| 1416 | −__printf(2, 3) | |
| 1420 | +__printf(2, 3) __cold | |
| 1417 | 1421 | void _dev_info(const struct device *dev, const char *fmt, ...); |
| 1418 | 1422 | |
| 1419 | 1423 | #else |
| @@ -21,12 +21,24 @@ struct ihex_binrec { · 20 unmodified lines | ||
| 21 | 21 | uint8_t data[0]; |
| 22 | 22 | } __attribute__((packed)); |
| 23 | 23 | |
| 24 | +static inline uint16_t ihex_binrec_size(const struct ihex_binrec *p) | |
| 25 | +{ | |
| 26 | + return be16_to_cpu(p->len) + sizeof(*p); | |
| 27 | +} | |
| 28 | + | |
| 24 | 29 | /* Find the next record, taking into account the 4-byte alignment */ |
| 30 | +static inline const struct ihex_binrec * | |
| 31 | +__ihex_next_binrec(const struct ihex_binrec *rec) | |
| 32 | +{ | |
| 33 | + const void *p = rec; | |
| 34 | + | |
| 35 | + return p + ALIGN(ihex_binrec_size(rec), 4); | |
| 36 | +} | |
| 37 | + | |
| 25 | 38 | static inline const struct ihex_binrec * |
| 26 | 39 | ihex_next_binrec(const struct ihex_binrec *rec) |
| 27 | 40 | { |
| 28 | − int next = ((be16_to_cpu(rec->len) + 5) & ~3) - 2; | |
| 29 | − rec = (void *)&rec->data[next]; | |
| 41 | + rec = __ihex_next_binrec(rec); | |
| 30 | 42 | |
| 31 | 43 | return be16_to_cpu(rec->len) ? rec : NULL; |
| 32 | 44 | } |
| @@ -34,18 +46,15 @@ ihex_next_binrec(const struct ihex_binrec *rec) · 1 unmodified line | ||
| 34 | 46 | /* Check that ihex_next_binrec() won't take us off the end of the image... */ |
| 35 | 47 | static inline int ihex_validate_fw(const struct firmware *fw) |
| 36 | 48 | { |
| 37 | − const struct ihex_binrec *rec; | |
| 38 | − size_t ofs = 0; | |
| 49 | + const struct ihex_binrec *end, *rec; | |
| 39 | 50 | |
| 40 | − while (ofs <= fw->size - sizeof(*rec)) { | |
| 41 | − rec = (void *)&fw->data[ofs]; | |
| 51 | + rec = (const void *)fw->data; | |
| 52 | + end = (const void *)&fw->data[fw->size - sizeof(*end)]; | |
| 42 | 53 | |
| 54 | + for (; rec <= end; rec = __ihex_next_binrec(rec)) { | |
| 43 | 55 | /* Zero length marks end of records */ |
| 44 | − if (!be16_to_cpu(rec->len)) | |
| 56 | + if (rec == end && !be16_to_cpu(rec->len)) | |
| 45 | 57 | return 0; |
| 46 | − | |
| 47 | − /* Point to next record... */ | |
| 48 | − ofs += (sizeof(*rec) + be16_to_cpu(rec->len) + 3) & ~3; | |
| 49 | 58 | } |
| 50 | 59 | return -EINVAL; |
| 51 | 60 | } |
| @@ -63,6 +63,7 @@ extern int platform_add_devices(struct platform_device **, int); · 62 unmodified lines | ||
| 63 | 63 | struct platform_device_info { |
| 64 | 64 | struct device *parent; |
| 65 | 65 | struct fwnode_handle *fwnode; |
| 66 | + bool of_node_reused; | |
| 66 | 67 | |
| 67 | 68 | const char *name; |
| 68 | 69 | int id; |
| @@ -443,6 +443,8 @@ int workqueue_set_unbound_cpumask(cpumask_var_t cpumask); · 442 unmodified lines | ||
| 443 | 443 | |
| 444 | 444 | extern bool queue_work_on(int cpu, struct workqueue_struct *wq, |
| 445 | 445 | struct work_struct *work); |
| 446 | +extern bool queue_work_node(int node, struct workqueue_struct *wq, | |
| 447 | + struct work_struct *work); | |
| 446 | 448 | extern bool queue_delayed_work_on(int cpu, struct workqueue_struct *wq, |
| 447 | 449 | struct delayed_work *work, unsigned long delay); |
| 448 | 450 | extern bool mod_delayed_work_on(int cpu, struct workqueue_struct *wq, |