driver-core: remove lock for platform devices during probe
During driver probe procedure, lock on the parent of platform devices could be removed to make probe in parallel. Change-Id: I5457869e056a55b51dd91937d6202947b13977eb Signed-off-by: vkakani <vkakani@codeaurora.org> Signed-off-by: Wei Li <weili@codeaurora.org>
This commit is contained in:
parent
c7a3fb0e9b
commit
030cf68850
2 changed files with 20 additions and 4 deletions
4
Makefile
4
Makefile
|
@ -404,7 +404,9 @@ KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
|
|||
-Wno-format-security \
|
||||
-std=gnu89 $(call cc-option,-fno-PIE)
|
||||
|
||||
|
||||
ifeq ($(TARGET_BOARD_TYPE),auto)
|
||||
KBUILD_CFLAGS += -DCONFIG_PLATFORM_AUTO
|
||||
endif
|
||||
KBUILD_AFLAGS_KERNEL :=
|
||||
KBUILD_CFLAGS_KERNEL :=
|
||||
KBUILD_AFLAGS := -D__ASSEMBLY__ $(call cc-option,-fno-PIE)
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include <linux/async.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
#include <linux/pinctrl/devinfo.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
||||
#include "base.h"
|
||||
#include "power/power.h"
|
||||
|
@ -642,6 +643,20 @@ void device_initial_probe(struct device *dev)
|
|||
{
|
||||
__device_attach(dev, true);
|
||||
}
|
||||
#ifdef CONFIG_PLATFORM_AUTO
|
||||
static inline int lock_parent(struct device *dev)
|
||||
{
|
||||
if (!dev->parent || dev->bus == &platform_bus_type)
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
#else
|
||||
static inline int lock_parent(struct device *dev)
|
||||
{
|
||||
return dev->parent ? 1 : 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int __driver_attach(struct device *dev, void *data)
|
||||
{
|
||||
|
@ -659,14 +674,13 @@ static int __driver_attach(struct device *dev, void *data)
|
|||
|
||||
if (!driver_match_device(drv, dev))
|
||||
return 0;
|
||||
|
||||
if (dev->parent) /* Needed for USB */
|
||||
if (lock_parent(dev))
|
||||
device_lock(dev->parent);
|
||||
device_lock(dev);
|
||||
if (!dev->driver)
|
||||
driver_probe_device(drv, dev);
|
||||
device_unlock(dev);
|
||||
if (dev->parent)
|
||||
if (lock_parent(dev))
|
||||
device_unlock(dev->parent);
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Reference in a new issue