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

Commit 63d4ec87 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull PCI fixes from Bjorn Helgaas:
 "Power management:
    - PCI/PM: Fix proc config reg access for D3cold and bridge
      suspending
    - PCI/PM: Resume device before shutdown
    - PCI/PM: Fix deadlock when unbinding device if parent in D3cold
  Hotplug:
    -  PCI/portdrv: Don't create hotplug slots unless port supports
       hotplug"

* tag '3.7-pci-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci:
  PCI/portdrv: Don't create hotplug slots unless port supports hotplug
  PCI/PM: Fix proc config reg access for D3cold and bridge suspending
  PCI/PM: Resume device before shutdown
  PCI/PM: Fix deadlock when unbinding device if parent in D3cold
parents a4275153 ff8e59bc
Loading
Loading
Loading
Loading
+0 −3
Original line number Original line Diff line number Diff line
@@ -320,10 +320,7 @@ void pci_walk_bus(struct pci_bus *top, int (*cb)(struct pci_dev *, void *),
		} else
		} else
			next = dev->bus_list.next;
			next = dev->bus_list.next;


		/* Run device routines with the device locked */
		device_lock(&dev->dev);
		retval = cb(dev, userdata);
		retval = cb(dev, userdata);
		device_unlock(&dev->dev);
		if (retval)
		if (retval)
			break;
			break;
	}
	}
+2 −10
Original line number Original line Diff line number Diff line
@@ -398,6 +398,8 @@ static void pci_device_shutdown(struct device *dev)
	struct pci_dev *pci_dev = to_pci_dev(dev);
	struct pci_dev *pci_dev = to_pci_dev(dev);
	struct pci_driver *drv = pci_dev->driver;
	struct pci_driver *drv = pci_dev->driver;


	pm_runtime_resume(dev);

	if (drv && drv->shutdown)
	if (drv && drv->shutdown)
		drv->shutdown(pci_dev);
		drv->shutdown(pci_dev);
	pci_msi_shutdown(pci_dev);
	pci_msi_shutdown(pci_dev);
@@ -408,16 +410,6 @@ static void pci_device_shutdown(struct device *dev)
	 * continue to do DMA
	 * continue to do DMA
	 */
	 */
	pci_disable_device(pci_dev);
	pci_disable_device(pci_dev);

	/*
	 * Devices may be enabled to wake up by runtime PM, but they need not
	 * be supposed to wake up the system from its "power off" state (e.g.
	 * ACPI S5).  Therefore disable wakeup for all devices that aren't
	 * supposed to wake up the system at this point.  The state argument
	 * will be ignored by pci_enable_wake().
	 */
	if (!device_may_wakeup(dev))
		pci_enable_wake(pci_dev, PCI_UNKNOWN, false);
}
}


#ifdef CONFIG_PM
#ifdef CONFIG_PM
+0 −34
Original line number Original line Diff line number Diff line
@@ -458,40 +458,6 @@ boot_vga_show(struct device *dev, struct device_attribute *attr, char *buf)
}
}
struct device_attribute vga_attr = __ATTR_RO(boot_vga);
struct device_attribute vga_attr = __ATTR_RO(boot_vga);


static void
pci_config_pm_runtime_get(struct pci_dev *pdev)
{
	struct device *dev = &pdev->dev;
	struct device *parent = dev->parent;

	if (parent)
		pm_runtime_get_sync(parent);
	pm_runtime_get_noresume(dev);
	/*
	 * pdev->current_state is set to PCI_D3cold during suspending,
	 * so wait until suspending completes
	 */
	pm_runtime_barrier(dev);
	/*
	 * Only need to resume devices in D3cold, because config
	 * registers are still accessible for devices suspended but
	 * not in D3cold.
	 */
	if (pdev->current_state == PCI_D3cold)
		pm_runtime_resume(dev);
}

static void
pci_config_pm_runtime_put(struct pci_dev *pdev)
{
	struct device *dev = &pdev->dev;
	struct device *parent = dev->parent;

	pm_runtime_put(dev);
	if (parent)
		pm_runtime_put_sync(parent);
}

static ssize_t
static ssize_t
pci_read_config(struct file *filp, struct kobject *kobj,
pci_read_config(struct file *filp, struct kobject *kobj,
		struct bin_attribute *bin_attr,
		struct bin_attribute *bin_attr,
+32 −0
Original line number Original line Diff line number Diff line
@@ -1858,6 +1858,38 @@ bool pci_dev_run_wake(struct pci_dev *dev)
}
}
EXPORT_SYMBOL_GPL(pci_dev_run_wake);
EXPORT_SYMBOL_GPL(pci_dev_run_wake);


void pci_config_pm_runtime_get(struct pci_dev *pdev)
{
	struct device *dev = &pdev->dev;
	struct device *parent = dev->parent;

	if (parent)
		pm_runtime_get_sync(parent);
	pm_runtime_get_noresume(dev);
	/*
	 * pdev->current_state is set to PCI_D3cold during suspending,
	 * so wait until suspending completes
	 */
	pm_runtime_barrier(dev);
	/*
	 * Only need to resume devices in D3cold, because config
	 * registers are still accessible for devices suspended but
	 * not in D3cold.
	 */
	if (pdev->current_state == PCI_D3cold)
		pm_runtime_resume(dev);
}

void pci_config_pm_runtime_put(struct pci_dev *pdev)
{
	struct device *dev = &pdev->dev;
	struct device *parent = dev->parent;

	pm_runtime_put(dev);
	if (parent)
		pm_runtime_put_sync(parent);
}

/**
/**
 * pci_pm_init - Initialize PM functions of given PCI device
 * pci_pm_init - Initialize PM functions of given PCI device
 * @dev: PCI device to handle.
 * @dev: PCI device to handle.
+2 −0
Original line number Original line Diff line number Diff line
@@ -72,6 +72,8 @@ extern void pci_disable_enabled_device(struct pci_dev *dev);
extern int pci_finish_runtime_suspend(struct pci_dev *dev);
extern int pci_finish_runtime_suspend(struct pci_dev *dev);
extern int __pci_pme_wakeup(struct pci_dev *dev, void *ign);
extern int __pci_pme_wakeup(struct pci_dev *dev, void *ign);
extern void pci_wakeup_bus(struct pci_bus *bus);
extern void pci_wakeup_bus(struct pci_bus *bus);
extern void pci_config_pm_runtime_get(struct pci_dev *dev);
extern void pci_config_pm_runtime_put(struct pci_dev *dev);
extern void pci_pm_init(struct pci_dev *dev);
extern void pci_pm_init(struct pci_dev *dev);
extern void platform_pci_wakeup_init(struct pci_dev *dev);
extern void platform_pci_wakeup_init(struct pci_dev *dev);
extern void pci_allocate_cap_save_buffers(struct pci_dev *dev);
extern void pci_allocate_cap_save_buffers(struct pci_dev *dev);
Loading