History log of /drivers/pci/pci-driver.c
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
0659cf9dcd148f6771c056fa95976fda9c5abf9d 09-Jul-2012 Alan Stern <stern@rowland.harvard.edu> PCI: EHCI: fix crash during suspend on ASUS computers

commit dbf0e4c7257f8d684ec1a3c919853464293de66e upstream.

Quite a few ASUS computers experience a nasty problem, related to the
EHCI controllers, when going into system suspend. It was observed
that the problem didn't occur if the controllers were not put into the
D3 power state before starting the suspend, and commit
151b61284776be2d6f02d48c23c3625678960b97 (USB: EHCI: fix crash during
suspend on ASUS computers) was created to do this.

It turned out this approach messed up other computers that didn't have
the problem -- it prevented USB wakeup from working. Consequently
commit c2fb8a3fa25513de8fedb38509b1f15a5bbee47b (USB: add
NO_D3_DURING_SLEEP flag and revert 151b61284776be2) was merged; it
reverted the earlier commit and added a whitelist of known good board
names.

Now we know the actual cause of the problem. Thanks to AceLan Kao for
tracking it down.

According to him, an engineer at ASUS explained that some of their
BIOSes contain a bug that was added in an attempt to work around a
problem in early versions of Windows. When the computer goes into S3
suspend, the BIOS tries to verify that the EHCI controllers were first
quiesced by the OS. Nothing's wrong with this, but the BIOS does it
by checking that the PCI COMMAND registers contain 0 without checking
the controllers' power state. If the register isn't 0, the BIOS
assumes the controller needs to be quiesced and tries to do so. This
involves making various MMIO accesses to the controller, which don't
work very well if the controller is already in D3. The end result is
a system hang or memory corruption.

Since the value in the PCI COMMAND register doesn't matter once the
controller has been suspended, and since the value will be restored
anyway when the controller is resumed, we can work around the BIOS bug
simply by setting the register to 0 during system suspend. This patch
(as1590) does so and also reverts the second commit mentioned above,
which is now unnecessary.

In theory we could do this for every PCI device. However to avoid
introducing new problems, the patch restricts itself to EHCI host
controllers.

Finally the affected systems can suspend with USB wakeup working
properly.

Reference: https://bugzilla.kernel.org/show_bug.cgi?id=37632
Reference: https://bugzilla.kernel.org/show_bug.cgi?id=42728
Based-on-patch-by: AceLan Kao <acelan.kao@canonical.com>
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Tested-by: Dâniel Fraga <fragabr@gmail.com>
Tested-by: Javier Marcet <jmarcet@gmail.com>
Tested-by: Andrey Rahmatullin <wrar@wrar.name>
Tested-by: Oleksij Rempel <bug-track@fisher-privat.net>
Tested-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
/drivers/pci/pci-driver.c
475c77edf826333aa61625f49d6a2bec26ecb5a6 23-Mar-2012 Linus Torvalds <torvalds@linux-foundation.org> Merge branch 'linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci

Pull PCI changes (including maintainer change) from Jesse Barnes:
"This pull has some good cleanups from Bjorn and Yinghai, as well as
some more code from Yinghai to better handle resource re-allocation
when enabled.

There's also a new initcall_debug feature from Arjan which will print
out quirk timing information to help identify slow quirks for fixing
or refinement (Yinghai sent in a few patches to do just that once the
new debug code landed).

Beyond that, I'm handing off PCI maintainership to Bjorn Helgaas.
He's been a core PCI and Linux contributor for some time now, and has
kindly volunteered to take over. I just don't feel I have the time
for PCI review and work that it deserves lately (I've taken on some
other projects), and haven't been as responsive lately as I'd like, so
I approached Bjorn asking if he'd like to manage things. He's going
to give it a try, and I'm confident he'll do at least as well as I
have in keeping the tree managed, patches flowing, and keeping things
stable."

Fix up some fairly trivial conflicts due to other cleanups (mips device
resource fixup cleanups clashing with list handling cleanup, ppc iseries
removal clashing with pci_probe_only cleanup etc)

* 'linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci: (112 commits)
PCI: Bjorn gets PCI hotplug too
PCI: hand PCI maintenance over to Bjorn Helgaas
unicore32/PCI: move <asm-generic/pci-bridge.h> include to asm/pci.h
sparc/PCI: convert devtree and arch-probed bus addresses to resource
powerpc/PCI: allow reallocation on PA Semi
powerpc/PCI: convert devtree bus addresses to resource
powerpc/PCI: compute I/O space bus-to-resource offset consistently
arm/PCI: don't export pci_flags
PCI: fix bridge I/O window bus-to-resource conversion
x86/PCI: add spinlock held check to 'pcibios_fwaddrmap_lookup()'
PCI / PCIe: Introduce command line option to disable ARI
PCI: make acpihp use __pci_remove_bus_device instead
PCI: export __pci_remove_bus_device
PCI: Rename pci_remove_behind_bridge to pci_stop_and_remove_behind_bridge
PCI: Rename pci_remove_bus_device to pci_stop_and_remove_bus_device
PCI: print out PCI device info along with duration
PCI: Move "pci reassigndev resource alignment" out of quirks.c
PCI: Use class for quirk for usb host controller fixup
PCI: Use class for quirk for ti816x class fixup
PCI: Use class for quirk for intel e100 interrupt fixup
...
5b415f1e79e0c09366f26e3eabe751642059285a 07-Feb-2012 Rafael J. Wysocki <rjw@sisk.pl> PCI / PM: Disable wakeup during shutdown for devices not enabled to wake up

If a PCI device is enabled to generate wakeup signals (PME) when put
into a low-power state by runtime PM, it will be still enabled to
generate those signals after the system shutdown, unless its driver's
.shutdown() callback takes care of the wakeup signals generation
setting. Moreover, there are devices that are not enabled to wake
up the system and that are configured by runtime PM to generate
wakeup signals so that (runtime) remote wakeup works with them.
Those devices should be reconfigured during system shutdown so that
they don't generate wakeup signals, but at least some drivers don't
do that. However, that very well may be done by the PCI core so
that drivers don't have to worry about it. For this reason, modify
pci_device_shutdown() to disable the generation of wakeup events for
devices not supposed to wake up the system.

References: https://bugzilla.kernel.org/show_bug.cgi?id=37952
Reported-and-tested-by: Kamil Iskra <kamil.54002@iskra.name>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
/drivers/pci/pci-driver.c
ed283e9f0a2cc0541870828c76c6c6997c51a318 24-Jan-2012 Alan Stern <stern@rowland.harvard.edu> USB/PCI/PCMCIA: Clean up new_id and remove_id sysfs attribute routines

This patch (as1514) cleans up some places where new_id and remove_id
sysfs attributes are created and deleted. Handling both attributes in
a single routine rather than a pair of routines makes the code
smaller. It also prevents certain kinds of errors, like one we
currently have in the USB subsystem: The removeid attribute is often
created even when newid isn't (because the driver's no_dynamid_id flag
is set).

In the case of the PCMCIA subsystem, the newid attribute is created
but never explicitly deleted. The patch adds a deletion routine.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Acked-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Acked-by: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/pci/pci-driver.c
cef9bc56e1e944afd11f96de569657117a138c6d 24-Jan-2012 Alan Stern <stern@rowland.harvard.edu> Dynamic ID addition doesn't need get_driver()

As part of the removal of get_driver()/put_driver(), this patch
(as1511) changes all the places that add dynamic IDs for drivers.
Since these additions are done by writing to the drivers' sysfs
attribute files, and the attributes are removed when the drivers are
unregistered, there is no reason to take an extra reference to the
drivers.

The one exception is the pci-stub driver, which calls pci_add_dynid()
as part of its registration. But again, there's no reason to take an
extra reference here, because the driver can't be unloaded while it is
being registered.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
CC: Dmitry Torokhov <dmitry.torokhov@gmail.com>
CC: Jiri Kosina <jkosina@suse.cz>
CC: Jesse Barnes <jbarnes@virtuousgeek.org>
CC: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/pci/pci-driver.c
82440a8253e09047410ff4df5c202be15645573f 20-Nov-2011 David Fries <David@Fries.net> PCI: pci_has_legacy_pm_support add driver and device to WARN

Include the driver name and device in warning when a pci driver
supports both legacy pm and new framework as just the stack trace
gives no way to identify the driver.

Signed-off-by: David Fries <David@Fries.net>
Acked-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
/drivers/pci/pci-driver.c
eea3fc0357eb89d0b2d1af37bdfb83eb4076a542 06-Jul-2011 Rafael J. Wysocki <rjw@sisk.pl> PCI / PM: Detect early wakeup in pci_pm_prepare()

A subsequent patch is going to move the invocation of
pm_runtime_barrier() from dpm_prepare() to __device_suspend().
Consequently, early wakeup events resulting from runtime resume
requests for wakeup devices queued up right before system suspend
will only be detected after all of the subsystem-level .prepare()
callbacks have run. However, the PCI bus type calls
pm_runtime_get_sync() from its pci_pm_prepare() callback routine,
so it would destroy the early wakeup events information regarding PCI
devices. To prevent this from happening add an early wakeup
detection mechanism, analogous to the one currently in dpm_prepare(),
to pci_pm_prepare().

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Jesse Barnes <jbarnes@virtuousgeek.org>
/drivers/pci/pci-driver.c
a5f76d5eba157bf637beb2dd18026db2917c512e 21-Jun-2011 Rafael J. Wysocki <rjw@sisk.pl> PCI / PM: Block races between runtime PM and system sleep

