diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-08-11 13:38:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-08-11 13:38:36 -0400 |
commit | a7ef6a40f700496c60b8f7206fff74fecd67b3a2 (patch) | |
tree | aaba79c8ebafe06787b52c686505c76e15b81bdb | |
parent | 000b9151d7851cc1e490b2a76d0206e524f43cca (diff) | |
parent | 35405f256de924be56ea5edaca4cdc627f1bb0f8 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6:
PCI: Limit VPD length for Broadcom 5708S
PCI PM: Export pci_pme_active to drivers
PCI: remove duplicate symbol from pci_ids.h
PCI: check the return value of device_create_bin_file() in pci_create_bus()
PCI: fully restore MSI state at resume time
DMA: make dma-coherent.c documentation kdoc-friendly
PCI: make pci_register_driver() a macro
PCI: add Broadcom 5708S to VPD length quirk
-rw-r--r-- | drivers/pci/msi.c | 5 | ||||
-rw-r--r-- | drivers/pci/pci.c | 3 | ||||
-rw-r--r-- | drivers/pci/probe.c | 54 | ||||
-rw-r--r-- | drivers/pci/quirks.c | 7 | ||||
-rw-r--r-- | include/linux/pci.h | 11 | ||||
-rw-r--r-- | include/linux/pci_ids.h | 2 | ||||
-rw-r--r-- | kernel/dma-coherent.c | 10 |
7 files changed, 60 insertions, 32 deletions
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index 18354817173c..4a10b5624f72 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c | |||
@@ -308,9 +308,8 @@ static void __pci_restore_msi_state(struct pci_dev *dev) | |||
308 | entry->msi_attrib.masked); | 308 | entry->msi_attrib.masked); |
309 | 309 | ||
310 | pci_read_config_word(dev, pos + PCI_MSI_FLAGS, &control); | 310 | pci_read_config_word(dev, pos + PCI_MSI_FLAGS, &control); |
311 | control &= ~(PCI_MSI_FLAGS_QSIZE | PCI_MSI_FLAGS_ENABLE); | 311 | control &= ~PCI_MSI_FLAGS_QSIZE; |
312 | if (entry->msi_attrib.maskbit || !entry->msi_attrib.masked) | 312 | control |= PCI_MSI_FLAGS_ENABLE; |
313 | control |= PCI_MSI_FLAGS_ENABLE; | ||
314 | pci_write_config_word(dev, pos + PCI_MSI_FLAGS, control); | 313 | pci_write_config_word(dev, pos + PCI_MSI_FLAGS, control); |
315 | } | 314 | } |
316 | 315 | ||
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 0a3d856833fc..c9884bba22de 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -1060,7 +1060,7 @@ bool pci_pme_capable(struct pci_dev *dev, pci_power_t state) | |||
1060 | * The caller must verify that the device is capable of generating PME# before | 1060 | * The caller must verify that the device is capable of generating PME# before |
1061 | * calling this function with @enable equal to 'true'. | 1061 | * calling this function with @enable equal to 'true'. |
1062 | */ | 1062 | */ |
1063 | static void pci_pme_active(struct pci_dev *dev, bool enable) | 1063 | void pci_pme_active(struct pci_dev *dev, bool enable) |
1064 | { | 1064 | { |
1065 | u16 pmcsr; | 1065 | u16 pmcsr; |
1066 | 1066 | ||
@@ -1941,6 +1941,7 @@ EXPORT_SYMBOL(pci_set_power_state); | |||
1941 | EXPORT_SYMBOL(pci_save_state); | 1941 | EXPORT_SYMBOL(pci_save_state); |
1942 | EXPORT_SYMBOL(pci_restore_state); | 1942 | EXPORT_SYMBOL(pci_restore_state); |
1943 | EXPORT_SYMBOL(pci_pme_capable); | 1943 | EXPORT_SYMBOL(pci_pme_capable); |
1944 | EXPORT_SYMBOL(pci_pme_active); | ||
1944 | EXPORT_SYMBOL(pci_enable_wake); | 1945 | EXPORT_SYMBOL(pci_enable_wake); |
1945 | EXPORT_SYMBOL(pci_target_state); | 1946 | EXPORT_SYMBOL(pci_target_state); |
1946 | EXPORT_SYMBOL(pci_prepare_to_sleep); | 1947 | EXPORT_SYMBOL(pci_prepare_to_sleep); |
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 7098dfb07449..a04498d390c8 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c | |||
@@ -52,27 +52,49 @@ EXPORT_SYMBOL(no_pci_devices); | |||
52 | * Some platforms allow access to legacy I/O port and ISA memory space on | 52 | * Some platforms allow access to legacy I/O port and ISA memory space on |
53 | * a per-bus basis. This routine creates the files and ties them into | 53 | * a per-bus basis. This routine creates the files and ties them into |
54 | * their associated read, write and mmap files from pci-sysfs.c | 54 | * their associated read, write and mmap files from pci-sysfs.c |
55 | * | ||
56 | * On error unwind, but don't propogate the error to the caller | ||
57 | * as it is ok to set up the PCI bus without these files. | ||
55 | */ | 58 | */ |
56 | static void pci_create_legacy_files(struct pci_bus *b) | 59 | static void pci_create_legacy_files(struct pci_bus *b) |
57 | { | 60 | { |
61 | int error; | ||
62 | |||
58 | b->legacy_io = kzalloc(sizeof(struct bin_attribute) * 2, | 63 | b->legacy_io = kzalloc(sizeof(struct bin_attribute) * 2, |
59 | GFP_ATOMIC); | 64 | GFP_ATOMIC); |
60 | if (b->legacy_io) { | 65 | if (!b->legacy_io) |
61 | b->legacy_io->attr.name = "legacy_io"; | 66 | goto kzalloc_err; |
62 | b->legacy_io->size = 0xffff; | 67 | |
63 | b->legacy_io->attr.mode = S_IRUSR | S_IWUSR; | 68 | b->legacy_io->attr.name = "legacy_io"; |
64 | b->legacy_io->read = pci_read_legacy_io; | 69 | b->legacy_io->size = 0xffff; |
65 | b->legacy_io->write = pci_write_legacy_io; | 70 | b->legacy_io->attr.mode = S_IRUSR | S_IWUSR; |
66 | device_create_bin_file(&b->dev, b->legacy_io); | 71 | b->legacy_io->read = pci_read_legacy_io; |
67 | 72 | b->legacy_io->write = pci_write_legacy_io; | |
68 | /* Allocated above after the legacy_io struct */ | 73 | error = device_create_bin_file(&b->dev, b->legacy_io); |
69 | b->legacy_mem = b->legacy_io + 1; | 74 | if (error) |
70 | b->legacy_mem->attr.name = "legacy_mem"; | 75 | goto legacy_io_err; |
71 | b->legacy_mem->size = 1024*1024; | 76 | |
72 | b->legacy_mem->attr.mode = S_IRUSR | S_IWUSR; | 77 | /* Allocated above after the legacy_io struct */ |
73 | b->legacy_mem->mmap = pci_mmap_legacy_mem; | 78 | b->legacy_mem = b->legacy_io + 1; |
74 | device_create_bin_file(&b->dev, b->legacy_mem); | 79 | b->legacy_mem->attr.name = "legacy_mem"; |
75 | } | 80 | b->legacy_mem->size = 1024*1024; |
81 | b->legacy_mem->attr.mode = S_IRUSR | S_IWUSR; | ||
82 | b->legacy_mem->mmap = pci_mmap_legacy_mem; | ||
83 | error = device_create_bin_file(&b->dev, b->legacy_mem); | ||
84 | if (error) | ||
85 | goto legacy_mem_err; | ||
86 | |||
87 | return; | ||
88 | |||
89 | legacy_mem_err: | ||
90 | device_remove_bin_file(&b->dev, b->legacy_io); | ||
91 | legacy_io_err: | ||
92 | kfree(b->legacy_io); | ||
93 | b->legacy_io = NULL; | ||
94 | kzalloc_err: | ||
95 | printk(KERN_WARNING "pci: warning: could not create legacy I/O port " | ||
96 | "and ISA memory resources to sysfs\n"); | ||
97 | return; | ||
76 | } | 98 | } |
77 | 99 | ||
78 | void pci_remove_legacy_files(struct pci_bus *b) | 100 | void pci_remove_legacy_files(struct pci_bus *b) |
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 0fb365074288..9236e7f869c8 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c | |||
@@ -1756,9 +1756,14 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_VIA, 0x324e, quirk_via_cx700_pci_parking_c | |||
1756 | */ | 1756 | */ |
1757 | static void __devinit quirk_brcm_570x_limit_vpd(struct pci_dev *dev) | 1757 | static void __devinit quirk_brcm_570x_limit_vpd(struct pci_dev *dev) |
1758 | { | 1758 | { |
1759 | /* Only disable the VPD capability for 5706, 5708, and 5709 rev. A */ | 1759 | /* |
1760 | * Only disable the VPD capability for 5706, 5706S, 5708, | ||
1761 | * 5708S and 5709 rev. A | ||
1762 | */ | ||
1760 | if ((dev->device == PCI_DEVICE_ID_NX2_5706) || | 1763 | if ((dev->device == PCI_DEVICE_ID_NX2_5706) || |
1764 | (dev->device == PCI_DEVICE_ID_NX2_5706S) || | ||
1761 | (dev->device == PCI_DEVICE_ID_NX2_5708) || | 1765 | (dev->device == PCI_DEVICE_ID_NX2_5708) || |
1766 | (dev->device == PCI_DEVICE_ID_NX2_5708S) || | ||
1762 | ((dev->device == PCI_DEVICE_ID_NX2_5709) && | 1767 | ((dev->device == PCI_DEVICE_ID_NX2_5709) && |
1763 | (dev->revision & 0xf0) == 0x0)) { | 1768 | (dev->revision & 0xf0) == 0x0)) { |
1764 | if (dev->vpd) | 1769 | if (dev->vpd) |
diff --git a/include/linux/pci.h b/include/linux/pci.h index 825be3878f68..c0e14008a3c2 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -641,6 +641,7 @@ int pci_restore_state(struct pci_dev *dev); | |||
641 | int pci_set_power_state(struct pci_dev *dev, pci_power_t state); | 641 | int pci_set_power_state(struct pci_dev *dev, pci_power_t state); |
642 | pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state); | 642 | pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state); |
643 | bool pci_pme_capable(struct pci_dev *dev, pci_power_t state); | 643 | bool pci_pme_capable(struct pci_dev *dev, pci_power_t state); |
644 | void pci_pme_active(struct pci_dev *dev, bool enable); | ||
644 | int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable); | 645 | int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable); |
645 | pci_power_t pci_target_state(struct pci_dev *dev); | 646 | pci_power_t pci_target_state(struct pci_dev *dev); |
646 | int pci_prepare_to_sleep(struct pci_dev *dev); | 647 | int pci_prepare_to_sleep(struct pci_dev *dev); |
@@ -680,10 +681,12 @@ void pci_enable_bridges(struct pci_bus *bus); | |||
680 | /* Proper probing supporting hot-pluggable devices */ | 681 | /* Proper probing supporting hot-pluggable devices */ |
681 | int __must_check __pci_register_driver(struct pci_driver *, struct module *, | 682 | int __must_check __pci_register_driver(struct pci_driver *, struct module *, |
682 | const char *mod_name); | 683 | const char *mod_name); |
683 | static inline int __must_check pci_register_driver(struct pci_driver *driver) | 684 | |
684 | { | 685 | /* |
685 | return __pci_register_driver(driver, THIS_MODULE, KBUILD_MODNAME); | 686 | * pci_register_driver must be a macro so that KBUILD_MODNAME can be expanded |
686 | } | 687 | */ |
688 | #define pci_register_driver(driver) \ | ||
689 | __pci_register_driver(driver, THIS_MODULE, KBUILD_MODNAME) | ||
687 | 690 | ||
688 | void pci_unregister_driver(struct pci_driver *dev); | 691 | void pci_unregister_driver(struct pci_driver *dev); |
689 | void pci_remove_behind_bridge(struct pci_dev *dev); | 692 | void pci_remove_behind_bridge(struct pci_dev *dev); |
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 35a78415accc..9ec2bcce8e83 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h | |||
@@ -2177,8 +2177,6 @@ | |||
2177 | #define PCI_DEVICE_ID_HERC_WIN 0x5732 | 2177 | #define PCI_DEVICE_ID_HERC_WIN 0x5732 |
2178 | #define PCI_DEVICE_ID_HERC_UNI 0x5832 | 2178 | #define PCI_DEVICE_ID_HERC_UNI 0x5832 |
2179 | 2179 | ||
2180 | #define PCI_VENDOR_ID_RDC 0x17f3 | ||
2181 | |||
2182 | #define PCI_VENDOR_ID_SITECOM 0x182d | 2180 | #define PCI_VENDOR_ID_SITECOM 0x182d |
2183 | #define PCI_DEVICE_ID_SITECOM_DC105V2 0x3069 | 2181 | #define PCI_DEVICE_ID_SITECOM_DC105V2 0x3069 |
2184 | 2182 | ||
diff --git a/kernel/dma-coherent.c b/kernel/dma-coherent.c index 91e96950cd52..c1d4d5b4c61c 100644 --- a/kernel/dma-coherent.c +++ b/kernel/dma-coherent.c | |||
@@ -92,7 +92,7 @@ void *dma_mark_declared_memory_occupied(struct device *dev, | |||
92 | EXPORT_SYMBOL(dma_mark_declared_memory_occupied); | 92 | EXPORT_SYMBOL(dma_mark_declared_memory_occupied); |
93 | 93 | ||
94 | /** | 94 | /** |
95 | * Try to allocate memory from the per-device coherent area. | 95 | * dma_alloc_from_coherent() - try to allocate memory from the per-device coherent area |
96 | * | 96 | * |
97 | * @dev: device from which we allocate memory | 97 | * @dev: device from which we allocate memory |
98 | * @size: size of requested memory area | 98 | * @size: size of requested memory area |
@@ -100,11 +100,11 @@ EXPORT_SYMBOL(dma_mark_declared_memory_occupied); | |||
100 | * @ret: This pointer will be filled with the virtual address | 100 | * @ret: This pointer will be filled with the virtual address |
101 | * to allocated area. | 101 | * to allocated area. |
102 | * | 102 | * |
103 | * This function should be only called from per-arch %dma_alloc_coherent() | 103 | * This function should be only called from per-arch dma_alloc_coherent() |
104 | * to support allocation from per-device coherent memory pools. | 104 | * to support allocation from per-device coherent memory pools. |
105 | * | 105 | * |
106 | * Returns 0 if dma_alloc_coherent should continue with allocating from | 106 | * Returns 0 if dma_alloc_coherent should continue with allocating from |
107 | * generic memory areas, or !0 if dma_alloc_coherent should return %ret. | 107 | * generic memory areas, or !0 if dma_alloc_coherent should return @ret. |
108 | */ | 108 | */ |
109 | int dma_alloc_from_coherent(struct device *dev, ssize_t size, | 109 | int dma_alloc_from_coherent(struct device *dev, ssize_t size, |
110 | dma_addr_t *dma_handle, void **ret) | 110 | dma_addr_t *dma_handle, void **ret) |
@@ -126,7 +126,7 @@ int dma_alloc_from_coherent(struct device *dev, ssize_t size, | |||
126 | } | 126 | } |
127 | 127 | ||
128 | /** | 128 | /** |
129 | * Try to free the memory allocated from per-device coherent memory pool. | 129 | * dma_release_from_coherent() - try to free the memory allocated from per-device coherent memory pool |
130 | * @dev: device from which the memory was allocated | 130 | * @dev: device from which the memory was allocated |
131 | * @order: the order of pages allocated | 131 | * @order: the order of pages allocated |
132 | * @vaddr: virtual address of allocated pages | 132 | * @vaddr: virtual address of allocated pages |
@@ -135,7 +135,7 @@ int dma_alloc_from_coherent(struct device *dev, ssize_t size, | |||
135 | * coherent memory pool and if so, releases that memory. | 135 | * coherent memory pool and if so, releases that memory. |
136 | * | 136 | * |
137 | * Returns 1 if we correctly released the memory, or 0 if | 137 | * Returns 1 if we correctly released the memory, or 0 if |
138 | * %dma_release_coherent() should proceed with releasing memory from | 138 | * dma_release_coherent() should proceed with releasing memory from |
139 | * generic pools. | 139 | * generic pools. |
140 | */ | 140 | */ |
141 | int dma_release_from_coherent(struct device *dev, int order, void *vaddr) | 141 | int dma_release_from_coherent(struct device *dev, int order, void *vaddr) |