|
26 | 26 | #include <linux/of.h>
|
27 | 27 | #include <linux/of_device.h>
|
28 | 28 | #include <linux/pm_runtime.h>
|
29 |
| -#include <linux/rcupdate.h> |
30 | 29 | #include <linux/sched/mm.h>
|
31 | 30 | #include <linux/sched/signal.h>
|
32 | 31 | #include <linux/slab.h>
|
@@ -2634,7 +2633,6 @@ static const char *dev_uevent_name(const struct kobject *kobj)
|
2634 | 2633 | static int dev_uevent(const struct kobject *kobj, struct kobj_uevent_env *env)
|
2635 | 2634 | {
|
2636 | 2635 | const struct device *dev = kobj_to_dev(kobj);
|
2637 |
| - struct device_driver *driver; |
2638 | 2636 | int retval = 0;
|
2639 | 2637 |
|
2640 | 2638 | /* add device node properties if present */
|
@@ -2663,12 +2661,8 @@ static int dev_uevent(const struct kobject *kobj, struct kobj_uevent_env *env)
|
2663 | 2661 | if (dev->type && dev->type->name)
|
2664 | 2662 | add_uevent_var(env, "DEVTYPE=%s", dev->type->name);
|
2665 | 2663 |
|
2666 |
| - /* Synchronize with module_remove_driver() */ |
2667 |
| - rcu_read_lock(); |
2668 |
| - driver = READ_ONCE(dev->driver); |
2669 |
| - if (driver) |
2670 |
| - add_uevent_var(env, "DRIVER=%s", driver->name); |
2671 |
| - rcu_read_unlock(); |
| 2664 | + if (dev->driver) |
| 2665 | + add_uevent_var(env, "DRIVER=%s", dev->driver->name); |
2672 | 2666 |
|
2673 | 2667 | /* Add common DT information about the device */
|
2674 | 2668 | of_device_uevent(dev, env);
|
@@ -2738,8 +2732,11 @@ static ssize_t uevent_show(struct device *dev, struct device_attribute *attr,
|
2738 | 2732 | if (!env)
|
2739 | 2733 | return -ENOMEM;
|
2740 | 2734 |
|
| 2735 | + /* Synchronize with really_probe() */ |
| 2736 | + device_lock(dev); |
2741 | 2737 | /* let the kset specific function add its keys */
|
2742 | 2738 | retval = kset->uevent_ops->uevent(&dev->kobj, env);
|
| 2739 | + device_unlock(dev); |
2743 | 2740 | if (retval)
|
2744 | 2741 | goto out;
|
2745 | 2742 |
|
|
0 commit comments