@@ -138,9 +138,11 @@ static const struct pci_device_id *pci_match_device(struct pci_driver *drv,
138138{
139139 struct pci_dynid * dynid ;
140140 const struct pci_device_id * found_id = NULL , * ids ;
141+ int ret ;
141142
142143 /* When driver_override is set, only bind to the matching driver */
143- if (dev -> driver_override && strcmp (dev -> driver_override , drv -> name ))
144+ ret = device_match_driver_override (& dev -> dev , & drv -> driver );
145+ if (ret == 0 )
144146 return NULL ;
145147
146148 /* Look at the dynamic ids first, before the static ones */
@@ -164,15 +166,15 @@ static const struct pci_device_id *pci_match_device(struct pci_driver *drv,
164166 * matching.
165167 */
166168 if (found_id -> override_only ) {
167- if (dev -> driver_override )
169+ if (ret > 0 )
168170 return found_id ;
169171 } else {
170172 return found_id ;
171173 }
172174 }
173175
174176 /* driver_override will always match, send a dummy id */
175- if (dev -> driver_override )
177+ if (ret > 0 )
176178 return & pci_device_id_any ;
177179 return NULL ;
178180}
@@ -452,7 +454,7 @@ static int __pci_device_probe(struct pci_driver *drv, struct pci_dev *pci_dev)
452454static inline bool pci_device_can_probe (struct pci_dev * pdev )
453455{
454456 return (!pdev -> is_virtfn || pdev -> physfn -> sriov -> drivers_autoprobe ||
455- pdev -> driver_override );
457+ device_has_driver_override ( & pdev -> dev ) );
456458}
457459#else
458460static inline bool pci_device_can_probe (struct pci_dev * pdev )
@@ -1722,6 +1724,7 @@ static const struct cpumask *pci_device_irq_get_affinity(struct device *dev,
17221724
17231725const struct bus_type pci_bus_type = {
17241726 .name = "pci" ,
1727+ .driver_override = true,
17251728 .match = pci_bus_match ,
17261729 .uevent = pci_uevent ,
17271730 .probe = pci_device_probe ,
0 commit comments