After commit e8665002477f0278f84f898145b1f141ba26ee26
(PM: Allow pm_runtime_suspend() to succeed during system suspend) it
is possible that a device resumed by the pm_runtime_resume(dev) in
pci_pm_prepare() will be suspended immediately from a work item,
timer function or otherwise, defeating the very purpose of calling
pm_runtime_resume(dev) from there. To prevent that from happening
it is necessary to increment the runtime PM usage counter of the
device by replacing pm_runtime_resume() with pm_runtime_get_sync().
Moreover, the incremented runtime PM usage counter has to be
decremented by the corresponding pci_pm_complete(), via
pm_runtime_put_sync().

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Cc: stable@kernel.org
Acked-by: Jesse Barnes <jbarnes@virtuousgeek.org>
/drivers/pci/pci-driver.c
1f112cee07b314e244ee9e71d9c1e6950dc13327 11-Apr-2011 Rafael J. Wysocki <rjw@sisk.pl> PM / Hibernate: Introduce CONFIG_HIBERNATE_CALLBACKS

Xen save/restore is going to use hibernate device callbacks for
quiescing devices and putting them back to normal operations and it
would need to select CONFIG_HIBERNATION for this purpose. However,
that also would cause the hibernate interfaces for user space to be
enabled, which might confuse user space, because the Xen kernels
don't support hibernation. Moreover, it would be wasteful, as it
would make the Xen kernels include a substantial amount of code that
they would never use.

To address this issue introduce new power management Kconfig option
CONFIG_HIBERNATE_CALLBACKS, such that it will only select the code
that is necessary for the hibernate device callbacks to work and make
CONFIG_HIBERNATION select it. Then, Xen save/restore will be able to
select CONFIG_HIBERNATE_CALLBACKS without dragging the entire
hibernate code along with it.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Tested-by: Shriram Rajagopalan <rshriram@cs.ubc.ca>
/drivers/pci/pci-driver.c
aa33860158114d0df3c7997bc1dd41c0168e1c2a 11-Feb-2011 Rafael J. Wysocki <rjw@sisk.pl> PM: Remove CONFIG_PM_OPS

After redefining CONFIG_PM to depend on (CONFIG_PM_SLEEP ||
CONFIG_PM_RUNTIME) the CONFIG_PM_OPS option is redundant and can be
replaced with CONFIG_PM.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
/drivers/pci/pci-driver.c
23ea3793fd368fd6a1ea20659699e280e2996658 19-Nov-2010 Randy Dunlap <randy.dunlap@oracle.com> PCI: fix __pci_device_probe kernel-doc warning

Fix kernel-doc warning for __pci_device_probe():

Warning(drivers/pci/pci-driver.c:341): missing initial short description on line:
* __pci_device_probe()

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
/drivers/pci/pci-driver.c
1d3c16a818e992c199844954d95c17fd7ce6cbba 01-Dec-2010 Jon Mason <jon.mason@exar.com> PCI: make pci_restore_state return void

pci_restore_state only ever returns 0, thus there is no benefit in
having it return any value. Also, a large majority of the callers do
not check the return code of pci_restore_state. Make the
pci_restore_state a void return and avoid the overhead.

Acked-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Jon Mason <jon.mason@exar.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
/drivers/pci/pci-driver.c
f3ec4f87d607f40497afdb5ac03f11e2ea253d52 08-Jun-2010 Alan Stern <stern@rowland.harvard.edu> PCI: change device runtime PM settings for probe and remove

This patch (as1388) changes the way the PCI core handles runtime PM
settings when probing or unbinding drivers. Now the core will make
sure the device is enabled for runtime PM, with a usage count >= 1,
when a driver is probed. It does the same when calling a driver's
remove method.

