Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8e2c4f28 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6:
  PCI: pci_slot: grab refcount on slot's bus
  PCI Hotplug: acpiphp: grab refcount on p2p subordinate bus
  PCI: allow PCI core hotplug to remove PCI root bus
  PCI: Fix oops in pci_vpd_truncate
  PCI: don't corrupt enable_cnt when doing manual resource alignment
  PCI: annotate pci_rescan_bus as __ref, not __devinit
  PCI-IOV: fix missing kernel-doc
  PCI: Setup disabled bridges even if buses are added
  PCI: SR-IOV quirk for Intel 82576 NIC
parents 6a5d2638 72800360
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -164,6 +164,8 @@ register_slot(acpi_handle handle, u32 lvl, void *context, void **rv)
	list_add(&slot->list, &slot_list);
	mutex_unlock(&slot_list_lock);

	get_device(&pci_bus->dev);

	dbg("pci_slot: %p, pci_bus: %x, device: %d, name: %s\n",
		pci_slot, pci_bus->number, device, name);

@@ -310,12 +312,15 @@ static void
acpi_pci_slot_remove(acpi_handle handle)
{
	struct acpi_pci_slot *slot, *tmp;
	struct pci_bus *pbus;

	mutex_lock(&slot_list_lock);
	list_for_each_entry_safe(slot, tmp, &slot_list, list) {
		if (slot->root_handle == handle) {
			list_del(&slot->list);
			pbus = slot->pci_slot->bus;
			pci_destroy_slot(slot->pci_slot);
			put_device(&pbus->dev);
			kfree(slot);
		}
	}
+1 −1
Original line number Diff line number Diff line
@@ -184,7 +184,7 @@ void pci_enable_bridges(struct pci_bus *bus)

	list_for_each_entry(dev, &bus->devices, bus_list) {
		if (dev->subordinate) {
			if (atomic_read(&dev->enable_cnt) == 0) {
			if (!pci_is_enabled(dev)) {
				retval = pci_enable_device(dev);
				pci_set_master(dev);
			}
+14 −0
Original line number Diff line number Diff line
@@ -38,6 +38,8 @@
 *  - The one in acpiphp_bridge has its refcount elevated by pci_get_slot()
 *    when the bridge is scanned and it loses a refcount when the bridge
 *    is removed.
 *  - When a P2P bridge is present, we elevate the refcount on the subordinate
 *    bus. It loses the refcount when the the driver unloads.
 */

#include <linux/init.h>
@@ -440,6 +442,12 @@ static void add_p2p_bridge(acpi_handle *handle, struct pci_dev *pci_dev)
		goto err;
	}

	/*
	 * Grab a ref to the subordinate PCI bus in case the bus is
	 * removed via PCI core logical hotplug. The ref pins the bus
	 * (which we access during module unload).
	 */
	get_device(&bridge->pci_bus->dev);
	spin_lock_init(&bridge->res_lock);

	init_bridge_misc(bridge);
@@ -619,6 +627,12 @@ static void cleanup_bridge(struct acpiphp_bridge *bridge)
		slot = next;
	}

	/*
	 * Only P2P bridges have a pci_dev
	 */
	if (bridge->pci_dev)
		put_device(&bridge->pci_bus->dev);

	pci_dev_put(bridge->pci_dev);
	list_del(&bridge->list);
	kfree(bridge);
+1 −0
Original line number Diff line number Diff line
@@ -631,6 +631,7 @@ int pci_iov_bus_range(struct pci_bus *bus)
/**
 * pci_enable_sriov - enable the SR-IOV capability
 * @dev: the PCI device
 * @nr_virtfn: number of virtual functions to enable
 *
 * Returns 0 on success, or negative on failure.
 */
+1 −5
Original line number Diff line number Diff line
@@ -148,7 +148,7 @@ static ssize_t is_enabled_store(struct device *dev,
		return -EPERM;

	if (!val) {
		if (atomic_read(&pdev->enable_cnt) != 0)
		if (pci_is_enabled(pdev))
			pci_disable_device(pdev);
		else
			result = -EIO;
@@ -277,14 +277,10 @@ remove_store(struct device *dev, struct device_attribute *dummy,
{
	int ret = 0;
	unsigned long val;
	struct pci_dev *pdev = to_pci_dev(dev);

	if (strict_strtoul(buf, 0, &val) < 0)
		return -EINVAL;

	if (pci_is_root_bus(pdev->bus))
		return -EBUSY;

	/* An attribute cannot be unregistered by one of its own methods,
	 * so we have to use this roundabout approach.
	 */
Loading