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 | #include <linux/types.h> | 15 | #include <linux/types.h> |
| 16 | #include <linux/list.h> | 16 | #include <linux/list.h> |
| 17 | #include <linux/numa.h> | ||
| 18 | #include <linux/device.h> | ||
| 17 | 19 | ||
| 18 | typedef u64 async_cookie_t; | 20 | typedef u64 async_cookie_t; |
| 19 | typedef void (*async_func_t) (void *data, async_cookie_t cookie); | 21 | typedef void (*async_func_t) (void *data, async_cookie_t cookie); |
| @@ -37,9 +39,83 @@ struct async_domain { · 17 unmodified lines | |||
| 37 | struct async_domain _name = { .pending = LIST_HEAD_INIT(_name.pending), \ | 39 | struct async_domain _name = { .pending = LIST_HEAD_INIT(_name.pending), \ |
| 38 | .registered = 0 } | 40 | .registered = 0 } |
| 39 | 41 | ||
| 40 | extern async_cookie_t async_schedule(async_func_t func, void *data); | 42 | async_cookie_t async_schedule_node(async_func_t func, void *data, |
| 41 | extern async_cookie_t async_schedule_domain(async_func_t func, void *data, | 43 | int node); |
| 42 | struct async_domain *domain); | 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 | void async_unregister_domain(struct async_domain *domain); | 119 | void async_unregister_domain(struct async_domain *domain); |
| 44 | extern void async_synchronize_full(void); | 120 | extern void async_synchronize_full(void); |
| 45 | extern void async_synchronize_full_domain(struct async_domain *domain); | 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 | int (*compare_typed)(struct device *, int, void *), void *compare_data); | 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 | * @master: device with the aggregate driver | 102 | * @master: device with the aggregate driver |
| 103 | * @matchptr: pointer to the list of component matches | 103 | * @matchptr: pointer to the list of component matches |
| 104 | * @compare: compare function to match against all components | 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 | struct device *start, void *data, | 341 | struct device *start, void *data, |
| 342 | int (*match)(struct device *dev, void *data)); | 342 | int (*match)(struct device *dev, void *data)); |
| 343 | 343 | ||
| 344 | void driver_deferred_probe_add(struct device *dev); | ||
| 344 | int driver_deferred_probe_check_state(struct device *dev); | 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 | * PM_RUNTIME: If set, the runtime PM framework will use this link. | 828 | * PM_RUNTIME: If set, the runtime PM framework will use this link. |
| 828 | * RPM_ACTIVE: Run pm_runtime_get_sync() on the supplier during link creation. | 829 | * RPM_ACTIVE: Run pm_runtime_get_sync() on the supplier during link creation. |
| 829 | * AUTOREMOVE_SUPPLIER: Remove the link automatically on supplier driver unbind. | 830 | * AUTOREMOVE_SUPPLIER: Remove the link automatically on supplier driver unbind. |
| 831 | * AUTOPROBE_CONSUMER: Probe consumer driver automatically after supplier binds. | ||
| 830 | */ | 832 | */ |
| 831 | #define DL_FLAG_STATELESS BIT(0) | 833 | #define DL_FLAG_STATELESS BIT(0) |
| 832 | #define DL_FLAG_AUTOREMOVE_CONSUMER BIT(1) | 834 | #define DL_FLAG_AUTOREMOVE_CONSUMER BIT(1) |
| 833 | #define DL_FLAG_PM_RUNTIME BIT(2) | 835 | #define DL_FLAG_PM_RUNTIME BIT(2) |
| 834 | #define DL_FLAG_RPM_ACTIVE BIT(3) | 836 | #define DL_FLAG_RPM_ACTIVE BIT(3) |
| 835 | #define DL_FLAG_AUTOREMOVE_SUPPLIER BIT(4) | 837 | #define DL_FLAG_AUTOREMOVE_SUPPLIER BIT(4) |
| 838 | #define DL_FLAG_AUTOPROBE_CONSUMER BIT(5) | ||
| 836 | 839 | ||
| 837 | /** | 840 | /** |
| 838 | * struct device_link - Device link representation. | 841 | * struct device_link - Device link representation. |
| @@ -845,6 +848,7 @@ enum device_link_state { · 6 unmodified lines | |||
| 845 | * @rpm_active: Whether or not the consumer device is runtime-PM-active. | 848 | * @rpm_active: Whether or not the consumer device is runtime-PM-active. |
| 846 | * @kref: Count repeated addition of the same link. | 849 | * @kref: Count repeated addition of the same link. |
| 847 | * @rcu_head: An RCU head to use for deferred execution of SRCU callbacks. | 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 | struct device_link { | 853 | struct device_link { |
| 850 | struct device *supplier; | 854 | struct device *supplier; |
| @@ -853,11 +857,12 @@ struct device_link { · 2 unmodified lines | |||
| 853 | struct list_head c_node; | 857 | struct list_head c_node; |
| 854 | enum device_link_state status; | 858 | enum device_link_state status; |
| 855 | u32 flags; | 859 | u32 flags; |
| 856 | bool rpm_active; | 860 | refcount_t rpm_active; |
| 857 | struct kref kref; | 861 | struct kref kref; |
| 858 | #ifdef CONFIG_SRCU | 862 | #ifdef CONFIG_SRCU |
| 859 | struct rcu_head rcu_head; | 863 | struct rcu_head rcu_head; |
| 860 | #endif | 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 | void *platform_data; /* Platform specific data, device | 990 | void *platform_data; /* Platform specific data, device |
| 986 | core doesn't touch it */ | 991 | core doesn't touch it */ |
| 987 | void *driver_data; /* Driver data, set and get with | 992 | void *driver_data; /* Driver data, set and get with |
| 988 | dev_set/get_drvdata */ | 993 | dev_set_drvdata/dev_get_drvdata */ |
| 989 | struct dev_links_info links; | 994 | struct dev_links_info links; |
| 990 | struct dev_pm_info power; | 995 | struct dev_pm_info power; |
| 991 | struct dev_pm_domain *pm_domain; | 996 | struct dev_pm_domain *pm_domain; |
| @@ -1035,7 +1040,6 @@ struct device { · 43 unmodified lines | |||
| 1035 | spinlock_t devres_lock; | 1040 | spinlock_t devres_lock; |
| 1036 | struct list_head devres_head; | 1041 | struct list_head devres_head; |
| 1037 | 1042 | ||
| 1038 | struct klist_node knode_class; | ||
| 1039 | struct class *class; | 1043 | struct class *class; |
| 1040 | const struct attribute_group **groups; /* optional groups */ | 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 | #ifdef CONFIG_PRINTK | 1397 | #ifdef CONFIG_PRINTK |
| 1394 | 1398 | ||
| 1395 | __printf(3, 0) | 1399 | __printf(3, 0) __cold |
| 1396 | int dev_vprintk_emit(int level, const struct device *dev, | 1400 | int dev_vprintk_emit(int level, const struct device *dev, |
| 1397 | const char *fmt, va_list args); | 1401 | const char *fmt, va_list args); |
| 1398 | __printf(3, 4) | 1402 | __printf(3, 4) __cold |
| 1399 | int dev_printk_emit(int level, const struct device *dev, const char *fmt, ...); | 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 | void dev_printk(const char *level, const struct device *dev, | 1406 | void dev_printk(const char *level, const struct device *dev, |
| 1403 | const char *fmt, ...); | 1407 | const char *fmt, ...); |
| 1404 | __printf(2, 3) | 1408 | __printf(2, 3) __cold |
| 1405 | void _dev_emerg(const struct device *dev, const char *fmt, ...); | 1409 | void _dev_emerg(const struct device *dev, const char *fmt, ...); |
| 1406 | __printf(2, 3) | 1410 | __printf(2, 3) __cold |
| 1407 | void _dev_alert(const struct device *dev, const char *fmt, ...); | 1411 | void _dev_alert(const struct device *dev, const char *fmt, ...); |
| 1408 | __printf(2, 3) | 1412 | __printf(2, 3) __cold |
| 1409 | void _dev_crit(const struct device *dev, const char *fmt, ...); | 1413 | void _dev_crit(const struct device *dev, const char *fmt, ...); |
| 1410 | __printf(2, 3) | 1414 | __printf(2, 3) __cold |
| 1411 | void _dev_err(const struct device *dev, const char *fmt, ...); | 1415 | void _dev_err(const struct device *dev, const char *fmt, ...); |
| 1412 | __printf(2, 3) | 1416 | __printf(2, 3) __cold |
| 1413 | void _dev_warn(const struct device *dev, const char *fmt, ...); | 1417 | void _dev_warn(const struct device *dev, const char *fmt, ...); |
| 1414 | __printf(2, 3) | 1418 | __printf(2, 3) __cold |
| 1415 | void _dev_notice(const struct device *dev, const char *fmt, ...); | 1419 | void _dev_notice(const struct device *dev, const char *fmt, ...); |
| 1416 | __printf(2, 3) | 1420 | __printf(2, 3) __cold |
| 1417 | void _dev_info(const struct device *dev, const char *fmt, ...); | 1421 | void _dev_info(const struct device *dev, const char *fmt, ...); |
| 1418 | 1422 | ||
| 1419 | #else | 1423 | #else |
| @@ -21,12 +21,24 @@ struct ihex_binrec { · 20 unmodified lines | |||
| 21 | uint8_t data[0]; | 21 | uint8_t data[0]; |
| 22 | } __attribute__((packed)); | 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 | /* Find the next record, taking into account the 4-byte alignment */ | 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 | static inline const struct ihex_binrec * | 38 | static inline const struct ihex_binrec * |
| 26 | ihex_next_binrec(const struct ihex_binrec *rec) | 39 | ihex_next_binrec(const struct ihex_binrec *rec) |
| 27 | { | 40 | { |
| 28 | int next = ((be16_to_cpu(rec->len) + 5) & ~3) - 2; | 41 | rec = __ihex_next_binrec(rec); |
| 29 | rec = (void *)&rec->data[next]; | ||
| 30 | 42 | ||
| 31 | return be16_to_cpu(rec->len) ? rec : NULL; | 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 | /* Check that ihex_next_binrec() won't take us off the end of the image... */ | 46 | /* Check that ihex_next_binrec() won't take us off the end of the image... */ |
| 35 | static inline int ihex_validate_fw(const struct firmware *fw) | 47 | static inline int ihex_validate_fw(const struct firmware *fw) |
| 36 | { | 48 | { |
| 37 | const struct ihex_binrec *rec; | 49 | const struct ihex_binrec *end, *rec; |
| 38 | size_t ofs = 0; | ||
| 39 | 50 | ||
| 40 | while (ofs <= fw->size - sizeof(*rec)) { | 51 | rec = (const void *)fw->data; |
| 41 | rec = (void *)&fw->data[ofs]; | 52 | end = (const void *)&fw->data[fw->size - sizeof(*end)]; |
| 42 | 53 | ||
| 54 | for (; rec <= end; rec = __ihex_next_binrec(rec)) { | ||
| 43 | /* Zero length marks end of records */ | 55 | /* Zero length marks end of records */ |
| 44 | if (!be16_to_cpu(rec->len)) | 56 | if (rec == end && !be16_to_cpu(rec->len)) |
| 45 | return 0; | 57 | return 0; |
| 46 | |||
| 47 | /* Point to next record... */ | ||
| 48 | ofs += (sizeof(*rec) + be16_to_cpu(rec->len) + 3) & ~3; | ||
| 49 | } | 58 | } |
| 50 | return -EINVAL; | 59 | return -EINVAL; |
| 51 | } | 60 | } |
| @@ -63,6 +63,7 @@ extern int platform_add_devices(struct platform_device **, int); · 62 unmodified lines | |||
| 63 | struct platform_device_info { | 63 | struct platform_device_info { |
| 64 | struct device *parent; | 64 | struct device *parent; |
| 65 | struct fwnode_handle *fwnode; | 65 | struct fwnode_handle *fwnode; |
| 66 | bool of_node_reused; | ||
| 66 | 67 | ||
| 67 | const char *name; | 68 | const char *name; |
| 68 | int id; | 69 | int id; |
| @@ -443,6 +443,8 @@ int workqueue_set_unbound_cpumask(cpumask_var_t cpumask); · 442 unmodified lines | |||
| 443 | 443 | ||
| 444 | extern bool queue_work_on(int cpu, struct workqueue_struct *wq, | 444 | extern bool queue_work_on(int cpu, struct workqueue_struct *wq, |
| 445 | struct work_struct *work); | 445 | struct work_struct *work); |
| 446 | extern bool queue_work_node(int node, struct workqueue_struct *wq, | ||
| 447 | struct work_struct *work); | ||
| 446 | extern bool queue_delayed_work_on(int cpu, struct workqueue_struct *wq, | 448 | extern bool queue_delayed_work_on(int cpu, struct workqueue_struct *wq, |
| 447 | struct delayed_work *work, unsigned long delay); | 449 | struct delayed_work *work, unsigned long delay); |
| 448 | extern bool mod_delayed_work_on(int cpu, struct workqueue_struct *wq, | 450 | extern bool mod_delayed_work_on(int cpu, struct workqueue_struct *wq, |