aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/pci/bus.c5
-rw-r--r--drivers/pci/pci-driver.c6
-rw-r--r--include/linux/pci.h1
3 files changed, 11 insertions, 1 deletions
diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c
index 847f3ca47bb8..c8709c6fdb7c 100644
--- a/drivers/pci/bus.c
+++ b/drivers/pci/bus.c
@@ -177,10 +177,15 @@ int pci_bus_add_device(struct pci_dev *dev)
177 if (retval) 177 if (retval)
178 return retval; 178 return retval;
179 179
180 dev->match_driver = false;
180 retval = device_add(&dev->dev); 181 retval = device_add(&dev->dev);
181 if (retval) 182 if (retval)
182 return retval; 183 return retval;
183 184
185 dev->match_driver = true;
186 retval = device_attach(&dev->dev);
187 WARN_ON(retval < 0);
188
184 dev->is_added = 1; 189 dev->is_added = 1;
185 pci_proc_attach_device(dev); 190 pci_proc_attach_device(dev);
186 pci_create_sysfs_dev_files(dev); 191 pci_create_sysfs_dev_files(dev);
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index f79cbcd3944b..acdcc3c6ecdd 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -1186,9 +1186,13 @@ pci_dev_driver(const struct pci_dev *dev)
1186static int pci_bus_match(struct device *dev, struct device_driver *drv) 1186static int pci_bus_match(struct device *dev, struct device_driver *drv)
1187{ 1187{
1188 struct pci_dev *pci_dev = to_pci_dev(dev); 1188 struct pci_dev *pci_dev = to_pci_dev(dev);
1189 struct pci_driver *pci_drv = to_pci_driver(drv); 1189 struct pci_driver *pci_drv;
1190 const struct pci_device_id *found_id; 1190 const struct pci_device_id *found_id;
1191 1191
1192 if (!pci_dev->match_driver)
1193 return 0;
1194
1195 pci_drv = to_pci_driver(drv);
1192 found_id = pci_match_device(pci_drv, pci_dev); 1196 found_id = pci_match_device(pci_drv, pci_dev);
1193 if (found_id) 1197 if (found_id)
1194 return 1; 1198 return 1;
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 907b455ab603..8ee7e4e46539 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -286,6 +286,7 @@ struct pci_dev {
286 unsigned int irq; 286 unsigned int irq;
287 struct resource resource[DEVICE_COUNT_RESOURCE]; /* I/O and memory regions + expansion ROMs */ 287 struct resource resource[DEVICE_COUNT_RESOURCE]; /* I/O and memory regions + expansion ROMs */
288 288
289 bool match_driver; /* Skip attaching driver */
289 /* These fields are used by common fixups */ 290 /* These fields are used by common fixups */
290 unsigned int transparent:1; /* Transparent PCI bridge */ 291 unsigned int transparent:1; /* Transparent PCI bridge */
291 unsigned int multifunction:1;/* Part of multi-function device */ 292 unsigned int multifunction:1;/* Part of multi-function device */