From patchwork Tue Oct 2 06:32:59 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [01/10] device: add drivers_autoprobe in struct device Date: Mon, 01 Oct 2012 20:32:59 -0000 From: Yinghai Lu X-Patchwork-Id: 188385 Message-Id: <1349159588-15029-2-git-send-email-yinghai@kernel.org> To: Bjorn Helgaas Cc: linux-pci@vger.kernel.org, Yinghai Lu , Greg Kroah-Hartman To use to control the delay attach driver for specific device. Will use bus notifier to toggle this bits when needed. Signed-off-by: Yinghai Lu Cc: Greg Kroah-Hartman --- drivers/base/bus.c | 2 +- drivers/base/core.c | 1 + include/linux/device.h | 1 + 3 files changed, 3 insertions(+), 1 deletions(-) diff --git a/drivers/base/bus.c b/drivers/base/bus.c index 181ed26..22b826a 100644 --- a/drivers/base/bus.c +++ b/drivers/base/bus.c @@ -538,7 +538,7 @@ void bus_probe_device(struct device *dev) if (!bus) return; - if (bus->p->drivers_autoprobe) { + if (bus->p->drivers_autoprobe && dev->drivers_autoprobe) { ret = device_attach(dev); WARN_ON(ret < 0); } diff --git a/drivers/base/core.c b/drivers/base/core.c index 5e6e00b..8a71f88 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -656,6 +656,7 @@ void device_initialize(struct device *dev) INIT_LIST_HEAD(&dev->devres_head); device_pm_init(dev); set_dev_node(dev, -1); + dev->drivers_autoprobe = true; } static struct kobject *virtual_device_parent(struct device *dev) diff --git a/include/linux/device.h b/include/linux/device.h index 52a5f15..e08db26 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -647,6 +647,7 @@ struct device { struct bus_type *bus; /* type of bus device is on */ struct device_driver *driver; /* which driver has allocated this device */ + bool drivers_autoprobe; void *platform_data; /* Platform specific data, device core doesn't touch it */ struct dev_pm_info power;