If the driver wants to use runtime PM, all it has to do is call
pm_runtime_pu_noidle() near the end of its probe routine (to cancel
the core's usage increment) and pm_runtime_get_noresume() near the
start of its remove routine (to restore the usage count). It does not
need to mess around with setting the runtime state to enabled,
disabled, active, or suspended.

The patch updates e1000e and r8169, the only PCI drivers that already
use the existing runtime PM interface.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Acked-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
/drivers/pci/pci-driver.c
6cbf82148ff286ec22a55be6836c3a5bffc489c1 17-Feb-2010 Rafael J. Wysocki <rjw@sisk.pl> PCI PM: Run-time callbacks for PCI bus type

Introduce run-time PM callbacks for the PCI bus type. Make the new
callbacks work in analogy with the existing system sleep PM
callbacks, so that the drivers already converted to struct dev_pm_ops
can use their suspend and resume routines for run-time PM without
modifications.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
/drivers/pci/pci-driver.c
4406c56d0a4da7a37b9180abeaece6cd00bcc874 16-Sep-2009 Linus Torvalds <torvalds@linux-foundation.org> Merge branch 'linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6

* 'linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6: (75 commits)
PCI hotplug: clean up acpi_run_hpp()
PCI hotplug: acpiphp: use generic pci_configure_slot()
PCI hotplug: shpchp: use generic pci_configure_slot()
PCI hotplug: pciehp: use generic pci_configure_slot()
PCI hotplug: add pci_configure_slot()
PCI hotplug: clean up acpi_get_hp_params_from_firmware() interface
PCI hotplug: acpiphp: don't cache hotplug_params in acpiphp_bridge
PCI hotplug: acpiphp: remove superfluous _HPP/_HPX evaluation
PCI: Clear saved_state after the state has been restored
PCI PM: Return error codes from pci_pm_resume()
PCI: use dev_printk in quirk messages
PCI / PCIe portdrv: Fix pcie_portdrv_slot_reset()
PCI Hotplug: convert acpi_pci_detect_ejectable() to take an acpi_handle
PCI Hotplug: acpiphp: find bridges the easy way
PCI: pcie portdrv: remove unused variable
PCI / ACPI PM: Propagate wake-up enable for devices w/o ACPI support
ACPI PM: Replace wakeup.prepared with reference counter
PCI PM: Introduce device flag wakeup_prepared
PCI / ACPI PM: Rework some debug messages
PCI PM: Simplify PCI wake-up code
...

Fixed up conflict in arch/powerpc/kernel/pci_64.c due to OF device tree
scanning having been moved and merged for the 32- and 64-bit cases. The
'needs_freset' initialization added in 6e19314cc ("PCI/powerpc: support
PCIe fundamental reset") is now in arch/powerpc/kernel/pci_of_scan.c.
4b77b0a2ba27d64f58f16d8d4d48d8319dda36ff 09-Sep-2009 Rafael J. Wysocki <rjw@sisk.pl> PCI: Clear saved_state after the state has been restored

Some PCI devices fail if their standard configuration registers are
restored twice in a row. Prevent this from happening by making
pci_restore_state() clear the saved_state flag of the device right
after the device's standard configuration registers have been
populated with the previously saved values.

Simplify PCI PM callbacks by removing the direct clearing of
state_saved from them, as it shouldn't be necessary any more (except
in pci_pm_thaw(), where it has to be cleared, so that the values saved
during the "freeze" phase of hibernation are not used later by mistake).

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
/drivers/pci/pci-driver.c
999cce4a52d5abdda5d2cec6bac241899bc19e4c 09-Sep-2009 Rafael J. Wysocki <rjw@sisk.pl> PCI PM: Return error codes from pci_pm_resume()

Currently pci_pm_resume() always returns 0, which makes the error
variable defined in there a bit pointless. Make pci_pm_resume()
return error codes obtained from drivers' callbacks.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
/drivers/pci/pci-driver.c
9dba910e9de2c4aa15ec1286f10052c107ef48ca 03-Sep-2009 Tejun Heo <tj@kernel.org> PCI: separate out pci_add_dynid()

Separate out pci_add_dynid() from store_new_id() and export it so that
in-kernel code can add PCI IDs dynamically. As the function will be
available regardless of HOTPLUG, put it and pull pci_free_dynids()
outside of CONFIG_HOTPLUG.

This will be used by pci-stub to initialize initial IDs via module
param.

While at it, remove bogus get_driver() failure check.

Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Reviewed-by: Grant Grundler <grundler@parisc-linux.org>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
/drivers/pci/pci-driver.c
4b61bb575b1fb42ab1df228ae7812e5135f656da 28-Aug-2009 Dmitry Torokhov <dmitry.torokhov@gmail.com> Merge commit 'v2.6.31-rc8' into next
c82f63e411f1b58427c103bd95af2863b1c96dd1 08-Aug-2009 Alek Du <alek.du@intel.com> PCI: check saved state before restore

Without the check, the config space may be filled with zeros. Though
the driver should try to avoid call restoring before saving, but the
pci layer also should check this.

Also removes the existing check in pci_restore_standard_config, since
it's superfluous with the new check in restore_state.

Acked-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Alek Du <alek.du@intel.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
/drivers/pci/pci-driver.c
8150f32b90f630ad3e460f026ce338cb81685bc9 25-Jul-2009 Dmitry Torokhov <dmitry.torokhov@gmail.com> Driver Core: Make PM operations a const pointer

They are not supposed to be modified by drivers, so make them const.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
/drivers/pci/pci-driver.c
90975ef71246c5c688ead04e8ff6f36dc92d28b3 05-Apr-2009 Linus Torvalds <torvalds@linux-foundation.org> Merge git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-cpumask

* git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-cpumask: (36 commits)
cpumask: remove cpumask allocation from idle_balance, fix
numa, cpumask: move numa_node_id default implementation to topology.h, fix
cpumask: remove cpumask allocation from idle_balance
x86: cpumask: x86 mmio-mod.c use cpumask_var_t for downed_cpus
x86: cpumask: update 32-bit APM not to mug current->cpus_allowed
x86: microcode: cleanup
x86: cpumask: use work_on_cpu in arch/x86/kernel/microcode_core.c
cpumask: fix CONFIG_CPUMASK_OFFSTACK=y cpu hotunplug crash
numa, cpumask: move numa_node_id default implementation to topology.h
cpumask: convert node_to_cpumask_map[] to cpumask_var_t
cpumask: remove x86 cpumask_t uses.
cpumask: use cpumask_var_t in uv_flush_tlb_others.
cpumask: remove cpumask_t assignment from vector_allocation_domain()
cpumask: make Xen use the new operators.
cpumask: clean up summit's send_IPI functions
cpumask: use new cpumask functions throughout x86
x86: unify cpu_callin_mask/cpu_callout_mask/cpu_initialized_mask/cpu_sibling_setup_mask
cpumask: convert struct cpuinfo_x86's llc_shared_map to cpumask_var_t
cpumask: convert node_to_cpumask_map[] to cpumask_var_t
x86: unify 32 and 64-bit node_to_cpumask_map
...
e76e5b2c663ac74ae6a542ac20795c625e36a5cd 01-Apr-2009 Linus Torvalds <torvalds@linux-foundation.org> Merge branch 'linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6

* 'linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6: (88 commits)
PCI: fix HT MSI mapping fix
PCI: don't enable too much HT MSI mapping
x86/PCI: make pci=lastbus=255 work when acpi is on
PCI: save and restore PCIe 2.0 registers
PCI: update fakephp for bus_id removal
PCI: fix kernel oops on bridge removal
PCI: fix conflict between SR-IOV and config space sizing
powerpc/PCI: include pci.h in powerpc MSI implementation
PCI Hotplug: schedule fakephp for feature removal
PCI Hotplug: rename legacy_fakephp to fakephp
PCI Hotplug: restore fakephp interface with complete reimplementation
PCI: Introduce /sys/bus/pci/devices/.../rescan
PCI: Introduce /sys/bus/pci/devices/.../remove
PCI: Introduce /sys/bus/pci/rescan
PCI: Introduce pci_rescan_bus()
PCI: do not enable bridges more than once
PCI: do not initialize bridges more than once
PCI: always scan child buses
PCI: pci_scan_slot() returns newly found devices
PCI: don't scan existing devices
...

Fix trivial append-only conflict in Documentation/feature-removal-schedule.txt
558f6ab9106e6be701acb0257e7171df1bbccf04 31-Mar-2009 Rusty Russell <rusty@rustcorp.com.au> Merge branch 'cpumask-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip

Conflicts:

arch/x86/include/asm/topology.h
drivers/oprofile/buffer_sync.c
(Both cases: changed in Linus' tree, removed in Ingo's).
931ff68a5a53fa84bcdf9b1b179a80e54e034bd0 16-Mar-2009 Rafael J. Wysocki <rjw@sisk.pl> PCI PM: Restore config spaces of all devices during early resume

At present the configuration spaces of PCI devices that have no
drivers or no PM support in the drivers (either legacy or through a
pm object) are not saved during suspend and, consequently, they are
not restored during resume. This generally may lead to the state of
the system being slightly inconsistent after the resume, so it's
better to save and restore the configuration spaces of these devices
as well.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Ingo Molnar <mingo@elte.hu>
Acked-by: Jesse Barnes <jbarnes@virtuousgeek.org>
/drivers/pci/pci-driver.c
46939f8b15e44f065d052e89ea4f2adc81fdc740 16-Mar-2009 Rafael J. Wysocki <rjw@sisk.pl> PCI PM: Put devices into low power states during late suspend (rev. 2)

Once we have allowed timer interrupts to be enabled during the late
phase of suspending devices, we are now able to use the generic
pci_set_power_state() to put PCI devices into low power states at
that time. We can also use some related platform callbacks, like the
ones preparing devices for wake-up, during the late suspend.

Doing this will allow us to avoid the race condition where a device
using shared interrupts is put into a low power state with interrupts
enabled and then an interrupt (for another device) comes in and
confuses its driver. At the same time, devices that don't support
the native PCI PM or that require some additional, platform-specific
operations to be carried out to put them into low power states will
be handled as appropriate.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Ingo Molnar <mingo@elte.hu>
Acked-by: Jesse Barnes <jbarnes@virtuousgeek.org>
/drivers/pci/pci-driver.c
0128a89cf75124500b5b69f0c3c7b7c5aa60676f 16-Mar-2009 Rafael J. Wysocki <rjw@sisk.pl> PCI PM: Move pci_restore_standard_config to pci-driver.c

Move pci_restore_standard_config() from pci.c to pci-driver.c and
make it static.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Ingo Molnar <mingo@elte.hu>
Acked-by: Jesse Barnes <jbarnes@virtuousgeek.org>
/drivers/pci/pci-driver.c
57ef80266e14ecc363380268fedc64e519047b4a 16-Mar-2009 Frans Pop <elendil@planet.nl> PCI PM: Consistently use variable name "error" for pm call return values

I noticed two functions use a variable "i" to store the return value of PM
function calls while the rest of the file uses "error". As "i" normally
indicates a counter of some sort it seems better to keep this consistent.

Signed-off-by: Frans Pop <elendil@planet.nl>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
/drivers/pci/pci-driver.c
705b1aaa823e800490f157cd9366ad8cff385f5f 20-Mar-2009 Alex Chiang <achiang@hp.com> PCI: Introduce /sys/bus/pci/rescan

This interface allows the user to force a rescan of all PCI buses
in system, and rediscover devices that have been removed earlier.

pci_bus_attrs implementation from Trent Piepho.

Thanks to Vegard Nossum for discovering locking issues with the
sysfs interface.

Cc: Trent Piepho <xyzzy@speakeasy.org>
Signed-off-by: Alex Chiang <achiang@hp.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
/drivers/pci/pci-driver.c
0994375e9614f78657031e04e30019b9cdb62795 24-Feb-2009 Chris Wright <chrisw@sous-sol.org> PCI: add remove_id sysfs entry

This adds a remove_id sysfs entry to allow users of new_id to later
remove the added dynid. One use case is management tools that want to
dynamically bind/unbind devices to pci-stub driver while devices are
assigned to KVM guests. Rather than having to track which driver was
originally bound to the driver, a mangement tool can simply:

Guest uses device

Signed-off-by: Chris Wright <chrisw@sous-sol.org>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
/drivers/pci/pci-driver.c
a70f730282019f487aa33a84e5ac9a5e89c5abd0 13-Mar-2009 Rusty Russell <rusty@rustcorp.com.au> cpumask: replace node_to_cpumask with cpumask_of_node.

Impact: cleanup

node_to_cpumask (and the blecherous node_to_cpumask_ptr which
contained a declaration) are replaced now everyone implements
cpumask_of_node.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
/drivers/pci/pci-driver.c
5294e256717923f4a3297bb8b802f5e0625763f3 04-Feb-2009 Rafael J. Wysocki <rjw@sisk.pl> PCI PM: make the PM core more careful with drivers using the new PM framework

Currently, the PM core always attempts to manage devices with drivers
that use the new PM framework. In particular, it attempts to disable
the devices (which is unnecessary), to save their state (which may be
undesirable if the driver has done that already) and to put them into
low power states (again, this may be undesirable if the driver has
already put the device into a low power state). That need not be
the right thing to do, so make the core be more careful in this
respect.

Generally, there are the following categories of devices to consider:
* bridge devices without drivers
* non-bridge devices without drivers
* bridge devices with drivers
* non-bridge devices with drivers
and each of them should be handled differently.

For bridge devices without drivers the PCI PM core will save their
state on suspend and restore it (early) during resume, after putting
them into D0 if necessary. It will not attempt to do anything else
to these devices.

For non-bridge devices without drivers the PCI PM core will disable
them and save their state on suspend. During resume, it will put
them into D0, if necessary, restore their state (early) and reenable
them.

For bridge devices with drivers the PCI PM core will only save
their state on suspend if the driver hasn't done that already.
Still, the core will restore their state (early) during resume,
after putting them into D0, if necessary.

For non-bridge devices with drivers the PCI PM core will only save
their state on suspend if the driver hasn't done that already. Also,
if the state of the device hasn't been saved by the driver, the core
will attempt to put the device into a low power state. During
resume the core will restore the state of the device (early), after
putting it into D0, if necessary.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
/drivers/pci/pci-driver.c
cbbc2f6b0d438f80831c20124137ea92f0e5149b 04-Feb-2009 Rafael J. Wysocki <rjw@sisk.pl> PCI PM: Do not disable and enable bridges during suspend-resume

It is a mistake to disable and enable PCI bridges and PCI Express
ports during suspend-resume, at least at the time when it is
currently done. Disabling them may lead to problems with accessing
devices behind them and they should be automatically enabled when
their standard config spaces are restored. Fix this by not attempting
to disable bridges during suspend and enable them during resume.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
/drivers/pci/pci-driver.c
99dadce8756bf08f5f8baf749533d044f6b3ff25 04-Feb-2009 Rafael J. Wysocki <rjw@sisk.pl> PCI PM: Fix saving of device state in pci_legacy_suspend

Make pci_legacy_suspend() save the state of the device if it is
in PCI_UNKNOWN after its suspend callback has run and warn only if
the power state of the device has been changed by its suspend
callback.

Also, use WARN_ONCE(), which is more useful, in pci_legacy_suspend(),
so that the name of the offending function is printed.

Additionally, remove the unnecessary line of code setting
pci_dev->state_saved.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Reported-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
/drivers/pci/pci-driver.c
ddb7c9d29fac34626aef2af9f19787a888e4ca9c 04-Feb-2009 Rafael J. Wysocki <rjw@sisk.pl> PCI PM: Fix handling of devices without drivers

Suspend to RAM is reported to break on some machines as a result of
attempting to put one of driverless PCI devices into a low power
state. Avoid that by not attepmting to power manage driverless
devices during suspend.

Fix up pci_pm_poweroff() after a previous incomplete fix for the same
thing during hibernation.

This patch is reported to fix the regression from 2.6.28 tracked as
http://bugzilla.kernel.org/show_bug.cgi?id=12605

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Reported-and-tested-by: Eric Sesterhenn <snakebyte@gmx.de>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
/drivers/pci/pci-driver.c
545ffd58adc86b8d33449dab44fe81b503a6f81b 22-Jan-2009 Rafael J. Wysocki <rjw@sisk.pl> PCI PM: Fix hibernation breakage on EeePC 701

Hibernation breaks on EeePC 701 as a result of attempting to put one
of its (driverless) devices into a low power state. Avoid that by
not attepmting to power manage driverless devices during hibernation.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Reported-and-tested-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
/drivers/pci/pci-driver.c
418e4da33f45fd7bdcce48778b149b780ff730bc 26-Jan-2009 Rafael J. Wysocki <rjw@sisk.pl> PCI PM: Fix suspend error paths and testing facility breakage

If one of device drivers refuses to suspend by returning error code
from its ->suspend() callback, the devices that have already been
suspended are resumed by executing their drivers' ->resume()
callbacks. Some of these callbacks expect the device's
configuration space to be restored if the device has been put into
D3 before they are called. Unfortunately, this mechanism has been
broken by recent changes moving the restoration of config spaces
of some devices (most importantly, USB controllers and HDA Intel)
into the resume callbacks executed with interrupts off. Obviously,
these callbacks are not invoked in the suspend error path and, as a
result, the system cannot be successfully brought back into the
working state in case of a suspend error. The same thing happens
in the hibernation error path right before putting the system into
S4.

Similarly, the suspend testing facility associated with the
/sys/power/pm_test file is broken, because it uses the very same
mechanism that is used in the suspend and hibernation error paths.

Fix the breakage by making the PCI core restore the configuration
spaces of PCI devices that haven't been restored already before
pci_pm_resume() is called for those devices by the PM core.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
/drivers/pci/pci-driver.c
aa8c6c93747f7b55fa11e1624fec8ca33763a805 16-Jan-2009 Rafael J. Wysocki <rjw@sisk.pl> PCI PM: Restore standard config registers of all devices early

There is a problem in our handling of suspend-resume of PCI devices that
many of them have their standard config registers restored with
interrupts enabled and they are put into the full power state with
interrupts enabled as well. This may lead to the following scenario:
* an interrupt vector is shared between two or more devices
* one device is resumed earlier and generates an interrupt
* the interrupt handler of another device tries to handle it and
attempts to access the device the config space of which hasn't been
restored yet and/or which still is in a low power state
* the system crashes as a result

To prevent this from happening we should restore the standard
configuration registers of all devices with interrupts disabled and we
should put them into the D0 power state right after that.
Unfortunately, this cannot be done using the existing
pci_set_power_state(), because it can sleep. Also, to do it we have to
make sure that the config spaces of all devices were actually saved
during suspend.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
/drivers/pci/pci-driver.c
f6dc1e5e3d4b523e1616b43beddb04e4fb1d376a 07-Jan-2009 Rafael J. Wysocki <rjw@sisk.pl> PCI PM: Put PM callbacks in the order of execution

Put PM callbacks in drivers/pci/pci-driver.c in the order in which
they are executed which makes it much easier to follow the code.

No functional changes should result from this.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@suse.cz>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
/drivers/pci/pci-driver.c
d67e37d7933ba3b28a63ff38c957e433aaca5dc4 07-Jan-2009 Rafael J. Wysocki <rjw@sisk.pl> PCI PM: Run default PM callbacks for all devices using new framework

It should be quite clear that it generally makes sense to execute
the default PM callbacks (ie. the callbacks used for handling
suspend, hibernation and resume of PCI devices without drivers) for
all devices. Of course, the drivers that provide legacy PCI PM
support (ie. the ->suspend, ->suspend_late, ->resume_early
or ->resume hooks in the pci_driver structure), carry out these
operations too, so we can't do it for devices with such drivers.
Still, we can make the default PM callbacks run for devices with
drivers using the new framework (ie. implement the pm object), since
there are no such drivers at the moment.

This also simplifies the code and makes it smaller.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@suse.cz>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
/drivers/pci/pci-driver.c
ad8cfa1defee14a5181d9b63e666318c51cfaeed 07-Jan-2009 Rafael J. Wysocki <rjw@sisk.pl> PCI PM: Call pci_fixup_device from legacy routines

The size of drivers/pci/pci-driver.c can be reduced quite a bit
if pci_fixup_device() is called from the legacy PM callbacks, so make
it happen.

No functional changes should result from this.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@suse.cz>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
/drivers/pci/pci-driver.c
bb8089454391ac5577215aec1f1991adcd4b4cbf 07-Jan-2009 Rafael J. Wysocki <rjw@sisk.pl> PCI PM: Rearrange code in pci-driver.c

Rename two functions and rearrange code in drivers/pci/pci-driver.c
so that it's easier to follow. In particular, separate invocations
of the legacy callbacks from the rest of the new callbacks' code.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
/drivers/pci/pci-driver.c
734104292ff77dc71fe626b4ebd91b314547ca1b 07-Jan-2009 Rafael J. Wysocki <rjw@sisk.pl> PCI PM: Avoid touching devices behind bridges in unknown state

It generally is better to avoid accessing devices behind bridges that
may not be in the D0 power state, because in that case the bridges'
secondary buses may not be accessible. For this reason, during the
early phase of resume (ie. with interrupts disabled), before
restoring the standard config registers of a device, check the power
state of the bridge the device is behind and postpone the restoration
of the device's config space, as well as any other operations that
would involve accessing the device, if that state is not D0.

In such cases the restoration of the device's config space will be
retried during the "normal" phase of resume (ie. with interrupts
enabled), so that the bridge can be put into D0 before that happens.

Also, save standard configuration registers of PCI devices during the
"normal" phase of suspend (ie. with interrupts enabled), so that the
bridges the devices are behind can be put into low power states (we
don't put bridges into low power states at the moment, but we may
want to do it in the future and it seems reasonable to design for
that).

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
/drivers/pci/pci-driver.c
07e836e8d1f3688311d97fe1bf46980b0f9ae9c1 07-Jan-2009 Rafael J. Wysocki <rjw@sisk.pl> PCI PM: Move pci_has_legacy_pm_support

Move pci_has_legacy_pm_support() closer to the functions that
call it.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@suse.cz>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
/drivers/pci/pci-driver.c
571ff7584bb9e05fca0eb79752ae55a46faf3a98 07-Jan-2009 Rafael J. Wysocki <rjw@sisk.pl> PCI PM: Power-manage devices without drivers during suspend-resume

PCI devices without drivers can be put into low power states during
suspend with the help of pci_prepare_to_sleep() and prevented from
generating wake-up events during resume with the help of
pci_enable_wake(). However, it's better not to put bridges into
low power states during suspend, because that might result in entire
bus segments being powered off.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@suse.cz>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
/drivers/pci/pci-driver.c
fa58d305d9925b01830e535896a7227a868a9e15 07-Jan-2009 Rafael J. Wysocki <rjw@sisk.pl> PCI PM: Add suspend counterpart of pci_reenable_device

PCI devices without drivers are not disabled during suspend and
hibernation, but they are enabled during resume, with the help of
pci_reenable_device(), so there is an unbalanced execution of
pcibios_enable_device() in the resume code path.

To correct this introduce function pci_disable_enabled_device()
that will disable the argument device, if it is enabled when the
function is being run, without updating the device's pci_dev
structure and use it in the suspend code path to balance the
pci_reenable_device() executed during resume.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@suse.cz>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
/drivers/pci/pci-driver.c
c9b9972b3c88272be02d971346285d1c67fbb95f 07-Jan-2009 Rafael J. Wysocki <rjw@sisk.pl> PCI PM: Fix poweroff and restore callbacks

pci_fixup_device() is called too early in pci_pm_poweroff() and too
late in pci_pm_restore(). Moreover, pci_pm_restore_noirq() calls
pci_fixup_device() twice and in a wrong way. Fix that.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@suse.cz>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
/drivers/pci/pci-driver.c
873392ca514f87eae39f53b6944caf85b1a047cb 31-Dec-2008 Rusty Russell <rusty@rustcorp.com.au> PCI: work_on_cpu: use in drivers/pci/pci-driver.c

This uses work_on_cpu(), rather than altering the cpumask of the
thread which we happen to be.

Note the cleanups:

1) I've removed the CONFIG_NUMA test, since dev_to_node() returns -1
for !CONFIG_NUMA anyway and the compiler will eliminate it.

