Skip to content

Commit

Permalink
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/pci-2.6
Browse files Browse the repository at this point in the history
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/pci-2.6:
  pci: hotplug: pciehp: fix error code path in hpc_power_off_slot
  PCI: Add DECLARE_PCI_DEVICE_TABLE macro
  PCI: fix up error messages for pci_bus registering
  PCI: fix section mismatch warning in pci_scan_child_bus
  PCI: consolidate duplicated MSI enable functions
  PCI: use dev_printk in quirk messages
  • Loading branch information
Linus Torvalds committed Mar 5, 2008
2 parents 10955d2 + c1ef5cb commit 12f981f
Show file tree
Hide file tree
Showing 11 changed files with 40 additions and 50 deletions.
6 changes: 4 additions & 2 deletions Documentation/pci.txt
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ initialization with a pointer to a structure describing the driver


The ID table is an array of struct pci_device_id entries ending with an
all-zero entry. Each entry consists of:
all-zero entry; use of the macro DECLARE_PCI_DEVICE_TABLE is the preferred
method of declaring the table. Each entry consists of:

vendor,device Vendor and device ID to match (or PCI_ANY_ID)

Expand Down Expand Up @@ -191,7 +192,8 @@ Tips on when/where to use the above attributes:

o Do not mark the struct pci_driver.

o The ID table array should be marked __devinitdata.
o The ID table array should be marked __devinitconst; this is done
automatically if the table is declared with DECLARE_PCI_DEVICE_TABLE().

o The probe() and remove() functions should be marked __devinit
and __devexit respectively. All initialization functions
Expand Down
10 changes: 6 additions & 4 deletions drivers/pci/bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,15 @@ void pci_bus_add_devices(struct pci_bus *bus)
child_bus = dev->subordinate;
child_bus->dev.parent = child_bus->bridge;
retval = device_register(&child_bus->dev);
if (!retval)
if (retval)
dev_err(&dev->dev, "Error registering pci_bus,"
" continuing...\n");
else
retval = device_create_file(&child_bus->dev,
&dev_attr_cpuaffinity);
if (retval)
dev_err(&dev->dev, "Error registering pci_bus"
" device bridge symlink,"
" continuing...\n");
dev_err(&dev->dev, "Error creating cpuaffinity"
" file, continuing...\n");
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/pci/hotplug-pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "pci.h"


unsigned int pci_do_scan_bus(struct pci_bus *bus)
unsigned int __devinit pci_do_scan_bus(struct pci_bus *bus)
{
unsigned int max;

Expand Down
2 changes: 1 addition & 1 deletion drivers/pci/hotplug/acpiphp_glue.c
Original file line number Diff line number Diff line change
Expand Up @@ -1085,7 +1085,7 @@ static int acpiphp_bus_trim(acpi_handle handle)
* This function should be called per *physical slot*,
* not per each slot object in ACPI namespace.
*/
static int enable_device(struct acpiphp_slot *slot)
static int __ref enable_device(struct acpiphp_slot *slot)
{
struct pci_dev *dev;
struct pci_bus *bus = slot->bridge->pci_bus;
Expand Down
2 changes: 1 addition & 1 deletion drivers/pci/hotplug/cpci_hotplug_pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ int cpci_led_off(struct slot* slot)
* Device configuration functions
*/

int cpci_configure_slot(struct slot* slot)
int __ref cpci_configure_slot(struct slot *slot)
{
struct pci_bus *parent;
int fn;
Expand Down
5 changes: 3 additions & 2 deletions drivers/pci/hotplug/pciehp_hpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,8 @@ static int hpc_power_off_slot(struct slot * slot)
retval = pcie_write_cmd(slot, slot_cmd, cmd_mask);
if (retval) {
err("%s: Write command failed!\n", __FUNCTION__);
return -1;
retval = -1;
goto out;
}
dbg("%s: SLOTCTRL %x write cmd %x\n",
__FUNCTION__, ctrl->cap_base + SLOTCTRL, slot_cmd);
Expand All @@ -722,7 +723,7 @@ static int hpc_power_off_slot(struct slot * slot)
* removed from the slot/adapter.
*/
msleep(1000);

out:
if (changed)
pcie_unmask_bad_dllp(ctrl);

Expand Down
2 changes: 1 addition & 1 deletion drivers/pci/hotplug/pciehp_pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ static void program_fw_provided_values(struct pci_dev *dev)
}
}

static int pciehp_add_bridge(struct pci_dev *dev)
static int __ref pciehp_add_bridge(struct pci_dev *dev)
{
struct pci_bus *parent = dev->bus;
int pass, busnr, start = parent->secondary;
Expand Down
2 changes: 1 addition & 1 deletion drivers/pci/hotplug/shpchp_pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ static void program_fw_provided_values(struct pci_dev *dev)
}
}

int shpchp_configure_device(struct slot *p_slot)
int __ref shpchp_configure_device(struct slot *p_slot)
{
struct pci_dev *dev;
struct pci_bus *parent = p_slot->ctrl->pci_dev->subordinate;
Expand Down
8 changes: 4 additions & 4 deletions drivers/pci/probe.c
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ static void pci_read_bases(struct pci_dev *dev, unsigned int howmany, int rom)
}
}

