History

Merge tag 'driver-core-5.1-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 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 ...

Linus Torvalds committed 7 years ago

Commit e431f2d2 parents 45763bf 36cf3b152 files · +1095 −412Browse files

Showing the changes to include/linux (6 of 52 files). Show all

Unified · Split

6 files
  1. include/linux/async.h +79 −3
  2. include/linux/component.h +1 −1
  3. include/linux/device.h +17 −13
  4. include/linux/ihex.h +19 −10
  5. include/linux/platform_device.h +1 −0
  6. include/linux/workqueue.h +2 −0
include/linux/async.h+79−3
@@ -14,6 +14,8 @@ · 13 unmodified lines
1414
1515 #include <linux/types.h>
1616 #include <linux/list.h>
17+#include <linux/numa.h>
18+#include <linux/device.h>
1719
1820 typedef u64 async_cookie_t;
1921 typedef void (*async_func_t) (void *data, async_cookie_t cookie);
@@ -37,9 +39,83 @@ struct async_domain { · 17 unmodified lines
3739 struct async_domain _name = { .pending = LIST_HEAD_INIT(_name.pending), \
3840 .registered = 0 }
3941
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+
43119 void async_unregister_domain(struct async_domain *domain);
44120 extern void async_synchronize_full(void);
45121 extern void async_synchronize_full_domain(struct async_domain *domain);
include/linux/component.h+1−1
@@ -98,7 +98,7 @@ void component_match_add_typed(struct device *master, · 97 unmodified lines
9898 int (*compare_typed)(struct device *, int, void *), void *compare_data);
9999
100100 /**
101− * component_match_add - add a compent match
101+ * component_match_add - add a component match entry
102102 * @master: device with the aggregate driver
103103 * @matchptr: pointer to the list of component matches
104104 * @compare: compare function to match against all components
include/linux/device.h+17−13
@@ -341,6 +341,7 @@ struct device *driver_find_device(struct device_driver *drv, · 340 unmodified lines
341341 struct device *start, void *data,
342342 int (*match)(struct device *dev, void *data));
343343
344+void driver_deferred_probe_add(struct device *dev);
344345 int driver_deferred_probe_check_state(struct device *dev);
345346
346347 /**
@@ -827,12 +828,14 @@ enum device_link_state { · 480 unmodified lines
827828 * PM_RUNTIME: If set, the runtime PM framework will use this link.
828829 * RPM_ACTIVE: Run pm_runtime_get_sync() on the supplier during link creation.
829830 * AUTOREMOVE_SUPPLIER: Remove the link automatically on supplier driver unbind.
831+ * AUTOPROBE_CONSUMER: Probe consumer driver automatically after supplier binds.
830832 */
831833 #define DL_FLAG_STATELESS BIT(0)
832834 #define DL_FLAG_AUTOREMOVE_CONSUMER BIT(1)
833835 #define DL_FLAG_PM_RUNTIME BIT(2)
834836 #define DL_FLAG_RPM_ACTIVE BIT(3)
835837 #define DL_FLAG_AUTOREMOVE_SUPPLIER BIT(4)
838+#define DL_FLAG_AUTOPROBE_CONSUMER BIT(5)
836839
837840 /**
838841 * struct device_link - Device link representation.
@@ -845,6 +848,7 @@ enum device_link_state { · 6 unmodified lines
845848 * @rpm_active: Whether or not the consumer device is runtime-PM-active.
846849 * @kref: Count repeated addition of the same link.
847850 * @rcu_head: An RCU head to use for deferred execution of SRCU callbacks.
851+ * @supplier_preactivated: Supplier has been made active before consumer probe.
848852 */
849853 struct device_link {
850854 struct device *supplier;
@@ -853,11 +857,12 @@ struct device_link { · 2 unmodified lines
853857 struct list_head c_node;
854858 enum device_link_state status;
855859 u32 flags;
856− bool rpm_active;
860+ refcount_t rpm_active;
857861 struct kref kref;
858862 #ifdef CONFIG_SRCU
859863 struct rcu_head rcu_head;
860864 #endif
865+ bool supplier_preactivated; /* Owned by consumer probe. */
861866 };
862867
863868 /**
@@ -985,7 +990,7 @@ struct device { · 121 unmodified lines
985990 void *platform_data; /* Platform specific data, device
986991 core doesn't touch it */
987992 void *driver_data; /* Driver data, set and get with
988− dev_set/get_drvdata */
993+ dev_set_drvdata/dev_get_drvdata */
989994 struct dev_links_info links;
990995 struct dev_pm_info power;
991996 struct dev_pm_domain *pm_domain;
@@ -1035,7 +1040,6 @@ struct device { · 43 unmodified lines
10351040 spinlock_t devres_lock;
10361041 struct list_head devres_head;
10371042
1038− struct klist_node knode_class;
10391043 struct class *class;
10401044 const struct attribute_group **groups; /* optional groups */
10411045
@@ -1392,28 +1396,28 @@ void device_link_remove(void *consumer, struct device *supplier); · 350 unmodified lines
13921396
13931397 #ifdef CONFIG_PRINTK
13941398
1395−__printf(3, 0)
1399+__printf(3, 0) __cold
13961400 int dev_vprintk_emit(int level, const struct device *dev,
13971401 const char *fmt, va_list args);
1398−__printf(3, 4)
1402+__printf(3, 4) __cold
13991403 int dev_printk_emit(int level, const struct device *dev, const char *fmt, ...);
14001404
1401−__printf(3, 4)
1405+__printf(3, 4) __cold
14021406 void dev_printk(const char *level, const struct device *dev,
14031407 const char *fmt, ...);
1404−__printf(2, 3)
1408+__printf(2, 3) __cold
14051409 void _dev_emerg(const struct device *dev, const char *fmt, ...);
1406−__printf(2, 3)
1410+__printf(2, 3) __cold
14071411 void _dev_alert(const struct device *dev, const char *fmt, ...);
1408−__printf(2, 3)
1412+__printf(2, 3) __cold
14091413 void _dev_crit(const struct device *dev, const char *fmt, ...);
1410−__printf(2, 3)
1414+__printf(2, 3) __cold
14111415 void _dev_err(const struct device *dev, const char *fmt, ...);
1412−__printf(2, 3)
1416+__printf(2, 3) __cold
14131417 void _dev_warn(const struct device *dev, const char *fmt, ...);
1414−__printf(2, 3)
1418+__printf(2, 3) __cold
14151419 void _dev_notice(const struct device *dev, const char *fmt, ...);
1416−__printf(2, 3)
1420+__printf(2, 3) __cold
14171421 void _dev_info(const struct device *dev, const char *fmt, ...);
14181422
14191423 #else
include/linux/ihex.h+19−10
@@ -21,12 +21,24 @@ struct ihex_binrec { · 20 unmodified lines
2121 uint8_t data[0];
2222 } __attribute__((packed));
2323
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+
2429 /* 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+
2538 static inline const struct ihex_binrec *
2639 ihex_next_binrec(const struct ihex_binrec *rec)
2740 {
28− int next = ((be16_to_cpu(rec->len) + 5) & ~3) - 2;
29− rec = (void *)&rec->data[next];
41+ rec = __ihex_next_binrec(rec);
3042
3143 return be16_to_cpu(rec->len) ? rec : NULL;
3244 }
@@ -34,18 +46,15 @@ ihex_next_binrec(const struct ihex_binrec *rec) · 1 unmodified line
3446 /* Check that ihex_next_binrec() won't take us off the end of the image... */
3547 static inline int ihex_validate_fw(const struct firmware *fw)
3648 {
37− const struct ihex_binrec *rec;
38− size_t ofs = 0;
49+ const struct ihex_binrec *end, *rec;
3950
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)];
4253
54+ for (; rec <= end; rec = __ihex_next_binrec(rec)) {
4355 /* Zero length marks end of records */
44− if (!be16_to_cpu(rec->len))
56+ if (rec == end && !be16_to_cpu(rec->len))
4557 return 0;
46−
47− /* Point to next record... */
48− ofs += (sizeof(*rec) + be16_to_cpu(rec->len) + 3) & ~3;
4958 }
5059 return -EINVAL;
5160 }
include/linux/platform_device.h+1−0
@@ -63,6 +63,7 @@ extern int platform_add_devices(struct platform_device **, int); · 62 unmodified lines
6363 struct platform_device_info {
6464 struct device *parent;
6565 struct fwnode_handle *fwnode;
66+ bool of_node_reused;
6667
6768 const char *name;
6869 int id;
include/linux/workqueue.h+2−0
@@ -443,6 +443,8 @@ int workqueue_set_unbound_cpumask(cpumask_var_t cpumask); · 442 unmodified lines
443443
444444 extern bool queue_work_on(int cpu, struct workqueue_struct *wq,
445445 struct work_struct *work);
446+extern bool queue_work_node(int node, struct workqueue_struct *wq,
447+ struct work_struct *work);
446448 extern bool queue_delayed_work_on(int cpu, struct workqueue_struct *wq,
447449 struct delayed_work *work, unsigned long delay);
448450 extern bool mod_delayed_work_on(int cpu, struct workqueue_struct *wq,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t