2) No need to reset mempolicy to default (a bad idea anyway) since
work_on_cpu is run from a workqueue.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
/drivers/pci/pci-driver.c
2debb4d2019fa05a0896f1591dea0e0dc21bc046 26-Nov-2008 Chris Wright <chrisw@sous-sol.org> PCI: allow pci driver to support only dynids

commit b41d6cf38e27 (PCI: Check dynids driver_data value for validity)
requires all drivers to include an id table to try and match
driver_data. Before validating driver_data check driver has an id
table.

Acked-by: Jean Delvare <khali@linux-fr.org>
Cc: Milton Miller <miltonm@bga.com>
Signed-off-by: Chris Wright <chrisw@sous-sol.org>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
/drivers/pci/pci-driver.c
355a72d75b3b4f4877db4c9070c798238028ecb5 08-Dec-2008 Rafael J. Wysocki <rjw@sisk.pl> PCI: Rework default handling of suspend and resume

Rework the handling of suspend and resume of PCI devices which have
no drivers or the drivers of which do not provide any suspend-resume
callbacks in such a way that their standard PCI configuration
registers will be saved and restored with interrupts disabled. This
should prevent such devices, including PCI bridges, from being
resumed too late to be able to function correctly during the resume
of the other PCI devices that may depend on them.

