linux-stable/drivers
Inaky Perez-Gonzalez bae94d0237 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>
2006-12-01 14:36:59 -08:00
..
acorn IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
acpi [PATCH] Correct bound checking from the value returned from _PPC method. 2006-11-23 09:18:55 -08:00
amba
ata [PATCH] libata: Fixup ata_sas_queuecmd to handle __ata_scsi_queuecmd failure 2006-11-28 03:51:55 -05:00
atm [ATM] horizon: read_bia() needs to be __devinit 2006-10-24 16:16:39 -07:00
base [PATCH] Fix device_attribute memory leak in device_del 2006-11-25 13:28:33 -08:00
block aoe: Add forgotten NULL at end of attribute list in aoeblk.c 2006-11-16 14:30:26 -08:00
bluetooth [PATCH] lockdep: annotate DECLARE_WAIT_QUEUE_HEAD 2006-10-30 12:08:40 -08:00
cdrom [PATCH] cdrom: add endianness annotations 2006-10-10 16:15:33 -07:00
char [PATCH] tlclk: fix platform_device_register_simple() error check 2006-11-25 13:28:34 -08:00
clocksource [PATCH] clocksource: acpi_pm: add another greylist chipset 2006-10-21 13:35:05 -07:00
connector
cpufreq [PATCH] Fix CPU_FREQ_GOV_ONDEMAND=y compile error 2006-11-21 14:07:15 -08:00
crypto
dio
dma [PATCH] drivers/dma trivial annotations 2006-10-10 15:37:21 -07:00
edac [PATCH] edac_mc: fix error handling 2006-11-03 12:27:57 -08:00
eisa [PATCH] EISA: handle sysfs errors 2006-10-11 11:14:25 -07:00
fc4 [SCSI] fc4: Conversion to struct scsi_cmnd in fc4 2006-10-25 15:12:45 -07:00
firmware [PATCH] dell_rbu: fix error check 2006-11-16 11:43:38 -08:00
hwmon hwmon: Fix debug messages in w83781d 2006-10-18 13:03:09 -07:00
i2c [PATCH] Fix i2c-ixp4xx compile (missing brace) 2006-11-23 09:27:49 -08:00
ide [PATCH] sgiioc4: Disable module unload 2006-11-25 13:28:34 -08:00
ieee1394 [ETH1394]: Fix unaligned accesses. 2006-10-30 15:24:38 -08:00
infiniband IB/ipath: Depend on CONFIG_NET 2006-11-20 13:06:19 -08:00
input lkkbd: Remove my old snail-mail address 2006-11-17 10:32:04 +01:00
isdn [PATCH] fix build error for HISAX_NETJET 2006-11-20 09:42:05 -08:00
leds [PATCH] drivers/led: handle sysfs errors 2006-10-17 08:18:46 -07:00
macintosh [PATCH] powerpc: windfarm shall request it's sub modules 2006-11-15 19:57:12 -08:00
mca [PATCH] drivers/mca: handle sysfs errors 2006-10-11 11:14:25 -07:00
md [PATCH] md: do not freeze md threads for suspend 2006-11-08 18:29:24 -08:00
media V4L/DVB (4874): Fix oops on symbol rate==0 2006-11-26 11:02:43 -02:00
message [PATCH] lockdep: annotate DECLARE_WAIT_QUEUE_HEAD 2006-10-30 12:08:40 -08:00
mfd IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
misc [PATCH] Fix for LKDTM MEM_SWAPOUT crashpoint 2006-11-06 01:46:23 -08:00
mmc MMC: Do not set unsupported bits in OCR response 2006-11-09 07:23:54 +01:00
mtd [PATCH] Fix Intel/Sharp command set erase suspend bug 2006-11-28 17:26:50 -08:00
net [PATCH] r8169: Fix iteration variable sign 2006-11-29 13:45:07 -08:00
nubus
oprofile
parisc Build fixes for struct pt_regs removal 2006-10-06 20:47:23 -06:00
parport [PATCH] parport: fix compilation failure 2006-11-16 11:43:37 -08:00
pci PCI: switch pci_{enable,disable}_device() to be nestable 2006-12-01 14:36:59 -08:00
pcmcia [PATCH] fix "pcmcia: fix 'rmmod pcmcia' with unbound devices" 2006-11-25 13:28:33 -08:00
pnp Fix DMA resource allocation in ACPIPnP 2006-10-18 11:36:11 -07:00
rapidio Fix several typos in drivers/ 2006-10-03 22:31:37 +02:00
rtc [PATCH] drivers/rtc/rtc-rs5c372.c: fix a NULL dereference 2006-11-25 13:28:33 -08:00
s390 [S390] cio: Make ccw_device_register() static. 2006-10-27 12:39:33 +02:00
sbus [SPARC]: Fix bus_id[] string overflow. 2006-10-27 01:03:31 -07:00
scsi Merge master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6 2006-11-16 11:48:01 -08:00
serial [POWERPC] CPM_UART: Fix non-console initialisation 2006-11-10 21:35:36 +11:00
sh
sn [PATCH] ioc4: Enable build on non-SN2 2006-10-17 08:18:42 -07:00
spi [PATCH] spi section fix 2006-11-03 12:27:58 -08:00
tc [MIPS] Fix DECserial build error by IRQ hander change 2006-10-08 02:38:28 +01:00
telephony [PATCH] drivers/telephony/ixj: fix an array overrun 2006-11-08 18:29:23 -08:00
usb [PATCH] usb: ati remote memleak fix 2006-11-25 13:28:34 -08:00
video Fix generic fb_ddc i2c edid probe msg 2006-11-16 22:18:28 -08:00
w1 W1: ioremap balanced with iounmap 2006-11-16 14:30:26 -08:00
zorro
Kconfig [PATCH] ioc4: Enable build on non-SN2 2006-10-17 08:18:42 -07:00
Makefile