diff options
Diffstat (limited to 'drivers/pci')
-rw-r--r-- | drivers/pci/pci-sysfs.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c index dfc4e0ddf241..1c8929801400 100644 --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c | |||
@@ -493,6 +493,19 @@ pci_mmap_legacy_io(struct kobject *kobj, struct bin_attribute *attr, | |||
493 | } | 493 | } |
494 | 494 | ||
495 | /** | 495 | /** |
496 | * pci_adjust_legacy_attr - adjustment of legacy file attributes | ||
497 | * @b: bus to create files under | ||
498 | * @mmap_type: I/O port or memory | ||
499 | * | ||
500 | * Stub implementation. Can be overridden by arch if necessary. | ||
501 | */ | ||
502 | void __weak | ||
503 | pci_adjust_legacy_attr(struct pci_bus *b, enum pci_mmap_state mmap_type) | ||
504 | { | ||
505 | return; | ||
506 | } | ||
507 | |||
508 | /** | ||
496 | * pci_create_legacy_files - create legacy I/O port and memory files | 509 | * pci_create_legacy_files - create legacy I/O port and memory files |
497 | * @b: bus to create files under | 510 | * @b: bus to create files under |
498 | * | 511 | * |
@@ -518,6 +531,7 @@ void pci_create_legacy_files(struct pci_bus *b) | |||
518 | b->legacy_io->read = pci_read_legacy_io; | 531 | b->legacy_io->read = pci_read_legacy_io; |
519 | b->legacy_io->write = pci_write_legacy_io; | 532 | b->legacy_io->write = pci_write_legacy_io; |
520 | b->legacy_io->mmap = pci_mmap_legacy_io; | 533 | b->legacy_io->mmap = pci_mmap_legacy_io; |
534 | pci_adjust_legacy_attr(b, pci_mmap_io); | ||
521 | error = device_create_bin_file(&b->dev, b->legacy_io); | 535 | error = device_create_bin_file(&b->dev, b->legacy_io); |
522 | if (error) | 536 | if (error) |
523 | goto legacy_io_err; | 537 | goto legacy_io_err; |
@@ -528,6 +542,7 @@ void pci_create_legacy_files(struct pci_bus *b) | |||
528 | b->legacy_mem->size = 1024*1024; | 542 | b->legacy_mem->size = 1024*1024; |
529 | b->legacy_mem->attr.mode = S_IRUSR | S_IWUSR; | 543 | b->legacy_mem->attr.mode = S_IRUSR | S_IWUSR; |
530 | b->legacy_mem->mmap = pci_mmap_legacy_mem; | 544 | b->legacy_mem->mmap = pci_mmap_legacy_mem; |
545 | pci_adjust_legacy_attr(b, pci_mmap_mem); | ||
531 | error = device_create_bin_file(&b->dev, b->legacy_mem); | 546 | error = device_create_bin_file(&b->dev, b->legacy_mem); |
532 | if (error) | 547 | if (error) |
533 | goto legacy_mem_err; | 548 | goto legacy_mem_err; |
@@ -719,8 +734,8 @@ static int pci_create_resource_files(struct pci_dev *pdev) | |||
719 | return 0; | 734 | return 0; |
720 | } | 735 | } |
721 | #else /* !HAVE_PCI_MMAP */ | 736 | #else /* !HAVE_PCI_MMAP */ |
722 | static inline int pci_create_resource_files(struct pci_dev *dev) { return 0; } | 737 | int __weak pci_create_resource_files(struct pci_dev *dev) { return 0; } |
723 | static inline void pci_remove_resource_files(struct pci_dev *dev) { return; } | 738 | void __weak pci_remove_resource_files(struct pci_dev *dev) { return; } |
724 | #endif /* HAVE_PCI_MMAP */ | 739 | #endif /* HAVE_PCI_MMAP */ |
725 | 740 | ||
726 | /** | 741 | /** |