Also, to remove one possible source of future confusion, drop the
default handling of suspend and resume for PCI devices with drivers
providing the 'pm' object introduced by the new suspend-resume
framework (there are no such PCI drivers at the moment).

This patch addresses the regression from 2.6.26 tracked as
http://bugzilla.kernel.org/show_bug.cgi?id=12121 .

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/pci/pci-driver.c
adf094931ffb25ef4b381559918f1a34181a5273 06-Oct-2008 Rafael J. Wysocki <rjw@sisk.pl> PM: Simplify the new suspend/hibernation framework for devices

PM: Simplify the new suspend/hibernation framework for devices

Following the discussion at the Kernel Summit, simplify the new
device PM framework by merging 'struct pm_ops' and
'struct pm_ext_ops' and removing pointers to 'struct pm_ext_ops'
from 'struct platform_driver' and 'struct pci_driver'.

After this change, the suspend/hibernation callbacks will only
reside in 'struct device_driver' as well as at the bus type/
device class/device type level. Accordingly, PCI and platform
device drivers are now expected to put their suspend/hibernation
callbacks into the 'struct device_driver' embedded in
'struct pci_driver' or 'struct platform_driver', respectively.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@suse.cz>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/pci/pci-driver.c
b41d6cf38e27a940d998d989526a9748de1bf028 17-Aug-2008 Jean Delvare <khali@linux-fr.org> PCI: Check dynids driver_data value for validity

Only accept dynids whose driver_data value matches one of the driver's
pci_driver_id entries. This prevents the user from accidentally passing
values the drivers do not expect.

Cc: Milton Miller <miltonm@bga.com>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
/drivers/pci/pci-driver.c
edbc25caaa492a82e19baa915f1f6b0a0db6554d 10-Jul-2008 Milton Miller <miltonm@bga.com> PCI: remove dynids.use_driver_data

The driver flag dynids.use_driver_data is almost consistently not set,
and causes more problems than it solves. It was initially intended as a
flag to indicate whether a driver's usage of driver_data had been
carefully inspected and was ready for values from userspace. That audit
was never done, so most drivers just get a 0 for driver_data when new
IDs are added from userspace via sysfs. So remove the flag, allowing
drivers to see the data directly (a followon patch validates the passed
driver_data value against what the drivers expect).

Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Acked-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Milton Miller <miltonm@bga.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
/drivers/pci/pci-driver.c
dc7c65db2845a8d17432d89252c4227a9a7cb15f 17-Jul-2008 Linus Torvalds <torvalds@linux-foundation.org> Merge branch 'linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6

* 'linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6: (72 commits)
Revert "x86/PCI: ACPI based PCI gap calculation"
PCI: remove unnecessary volatile in PCIe hotplug struct controller
x86/PCI: ACPI based PCI gap calculation
PCI: include linux/pm_wakeup.h for device_set_wakeup_capable
PCI PM: Fix pci_prepare_to_sleep
x86/PCI: Fix PCI config space for domains > 0
Fix acpi_pm_device_sleep_wake() by providing a stub for CONFIG_PM_SLEEP=n
PCI: Simplify PCI device PM code
PCI PM: Introduce pci_prepare_to_sleep and pci_back_from_sleep
PCI ACPI: Rework PCI handling of wake-up
ACPI: Introduce new device wakeup flag 'prepared'
ACPI: Introduce acpi_device_sleep_wake function
PCI: rework pci_set_power_state function to call platform first
PCI: Introduce platform_pci_power_manageable function
ACPI: Introduce acpi_bus_power_manageable function
PCI: make pci_name use dev_name
PCI: handle pci_name() being const
PCI: add stub for pci_set_consistent_dma_mask()
PCI: remove unused arch pcibios_update_resource() functions
PCI: fix pci_setup_device()'s sprinting into a const buffer
...

Fixed up conflicts in various files (arch/x86/kernel/setup_64.c,
arch/x86/pci/irq.c, arch/x86/pci/pci.h, drivers/acpi/sleep/main.c,
drivers/pci/pci.c, drivers/pci/pci.h, include/acpi/acpi_bus.h) from x86
and ACPI updates manually.
bbb44d9f23d868a2837c6b22b8dfb123d8e7800c 20-May-2008 Rafael J. Wysocki <rjw@sisk.pl> PCI: implement new suspend/resume callbacks

Implement new suspend and hibernation callbacks for the PCI bus type.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
/drivers/pci/pci-driver.c
e1a2a51e684bfe9d6165992d4a065439617a3107 15-May-2008 Rafael J. Wysocki <rjw@sisk.pl> Suspend/Resume bug in PCI layer wrt quirks

Some quirks should be called with interrupt disabled, we can't directly
call them in .resume_early. Also the patch introduces
pci_fixup_resume_early and pci_fixup_suspend, which matches current
device core callbacks (.suspend/.resume_early).

TBD: Somebody knows why we need quirk resume should double check if a
quirk should be called in resume or resume_early. I changed some per my
understanding, but can't make sure I fixed all.

Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
/drivers/pci/pci-driver.c
4efeb4dd3c0bf534e431a8e7c72d0afbd4cd24aa 12-May-2008 Yinghai Lu <Yinghai.Lu@Sun.COM> PCI: use dev_to_node in pci_call_probe

to make sure get one online node.

Signed-off-by: Yinghai Lu <yinghai.lu@sun.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
/drivers/pci/pci-driver.c
d52877c7b1afb8c37ebe17e2005040b79cb618b0 23-Apr-2008 Yinghai Lu <yhlu.kernel.send@gmail.com> pci/irq: let pci_device_shutdown to call pci_msi_shutdown v2

[PATCH 2/2] pci/irq: let pci_device_shutdown to call pci_msi_shutdown v2

this change

| commit 23a274c8a5adafc74a66f16988776fc7dd6f6e51
| Author: Prakash, Sathya <sathya.prakash@lsi.com>
| Date: Fri Mar 7 15:53:21 2008 +0530
|
| [SCSI] mpt fusion: Enable MSI by default for SAS controllers
|
| This patch modifies the driver to enable MSI by default for all SAS chips.
|
| Signed-off-by: Sathya Prakash <sathya.prakash@lsi.com>
| Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
|
Causes the kexec of a RHEL 5.1 kernel to fail.

root casue: the rhel 5.1 kernel still uses INTx emulation. and
mptscsih_shutdown doesn't call pci_disable_msi to reenable INTx on kexec path

So call pci_msi_shutdown in the shutdown path to do the same thing to msix

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Jesse Barnes <jbarnes@hobbes.lan>
/drivers/pci/pci-driver.c
f70316dace2bb99730800d47044acb818c6735f6 05-Apr-2008 Mike Travis <travis@sgi.com> generic: use new set_cpus_allowed_ptr function

* Use new set_cpus_allowed_ptr() function added by previous patch,
which instead of passing the "newly allowed cpus" cpumask_t arg
by value, pass it by pointer:

-int set_cpus_allowed(struct task_struct *p, cpumask_t new_mask)
+int set_cpus_allowed_ptr(struct task_struct *p, const cpumask_t *new_mask)

* Modify CPU_MASK_ALL

Depends on:
[sched-devel]: sched: add new set_cpus_allowed_ptr function

Signed-off-by: Mike Travis <travis@sgi.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
/drivers/pci/pci-driver.c
74e27e44b0407fb1f6e8d1f7b7818f108463c4b8 22-Nov-2007 Lee Schermerhorn <Lee.Schermerhorn@hp.com> PCI: Mem Policy: fix mempolicy usage in pci driver

In an attempt to ensure memory allocation from the local node, the pci
driver temporarily replaces the current task's memory policy with the
system default policy. Trying to be a good citizen, the driver then call's
mpol_get() on the new policy. When it's finished probing, it undoes the
'_get by calling mpol_free() [on the system default policy] and then
restores the current task's saved mempolicy.

A couple of issues here:

1) it's never necessary to set a task's mempolicy to the
system default policy in order to get system default
allocation behavior. Simply set the current task's
mempolicy to NULL and allocations will fall back to
system default policy.

