summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/admin-guide/kernel-parameters.txt9
-rw-r--r--Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt6
-rw-r--r--Documentation/driver-api/firmware/fallback-mechanisms.rst7
-rw-r--r--drivers/base/base.h2
-rw-r--r--drivers/base/cacheinfo.c24
-rw-r--r--drivers/base/core.c23
-rw-r--r--drivers/base/dd.c134
-rw-r--r--drivers/base/init.c2
-rw-r--r--drivers/base/power/domain.c2
-rw-r--r--drivers/iommu/arm-smmu-v3.c2
-rw-r--r--drivers/iommu/arm-smmu.c7
-rw-r--r--drivers/iommu/exynos-iommu.c2
-rw-r--r--drivers/iommu/ipmmu-vmsa.c3
-rw-r--r--drivers/iommu/msm_iommu.c2
-rw-r--r--drivers/iommu/of_iommu.c21
-rw-r--r--drivers/iommu/qcom_iommu.c2
-rw-r--r--drivers/iommu/rockchip-iommu.c2
-rw-r--r--drivers/pinctrl/devicetree.c15
-rw-r--r--fs/kernfs/symlink.c2
-rw-r--r--fs/sysfs/group.c30
-rw-r--r--include/asm-generic/vmlinux.lds.h2
-rw-r--r--include/linux/device.h105
-rw-r--r--include/linux/kobject.h17
-rw-r--r--include/linux/of_iommu.h4
-rw-r--r--include/linux/sysfs.h6
-rw-r--r--lib/kobject.c2
26 files changed, 272 insertions, 161 deletions
diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index d60b169bb54b..bffb0caa3693 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -812,6 +812,15 @@
812 Defaults to the default architecture's huge page size 812 Defaults to the default architecture's huge page size
813 if not specified. 813 if not specified.
814 814
815 deferred_probe_timeout=
816 [KNL] Debugging option to set a timeout in seconds for
817 deferred probe to give up waiting on dependencies to
818 probe. Only specific dependencies (subsystems or
819 drivers) that have opted in will be ignored. A timeout of 0
820 will timeout at the end of initcalls. This option will also
821 dump out devices still on the deferred probe list after
822 retrying.
823
815 dhash_entries= [KNL] 824 dhash_entries= [KNL]
816 Set number of hash buckets for dentry cache. 825 Set number of hash buckets for dentry cache.
817 826
diff --git a/Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt b/Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt
index ad9bbbba36e9..cef2b5855d60 100644
--- a/Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt
+++ b/Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt
@@ -103,6 +103,12 @@ Optional properties:
103#pinctrl-cells: Number of pin control cells in addition to the index within the 103#pinctrl-cells: Number of pin control cells in addition to the index within the
104 pin controller device instance 104 pin controller device instance
105 105
106pinctrl-use-default: Boolean. Indicates that the OS can use the boot default
107 pin configuration. This allows using an OS that does not have a
108 driver for the pin controller. This property can be set either
109 globally for the pin controller or in child nodes for individual
110 pin group control.
111
106Pin controller devices should contain the pin configuration nodes that client 112Pin controller devices should contain the pin configuration nodes that client
107devices reference. 113devices reference.
108 114
diff --git a/Documentation/driver-api/firmware/fallback-mechanisms.rst b/Documentation/driver-api/firmware/fallback-mechanisms.rst
index d35fed65eae9..8b041d0ab426 100644
--- a/Documentation/driver-api/firmware/fallback-mechanisms.rst
+++ b/Documentation/driver-api/firmware/fallback-mechanisms.rst
@@ -92,7 +92,7 @@ the loading file.
92 92
93The firmware device used to help load firmware using sysfs is only created if 93The firmware device used to help load firmware using sysfs is only created if
94direct firmware loading fails and if the fallback mechanism is enabled for your 94direct firmware loading fails and if the fallback mechanism is enabled for your
95firmware request, this is set up with fw_load_from_user_helper(). It is 95firmware request, this is set up with :c:func:`firmware_fallback_sysfs`. It is
96important to re-iterate that no device is created if a direct filesystem lookup 96important to re-iterate that no device is created if a direct filesystem lookup
97succeeded. 97succeeded.
98 98
@@ -108,6 +108,11 @@ firmware_data_read() and firmware_loading_show() are just provided for the
108test_firmware driver for testing, they are not called in normal use or 108test_firmware driver for testing, they are not called in normal use or
109expected to be used regularly by userspace. 109expected to be used regularly by userspace.
110 110
111firmware_fallback_sysfs
112-----------------------
113.. kernel-doc:: drivers/base/firmware_loader/fallback.c
114 :functions: firmware_fallback_sysfs
115
111Firmware kobject uevent fallback mechanism 116Firmware kobject uevent fallback mechanism
112========================================== 117==========================================
113 118
diff --git a/drivers/base/base.h b/drivers/base/base.h
index a75c3025fb78..7a419a7a6235 100644
--- a/drivers/base/base.h
+++ b/drivers/base/base.h
@@ -84,8 +84,6 @@ struct device_private {
84#define to_device_private_bus(obj) \ 84#define to_device_private_bus(obj) \
85 container_of(obj, struct device_private, knode_bus) 85 container_of(obj, struct device_private, knode_bus)
86 86
87extern int device_private_init(struct device *dev);
88
89/* initialisation functions */ 87/* initialisation functions */
90extern int devices_init(void); 88extern int devices_init(void);
91extern int buses_init(void); 89extern int buses_init(void);
diff --git a/drivers/base/cacheinfo.c b/drivers/base/cacheinfo.c
index 2880e2ab01f5..5d5b5988e88b 100644
--- a/drivers/base/cacheinfo.c
+++ b/drivers/base/cacheinfo.c
@@ -74,52 +74,48 @@ static inline int get_cacheinfo_idx(enum cache_type type)
74static void cache_size(struct cacheinfo *this_leaf, struct device_node *np) 74static void cache_size(struct cacheinfo *this_leaf, struct device_node *np)
75{ 75{
76 const char *propname; 76 const char *propname;
77 const __be32 *cache_size;
78 int ct_idx; 77 int ct_idx;
79 78
80 ct_idx = get_cacheinfo_idx(this_leaf->type); 79 ct_idx = get_cacheinfo_idx(this_leaf->type);
81 propname = cache_type_info[ct_idx].size_prop; 80 propname = cache_type_info[ct_idx].size_prop;
82 81
83 cache_size = of_get_property(np, propname, NULL); 82 if (of_property_read_u32(np, propname, &this_leaf->size))
84 if (cache_size) 83 this_leaf->size = 0;
85 this_leaf->size = of_read_number(cache_size, 1);
86} 84}
87 85
88/* not cache_line_size() because that's a macro in include/linux/cache.h */ 86/* not cache_line_size() because that's a macro in include/linux/cache.h */
89static void cache_get_line_size(struct cacheinfo *this_leaf, 87static void cache_get_line_size(struct cacheinfo *this_leaf,
90 struct device_node *np) 88 struct device_node *np)
91{ 89{
92 const __be32 *line_size;
93 int i, lim, ct_idx; 90 int i, lim, ct_idx;
94 91
95 ct_idx = get_cacheinfo_idx(this_leaf->type); 92 ct_idx = get_cacheinfo_idx(this_leaf->type);
96 lim = ARRAY_SIZE(cache_type_info[ct_idx].line_size_props); 93 lim = ARRAY_SIZE(cache_type_info[ct_idx].line_size_props);
97 94
98 for (i = 0; i < lim; i++) { 95 for (i = 0; i < lim; i++) {
96 int ret;
97 u32 line_size;
99 const char *propname; 98 const char *propname;
100 99
101 propname = cache_type_info[ct_idx].line_size_props[i]; 100 propname = cache_type_info[ct_idx].line_size_props[i];
102 line_size = of_get_property(np, propname, NULL); 101 ret = of_property_read_u32(np, propname, &line_size);
103 if (line_size) 102 if (!ret) {
103 this_leaf->coherency_line_size = line_size;
104 break; 104 break;
105 }
105 } 106 }
106
107 if (line_size)
108 this_leaf->coherency_line_size = of_read_number(line_size, 1);
109} 107}
110 108
111static void cache_nr_sets(struct cacheinfo *this_leaf, struct device_node *np) 109static void cache_nr_sets(struct cacheinfo *this_leaf, struct device_node *np)
112{ 110{
113 const char *propname; 111 const char *propname;
114 const __be32 *nr_sets;
115 int ct_idx; 112 int ct_idx;
116 113
117 ct_idx = get_cacheinfo_idx(this_leaf->type); 114 ct_idx = get_cacheinfo_idx(this_leaf->type);
118 propname = cache_type_info[ct_idx].nr_sets_prop; 115 propname = cache_type_info[ct_idx].nr_sets_prop;
119 116
120 nr_sets = of_get_property(np, propname, NULL); 117 if (of_property_read_u32(np, propname, &this_leaf->number_of_sets))
121 if (nr_sets) 118 this_leaf->number_of_sets = 0;
122 this_leaf->number_of_sets = of_read_number(nr_sets, 1);
123} 119}
124 120
125static void cache_associativity(struct cacheinfo *this_leaf) 121static void cache_associativity(struct cacheinfo *this_leaf)
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 7fbd281cfd5d..04bbcd779e11 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -105,7 +105,7 @@ static int device_is_dependent(struct device *dev, void *target)
105 struct device_link *link; 105 struct device_link *link;
106 int ret; 106 int ret;
107 107
108 if (WARN_ON(dev == target)) 108 if (dev == target)
109 return 1; 109 return 1;
110 110
111 ret = device_for_each_child(dev, target, device_is_dependent); 111 ret = device_for_each_child(dev, target, device_is_dependent);
@@ -113,7 +113,7 @@ static int device_is_dependent(struct device *dev, void *target)
113 return ret; 113 return ret;
114 114
115 list_for_each_entry(link, &dev->links.consumers, s_node) { 115 list_for_each_entry(link, &dev->links.consumers, s_node) {
116 if (WARN_ON(link->consumer == target)) 116 if (link->consumer == target)
117 return 1; 117 return 1;
118 118
119 ret = device_is_dependent(link->consumer, target); 119 ret = device_is_dependent(link->consumer, target);
@@ -1647,6 +1647,8 @@ static void cleanup_glue_dir(struct device *dev, struct kobject *glue_dir)
1647 return; 1647 return;
1648 1648
1649 mutex_lock(&gdp_mutex); 1649 mutex_lock(&gdp_mutex);
1650 if (!kobject_has_children(glue_dir))
1651 kobject_del(glue_dir);
1650 kobject_put(glue_dir); 1652 kobject_put(glue_dir);
1651 mutex_unlock(&gdp_mutex); 1653 mutex_unlock(&gdp_mutex);
1652} 1654}
@@ -1786,7 +1788,7 @@ static void device_remove_sys_dev_entry(struct device *dev)
1786 } 1788 }
1787} 1789}
1788 1790
1789int device_private_init(struct device *dev) 1791static int device_private_init(struct device *dev)
1790{ 1792{
1791 dev->p = kzalloc(sizeof(*dev->p), GFP_KERNEL); 1793 dev->p = kzalloc(sizeof(*dev->p), GFP_KERNEL);
1792 if (!dev->p) 1794 if (!dev->p)
@@ -2859,6 +2861,9 @@ void device_shutdown(void)
2859{ 2861{
2860 struct device *dev, *parent; 2862 struct device *dev, *parent;
2861 2863
2864 wait_for_device_probe();
2865 device_block_probing();
2866
2862 spin_lock(&devices_kset->list_lock); 2867 spin_lock(&devices_kset->list_lock);
2863 /* 2868 /*
2864 * Walk the devices list backward, shutting down each in turn. 2869 * Walk the devices list backward, shutting down each in turn.
@@ -3052,12 +3057,12 @@ void func(const struct device *dev, const char *fmt, ...) \
3052} \ 3057} \
3053EXPORT_SYMBOL(func); 3058EXPORT_SYMBOL(func);
3054 3059
3055define_dev_printk_level(dev_emerg, KERN_EMERG); 3060define_dev_printk_level(_dev_emerg, KERN_EMERG);
3056define_dev_printk_level(dev_alert, KERN_ALERT); 3061define_dev_printk_level(_dev_alert, KERN_ALERT);
3057define_dev_printk_level(dev_crit, KERN_CRIT); 3062define_dev_printk_level(_dev_crit, KERN_CRIT);
3058define_dev_printk_level(dev_err, KERN_ERR); 3063define_dev_printk_level(_dev_err, KERN_ERR);
3059define_dev_printk_level(dev_warn, KERN_WARNING); 3064define_dev_printk_level(_dev_warn, KERN_WARNING);
3060define_dev_printk_level(dev_notice, KERN_NOTICE); 3065define_dev_printk_level(_dev_notice, KERN_NOTICE);
3061define_dev_printk_level(_dev_info, KERN_INFO); 3066define_dev_printk_level(_dev_info, KERN_INFO);
3062 3067
3063#endif 3068#endif
diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index 6ebcd65d64b6..edfc9f0b1180 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -16,6 +16,7 @@
16 * Copyright (c) 2007-2009 Novell Inc. 16 * Copyright (c) 2007-2009 Novell Inc.
17 */ 17 */
18 18
19#include <linux/debugfs.h>
19#include <linux/device.h> 20#include <linux/device.h>
20#include <linux/delay.h> 21#include <linux/delay.h>
21#include <linux/dma-mapping.h> 22#include <linux/dma-mapping.h>
@@ -53,6 +54,7 @@ static DEFINE_MUTEX(deferred_probe_mutex);
53static LIST_HEAD(deferred_probe_pending_list); 54static LIST_HEAD(deferred_probe_pending_list);
54static LIST_HEAD(deferred_probe_active_list); 55static LIST_HEAD(deferred_probe_active_list);
55static atomic_t deferred_trigger_count = ATOMIC_INIT(0); 56static atomic_t deferred_trigger_count = ATOMIC_INIT(0);
57static struct dentry *deferred_devices;
56static bool initcalls_done; 58static bool initcalls_done;
57 59
58/* 60/*
@@ -63,26 +65,6 @@ static bool initcalls_done;
63static bool defer_all_probes; 65static bool defer_all_probes;
64 66
65/* 67/*
66 * For initcall_debug, show the deferred probes executed in late_initcall
67 * processing.
68 */
69static void deferred_probe_debug(struct device *dev)
70{
71 ktime_t calltime, delta, rettime;
72 unsigned long long duration;
73
74 printk(KERN_DEBUG "deferred probe %s @ %i\n", dev_name(dev),
75 task_pid_nr(current));
76 calltime = ktime_get();
77 bus_probe_device(dev);
78 rettime = ktime_get();
79 delta = ktime_sub(rettime, calltime);
80 duration = (unsigned long long) ktime_to_ns(delta) >> 10;
81 printk(KERN_DEBUG "deferred probe %s returned after %lld usecs\n",
82 dev_name(dev), duration);
83}
84
85/*
86 * deferred_probe_work_func() - Retry probing devices in the active list. 68 * deferred_probe_work_func() - Retry probing devices in the active list.
87 */ 69 */
88static void deferred_probe_work_func(struct work_struct *work) 70static void deferred_probe_work_func(struct work_struct *work)
@@ -125,11 +107,7 @@ static void deferred_probe_work_func(struct work_struct *work)
125 device_pm_move_to_tail(dev); 107 device_pm_move_to_tail(dev);
126 108
127 dev_dbg(dev, "Retrying from deferred list\n"); 109 dev_dbg(dev, "Retrying from deferred list\n");
128 if (initcall_debug && !initcalls_done) 110 bus_probe_device(dev);
129 deferred_probe_debug(dev);
130 else
131 bus_probe_device(dev);
132
133 mutex_lock(&deferred_probe_mutex); 111 mutex_lock(&deferred_probe_mutex);
134 112
135 put_device(dev); 113 put_device(dev);
@@ -224,6 +202,69 @@ void device_unblock_probing(void)
224 driver_deferred_probe_trigger(); 202 driver_deferred_probe_trigger();
225} 203}
226 204
205/*
206 * deferred_devs_show() - Show the devices in the deferred probe pending list.
207 */
208static int deferred_devs_show(struct seq_file *s, void *data)
209{
210 struct device_private *curr;
211
212 mutex_lock(&deferred_probe_mutex);
213
214 list_for_each_entry(curr, &deferred_probe_pending_list, deferred_probe)
215 seq_printf(s, "%s\n", dev_name(curr->device));
216
217 mutex_unlock(&deferred_probe_mutex);
218
219 return 0;
220}
221DEFINE_SHOW_ATTRIBUTE(deferred_devs);
222
223static int deferred_probe_timeout = -1;
224static int __init deferred_probe_timeout_setup(char *str)
225{
226 deferred_probe_timeout = simple_strtol(str, NULL, 10);
227 return 1;
228}
229__setup("deferred_probe_timeout=", deferred_probe_timeout_setup);
230
231/**
232 * driver_deferred_probe_check_state() - Check deferred probe state
233 * @dev: device to check
234 *
235 * Returns -ENODEV if init is done and all built-in drivers have had a chance
236 * to probe (i.e. initcalls are done), -ETIMEDOUT if deferred probe debug
237 * timeout has expired, or -EPROBE_DEFER if none of those conditions are met.
238 *
239 * Drivers or subsystems can opt-in to calling this function instead of directly
240 * returning -EPROBE_DEFER.
241 */
242int driver_deferred_probe_check_state(struct device *dev)
243{
244 if (initcalls_done) {
245 if (!deferred_probe_timeout) {
246 dev_WARN(dev, "deferred probe timeout, ignoring dependency");
247 return -ETIMEDOUT;
248 }
249 dev_warn(dev, "ignoring dependency for device, assuming no driver");
250 return -ENODEV;
251 }
252 return -EPROBE_DEFER;
253}
254
255static void deferred_probe_timeout_work_func(struct work_struct *work)
256{
257 struct device_private *private, *p;
258
259 deferred_probe_timeout = 0;
260 driver_deferred_probe_trigger();
261 flush_work(&deferred_probe_work);
262
263 list_for_each_entry_safe(private, p, &deferred_probe_pending_list, deferred_probe)
264 dev_info(private->device, "deferred probe pending");
265}
266static DECLARE_DELAYED_WORK(deferred_probe_timeout_work, deferred_probe_timeout_work_func);
267
227/** 268/**
228 * deferred_probe_initcall() - Enable probing of deferred devices 269 * deferred_probe_initcall() - Enable probing of deferred devices
229 * 270 *
@@ -233,15 +274,36 @@ void device_unblock_probing(void)
233 */ 274 */
234static int deferred_probe_initcall(void) 275static int deferred_probe_initcall(void)
235{ 276{
277 deferred_devices = debugfs_create_file("devices_deferred", 0444, NULL,
278 NULL, &deferred_devs_fops);
279
236 driver_deferred_probe_enable = true; 280 driver_deferred_probe_enable = true;
237 driver_deferred_probe_trigger(); 281 driver_deferred_probe_trigger();
238 /* Sort as many dependencies as possible before exiting initcalls */ 282 /* Sort as many dependencies as possible before exiting initcalls */
239 flush_work(&deferred_probe_work); 283 flush_work(&deferred_probe_work);
240 initcalls_done = true; 284 initcalls_done = true;
285
286 /*
287 * Trigger deferred probe again, this time we won't defer anything
288 * that is optional
289 */
290 driver_deferred_probe_trigger();
291 flush_work(&deferred_probe_work);
292
293 if (deferred_probe_timeout > 0) {
294 schedule_delayed_work(&deferred_probe_timeout_work,
295 deferred_probe_timeout * HZ);
296 }
241 return 0; 297 return 0;
242} 298}
243late_initcall(deferred_probe_initcall); 299late_initcall(deferred_probe_initcall);
244 300
301static void __exit deferred_probe_exit(void)
302{
303 debugfs_remove_recursive(deferred_devices);
304}
305__exitcall(deferred_probe_exit);
306
245/** 307/**
246 * device_is_bound() - Check if device is bound to a driver 308 * device_is_bound() - Check if device is bound to a driver
247 * @dev: device to check 309 * @dev: device to check
@@ -519,6 +581,23 @@ done:
519 return ret; 581 return ret;
520} 582}
521 583
584/*
585 * For initcall_debug, show the driver probe time.
586 */
587static int really_probe_debug(struct device *dev, struct device_driver *drv)
588{
589 ktime_t calltime, delta, rettime;
590 int ret;
591
592 calltime = ktime_get();
593 ret = really_probe(dev, drv);
594 rettime = ktime_get();
595 delta = ktime_sub(rettime, calltime);
596 printk(KERN_DEBUG "probe of %s returned %d after %lld usecs\n",
597 dev_name(dev), ret, (s64) ktime_to_us(delta));
598 return ret;
599}
600
522/** 601/**
523 * driver_probe_done 602 * driver_probe_done
524 * Determine if the probe sequence is finished or not. 603 * Determine if the probe sequence is finished or not.
@@ -577,7 +656,10 @@ int driver_probe_device(struct device_driver *drv, struct device *dev)
577 pm_runtime_get_sync(dev->parent); 656 pm_runtime_get_sync(dev->parent);
578 657
579 pm_runtime_barrier(dev); 658 pm_runtime_barrier(dev);
580 ret = really_probe(dev, drv); 659 if (initcall_debug)
660 ret = really_probe_debug(dev, drv);
661 else
662 ret = really_probe(dev, drv);
581 pm_request_idle(dev); 663 pm_request_idle(dev);
582 664
583 if (dev->parent) 665 if (dev->parent)
diff --git a/drivers/base/init.c b/drivers/base/init.c
index dd85b05a6a16..908e6520e804 100644
--- a/drivers/base/init.c
+++ b/drivers/base/init.c
@@ -30,9 +30,9 @@ void __init driver_init(void)
30 /* These are also core pieces, but must come after the 30 /* These are also core pieces, but must come after the
31 * core core pieces. 31 * core core pieces.
32 */ 32 */
33 of_core_init();
33 platform_bus_init(); 34 platform_bus_init();
34 cpu_dev_init(); 35 cpu_dev_init();
35 memory_dev_init(); 36 memory_dev_init();
36 container_dev_init(); 37 container_dev_init();
37 of_core_init();
38} 38}
diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index 79bdca70a81a..4b5714199490 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -2253,7 +2253,7 @@ static int __genpd_dev_pm_attach(struct device *dev, struct device_node *np,
2253 mutex_unlock(&gpd_list_lock); 2253 mutex_unlock(&gpd_list_lock);
2254 dev_dbg(dev, "%s() failed to find PM domain: %ld\n", 2254 dev_dbg(dev, "%s() failed to find PM domain: %ld\n",
2255 __func__, PTR_ERR(pd)); 2255 __func__, PTR_ERR(pd));
2256 return -EPROBE_DEFER; 2256 return driver_deferred_probe_check_state(dev);
2257 } 2257 }
2258 2258
2259 dev_dbg(dev, "adding to PM domain %s\n", pd->name); 2259 dev_dbg(dev, "adding to PM domain %s\n", pd->name);
diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c
index 1d647104bccc..22bdabd3d8e0 100644
--- a/drivers/iommu/arm-smmu-v3.c
+++ b/drivers/iommu/arm-smmu-v3.c
@@ -2915,8 +2915,6 @@ static struct platform_driver arm_smmu_driver = {
2915}; 2915};
2916module_platform_driver(arm_smmu_driver); 2916module_platform_driver(arm_smmu_driver);
2917 2917
2918IOMMU_OF_DECLARE(arm_smmuv3, "arm,smmu-v3");
2919
2920MODULE_DESCRIPTION("IOMMU API for ARM architected SMMUv3 implementations"); 2918MODULE_DESCRIPTION("IOMMU API for ARM architected SMMUv3 implementations");
2921MODULE_AUTHOR("Will Deacon <will.deacon@arm.com>"); 2919MODULE_AUTHOR("Will Deacon <will.deacon@arm.com>");
2922MODULE_LICENSE("GPL v2"); 2920MODULE_LICENSE("GPL v2");
diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c
index f7a96bcf94a6..c73cfce1ccc0 100644
--- a/drivers/iommu/arm-smmu.c
+++ b/drivers/iommu/arm-smmu.c
@@ -2211,13 +2211,6 @@ static struct platform_driver arm_smmu_driver = {
2211}; 2211};
2212module_platform_driver(arm_smmu_driver); 2212module_platform_driver(arm_smmu_driver);
2213 2213
2214IOMMU_OF_DECLARE(arm_smmuv1, "arm,smmu-v1");
2215IOMMU_OF_DECLARE(arm_smmuv2, "arm,smmu-v2");
2216IOMMU_OF_DECLARE(arm_mmu400, "arm,mmu-400");
2217IOMMU_OF_DECLARE(arm_mmu401, "arm,mmu-401");
2218IOMMU_OF_DECLARE(arm_mmu500, "arm,mmu-500");
2219IOMMU_OF_DECLARE(cavium_smmuv2, "cavium,smmu-v2");
2220
2221MODULE_DESCRIPTION("IOMMU API for ARM architected SMMU implementations"); 2214MODULE_DESCRIPTION("IOMMU API for ARM architected SMMU implementations");
2222MODULE_AUTHOR("Will Deacon <will.deacon@arm.com>"); 2215MODULE_AUTHOR("Will Deacon <will.deacon@arm.com>");
2223MODULE_LICENSE("GPL v2"); 2216MODULE_LICENSE("GPL v2");
diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c
index 85879cfec52f..b128cb4372d3 100644
--- a/drivers/iommu/exynos-iommu.c
+++ b/drivers/iommu/exynos-iommu.c
@@ -1390,5 +1390,3 @@ err_reg_driver:
1390 return ret; 1390 return ret;
1391} 1391}
1392core_initcall(exynos_iommu_init); 1392core_initcall(exynos_iommu_init);
1393
1394IOMMU_OF_DECLARE(exynos_iommu_of, "samsung,exynos-sysmmu");
diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c
index 40ae6e87cb88..f026aa16d5f1 100644
--- a/drivers/iommu/ipmmu-vmsa.c
+++ b/drivers/iommu/ipmmu-vmsa.c
@@ -1108,9 +1108,6 @@ static void __exit ipmmu_exit(void)
1108subsys_initcall(ipmmu_init); 1108subsys_initcall(ipmmu_init);
1109module_exit(ipmmu_exit); 1109module_exit(ipmmu_exit);
1110 1110
1111IOMMU_OF_DECLARE(ipmmu_vmsa_iommu_of, "renesas,ipmmu-vmsa");
1112IOMMU_OF_DECLARE(ipmmu_r8a7795_iommu_of, "renesas,ipmmu-r8a7795");
1113
1114MODULE_DESCRIPTION("IOMMU API for Renesas VMSA-compatible IPMMU"); 1111MODULE_DESCRIPTION("IOMMU API for Renesas VMSA-compatible IPMMU");
1115MODULE_AUTHOR("Laurent Pinchart <laurent.pinchart@ideasonboard.com>"); 1112MODULE_AUTHOR("Laurent Pinchart <laurent.pinchart@ideasonboard.com>");
1116MODULE_LICENSE("GPL v2"); 1113MODULE_LICENSE("GPL v2");
diff --git a/drivers/iommu/msm_iommu.c b/drivers/iommu/msm_iommu.c
index 0d3350463a3f..27377742600d 100644
--- a/drivers/iommu/msm_iommu.c
+++ b/drivers/iommu/msm_iommu.c
@@ -877,7 +877,5 @@ static void __exit msm_iommu_driver_exit(void)
877subsys_initcall(msm_iommu_driver_init); 877subsys_initcall(msm_iommu_driver_init);
878module_exit(msm_iommu_driver_exit); 878module_exit(msm_iommu_driver_exit);
879 879
880IOMMU_OF_DECLARE(msm_iommu_of, "qcom,apq8064-iommu");
881
882MODULE_LICENSE("GPL v2"); 880MODULE_LICENSE("GPL v2");
883MODULE_AUTHOR("Stepan Moskovchenko <stepanm@codeaurora.org>"); 881MODULE_AUTHOR("Stepan Moskovchenko <stepanm@codeaurora.org>");
diff --git a/drivers/iommu/of_iommu.c b/drivers/iommu/of_iommu.c
index 5c36a8b7656a..f7787e757244 100644
--- a/drivers/iommu/of_iommu.c
+++ b/drivers/iommu/of_iommu.c
@@ -27,9 +27,6 @@
27 27
28#define NO_IOMMU 1 28#define NO_IOMMU 1
29 29
30static const struct of_device_id __iommu_of_table_sentinel
31 __used __section(__iommu_of_table_end);
32
33/** 30/**
34 * of_get_dma_window - Parse *dma-window property and returns 0 if found. 31 * of_get_dma_window - Parse *dma-window property and returns 0 if found.
35 * 32 *
@@ -98,19 +95,6 @@ int of_get_dma_window(struct device_node *dn, const char *prefix, int index,
98} 95}
99EXPORT_SYMBOL_GPL(of_get_dma_window); 96EXPORT_SYMBOL_GPL(of_get_dma_window);
100 97
101static bool of_iommu_driver_present(struct device_node *np)
102{
103 /*
104 * If the IOMMU still isn't ready by the time we reach init, assume
105 * it never will be. We don't want to defer indefinitely, nor attempt
106 * to dereference __iommu_of_table after it's been freed.
107 */
108 if (system_state >= SYSTEM_RUNNING)
109 return false;
110
111 return of_match_node(&__iommu_of_table, np);
112}
113
114static int of_iommu_xlate(struct device *dev, 98static int of_iommu_xlate(struct device *dev,
115 struct of_phandle_args *iommu_spec) 99 struct of_phandle_args *iommu_spec)
116{ 100{
@@ -120,8 +104,7 @@ static int of_iommu_xlate(struct device *dev,
120 104
121 ops = iommu_ops_from_fwnode(fwnode); 105 ops = iommu_ops_from_fwnode(fwnode);
122 if ((ops && !ops->of_xlate) || 106 if ((ops && !ops->of_xlate) ||
123 !of_device_is_available(iommu_spec->np) || 107 !of_device_is_available(iommu_spec->np))
124 (!ops && !of_iommu_driver_present(iommu_spec->np)))
125 return NO_IOMMU; 108 return NO_IOMMU;
126 109
127 err = iommu_fwspec_init(dev, &iommu_spec->np->fwnode, ops); 110 err = iommu_fwspec_init(dev, &iommu_spec->np->fwnode, ops);
@@ -133,7 +116,7 @@ static int of_iommu_xlate(struct device *dev,
133 * a proper probe-ordering dependency mechanism in future. 116 * a proper probe-ordering dependency mechanism in future.
134 */ 117 */
135 if (!ops) 118 if (!ops)
136 return -EPROBE_DEFER; 119 return driver_deferred_probe_check_state(dev);
137 120
138 return ops->of_xlate(dev, iommu_spec); 121 return ops->of_xlate(dev, iommu_spec);
139} 122}
diff --git a/drivers/iommu/qcom_iommu.c b/drivers/iommu/qcom_iommu.c
index fe88a4880d3a..b48aee82d14b 100644
--- a/drivers/iommu/qcom_iommu.c
+++ b/drivers/iommu/qcom_iommu.c
@@ -945,7 +945,5 @@ static void __exit qcom_iommu_exit(void)
945module_init(qcom_iommu_init); 945module_init(qcom_iommu_init);
946module_exit(qcom_iommu_exit); 946module_exit(qcom_iommu_exit);
947 947
948IOMMU_OF_DECLARE(qcom_iommu_dev, "qcom,msm-iommu-v1");
949
950MODULE_DESCRIPTION("IOMMU API for QCOM IOMMU v1 implementations"); 948MODULE_DESCRIPTION("IOMMU API for QCOM IOMMU v1 implementations");
951MODULE_LICENSE("GPL v2"); 949MODULE_LICENSE("GPL v2");
diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c
index 054cd2c8e9c8..de8d3bf91b23 100644
--- a/drivers/iommu/rockchip-iommu.c
+++ b/drivers/iommu/rockchip-iommu.c
@@ -1284,8 +1284,6 @@ static int __init rk_iommu_init(void)
1284} 1284}
1285subsys_initcall(rk_iommu_init); 1285subsys_initcall(rk_iommu_init);
1286 1286
1287IOMMU_OF_DECLARE(rk_iommu_of, "rockchip,iommu");
1288
1289MODULE_DESCRIPTION("IOMMU API for Rockchip"); 1287MODULE_DESCRIPTION("IOMMU API for Rockchip");
1290MODULE_AUTHOR("Simon Xue <xxm@rock-chips.com> and Daniel Kurtz <djkurtz@chromium.org>"); 1288MODULE_AUTHOR("Simon Xue <xxm@rock-chips.com> and Daniel Kurtz <djkurtz@chromium.org>");
1291MODULE_ALIAS("platform:rockchip-iommu"); 1289MODULE_ALIAS("platform:rockchip-iommu");
diff --git a/drivers/pinctrl/devicetree.c b/drivers/pinctrl/devicetree.c
index c4aa411f5935..2969ff3162c3 100644
--- a/drivers/pinctrl/devicetree.c
+++ b/drivers/pinctrl/devicetree.c
@@ -111,17 +111,24 @@ static int dt_to_map_one_config(struct pinctrl *p,
111 int ret; 111 int ret;
112 struct pinctrl_map *map; 112 struct pinctrl_map *map;
113 unsigned num_maps; 113 unsigned num_maps;
114 bool allow_default = false;
114 115
115 /* Find the pin controller containing np_config */ 116 /* Find the pin controller containing np_config */
116 np_pctldev = of_node_get(np_config); 117 np_pctldev = of_node_get(np_config);
117 for (;;) { 118 for (;;) {
119 if (!allow_default)
120 allow_default = of_property_read_bool(np_pctldev,
121 "pinctrl-use-default");
122
118 np_pctldev = of_get_next_parent(np_pctldev); 123 np_pctldev = of_get_next_parent(np_pctldev);
119 if (!np_pctldev || of_node_is_root(np_pctldev)) { 124 if (!np_pctldev || of_node_is_root(np_pctldev)) {
120 dev_info(p->dev, "could not find pctldev for node %pOF, deferring probe\n",
121 np_config);
122 of_node_put(np_pctldev); 125 of_node_put(np_pctldev);
123 /* OK let's just assume this will appear later then */ 126 ret = driver_deferred_probe_check_state(p->dev);
124 return -EPROBE_DEFER; 127 /* keep deferring if modules are enabled unless we've timed out */
128 if (IS_ENABLED(CONFIG_MODULES) && !allow_default && ret == -ENODEV)
129 ret = -EPROBE_DEFER;
130
131 return ret;
125 } 132 }
126 /* If we're creating a hog we can use the passed pctldev */ 133 /* If we're creating a hog we can use the passed pctldev */
127 if (hog_pctldev && (np_pctldev == p->dev->of_node)) { 134 if (hog_pctldev && (np_pctldev == p->dev->of_node)) {
diff --git a/fs/kernfs/symlink.c b/fs/kernfs/symlink.c
index 5ffed48f3d0e..305b220af45d 100644
--- a/fs/kernfs/symlink.c
+++ b/fs/kernfs/symlink.c
@@ -97,7 +97,7 @@ static int kernfs_get_target_path(struct kernfs_node *parent,
97 int slen = strlen(kn->name); 97 int slen = strlen(kn->name);
98 98
99 len -= slen; 99 len -= slen;
100 strncpy(s + len, kn->name, slen); 100 memcpy(s + len, kn->name, slen);
101 if (len) 101 if (len)
102 s[--len] = '/'; 102 s[--len] = '/';
103 103
diff --git a/fs/sysfs/group.c b/fs/sysfs/group.c
index c7a716c4acc9..1eb2d6307663 100644
--- a/fs/sysfs/group.c
+++ b/fs/sysfs/group.c
@@ -124,13 +124,22 @@ static int internal_create_group(struct kobject *kobj, int update,
124 } 124 }
125 kobject_get_ownership(kobj, &uid, &gid); 125 kobject_get_ownership(kobj, &uid, &gid);
126 if (grp->name) { 126 if (grp->name) {
127 kn = kernfs_create_dir_ns(kobj->sd, grp->name, 127 if (update) {
128 S_IRWXU | S_IRUGO | S_IXUGO, 128 kn = kernfs_find_and_get(kobj->sd, grp->name);
129 uid, gid, kobj, NULL); 129 if (!kn) {
130 if (IS_ERR(kn)) { 130 pr_warn("Can't update unknown attr grp name: %s/%s\n",
131 if (PTR_ERR(kn) == -EEXIST) 131 kobj->name, grp->name);
132 sysfs_warn_dup(kobj->sd, grp->name); 132 return -EINVAL;
133 return PTR_ERR(kn); 133 }
134 } else {
135 kn = kernfs_create_dir_ns(kobj->sd, grp->name,
136 S_IRWXU | S_IRUGO | S_IXUGO,
137 uid, gid, kobj, NULL);
138 if (IS_ERR(kn)) {
139 if (PTR_ERR(kn) == -EEXIST)
140 sysfs_warn_dup(kobj->sd, grp->name);
141 return PTR_ERR(kn);
142 }
134 } 143 }
135 } else 144 } else
136 kn = kobj->sd; 145 kn = kobj->sd;
@@ -141,6 +150,10 @@ static int internal_create_group(struct kobject *kobj, int update,
141 kernfs_remove(kn); 150 kernfs_remove(kn);
142 } 151 }
143 kernfs_put(kn); 152 kernfs_put(kn);
153
154 if (grp->name && update)
155 kernfs_put(kn);
156
144 return error; 157 return error;
145} 158}
146 159
@@ -205,7 +218,8 @@ EXPORT_SYMBOL_GPL(sysfs_create_groups);
205 * of the attribute files being created already exist. Furthermore, 218 * of the attribute files being created already exist. Furthermore,
206 * if the visibility of the files has changed through the is_visible() 219 * if the visibility of the files has changed through the is_visible()
207 * callback, it will update the permissions and add or remove the 220 * callback, it will update the permissions and add or remove the
208 * relevant files. 221 * relevant files. Changing a group's name (subdirectory name under
222 * kobj's directory in sysfs) is not allowed.
209 * 223 *
210 * The primary use for this function is to call it after making a change 224 * The primary use for this function is to call it after making a change
211 * that affects group visibility. 225 * that affects group visibility.
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index e373e2e10f6a..f173b5f30dbe 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -218,7 +218,6 @@
218#define TIMER_OF_TABLES() OF_TABLE(CONFIG_TIMER_OF, timer) 218#define TIMER_OF_TABLES() OF_TABLE(CONFIG_TIMER_OF, timer)
219#define IRQCHIP_OF_MATCH_TABLE() OF_TABLE(CONFIG_IRQCHIP, irqchip) 219#define IRQCHIP_OF_MATCH_TABLE() OF_TABLE(CONFIG_IRQCHIP, irqchip)
220#define CLK_OF_TABLES() OF_TABLE(CONFIG_COMMON_CLK, clk) 220#define CLK_OF_TABLES() OF_TABLE(CONFIG_COMMON_CLK, clk)
221#define IOMMU_OF_TABLES() OF_TABLE(CONFIG_OF_IOMMU, iommu)
222#define RESERVEDMEM_OF_TABLES() OF_TABLE(CONFIG_OF_RESERVED_MEM, reservedmem) 221#define RESERVEDMEM_OF_TABLES() OF_TABLE(CONFIG_OF_RESERVED_MEM, reservedmem)
223#define CPU_METHOD_OF_TABLES() OF_TABLE(CONFIG_SMP, cpu_method) 222#define CPU_METHOD_OF_TABLES() OF_TABLE(CONFIG_SMP, cpu_method)
224#define CPUIDLE_METHOD_OF_TABLES() OF_TABLE(CONFIG_CPU_IDLE, cpuidle_method) 223#define CPUIDLE_METHOD_OF_TABLES() OF_TABLE(CONFIG_CPU_IDLE, cpuidle_method)
@@ -601,7 +600,6 @@
601 CLK_OF_TABLES() \ 600 CLK_OF_TABLES() \
602 RESERVEDMEM_OF_TABLES() \ 601 RESERVEDMEM_OF_TABLES() \
603 TIMER_OF_TABLES() \ 602 TIMER_OF_TABLES() \
604 IOMMU_OF_TABLES() \
605 CPU_METHOD_OF_TABLES() \ 603 CPU_METHOD_OF_TABLES() \
606 CPUIDLE_METHOD_OF_TABLES() \ 604 CPUIDLE_METHOD_OF_TABLES() \
607 KERNEL_DTB() \ 605 KERNEL_DTB() \
diff --git a/include/linux/device.h b/include/linux/device.h
index f6475b1820ef..8f882549edee 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -339,6 +339,8 @@ struct device *driver_find_device(struct device_driver *drv,
339 struct device *start, void *data, 339 struct device *start, void *data,
340 int (*match)(struct device *dev, void *data)); 340 int (*match)(struct device *dev, void *data));
341 341
342int driver_deferred_probe_check_state(struct device *dev);
343
342/** 344/**
343 * struct subsys_interface - interfaces to device functions 345 * struct subsys_interface - interfaces to device functions
344 * @name: name of the device function 346 * @name: name of the device function
@@ -1329,30 +1331,34 @@ struct device_link *device_link_add(struct device *consumer,
1329void device_link_del(struct device_link *link); 1331void device_link_del(struct device_link *link);
1330void device_link_remove(void *consumer, struct device *supplier); 1332void device_link_remove(void *consumer, struct device *supplier);
1331 1333
1334#ifndef dev_fmt
1335#define dev_fmt(fmt) fmt
1336#endif
1337
1332#ifdef CONFIG_PRINTK 1338#ifdef CONFIG_PRINTK
1333 1339
1334extern __printf(3, 0) 1340__printf(3, 0)
1335int dev_vprintk_emit(int level, const struct device *dev, 1341int dev_vprintk_emit(int level, const struct device *dev,
1336 const char *fmt, va_list args); 1342 const char *fmt, va_list args);
1337extern __printf(3, 4) 1343__printf(3, 4)
1338int dev_printk_emit(int level, const struct device *dev, const char *fmt, ...); 1344int dev_printk_emit(int level, const struct device *dev, const char *fmt, ...);
1339 1345
1340extern __printf(3, 4) 1346__printf(3, 4)
1341void dev_printk(const char *level, const struct device *dev, 1347void dev_printk(const char *level, const struct device *dev,
1342 const char *fmt, ...); 1348 const char *fmt, ...);
1343extern __printf(2, 3) 1349__printf(2, 3)
1344void dev_emerg(const struct device *dev, const char *fmt, ...); 1350void _dev_emerg(const struct device *dev, const char *fmt, ...);
1345extern __printf(2, 3) 1351__printf(2, 3)
1346void dev_alert(const struct device *dev, const char *fmt, ...); 1352void _dev_alert(const struct device *dev, const char *fmt, ...);
1347extern __printf(2, 3) 1353__printf(2, 3)
1348void dev_crit(const struct device *dev, const char *fmt, ...); 1354void _dev_crit(const struct device *dev, const char *fmt, ...);
1349extern __printf(2, 3) 1355__printf(2, 3)
1350void dev_err(const struct device *dev, const char *fmt, ...); 1356void _dev_err(const struct device *dev, const char *fmt, ...);
1351extern __printf(2, 3) 1357__printf(2, 3)
1352void dev_warn(const struct device *dev, const char *fmt, ...); 1358void _dev_warn(const struct device *dev, const char *fmt, ...);
1353extern __printf(2, 3) 1359__printf(2, 3)
1354void dev_notice(const struct device *dev, const char *fmt, ...); 1360void _dev_notice(const struct device *dev, const char *fmt, ...);
1355extern __printf(2, 3) 1361__printf(2, 3)
1356void _dev_info(const struct device *dev, const char *fmt, ...); 1362void _dev_info(const struct device *dev, const char *fmt, ...);
1357 1363
1358#else 1364#else
@@ -1370,26 +1376,26 @@ static inline void __dev_printk(const char *level, const struct device *dev,
1370{} 1376{}
1371static inline __printf(3, 4) 1377static inline __printf(3, 4)
1372void dev_printk(const char *level, const struct device *dev, 1378void dev_printk(const char *level, const struct device *dev,
1373 const char *fmt, ...) 1379 const char *fmt, ...)
1374{} 1380{}
1375 1381
1376static inline __printf(2, 3) 1382static inline __printf(2, 3)
1377void dev_emerg(const struct device *dev, const char *fmt, ...) 1383void _dev_emerg(const struct device *dev, const char *fmt, ...)
1378{} 1384{}
1379static inline __printf(2, 3) 1385static inline __printf(2, 3)
1380void dev_crit(const struct device *dev, const char *fmt, ...) 1386void _dev_crit(const struct device *dev, const char *fmt, ...)
1381{} 1387{}
1382static inline __printf(2, 3) 1388static inline __printf(2, 3)
1383void dev_alert(const struct device *dev, const char *fmt, ...) 1389void _dev_alert(const struct device *dev, const char *fmt, ...)
1384{} 1390{}
1385static inline __printf(2, 3) 1391static inline __printf(2, 3)
1386void dev_err(const struct device *dev, const char *fmt, ...) 1392void _dev_err(const struct device *dev, const char *fmt, ...)
1387{} 1393{}
1388static inline __printf(2, 3) 1394static inline __printf(2, 3)
1389void dev_warn(const struct device *dev, const char *fmt, ...) 1395void _dev_warn(const struct device *dev, const char *fmt, ...)
1390{} 1396{}
1391static inline __printf(2, 3) 1397static inline __printf(2, 3)
1392void dev_notice(const struct device *dev, const char *fmt, ...) 1398void _dev_notice(const struct device *dev, const char *fmt, ...)
1393{} 1399{}
1394static inline __printf(2, 3) 1400static inline __printf(2, 3)
1395void _dev_info(const struct device *dev, const char *fmt, ...) 1401void _dev_info(const struct device *dev, const char *fmt, ...)
@@ -1398,27 +1404,36 @@ void _dev_info(const struct device *dev, const char *fmt, ...)
1398#endif 1404#endif
1399 1405
1400/* 1406/*
1401 * Stupid hackaround for existing uses of non-printk uses dev_info 1407 * #defines for all the dev_<level> macros to prefix with whatever
1402 * 1408 * possible use of #define dev_fmt(fmt) ...
1403 * Note that the definition of dev_info below is actually _dev_info
1404 * and a macro is used to avoid redefining dev_info
1405 */ 1409 */
1406 1410
1407#define dev_info(dev, fmt, arg...) _dev_info(dev, fmt, ##arg) 1411#define dev_emerg(dev, fmt, ...) \
1412 _dev_emerg(dev, dev_fmt(fmt), ##__VA_ARGS__)
1413#define dev_crit(dev, fmt, ...) \
1414 _dev_crit(dev, dev_fmt(fmt), ##__VA_ARGS__)
1415#define dev_alert(dev, fmt, ...) \
1416 _dev_alert(dev, dev_fmt(fmt), ##__VA_ARGS__)
1417#define dev_err(dev, fmt, ...) \
1418 _dev_err(dev, dev_fmt(fmt), ##__VA_ARGS__)
1419#define dev_warn(dev, fmt, ...) \
1420 _dev_warn(dev, dev_fmt(fmt), ##__VA_ARGS__)
1421#define dev_notice(dev, fmt, ...) \
1422 _dev_notice(dev, dev_fmt(fmt), ##__VA_ARGS__)
1423#define dev_info(dev, fmt, ...) \
1424 _dev_info(dev, dev_fmt(fmt), ##__VA_ARGS__)
1408 1425
1409#if defined(CONFIG_DYNAMIC_DEBUG) 1426#if defined(CONFIG_DYNAMIC_DEBUG)
1410#define dev_dbg(dev, format, ...) \ 1427#define dev_dbg(dev, fmt, ...) \
1411do { \ 1428 dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
1412 dynamic_dev_dbg(dev, format, ##__VA_ARGS__); \
1413} while (0)
1414#elif defined(DEBUG) 1429#elif defined(DEBUG)
1415#define dev_dbg(dev, format, arg...) \ 1430#define dev_dbg(dev, fmt, ...) \
1416 dev_printk(KERN_DEBUG, dev, format, ##arg) 1431 dev_printk(KERN_DEBUG, dev, dev_fmt(fmt), ##__VA_ARGS__)
1417#else 1432#else
1418#define dev_dbg(dev, format, arg...) \ 1433#define dev_dbg(dev, fmt, ...) \
1419({ \ 1434({ \
1420 if (0) \ 1435 if (0) \
1421 dev_printk(KERN_DEBUG, dev, format, ##arg); \ 1436 dev_printk(KERN_DEBUG, dev, dev_fmt(fmt), ##__VA_ARGS__); \
1422}) 1437})
1423#endif 1438#endif
1424 1439
@@ -1490,7 +1505,7 @@ do { \
1490 DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ 1505 DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \
1491 if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT) && \ 1506 if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT) && \
1492 __ratelimit(&_rs)) \ 1507 __ratelimit(&_rs)) \
1493 __dynamic_dev_dbg(&descriptor, dev, fmt, \ 1508 __dynamic_dev_dbg(&descriptor, dev, dev_fmt(fmt), \
1494 ##__VA_ARGS__); \ 1509 ##__VA_ARGS__); \
1495} while (0) 1510} while (0)
1496#elif defined(DEBUG) 1511#elif defined(DEBUG)
@@ -1500,23 +1515,23 @@ do { \
1500 DEFAULT_RATELIMIT_INTERVAL, \ 1515 DEFAULT_RATELIMIT_INTERVAL, \
1501 DEFAULT_RATELIMIT_BURST); \ 1516 DEFAULT_RATELIMIT_BURST); \
1502 if (__ratelimit(&_rs)) \ 1517 if (__ratelimit(&_rs)) \
1503 dev_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__); \ 1518 dev_printk(KERN_DEBUG, dev, dev_fmt(fmt), ##__VA_ARGS__); \
1504} while (0) 1519} while (0)
1505#else 1520#else
1506#define dev_dbg_ratelimited(dev, fmt, ...) \ 1521#define dev_dbg_ratelimited(dev, fmt, ...) \
1507do { \ 1522do { \
1508 if (0) \ 1523 if (0) \
1509 dev_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__); \ 1524 dev_printk(KERN_DEBUG, dev, dev_fmt(fmt), ##__VA_ARGS__); \
1510} while (0) 1525} while (0)
1511#endif 1526#endif
1512 1527
1513#ifdef VERBOSE_DEBUG 1528#ifdef VERBOSE_DEBUG
1514#define dev_vdbg dev_dbg 1529#define dev_vdbg dev_dbg
1515#else 1530#else
1516#define dev_vdbg(dev, format, arg...) \ 1531#define dev_vdbg(dev, fmt, ...) \
1517({ \ 1532({ \
1518 if (0) \ 1533 if (0) \
1519 dev_printk(KERN_DEBUG, dev, format, ##arg); \ 1534 dev_printk(KERN_DEBUG, dev, dev_fmt(fmt), ##__VA_ARGS__); \
1520}) 1535})
1521#endif 1536#endif
1522 1537
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index b49ff230beba..1ab0d624fb36 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -119,6 +119,23 @@ extern void kobject_get_ownership(struct kobject *kobj,
119 kuid_t *uid, kgid_t *gid); 119 kuid_t *uid, kgid_t *gid);
120extern char *kobject_get_path(struct kobject *kobj, gfp_t flag); 120extern char *kobject_get_path(struct kobject *kobj, gfp_t flag);
121 121
122/**
123 * kobject_has_children - Returns whether a kobject has children.
124 * @kobj: the object to test
125 *
126 * This will return whether a kobject has other kobjects as children.
127 *
128 * It does NOT account for the presence of attribute files, only sub
129 * directories. It also assumes there is no concurrent addition or
130 * removal of such children, and thus relies on external locking.
131 */
132static inline bool kobject_has_children(struct kobject *kobj)
133{
134 WARN_ON_ONCE(kref_read(&kobj->kref) == 0);
135
136 return kobj->sd && kobj->sd->dir.subdirs;
137}
138
122struct kobj_type { 139struct kobj_type {
123 void (*release)(struct kobject *kobj); 140 void (*release)(struct kobject *kobj);
124 const struct sysfs_ops *sysfs_ops; 141 const struct sysfs_ops *sysfs_ops;
diff --git a/include/linux/of_iommu.h b/include/linux/of_iommu.h
index 4fa654e4b5a9..f3d40dd7bb66 100644
--- a/include/linux/of_iommu.h
+++ b/include/linux/of_iommu.h
@@ -32,8 +32,4 @@ static inline const struct iommu_ops *of_iommu_configure(struct device *dev,
32 32
33#endif /* CONFIG_OF_IOMMU */ 33#endif /* CONFIG_OF_IOMMU */
34 34
35extern struct of_device_id __iommu_of_table;
36
37#define IOMMU_OF_DECLARE(name, compat) OF_DECLARE_1(iommu, name, compat, NULL)
38
39#endif /* __OF_IOMMU_H */ 35#endif /* __OF_IOMMU_H */
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index 3c12198c0103..987cefa337de 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -91,9 +91,9 @@ struct attribute_group {
91 struct bin_attribute **bin_attrs; 91 struct bin_attribute **bin_attrs;
92}; 92};
93 93
94/** 94/*
95 * Use these macros to make defining attributes easier. See include/linux/device.h 95 * Use these macros to make defining attributes easier.
96 * for examples.. 96 * See include/linux/device.h for examples..
97 */ 97 */
98 98
99#define SYSFS_PREALLOC 010000 99#define SYSFS_PREALLOC 010000
diff --git a/lib/kobject.c b/lib/kobject.c
index 389829d3a1d1..97d86dc17c42 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -144,7 +144,7 @@ static void fill_kobj_path(struct kobject *kobj, char *path, int length)
144 int cur = strlen(kobject_name(parent)); 144 int cur = strlen(kobject_name(parent));
145 /* back up enough to print this name with '/' */ 145 /* back up enough to print this name with '/' */
146 length -= cur; 146 length -= cur;
147 strncpy(path + length, kobject_name(parent), cur); 147 memcpy(path + length, kobject_name(parent), cur);
148 *(path + --length) = '/'; 148 *(path + --length) = '/';
149 } 149 }
150 150