Skip to content

Commit a7ef6a4

Browse files
committed
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
2 parents 000b915 + 35405f2 commit a7ef6a4

File tree

7 files changed

+60
-32
lines changed

7 files changed

+60
-32
lines changed

drivers/pci/msi.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -308,9 +308,8 @@ static void __pci_restore_msi_state(struct pci_dev *dev)
308308
entry->msi_attrib.masked);
309309

310310
pci_read_config_word(dev, pos + PCI_MSI_FLAGS, &control);
311-
control &= ~(PCI_MSI_FLAGS_QSIZE | PCI_MSI_FLAGS_ENABLE);
312-
if (entry->msi_attrib.maskbit || !entry->msi_attrib.masked)
313-
control |= PCI_MSI_FLAGS_ENABLE;
311+
control &= ~PCI_MSI_FLAGS_QSIZE;
312+
control |= PCI_MSI_FLAGS_ENABLE;
314313
pci_write_config_word(dev, pos + PCI_MSI_FLAGS, control);
315314
}
316315

drivers/pci/pci.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1060,7 +1060,7 @@ bool pci_pme_capable(struct pci_dev *dev, pci_power_t state)
10601060
* The caller must verify that the device is capable of generating PME# before
10611061
* calling this function with @enable equal to 'true'.
10621062
*/
1063-
static void pci_pme_active(struct pci_dev *dev, bool enable)
1063+
void pci_pme_active(struct pci_dev *dev, bool enable)
10641064
{
10651065
u16 pmcsr;
10661066

@@ -1941,6 +1941,7 @@ EXPORT_SYMBOL(pci_set_power_state);
19411941
EXPORT_SYMBOL(pci_save_state);
19421942
EXPORT_SYMBOL(pci_restore_state);
19431943
EXPORT_SYMBOL(pci_pme_capable);
1944+
EXPORT_SYMBOL(pci_pme_active);
19441945
EXPORT_SYMBOL(pci_enable_wake);
19451946
EXPORT_SYMBOL(pci_target_state);
19461947
EXPORT_SYMBOL(pci_prepare_to_sleep);

drivers/pci/probe.c

Lines changed: 38 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -52,27 +52,49 @@ EXPORT_SYMBOL(no_pci_devices);
5252
* Some platforms allow access to legacy I/O port and ISA memory space on
5353
* a per-bus basis. This routine creates the files and ties them into
5454
* 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.
5558
*/
5659
static void pci_create_legacy_files(struct pci_bus *b)
5760
{
61+
int error;
62+
5863
b->legacy_io = kzalloc(sizeof(struct bin_attribute) * 2,
5964
GFP_ATOMIC);
60-
if (b->legacy_io) {
61-
b->legacy_io->attr.name = "legacy_io";
62-
b->legacy_io->size = 0xffff;
63-
b->legacy_io->attr.mode = S_IRUSR | S_IWUSR;
64-
b->legacy_io->read = pci_read_legacy_io;
65-
b->legacy_io->write = pci_write_legacy_io;
66-
device_create_bin_file(&b->dev, b->legacy_io);
67-
68-
/* Allocated above after the legacy_io struct */
69-
b->legacy_mem = b->legacy_io + 1;
70-
b->legacy_mem->attr.name = "legacy_mem";
71-
b->legacy_mem->size = 1024*1024;
72-
b->legacy_mem->attr.mode = S_IRUSR | S_IWUSR;
73-
b->legacy_mem->mmap = pci_mmap_legacy_mem;
74-
device_create_bin_file(&b->dev, b->legacy_mem);
75-
}
65+
if (!b->legacy_io)
66+
goto kzalloc_err;
67+
68+
b->legacy_io->attr.name = "legacy_io";
69+
b->legacy_io->size = 0xffff;
70+
b->legacy_io->attr.mode = S_IRUSR | S_IWUSR;
71+
b->legacy_io->read = pci_read_legacy_io;
72+
b->legacy_io->write = pci_write_legacy_io;
73+
error = device_create_bin_file(&b->dev, b->legacy_io);
74+
if (error)
75+
goto legacy_io_err;
76+
77+
/* Allocated above after the legacy_io struct */
78+
b->legacy_mem = b->legacy_io + 1;
79+
b->legacy_mem->attr.name = "legacy_mem";
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;
7698
}
7799

78100
void pci_remove_legacy_files(struct pci_bus *b)

drivers/pci/quirks.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1756,9 +1756,14 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_VIA, 0x324e, quirk_via_cx700_pci_parking_c
17561756
*/
17571757
static void __devinit quirk_brcm_570x_limit_vpd(struct pci_dev *dev)
17581758
{
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+
*/
17601763
if ((dev->device == PCI_DEVICE_ID_NX2_5706) ||
1764+
(dev->device == PCI_DEVICE_ID_NX2_5706S) ||
17611765
(dev->device == PCI_DEVICE_ID_NX2_5708) ||
1766+
(dev->device == PCI_DEVICE_ID_NX2_5708S) ||
17621767
((dev->device == PCI_DEVICE_ID_NX2_5709) &&
17631768
(dev->revision & 0xf0) == 0x0)) {
17641769
if (dev->vpd)

include/linux/pci.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,7 @@ int pci_restore_state(struct pci_dev *dev);
641641
int pci_set_power_state(struct pci_dev *dev, pci_power_t state);
642642
pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state);
643643
bool pci_pme_capable(struct pci_dev *dev, pci_power_t state);
644+
void pci_pme_active(struct pci_dev *dev, bool enable);
644645
int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable);
645646
pci_power_t pci_target_state(struct pci_dev *dev);
646647
int pci_prepare_to_sleep(struct pci_dev *dev);
@@ -680,10 +681,12 @@ void pci_enable_bridges(struct pci_bus *bus);
680681
/* Proper probing supporting hot-pluggable devices */
681682
int __must_check __pci_register_driver(struct pci_driver *, struct module *,
682683
const char *mod_name);
683-
static inline int __must_check pci_register_driver(struct pci_driver *driver)
684-
{
685-
return __pci_register_driver(driver, THIS_MODULE, KBUILD_MODNAME);
686-
}
684+
685+
/*
686+
* pci_register_driver must be a macro so that KBUILD_MODNAME can be expanded
687+
*/
688+
#define pci_register_driver(driver) \
689+
__pci_register_driver(driver, THIS_MODULE, KBUILD_MODNAME)
687690

688691
void pci_unregister_driver(struct pci_driver *dev);
689692
void pci_remove_behind_bridge(struct pci_dev *dev);

include/linux/pci_ids.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2177,8 +2177,6 @@
21772177
#define PCI_DEVICE_ID_HERC_WIN 0x5732
21782178
#define PCI_DEVICE_ID_HERC_UNI 0x5832
21792179

2180-
#define PCI_VENDOR_ID_RDC 0x17f3
2181-
21822180
#define PCI_VENDOR_ID_SITECOM 0x182d
21832181
#define PCI_DEVICE_ID_SITECOM_DC105V2 0x3069
21842182

kernel/dma-coherent.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,19 +92,19 @@ void *dma_mark_declared_memory_occupied(struct device *dev,
9292
EXPORT_SYMBOL(dma_mark_declared_memory_occupied);
9393

9494
/**
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
9696
*
9797
* @dev: device from which we allocate memory
9898
* @size: size of requested memory area
9999
* @dma_handle: This will be filled with the correct dma handle
100100
* @ret: This pointer will be filled with the virtual address
101101
* to allocated area.
102102
*
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()
104104
* to support allocation from per-device coherent memory pools.
105105
*
106106
* 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.
108108
*/
109109
int dma_alloc_from_coherent(struct device *dev, ssize_t size,
110110
dma_addr_t *dma_handle, void **ret)
@@ -126,7 +126,7 @@ int dma_alloc_from_coherent(struct device *dev, ssize_t size,
126126
}
127127

128128
/**
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
130130
* @dev: device from which the memory was allocated
131131
* @order: the order of pages allocated
132132
* @vaddr: virtual address of allocated pages
@@ -135,7 +135,7 @@ int dma_alloc_from_coherent(struct device *dev, ssize_t size,
135135
* coherent memory pool and if so, releases that memory.
136136
*
137137
* 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
139139
* generic pools.
140140
*/
141141
int dma_release_from_coherent(struct device *dev, int order, void *vaddr)

0 commit comments

Comments
 (0)