2) we should never [need to] call mpol_free() on the system
default policy. [I plan on trapping this with a VM_BUG_ON()
in a subsequent patch.]

This patch removes the calls to mpol_get() and mpol_free()
and uses NULL for the temporary task mempolicy to effect
default allocation behavior.

Signed-off-by: Lee Schermerhorn <lee.schermerhorn@hp.com>
Acked-by: Christoph Lameter <clameter@sgi.com>
Acked-by: Mel Gorman <mel@csn.ul.ie>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/pci/pci-driver.c
2b937303188807b498d1a3163f60305f0941538e 28-Nov-2007 Greg Kroah-Hartman <gregkh@suse.de> PCI: remove foolish code from pci-driver.c

The PCI bus should not be trying to declare its own attribute type.
Especially as this code could never ever be called because the driver
core overwrites the driver kobject type to be its own internal type.
Delete all of this code as it was never being used and is not correct.

Also update my copyright on the file while I'm touching things there.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/pci/pci-driver.c
03d43b19b9f56c1d18bc8f2f7890534fbe6a285d 28-Nov-2007 Greg Kroah-Hartman <gregkh@suse.de> PCI: use proper call to driver_create_file

Don't try to call the "raw" sysfs_create_file when we already have a
helper function to do this kind of work for us.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/pci/pci-driver.c
d73460d79bc88de74221d73723ed61a0081b7a36 24-Oct-2007 Adrian Bunk <bunk@kernel.org> PCI: make pci_match_device() static

pci_match_device() no longer has any other users.

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/pci/pci-driver.c
6a84258e5f5bb8b9bd72e06a5837fa6fdacaf5c5 13-Oct-2007 Linus Torvalds <torvalds@woody.linux-foundation.org> Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/pci-2.6

* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/pci-2.6: (37 commits)
PCI: merge almost all of pci_32.h and pci_64.h together
PCI: X86: Introduce and enable PCI domain support
PCI: Add 'nodomains' boot option, and pci_domains_supported global
PCI: modify PCI bridge control ISA flag for clarity
PCI: use _CRS for PCI resource allocation
PCI: avoid P2P prefetch window for expansion ROMs
PCI: skip ISA ioresource alignment on some systems
PCI: remove transparent bridge sizing
pci: write file size to inode on proc bus file write
pci: use size stored in proc_dir_entry for proc bus files
pci: implement "pci=noaer"
PCI: fix IDE legacy mode resources
MSI: Use correct data offset for 32-bit MSI in read_msi_msg()
PCI: Fix incorrect argument order to list_add_tail() in PCI dynamic ID code
PCI: i386: Compaq EVO N800c needs PCI bus renumbering
PCI: Remove no longer correct documentation regarding MSI vector assignment
PCI: re-enable onboard sound on "MSI K8T Neo2-FIR"
PCI: quirk_vt82c586_acpi: Omit reading PCI revision ID
PCI: quirk amd_8131_mmrbc: Omit reading pci revision ID
cpqphp: Use PCI_CLASS_REVISION instead of PCI_REVISION_ID for read
...
a56bc69a182f501582557af7fad5bc882b1c856c 14-Sep-2007 Michael Ellerman <michael@ellerman.id.au> PCI: Fix incorrect argument order to list_add_tail() in PCI dynamic ID code

The code for dynamically assigning new ids to PCI drivers,
store_new_id(), calls list_add_tail() with the list head and new node
arguments in reversed order.

The result is that every new id written essentially overwrites the
previous list of ids.

Caught with the help of Rusty's "horribly bad" list_node patch:
http://lkml.org/lkml/2007/6/10/10

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/pci/pci-driver.c
7eff2e7a8b65c25920207324e56611150eb1cd9a 14-Aug-2007 Kay Sievers <kay.sievers@vrfy.org> Driver core: change add_uevent_var to use a struct

This changes the uevent buffer functions to use a struct instead of a
long list of parameters. It does no longer require the caller to do the
proper buffer termination and size accounting, which is currently wrong
in some places. It fixes a known bug where parts of the uevent
environment are overwritten because of wrong index calculations.

Many thanks to Mathieu Desnoyers for finding bugs and improving the
error handling.

Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Cc: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/pci/pci-driver.c
0b62e13b5c9b4871641973e024cc9dd440b5bb58 27-Jul-2007 Tejun Heo <htejun@gmail.com> pci: rename __pci_reenable_device() to pci_reenable_device()

Rename __pci_reenable_device() to pci_reenable_device().

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
/drivers/pci/pci-driver.c
8b60756a628a73bc8bf8b59d8716cb3f09b7e7eb 09-May-2007 Randy Dunlap <randy.dunlap@oracle.com> Fix more "deprecated" spellos.

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
/drivers/pci/pci-driver.c
5adc55da4a7758021bcc374904b0f8b076508a11 27-Mar-2007 Adrian Bunk <bunk@stusta.de> PCI: remove the broken PCI_MULTITHREAD_PROBE option

This patch removes the PCI_MULTITHREAD_PROBE option that had already
been marked as broken.

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/pci/pci-driver.c
6ba186361ed2cda7e174856a3ab8a8e3237b3c3d 07-Apr-2007 Jean Delvare <khali@linux-fr.org> PCI: Require vendor and device for new_id

Currently, there is no minimum number of fields required when adding
a new device ID to a PCI driver through the new_id sysfs file. It is
possible to add a new ID with only the vendor ID set, causing the
driver to attempt to attach to all PCI devices from that vendor. This
has been reported to happen accidentally:
http://lists.lm-sensors.org/pipermail/lm-sensors/2007-March/019366.html
It is even possible to not even set the vendor ID field, causing the
driver to attempt to attach to _all_ the PCI devices.

This sounds dangerous and I fail to see any valid use of this
"feature". Thus I suggest that we now require at least the first two
fields (vendor ID and device ID) to be set. For what it's worth, this
is what the USB subsystem does.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/pci/pci-driver.c
21c7f30b1d3f8a3de3128478daca3ce203fc8733 06-Feb-2007 Cornelia Huck <cornelia.huck@de.ibm.com> driver core: per-subsystem multithreaded probing

Make multithreaded probing work per subsystem instead of per driver.

It doesn't make much sense to probe the same device for multiple drivers in
parallel (after all, only one driver can bind to the device). Instead, create
a probing thread for each device that probes the drivers one after another.
Also make the decision to use multi-threaded probe per bus instead of per
device and adapt the pci code.

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/pci/pci-driver.c
f95d882d81ee731be2a4a3b34f86810e29b68836 10-Feb-2007 Randy Dunlap <randy.dunlap@oracle.com> PCI/sysfs/kobject kernel-doc fixes

Fix kernel-doc warnings in PCI, sysfs, and kobject files.

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/pci/pci-driver.c
78149df6d565c36675463352d0bfe0000b02b7a7 08-Feb-2007 Linus Torvalds <torvalds@woody.linux-foundation.org> Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/pci-2.6

* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/pci-2.6: (41 commits)
Revert "PCI: remove duplicate device id from ata_piix"
msi: Make MSI useable more architectures
msi: Kill the msi_desc array.
msi: Remove attach_msi_entry.
msi: Fix msi_remove_pci_irq_vectors.
msi: Remove msi_lock.
msi: Kill msi_lookup_irq
MSI: Combine pci_(save|restore)_msi/msix_state
MSI: Remove pci_scan_msi_device()
MSI: Replace pci_msi_quirk with calls to pci_no_msi()
PCI: remove duplicate device id from ipr
PCI: remove duplicate device id from ata_piix
PCI: power management: remove noise on non-manageable hw
PCI: cleanup MSI code
PCI: make isa_bridge Alpha-only
PCI: remove quirk_sis_96x_compatible()
PCI: Speed up the Intel SMBus unhiding quirk
PCI Quirk: 1k I/O space IOBL_ADR fix on P64H2
shpchp: delete trailing whitespace
shpchp: remove DBG_XXX_ROUTINE
...
38cc13022ed3cea949722d5a6f49025da82c9fd0 18-Dec-2006 Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com> PCI : add extremely specialized __pci_reenable_device for default resume

Original patch was posted as "PCI : Move pci_fixup_device and is_enabled".
This 3 of 3 patches does:

- add __pci_reenable_device
(recover former change of 1st patch)

Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Cc: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/pci/pci-driver.c
924b08f3ff12eb0e8ecd9e9a9b6a5b884a495c23 18-Dec-2006 Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com> PCI : remove too specialized __pci_enable_device for default resume

Original patch was posted as "PCI : Move pci_fixup_device and is_enabled".
This 1 of 3 patches does:

- reverts small part of Inaky's patch
(remove __pci_enable_device)
This change will be recovered by 3rd patch.

- temporarily remove pci_fixup_device.
This change will be recovered by 2nd patch.

Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Cc: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/pci/pci-driver.c
725522b5453dd680412f2b6463a988e4fd148757 15-Jan-2007 Greg Kroah-Hartman <gregkh@suse.de> PCI: add the sysfs driver name to all modules

This adds the module name to all PCI drivers, if they are built into the
kernel or not. It will show up in /sys/modules/MODULE_NAME/drivers/

It also fixes up the IDE core, which was calling __pci_register_driver()
directly.

Cc: Kay Sievers <kay.sievers@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/pci/pci-driver.c
ae9608af9e300395ec032479621f32688c121141 10-Jan-2007 Randy Dunlap <randy.dunlap@oracle.com> PCI: fix pci-driver kernel-doc

