aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/pci-driver.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci/pci-driver.c')
-rw-r--r--drivers/pci/pci-driver.c51
1 files changed, 24 insertions, 27 deletions
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index b91a17fe425b..3f8e3dbcaa7c 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -99,15 +99,15 @@ static void pci_free_dynids(struct pci_driver *drv)
99 * 99 *
100 * Allow PCI IDs to be added to an existing driver via sysfs. 100 * Allow PCI IDs to be added to an existing driver via sysfs.
101 */ 101 */
102static ssize_t 102static ssize_t store_new_id(struct device_driver *driver, const char *buf,
103store_new_id(struct device_driver *driver, const char *buf, size_t count) 103 size_t count)
104{ 104{
105 struct pci_driver *pdrv = to_pci_driver(driver); 105 struct pci_driver *pdrv = to_pci_driver(driver);
106 const struct pci_device_id *ids = pdrv->id_table; 106 const struct pci_device_id *ids = pdrv->id_table;
107 __u32 vendor, device, subvendor=PCI_ANY_ID, 107 __u32 vendor, device, subvendor = PCI_ANY_ID,
108 subdevice=PCI_ANY_ID, class=0, class_mask=0; 108 subdevice = PCI_ANY_ID, class = 0, class_mask = 0;
109 unsigned long driver_data=0; 109 unsigned long driver_data = 0;
110 int fields=0; 110 int fields = 0;
111 int retval = 0; 111 int retval = 0;
112 112
113 fields = sscanf(buf, "%x %x %x %x %x %x %lx", 113 fields = sscanf(buf, "%x %x %x %x %x %x %lx",
@@ -167,8 +167,8 @@ static DRIVER_ATTR(new_id, S_IWUSR, NULL, store_new_id);
167 * 167 *
168 * Removes a dynamic pci device ID to this driver. 168 * Removes a dynamic pci device ID to this driver.
169 */ 169 */
170static ssize_t 170static ssize_t store_remove_id(struct device_driver *driver, const char *buf,
171store_remove_id(struct device_driver *driver, const char *buf, size_t count) 171 size_t count)
172{ 172{
173 struct pci_dynid *dynid, *n; 173 struct pci_dynid *dynid, *n;
174 struct pci_driver *pdrv = to_pci_driver(driver); 174 struct pci_driver *pdrv = to_pci_driver(driver);
@@ -374,8 +374,7 @@ static int pci_call_probe(struct pci_driver *drv, struct pci_dev *dev,
374 * returns 0 on success, else error. 374 * returns 0 on success, else error.
375 * side-effect: pci_dev->driver is set to drv when drv claims pci_dev. 375 * side-effect: pci_dev->driver is set to drv when drv claims pci_dev.
376 */ 376 */
377static int 377static int __pci_device_probe(struct pci_driver *drv, struct pci_dev *pci_dev)
378__pci_device_probe(struct pci_driver *drv, struct pci_dev *pci_dev)
379{ 378{
380 const struct pci_device_id *id; 379 const struct pci_device_id *id;
381 int error = 0; 380 int error = 0;
@@ -392,7 +391,7 @@ __pci_device_probe(struct pci_driver *drv, struct pci_dev *pci_dev)
392 return error; 391 return error;
393} 392}
394 393
395static int pci_device_probe(struct device * dev) 394static int pci_device_probe(struct device *dev)
396{ 395{
397 int error = 0; 396 int error = 0;
398 struct pci_driver *drv; 397 struct pci_driver *drv;
@@ -408,10 +407,10 @@ static int pci_device_probe(struct device * dev)
408 return error; 407 return error;
409} 408}
410 409
411static int pci_device_remove(struct device * dev) 410static int pci_device_remove(struct device *dev)
412{ 411{
413 struct pci_dev * pci_dev = to_pci_dev(dev); 412 struct pci_dev *pci_dev = to_pci_dev(dev);
414 struct pci_driver * drv = pci_dev->driver; 413 struct pci_driver *drv = pci_dev->driver;
415 414
416 if (drv) { 415 if (drv) {
417 if (drv->remove) { 416 if (drv->remove) {
@@ -539,8 +538,8 @@ static int pci_pm_reenable_device(struct pci_dev *pci_dev)
539 538
540static int pci_legacy_suspend(struct device *dev, pm_message_t state) 539static int pci_legacy_suspend(struct device *dev, pm_message_t state)
541{ 540{
542 struct pci_dev * pci_dev = to_pci_dev(dev); 541 struct pci_dev *pci_dev = to_pci_dev(dev);
543 struct pci_driver * drv = pci_dev->driver; 542 struct pci_driver *drv = pci_dev->driver;
544 543
545 if (drv && drv->suspend) { 544 if (drv && drv->suspend) {
546 pci_power_t prev = pci_dev->current_state; 545 pci_power_t prev = pci_dev->current_state;
@@ -566,8 +565,8 @@ static int pci_legacy_suspend(struct device *dev, pm_message_t state)
566 565
567static int pci_legacy_suspend_late(struct device *dev, pm_message_t state) 566static int pci_legacy_suspend_late(struct device *dev, pm_message_t state)
568{ 567{
569 struct pci_dev * pci_dev = to_pci_dev(dev); 568 struct pci_dev *pci_dev = to_pci_dev(dev);
570 struct pci_driver * drv = pci_dev->driver; 569 struct pci_driver *drv = pci_dev->driver;
571 570
572 if (drv && drv->suspend_late) { 571 if (drv && drv->suspend_late) {
573 pci_power_t prev = pci_dev->current_state; 572 pci_power_t prev = pci_dev->current_state;
@@ -597,8 +596,8 @@ static int pci_legacy_suspend_late(struct device *dev, pm_message_t state)
597 596
598static int pci_legacy_resume_early(struct device *dev) 597static int pci_legacy_resume_early(struct device *dev)
599{ 598{
600 struct pci_dev * pci_dev = to_pci_dev(dev); 599 struct pci_dev *pci_dev = to_pci_dev(dev);
601 struct pci_driver * drv = pci_dev->driver; 600 struct pci_driver *drv = pci_dev->driver;
602 601
603 return drv && drv->resume_early ? 602 return drv && drv->resume_early ?
604 drv->resume_early(pci_dev) : 0; 603 drv->resume_early(pci_dev) : 0;
@@ -606,8 +605,8 @@ static int pci_legacy_resume_early(struct device *dev)
606 605
607static int pci_legacy_resume(struct device *dev) 606static int pci_legacy_resume(struct device *dev)
608{ 607{
609 struct pci_dev * pci_dev = to_pci_dev(dev); 608 struct pci_dev *pci_dev = to_pci_dev(dev);
610 struct pci_driver * drv = pci_dev->driver; 609 struct pci_driver *drv = pci_dev->driver;
611 610
612 pci_fixup_device(pci_fixup_resume, pci_dev); 611 pci_fixup_device(pci_fixup_resume, pci_dev);
613 612
@@ -1269,8 +1268,7 @@ EXPORT_SYMBOL(__pci_register_driver);
1269 * driverless. 1268 * driverless.
1270 */ 1269 */
1271 1270
1272void 1271void pci_unregister_driver(struct pci_driver *drv)
1273pci_unregister_driver(struct pci_driver *drv)
1274{ 1272{
1275 driver_unregister(&drv->driver); 1273 driver_unregister(&drv->driver);
1276 pci_free_dynids(drv); 1274 pci_free_dynids(drv);
@@ -1288,14 +1286,13 @@ static struct pci_driver pci_compat_driver = {
1288 * Returns the appropriate pci_driver structure or %NULL if there is no 1286 * Returns the appropriate pci_driver structure or %NULL if there is no
1289 * registered driver for the device. 1287 * registered driver for the device.
1290 */ 1288 */
1291struct pci_driver * 1289struct pci_driver *pci_dev_driver(const struct pci_dev *dev)
1292pci_dev_driver(const struct pci_dev *dev)
1293{ 1290{
1294 if (dev->driver) 1291 if (dev->driver)
1295 return dev->driver; 1292 return dev->driver;
1296 else { 1293 else {
1297 int i; 1294 int i;
1298 for(i=0; i<=PCI_ROM_RESOURCE; i++) 1295 for (i = 0; i <= PCI_ROM_RESOURCE; i++)
1299 if (dev->resource[i].flags & IORESOURCE_BUSY) 1296 if (dev->resource[i].flags & IORESOURCE_BUSY)
1300 return &pci_compat_driver; 1297 return &pci_compat_driver;
1301 } 1298 }