void pci_read_bridge_bases(struct pci_bus *child)
void __devinit pci_read_bridge_bases(struct pci_bus *child)
{
struct pci_dev *dev = child->self;
u8 io_base_lo, io_limit_lo;
Expand Down Expand Up @@ -472,7 +472,7 @@ static void pci_fixup_parent_subordinate_busnr(struct pci_bus *child, int max)
* them, we proceed to assigning numbers to the remaining buses in
* order to avoid overlaps between old and new bus numbers.
*/
int pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max, int pass)
int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max, int pass)
{
struct pci_bus *child;
int is_cardbus = (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS);
Expand Down Expand Up @@ -1008,7 +1008,7 @@ int pci_scan_slot(struct pci_bus *bus, int devfn)
return nr;
}

unsigned int pci_scan_child_bus(struct pci_bus *bus)
unsigned int __devinit pci_scan_child_bus(struct pci_bus *bus)
{
unsigned int devfn, pass, max = bus->secondary;
struct pci_dev *dev;
Expand Down Expand Up @@ -1116,7 +1116,7 @@ struct pci_bus * pci_create_bus(struct device *parent,
return NULL;
}

struct pci_bus *pci_scan_bus_parented(struct device *parent,
struct pci_bus * __devinit pci_scan_bus_parented(struct device *parent,
int bus, struct pci_ops *ops, void *sysdata)
{
struct pci_bus *b;
Expand Down
41 changes: 8 additions & 33 deletions drivers/pci/quirks.c
Original file line number Diff line number Diff line change
Expand Up @@ -1652,9 +1652,8 @@ static void __devinit quirk_via_cx700_pci_parking_caching(struct pci_dev *dev)
pci_write_config_byte(dev, 0x75, 0x1);
pci_write_config_byte(dev, 0x77, 0x0);

printk(KERN_INFO
"PCI: VIA CX700 PCI parking/caching fixup on %s\n",
pci_name(dev));
dev_info(&dev->dev,
"Disabling VIA CX700 PCI parking/caching\n");
}
}
}
Expand Down Expand Up @@ -1726,32 +1725,6 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_HT2
quirk_msi_ht_cap);


/*
* Force enable MSI mapping capability on HT bridges
*/
static void __devinit quirk_msi_ht_cap_enable(struct pci_dev *dev)
{
int pos, ttl = 48;

pos = pci_find_ht_capability(dev, HT_CAPTYPE_MSI_MAPPING);
while (pos && ttl--) {
u8 flags;

if (pci_read_config_byte(dev, pos + HT_MSI_FLAGS, &flags) == 0) {
printk(KERN_INFO "PCI: Enabling HT MSI Mapping on %s\n",
pci_name(dev));

pci_write_config_byte(dev, pos + HT_MSI_FLAGS,
flags | HT_MSI_FLAGS_ENABLE);
}
pos = pci_find_next_ht_capability(dev, pos,
HT_CAPTYPE_MSI_MAPPING);
}
}
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SERVERWORKS,
PCI_DEVICE_ID_SERVERWORKS_HT1000_PXB,
quirk_msi_ht_cap_enable);

/* The nVidia CK804 chipset may have 2 HT MSI mappings.
* MSI are supported if the MSI capability set in any of these mappings.
*/
Expand All @@ -1778,9 +1751,8 @@ static void __devinit quirk_nvidia_ck804_msi_ht_cap(struct pci_dev *dev)
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_CK804_PCIE,
quirk_nvidia_ck804_msi_ht_cap);

/*
* Force enable MSI mapping capability on HT bridges */
static inline void ht_enable_msi_mapping(struct pci_dev *dev)
/* Force enable MSI mapping capability on HT bridges */
static void __devinit ht_enable_msi_mapping(struct pci_dev *dev)
{
int pos, ttl = 48;

Expand All @@ -1799,6 +1771,9 @@ static inline void ht_enable_msi_mapping(struct pci_dev *dev)
HT_CAPTYPE_MSI_MAPPING);
}
}
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SERVERWORKS,
PCI_DEVICE_ID_SERVERWORKS_HT1000_PXB,
ht_enable_msi_mapping);

static void __devinit nv_msi_ht_cap_quirk(struct pci_dev *dev)
{
Expand Down Expand Up @@ -1830,7 +1805,7 @@ static void __devinit nv_msi_ht_cap_quirk(struct pci_dev *dev)

if (pci_read_config_byte(dev, pos + HT_MSI_FLAGS,
&flags) == 0) {
dev_info(&dev->dev, "Quirk disabling HT MSI mapping");
dev_info(&dev->dev, "Disabling HT MSI mapping");
pci_write_config_byte(dev, pos + HT_MSI_FLAGS,
flags & ~HT_MSI_FLAGS_ENABLE);
}
Expand Down
10 changes: 10 additions & 0 deletions include/linux/pci.h
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,16 @@ struct pci_driver {

#define to_pci_driver(drv) container_of(drv, struct pci_driver, driver)

/**
* DECLARE_PCI_DEVICE_TABLE - macro used to describe a pci device table
* @_table: device table name
*
* This macro is used to create a struct pci_device_id array (a device table)
* in a generic manner.
*/
#define DECLARE_PCI_DEVICE_TABLE(_table) \
const struct pci_device_id _table[] __devinitconst

/**
* PCI_DEVICE - macro used to describe a specific pci device
* @vend: the 16 bit PCI Vendor ID
Expand Down

0 comments on commit 12f981f

Please sign in to comment.