Function short description should be on only one line.

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/pci/pci-driver.c
1597cacbe39802d86656d1f2e6329895bd2ef531 05-Dec-2006 Alan Cox <alan@lxorguk.ukuu.org.uk> PCI: Fix multiple problems with VIA hardware

This patch is designed to fix:
- Disk eating corruptor on KT7 after resume from RAM
- VIA IRQ handling
- VIA fixups for bus lockups after resume from RAM

The core of this is to add a table of resume fixups run at resume time.
We need to do this for a variety of boards and features, but particularly
we need to do this to get various critical VIA fixups done on resume.

The second part of the problem is to handle VIA IRQ number rules which
are a bit odd and need special handling for PIC interrupts. Various
patches broke various boxes and while this one may not be perfect
(hopefully it is) it ensures the workaround is applied to the right
devices only.

From: Jean Delvare <khali@linux-fr.org>

Now that PCI quirks are replayed on software resume, we can safely
re-enable the Asus SMBus unhiding quirk even when software suspend support
is enabled.

[akpm@osdl.org: fix const warning]
Signed-off-by: Alan Cox <alan@redhat.com>
Cc: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/pci/pci-driver.c
7461b60afa62b26943e97861d87b9f9a32d7fd9c 29-Nov-2006 Russell King <rmk+lkml@arm.linux.org.uk> PCI: use /sys/bus/pci/drivers/<driver>/new_id first

Unfortunately, the .../new_id feature does not work with the 8250_pci
driver.

The reason for this comes down to the way .../new_id is implemented.
When PCI tries to match a driver to a device, it checks the modules
static device ID tables _before_ checking the dynamic new_id tables.

When a driver is capable of matching by ID, and falls back to matching
by class (as 8250_pci does), this makes it absolutely impossible to
specify a board by ID, and as such the correct driver_data value to
use with it.

Let's say you have a serial board with vendor 0x1234 and device 0x5678.
It's class is set to PCI_CLASS_COMMUNICATION_SERIAL.

On boot, this card is matched to the 8250_pci driver, which tries to
probe it because it matched using the class entry. The driver finds
that it is unable to automatically detect the correct settings to use,
so it returns -ENODEV.

You know that the information the driver needs is to match this card
using a device_data value of '7'. So you echo 1234 5678 0 0 0 0 7
into new_id.

The kernel attempts to re-bind 8250_pci to this device. However,
because it scans the PCI driver tables, it _again_ matches the class
entry which has the wrong device_data. It fails.

End of story. You can't support the card without rebuilding the
kernel (or writing a specific PCI probe module to support it.)

So, can we make new_id override the driver-internal PCI ID tables?
IOW, like this:


From: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/pci/pci-driver.c
bae94d02371c402408a4edfb95e71e88dbd3e973 22-Nov-2006 Inaky Perez-Gonzalez <inaky@linux.intel.com> PCI: switch pci_{enable,disable}_device() to be nestable

Changes the pci_{enable,disable}_device() functions to work in a
nested basis, so that eg, three calls to enable_device() require three
calls to disable_device().

The reason for this is to simplify PCI drivers for
multi-interface/capability devices. These are devices that cram more
than one interface in a single function. A relevant example of that is
the Wireless [USB] Host Controller Interface (similar to EHCI) [see
http://www.intel.com/technology/comms/wusb/whci.htm].

In these kind of devices, multiple interfaces are accessed through a
single bar and IRQ line. For that, the drivers map only the smallest
area of the bar to access their register banks and use shared IRQ
handlers.

However, because the order at which those drivers load cannot be known
ahead of time, the sequence in which the calls to pci_enable_device()
and pci_disable_device() cannot be predicted. Thus:

1. driverA starts pci_enable_device()
2. driverB starts pci_enable_device()
3. driverA shutdown pci_disable_device()
4. driverB shutdown pci_disable_device()

between steps 3 and 4, driver B would loose access to it's device,
even if it didn't intend to.

By using this modification, the device won't be disabled until all the
callers to enable() have called disable().

This is implemented by replacing 'struct pci_dev->is_enabled' from a
bitfield to an atomic use count. Each caller to enable increments it,
each caller to disable decrements it. When the count increments from 0
to 1, __pci_enable_device() is called to actually enable the
device. When it drops to zero, pci_disable_device() actually does the
disabling.

We keep the backend __pci_enable_device() for pci_default_resume() to
use and also change the sysfs method implementation, so that userspace
enabling/disabling the device doesn't disable it one time too much.

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/pci/pci-driver.c
50bf14b3ff05fb6e10688021b96f95d30a300f8d 09-Nov-2006 Akinobu Mita <akinobu.mita@gmail.com> pci: fix __pci_register_driver error handling

__pci_register_driver() error path forgot to unwind.
driver_unregister() needs to be called when pci_create_newid_file() failed.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/pci/pci-driver.c
2449e06a5696b7af1c8a369b04c97f3b139cf3bb 20-Oct-2006 Shaohua Li <shaohua.li@intel.com> PCI: reset pci device state to unknown state for resume

Considering below scenario:
1.Unload a PCI device's driver, the device ->current remains in PCI_D0.
2.Do suspend/resume circle. After that, BIOS puts the device to D3.
3.Reload the device driver. The calling pci_set_power_state in the
driver can't change the state to D0, as set_power_state thinks the
device is already in D0.

A bug is reported at http://bugzilla.kernel.org/show_bug.cgi?id=6024
Pat attached a patch at
http://marc.theaimsgroup.com/?l=linux-pci&m=114049761428561&w=2 for this
issue, but it's lost. As pci_set_power_state can handle D3 -> D0
correctly (restore config space), I simplified Patrick's patch.

Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Cc: Patrick Mochel <mochel@digitalimplant.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/pci/pci-driver.c
50b0075520a0acba9cabab5203bbce918b966d9a 16-Aug-2006 Alan Cox <alan@lxorguk.ukuu.org.uk> PCI: Multiprobe sanitizer

There are numerous drivers that can use multithreaded probing but having
some kind of global flag as the way to control this makes migration to
threaded probing hard and since it enables it everywhere and is almost
as likely to cause serious pain as holding a clog dance in a minefield.

If we have a pci_driver multithread_probe flag to inherit you can turn
it on for one driver at a time.

From playing so far however I think we need a different model at the
device layer which serializes until the called probe function says "ok
you can start another one now". That would need some kind of flag and
semaphore plus a helper function.

Anyway in the absence of that this is a starting point to usefully play
with this stuff

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/pci/pci-driver.c
b19441af185559118e8247382ea4f2f76ebffc6d 28-Aug-2006 Greg Kroah-Hartman <gregkh@suse.de> PCI: fix __must_check warnings

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/pci/pci-driver.c
0f397f865076e3471ec884ee73ad5e34165fac2a 18-Jul-2006 Greg Kroah-Hartman <gregkh@suse.de> PCI: enable driver multi-threaded probe

This provides a build and run-time option to turn on multhreaded probe
for all PCI drivers. It can cause bad problems on multi-processor
machines that take a while to find their root disks, and play havoc on
machines that don't use persistant device names for block or network
devices.

But it can cause speedups on some machines, my tiny laptop's boot goes
up by 0.4 seconds, and my desktop boots up several seconds faster.

Use at your own risk!!!

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/pci/pci-driver.c
1d3a82af45428c5e8deaa119cdeb79611ae46371 30-Aug-2006 David Brownell <david-b@pacbell.net> PM: no suspend_prepare() phase

Remove the new suspend_prepare() phase. It doesn't seem very usable,
has never been tested, doesn't address fault cleanup, and would need
a sibling resume_complete(); plus there are no real use cases. It
could be restored later if those issues get resolved.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/pci/pci-driver.c
cbd69dbbf1adfce6e048f15afc8629901ca9dae5 24-Jun-2006 Linus Torvalds <torvalds@osdl.org> Suspend changes for PCI core

Changes the PCI core to use the new suspend infrastructure changes.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/pci/pci-driver.c
39ba487fe22a63b3df7c543c82d01db0f0fed700 15-Aug-2006 Henrik Kretzschmar <henne@nachtwindheim.de> [PATCH] PCI: kerneldoc correction in pci-driver

Removes an unused kerneldoc entry from pci_match_device and
put the others into correct order.

Signed-off-by: Henrik Kretzschmar <henne@nachtwindheim.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/pci/pci-driver.c
8d92bc2270d67a43b1d7e94a8cb6f81f1435fe9a 18-Apr-2006 Jean Delvare <khali@linux-fr.org> [PATCH] PCI: Error handling on PCI device resume

We currently don't handle errors properly when resuming a PCI device:
* In pci_default_resume() we capture the error code returned by
pci_enable_device() but don't pass it up to the caller.
Introduced by commit 95a629657dbe28e44a312c47815b3dc3f1ce0970
* In pci_resume_device(), the errors possibly returned by the driver's
.resume method or by the generic pci_default_resume() function are
ignored.

This patch fixes both issues.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/pci/pci-driver.c
026694920579590c73b5c56705d543568ed5ad41 23-Mar-2006 Andrew Morton <akpm@osdl.org> [PATCH] pm: print name of failed suspend function

Print more diagnostic info to help identify the source of power management
suspend failures.

Example:

usb_hcd_pci_suspend(): pci_set_power_state+0x0/0x1af() returns -22
pci_device_suspend(): usb_hcd_pci_suspend+0x0/0x11b() returns -22
suspend_device(): pci_device_suspend+0x0/0x34() returns -22

Work-in-progress. It needs lots more suspend_report_result() calls sprinkled
everywhere.

Cc: Patrick Mochel <mochel@digitalimplant.org>
Cc: Pavel Machek <pavel@ucw.cz>
Cc: Nigel Cunningham <nigel@suspend2.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/pci/pci-driver.c
f5afe8064f3087bead8fea7e32547c2a3ada5fd0 28-Feb-2006 Eric Sesterhenn <snakebyte@gmx.de> [PATCH] PCI: kzalloc() conversion in drivers/pci

this patch converts drivers/pci to kzalloc usage.
Compile tested with allyes config.

Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/pci/pci-driver.c
50defa1ccaffc197a133d92acb48d696d5ea3539 19-Feb-2006 Brian Gerst <bgerst@didntduck.org> [PATCH] PCI: Add pci_device_shutdown to pci_bus_type

The extra compatability code is not necessary. Any code still using
the old shutdown method will trigger the warning in driver_register()
instead.

Signed-off-by: Brian Gerst <bgerst@didntduck.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/pci/pci-driver.c
b15d686a2b589c9e4f1ea116553e9c3c3d030dae 05-Jan-2006 Russell King <rmk@arm.linux.org.uk> [PATCH] Add pci_bus_type probe and remove methods

Move the PCI bus device probe/remove methods to the bus_type
structure. We leave the shutdown method alone since there
are compatibility issues with that.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/pci/pci-driver.c
312c004d36ce6c739512bac83b452f4c20ab1f62 16-Nov-2005 Kay Sievers <kay.sievers@suse.de> [PATCH] driver core: replace "hotplug" by "uevent"

Leave the overloaded "hotplug" word to susbsystems which are handling
real devices. The driver core does not "plug" anything, it just exports
the state to userspace and generates events.

Signed-off-by: Kay Sievers <kay.sievers@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/pci/pci-driver.c
863b18f4b5e7d9e6903b353328cf6fa084dbb619 27-Oct-2005 Laurent riffard <laurent.riffard@free.fr> [PATCH] PCI: automatically set device_driver.owner

A nice feature of sysfs is that it can create the symlink from the
driver to the module that is contained in it.

It requires that the device_driver.owner is set, what is not the
case for many PCI drivers.

This patch allows pci_register_driver to set automatically the
device_driver.owner for any PCI driver.

Credits to Al Viro who suggested the method.

Signed-off-by: Laurent Riffard <laurent.riffard@free.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
--

drivers/ide/setup-pci.c | 12 +++++++-----
drivers/pci/pci-driver.c | 9 +++++----
include/linux/ide.h | 3 ++-
include/linux/pci.h | 10 ++++++++--
4 files changed, 22 insertions(+), 12 deletions(-)
/drivers/pci/pci-driver.c
f8eb1005a5bdb019d2a4ff3ef8d8e8015b22afcb 29-Oct-2005 Randy Dunlap <rdunlap@xenotime.net> [PATCH] pci-driver: store_new_id() not inline

store_new_id() should not be (and cannot be) inline;
the function pointer is stored in a device_attribute table.

Signed-off-by: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/pci/pci-driver.c
8c65b4a60450590e79a28e9717ceffa9e4debb3f 07-Nov-2005 Tim Schmielau <tim@physik3.uni-rostock.de> [PATCH] fix remaining missing includes

Fix more include file problems that surfaced since I submitted the previous
fix-missing-includes.patch. This should now allow not to include sched.h
from module.h, which is done by a followup patch.

Signed-off-by: Tim Schmielau <tim@physik3.uni-rostock.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
/drivers/pci/pci-driver.c
4e57b6817880946a3a78d5d8cad1ace363f7e449 31-Oct-2005 Tim Schmielau <tim@physik3.uni-rostock.de> [PATCH] fix missing includes

I recently picked up my older work to remove unnecessary #includes of
sched.h, starting from a patch by Dave Jones to not include sched.h
from module.h. This reduces the number of indirect includes of sched.h
by ~300. Another ~400 pointless direct includes can be removed after
this disentangling (patch to follow later).
However, quite a few indirect includes need to be fixed up for this.

In order to feed the patches through -mm with as little disturbance as
possible, I've split out the fixes I accumulated up to now (complete for
i386 and x86_64, more archs to follow later) and post them before the real
patch. This way this large part of the patch is kept simple with only
adding #includes, and all hunks are independent of each other. So if any
hunk rejects or gets in the way of other patches, just drop it. My scripts
will pick it up again in the next round.

Signed-off-by: Tim Schmielau <tim@physik3.uni-rostock.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
/drivers/pci/pci-driver.c
8f7020d36374dda9366fee1343f8eacfe8f5e641 23-Oct-2005 Randy Dunlap <rdunlap@xenotime.net> [PATCH] kernel-doc: PCI fixes

PCI: add descriptions for missing function parameters.
Eliminate all kernel-doc warnings here.

Signed-off-by: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/pci/pci-driver.c
a1720fdbd0f90e64668a59a304d01c5ba001b450 16-Oct-2005 Russell King <rmk+lkml@arm.linux.org.uk> [PATCH] PCI: Fixup PCI driver shutdown

Add a warning to pci driver registration code so that we know
whether we have drivers using the obsolete driver shutdown
method.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/pci/pci-driver.c
95a629657dbe28e44a312c47815b3dc3f1ce0970 28-Jul-2005 Greg Kroah-Hartman <gregkh@suse.de> [PATCH] PCI: start paying attention to a lot of pci function return values

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/pci/pci-driver.c
d42c69972b853fd33a26c8c7405624be41a22136 06-Jul-2005 Andi Kleen <ak@suse.de> [PATCH] PCI: Run PCI driver initialization on local node

Run PCI driver initialization on local node

Instead of adding messy kmalloc_node()s everywhere run the
PCI driver probe on the node local to the device.

This would not have helped for IDE, but should for
other more clean drivers that do more initialization in probe().
It won't help for drivers that do most of the work
on first open (like many network drivers)

Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/pci/pci-driver.c
3d3c2ae1101c1f2dff7e2f9d514769779dbd2737 06-Jul-2005 Greg KH <gregkh@suse.de> [PATCH] PCI: fix !CONFIG_HOTPLUG pci build problem

Here's a patch to fix the build issue when CONFIG_HOTPLUG is not enabled
in 2.6.13-rc2.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
/drivers/pci/pci-driver.c
75865858971add95809c5c9cd35dc4cfba08e33b 30-Jun-2005 Greg Kroah-Hartman <gregkh@suse.de> [PATCH] PCI: clean up dynamic pci id logic

The dynamic pci id logic has been bothering me for a while, and now that
I started to look into how to move some of this to the driver core, I
thought it was time to clean it all up.

It ends up making the code smaller, and easier to follow, and fixes a
few bugs at the same time (dynamic ids were not being matched
everywhere, and so could be missed on some call paths for new devices,
semaphore not needed to be grabbed when adding a new id and calling the
driver core, etc.)

I also renamed the function pci_match_device() to pci_match_id() as
that's what it really does.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/pci/pci-driver.c
fc7e4828995d8c9e4c9597f8a19179e4ab53f73e 29-Apr-2005 Dmitry Torokhov <dtor_core@ameritech.net> [PATCH] sysfs: (driver/pci) if show/store is missing return -EIO

sysfs: fix drivers/pci so if an attribute does not implement
show or store method read/write will return -EIO
instead of 0.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/pci/pci-driver.c
c83d9945c05570ba6b8ec5460c99d1ab7c6e6671 18-Jun-2005 Mika Kukkonen <mikukkon@miku.homelinux.net> [PATCH] Fix typo in drivers/pci/pci-driver.c

The git commit 794f5bfa77955c4455f6d72d8b0e2bee25f1ff0c
accidentally suffers from a previous typo in that file
(',' instead of ';' in end of line). Patch included.

Signed-off-by: Mika Kukkonen (mikukkon@iki.fi)
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
/drivers/pci/pci-driver.c
794f5bfa77955c4455f6d72d8b0e2bee25f1ff0c 17-Jun-2005 Christoph Hellwig <hch@lst.de> [PATCH] PCI: don't override drv->shutdown unconditionally

There are many drivers that have been setting the generic driver
model level shutdown callback, and pci thus must not override it.

Without this patch we can have really bad data loss on various
raid controllers.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
/drivers/pci/pci-driver.c
eaae4b3a84a3781543a32bcaf0a33306ae915574 04-May-2005 Steven Cole <elenstev@mesatop.com> [PATCH] PCI: Spelling fixes for drivers/pci.

Here are some spelling corrections for drivers/pci.

CONTROLER -> CONTROLLER
Regisetr -> Register
harware -> hardware
inital -> initial
Initilize -> Initialize
funtion -> function
funciton -> function
occured -> occurred

Signed-off-by: Steven Cole <elenstev@mesatop.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/pci/pci-driver.c
c8958177224622411b9979eabb5610e30b06034b 08-Apr-2005 Greg KH <gregkh@suse.de> [PATCH] PCI: Add pci shutdown ability

Now pci drivers can know when the system is going down without having to
add a reboot notifier event.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/pci/pci-driver.c
1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 17-Apr-2005 Linus Torvalds <torvalds@ppc970.osdl.org> Linux-2.6.12-rc2

Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.

Let it rip!
/drivers/pci/pci-driver.c