Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: (59 commits)
PCI: Free resource files in error path of pci_create_sysfs_dev_files()
pci-quirks: disable MSI on RS400-200 and RS480
PCI hotplug: Use menuconfig objects
PCI: ZT5550 CPCI Hotplug driver fix
PCI: rpaphp: Remove semaphores
PCI: rpaphp: Ensure more pcibios_add/pcibios_remove symmetry
PCI: rpaphp: Use pcibios_remove_pci_devices() symmetrically
PCI: rpaphp: Document is_php_dn()
PCI: rpaphp: Document find_php_slot()
PCI: rpaphp: Rename rpaphp_register_pci_slot() to rpaphp_enable_slot()
PCI: rpaphp: refactor tail call to rpaphp_register_slot()
PCI: rpaphp: remove rpaphp_set_attention_status()
PCI: rpaphp: remove print_slot_pci_funcs()
PCI: rpaphp: Remove setup_pci_slot()
PCI: rpaphp: remove a call that does nothing but a pointer lookup
PCI: rpaphp: Remove another wrappered function
PCI: rpaphp: Remve another call that is a wrapper
PCI: rpaphp: remove a function that does nothing but wrap debug printks
PCI: rpaphp: Remove un-needed goto
PCI: rpaphp: Fix a memleak; slot->location string was never freed
...

+875 -1220
-7
Documentation/feature-removal-schedule.txt
··· 117 117 118 118 --------------------------- 119 119 120 - What: pci_module_init(driver) 121 - When: January 2007 122 - Why: Is replaced by pci_register_driver(pci_driver). 123 - Who: Richard Knutsson <ricknu-0@student.ltu.se> and Greg Kroah-Hartman <gregkh@suse.de> 124 - 125 - --------------------------- 126 - 127 120 What: Usage of invalid timevals in setitimer 128 121 When: March 2007 129 122 Why: POSIX requires to validate timevals in the setitimer call. This
+3 -9
Documentation/pci.txt
··· 124 124 125 125 err_handler See Documentation/pci-error-recovery.txt 126 126 127 - multithread_probe Enable multi-threaded probe/scan. Driver must 128 - provide its own locking/syncronization for init 129 - operations if this is enabled. 130 - 131 127 132 128 The ID table is an array of struct pci_device_id entries ending with an 133 129 all-zero entry. Each entry consists of: ··· 159 163 /sys/bus/pci/drivers/{driver}/new_id 160 164 161 165 All fields are passed in as hexadecimal values (no leading 0x). 162 - Users need pass only as many fields as necessary: 163 - o vendor, device, subvendor, and subdevice fields default 164 - to PCI_ANY_ID (FFFFFFFF), 166 + The vendor and device fields are mandatory, the others are optional. Users 167 + need pass only as many optional fields as necessary: 168 + o subvendor and subdevice fields default to PCI_ANY_ID (FFFFFFFF) 165 169 o class and classmask fields default to 0 166 170 o driver_data defaults to 0UL. 167 171 ··· 545 549 pci_set_power_state() Set PCI Power Management state (0=D0 ... 3=D3) 546 550 pci_find_capability() Find specified capability in device's capability 547 551 list. 548 - pci_module_init() Inline helper function for ensuring correct 549 - pci_driver initialization and error handling. 550 552 pci_resource_start() Returns bus start address for a given PCI region 551 553 pci_resource_end() Returns bus end address for a given PCI region 552 554 pci_resource_len() Returns the byte length of a PCI region
+1 -1
Documentation/power/pci.txt
··· 203 203 204 204 Usage: 205 205 206 - if (dev->driver && dev->driver->suspend) 206 + if (dev->driver && dev->driver->resume) 207 207 dev->driver->resume(dev) 208 208 209 209 The resume callback may be called from any power state, and is always meant to
-1
arch/alpha/kernel/err_common.c
··· 7 7 */ 8 8 9 9 #include <linux/init.h> 10 - #include <linux/pci.h> 11 10 #include <linux/sched.h> 12 11 13 12 #include <asm/io.h>
-1
arch/alpha/kernel/err_ev6.c
··· 7 7 */ 8 8 9 9 #include <linux/init.h> 10 - #include <linux/pci.h> 11 10 #include <linux/sched.h> 12 11 13 12 #include <asm/io.h>
-1
arch/alpha/kernel/err_ev7.c
··· 7 7 */ 8 8 9 9 #include <linux/init.h> 10 - #include <linux/pci.h> 11 10 #include <linux/sched.h> 12 11 13 12 #include <asm/io.h>
+1
arch/arm/Kconfig
··· 255 255 depends on MMU 256 256 select PLAT_IOP 257 257 select PCI 258 + select ARCH_SUPPORTS_MSI 258 259 help 259 260 Support for Intel's IOP13XX (XScale) family of processors. 260 261
+1
arch/i386/Kconfig
··· 1073 1073 bool "PCI support" if !X86_VISWS 1074 1074 depends on !X86_VOYAGER 1075 1075 default y if X86_VISWS 1076 + select ARCH_SUPPORTS_MSI if (X86_LOCAL_APIC && X86_IO_APIC) 1076 1077 help 1077 1078 Find out whether you have a PCI motherboard. PCI is the name of a 1078 1079 bus system, i.e. the way the CPU talks to the other stuff inside
-1
arch/i386/kernel/cpu/cpufreq/speedstep-lib.c
··· 13 13 #include <linux/moduleparam.h> 14 14 #include <linux/init.h> 15 15 #include <linux/cpufreq.h> 16 - #include <linux/pci.h> 17 16 #include <linux/slab.h> 18 17 19 18 #include <asm/msr.h>
+1 -1
arch/i386/kernel/cpu/cpufreq/speedstep-smi.c
··· 17 17 #include <linux/moduleparam.h> 18 18 #include <linux/init.h> 19 19 #include <linux/cpufreq.h> 20 - #include <linux/pci.h> 21 20 #include <linux/slab.h> 22 21 #include <linux/delay.h> 23 22 #include <asm/ist.h> 23 + #include <asm/io.h> 24 24 25 25 #include "speedstep-lib.h" 26 26
+2 -2
arch/i386/kernel/io_apic.c
··· 2611 2611 if (irq < 0) 2612 2612 return irq; 2613 2613 2614 - set_irq_msi(irq, desc); 2615 2614 ret = msi_compose_msg(dev, irq, &msg); 2616 2615 if (ret < 0) { 2617 2616 destroy_irq(irq); 2618 2617 return ret; 2619 2618 } 2620 2619 2620 + set_irq_msi(irq, desc); 2621 2621 write_msi_msg(irq, &msg); 2622 2622 2623 2623 set_irq_chip_and_handler_name(irq, &msi_chip, handle_edge_irq, 2624 2624 "edge"); 2625 2625 2626 - return irq; 2626 + return 0; 2627 2627 } 2628 2628 2629 2629 void arch_teardown_msi_irq(unsigned int irq)
+1 -1
arch/i386/pci/fixup.c
··· 354 354 printk(KERN_DEBUG "Boot video device is %s\n", pci_name(pdev)); 355 355 } 356 356 } 357 - DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, pci_fixup_video); 357 + DECLARE_PCI_FIXUP_FINAL(PCI_ANY_ID, PCI_ANY_ID, pci_fixup_video); 358 358 359 359 /* 360 360 * Some Toshiba laptops need extra code to enable their TI TSB43AB22/A.
+2 -2
arch/i386/pci/i386.c
··· 246 246 continue; 247 247 if (!r->start && r->end) { 248 248 printk(KERN_ERR "PCI: Device %s not available " 249 - "because of resource collisions\n", 250 - pci_name(dev)); 249 + "because of resource %d collisions\n", 250 + pci_name(dev), idx); 251 251 return -EINVAL; 252 252 } 253 253 if (r->flags & IORESOURCE_IO)
+1
arch/ia64/Kconfig
··· 14 14 select PCI if (!IA64_HP_SIM) 15 15 select ACPI if (!IA64_HP_SIM) 16 16 select PM if (!IA64_HP_SIM) 17 + select ARCH_SUPPORTS_MSI 17 18 default y 18 19 help 19 20 The Itanium Processor Family is Intel's 64-bit successor to
-1
arch/ia64/sn/kernel/huberror.c
··· 8 8 9 9 #include <linux/types.h> 10 10 #include <linux/interrupt.h> 11 - #include <linux/pci.h> 12 11 #include <asm/delay.h> 13 12 #include <asm/sn/sn_sal.h> 14 13 #include "ioerror.h"
+2 -2
arch/ia64/sn/kernel/msi_sn.c
··· 87 87 if (irq < 0) 88 88 return irq; 89 89 90 - set_irq_msi(irq, entry); 91 90 /* 92 91 * Set up the vector plumbing. Let the prom (via sn_intr_alloc) 93 92 * decide which cpu to direct this msi at by default. ··· 143 144 */ 144 145 msg.data = 0x100 + irq; 145 146 147 + set_irq_msi(irq, entry); 146 148 write_msi_msg(irq, &msg); 147 149 set_irq_chip_and_handler(irq, &sn_msi_chip, handle_edge_irq); 148 150 149 - return irq; 151 + return 0; 150 152 } 151 153 152 154 #ifdef CONFIG_SMP
-1
arch/ia64/sn/kernel/xpnet.c
··· 24 24 25 25 #include <linux/module.h> 26 26 #include <linux/kernel.h> 27 - #include <linux/pci.h> 28 27 #include <linux/init.h> 29 28 #include <linux/ioport.h> 30 29 #include <linux/netdevice.h>
-1
arch/m68knommu/kernel/dma.c
··· 8 8 #include <linux/types.h> 9 9 #include <linux/mm.h> 10 10 #include <linux/string.h> 11 - #include <linux/pci.h> 12 11 #include <asm/io.h> 13 12 14 13 void *dma_alloc_coherent(struct device *dev, size_t size,
-1
arch/mips/lib/iomap.c
··· 6 6 * (C) Copyright 2007 MIPS Technologies, Inc. 7 7 * written by Ralf Baechle <ralf@linux-mips.org> 8 8 */ 9 - #include <linux/pci.h> 10 9 #include <linux/module.h> 11 10 #include <asm/io.h> 12 11
+1 -1
arch/powerpc/kernel/pci_64.c
··· 340 340 struct pci_dev *dev; 341 341 const char *type; 342 342 343 - dev = kzalloc(sizeof(struct pci_dev), GFP_KERNEL); 343 + dev = alloc_pci_dev(); 344 344 if (!dev) 345 345 return NULL; 346 346 type = of_get_property(node, "device_type", NULL);
-1
arch/powerpc/platforms/pseries/ras.c
··· 31 31 #include <linux/timex.h> 32 32 #include <linux/init.h> 33 33 #include <linux/slab.h> 34 - #include <linux/pci.h> 35 34 #include <linux/delay.h> 36 35 #include <linux/irq.h> 37 36 #include <linux/random.h>
-1
arch/ppc/8260_io/enet.c
··· 32 32 #include <linux/ioport.h> 33 33 #include <linux/slab.h> 34 34 #include <linux/interrupt.h> 35 - #include <linux/pci.h> 36 35 #include <linux/init.h> 37 36 #include <linux/delay.h> 38 37 #include <linux/netdevice.h>
-1
arch/ppc/8260_io/fcc_enet.c
··· 29 29 #include <linux/ioport.h> 30 30 #include <linux/slab.h> 31 31 #include <linux/interrupt.h> 32 - #include <linux/pci.h> 33 32 #include <linux/init.h> 34 33 #include <linux/delay.h> 35 34 #include <linux/netdevice.h>
-1
arch/ppc/8xx_io/enet.c
··· 30 30 #include <linux/ioport.h> 31 31 #include <linux/slab.h> 32 32 #include <linux/interrupt.h> 33 - #include <linux/pci.h> 34 33 #include <linux/init.h> 35 34 #include <linux/delay.h> 36 35 #include <linux/netdevice.h>
-1
arch/ppc/syslib/ppc4xx_sgdma.c
··· 23 23 #include <linux/mm.h> 24 24 #include <linux/init.h> 25 25 #include <linux/module.h> 26 - #include <linux/pci.h> 27 26 28 27 #include <asm/system.h> 29 28 #include <asm/io.h>
-1
arch/sh64/mach-cayman/iomap.c
··· 9 9 * License. See the file "COPYING" in the main directory of this archive 10 10 * for more details. 11 11 */ 12 - #include <linux/pci.h> 13 12 #include <asm/io.h> 14 13 #include <asm/cayman.h> 15 14
+1
arch/sparc64/Kconfig
··· 306 306 307 307 config PCI 308 308 bool "PCI support" 309 + select ARCH_SUPPORTS_MSI 309 310 help 310 311 Find out whether you have a PCI motherboard. PCI is the name of a 311 312 bus system, i.e. the way the CPU talks to the other stuff inside
+2 -2
arch/sparc64/kernel/pci.c
··· 1092 1092 return -EINVAL; 1093 1093 1094 1094 err = p->setup_msi_irq(&virt_irq, pdev, desc); 1095 - if (err < 0) 1095 + if (err) 1096 1096 return err; 1097 1097 1098 - return virt_irq; 1098 + return 0; 1099 1099 } 1100 1100 1101 1101 void arch_teardown_msi_irq(unsigned int virt_irq)
+2 -2
arch/sparc64/kernel/pci_sun4v.c
··· 1169 1169 if (!devino) 1170 1170 goto out_err; 1171 1171 1172 - set_irq_msi(*virt_irq_p, entry); 1173 - 1174 1172 msiqid = ((devino - pbm->msiq_first_devino) + 1175 1173 pbm->msiq_first); 1176 1174 ··· 1202 1204 msg.address_lo = pbm->msi32_start; 1203 1205 } 1204 1206 msg.data = msi_num; 1207 + 1208 + set_irq_msi(*virt_irq_p, entry); 1205 1209 write_msi_msg(*virt_irq_p, &msg); 1206 1210 1207 1211 irq_install_pre_handler(*virt_irq_p,
+1
arch/x86_64/Kconfig
··· 676 676 677 677 config PCI 678 678 bool "PCI support" 679 + select ARCH_SUPPORTS_MSI if (X86_LOCAL_APIC && X86_IO_APIC) 679 680 680 681 # x86-64 doesn't support PCI BIOS access from long mode so always go direct. 681 682 config PCI_DIRECT
+2 -2
arch/x86_64/kernel/io_apic.c
··· 1983 1983 if (irq < 0) 1984 1984 return irq; 1985 1985 1986 - set_irq_msi(irq, desc); 1987 1986 ret = msi_compose_msg(dev, irq, &msg); 1988 1987 if (ret < 0) { 1989 1988 destroy_irq(irq); 1990 1989 return ret; 1991 1990 } 1992 1991 1992 + set_irq_msi(irq, desc); 1993 1993 write_msi_msg(irq, &msg); 1994 1994 1995 1995 set_irq_chip_and_handler_name(irq, &msi_chip, handle_edge_irq, "edge"); 1996 1996 1997 - return irq; 1997 + return 0; 1998 1998 } 1999 1999 2000 2000 void arch_teardown_msi_irq(unsigned int irq)
-1
arch/xtensa/kernel/xtensa_ksyms.c
··· 18 18 #include <linux/interrupt.h> 19 19 #include <asm/irq.h> 20 20 #include <linux/in6.h> 21 - #include <linux/pci.h> 22 21 #include <linux/ide.h> 23 22 24 23 #include <asm/uaccess.h>
-1
arch/xtensa/platform-iss/setup.c
··· 20 20 #include <linux/init.h> 21 21 #include <linux/errno.h> 22 22 #include <linux/reboot.h> 23 - #include <linux/pci.h> 24 23 #include <linux/kdev_t.h> 25 24 #include <linux/types.h> 26 25 #include <linux/major.h>
-1
drivers/atm/adummy.c
··· 6 6 #include <linux/version.h> 7 7 #include <linux/kernel.h> 8 8 #include <linux/skbuff.h> 9 - #include <linux/pci.h> 10 9 #include <linux/errno.h> 11 10 #include <linux/types.h> 12 11 #include <linux/string.h>
+3 -38
drivers/base/dd.c
··· 226 226 * 227 227 * Walk the list of drivers that the bus has and call 228 228 * driver_probe_device() for each pair. If a compatible 229 - * pair is found, break out and return. If the bus specifies 230 - * multithreaded probing, walking the list of drivers is done 231 - * on a probing thread. 229 + * pair is found, break out and return. 232 230 * 233 231 * Returns 1 if the device was bound to a driver; 234 - * 0 if no matching device was found or multithreaded probing is done; 232 + * 0 if no matching device was found; 235 233 * -ENODEV if the device is not registered. 236 234 * 237 235 * When called for a USB interface, @dev->parent->sem must be held. ··· 237 239 int device_attach(struct device * dev) 238 240 { 239 241 int ret = 0; 240 - struct task_struct *probe_task = ERR_PTR(-ENOMEM); 241 242 242 243 down(&dev->sem); 243 244 if (dev->driver) { ··· 248 251 ret = 0; 249 252 } 250 253 } else { 251 - if (dev->bus->multithread_probe) 252 - probe_task = kthread_run(device_probe_drivers, dev, 253 - "probe-%s", dev->bus_id); 254 - if(IS_ERR(probe_task)) 255 - ret = bus_for_each_drv(dev->bus, NULL, dev, 256 - __device_attach); 254 + ret = bus_for_each_drv(dev->bus, NULL, dev, __device_attach); 257 255 } 258 256 up(&dev->sem); 259 257 return ret; ··· 374 382 put_device(dev); 375 383 } 376 384 } 377 - 378 - #ifdef CONFIG_PCI_MULTITHREAD_PROBE 379 - static int __init wait_for_probes(void) 380 - { 381 - DEFINE_WAIT(wait); 382 - 383 - printk(KERN_INFO "%s: waiting for %d threads\n", __FUNCTION__, 384 - atomic_read(&probe_count)); 385 - if (!atomic_read(&probe_count)) 386 - return 0; 387 - while (atomic_read(&probe_count)) { 388 - prepare_to_wait(&probe_waitqueue, &wait, TASK_UNINTERRUPTIBLE); 389 - if (atomic_read(&probe_count)) 390 - schedule(); 391 - } 392 - finish_wait(&probe_waitqueue, &wait); 393 - return 0; 394 - } 395 - 396 - core_initcall_sync(wait_for_probes); 397 - postcore_initcall_sync(wait_for_probes); 398 - arch_initcall_sync(wait_for_probes); 399 - subsys_initcall_sync(wait_for_probes); 400 - fs_initcall_sync(wait_for_probes); 401 - device_initcall_sync(wait_for_probes); 402 - late_initcall_sync(wait_for_probes); 403 - #endif 404 385 405 386 EXPORT_SYMBOL_GPL(device_bind_driver); 406 387 EXPORT_SYMBOL_GPL(device_release_driver);
+1 -1
drivers/char/agp/alpha-agp.c
··· 173 173 /* 174 174 * Build a fake pci_dev struct 175 175 */ 176 - pdev = kmalloc(sizeof(struct pci_dev), GFP_KERNEL); 176 + pdev = alloc_pci_dev(); 177 177 if (!pdev) 178 178 return -ENOMEM; 179 179 pdev->vendor = 0xffff;
+1 -1
drivers/char/agp/parisc-agp.c
··· 329 329 struct agp_bridge_data *bridge; 330 330 int error = 0; 331 331 332 - fake_bridge_dev = kmalloc(sizeof (struct pci_dev), GFP_KERNEL); 332 + fake_bridge_dev = alloc_pci_dev(); 333 333 if (!fake_bridge_dev) { 334 334 error = -ENOMEM; 335 335 goto fail;
-1
drivers/char/hw_random/via-rng.c
··· 26 26 27 27 #include <linux/module.h> 28 28 #include <linux/kernel.h> 29 - #include <linux/pci.h> 30 29 #include <linux/hw_random.h> 31 30 #include <asm/io.h> 32 31 #include <asm/msr.h>
-1
drivers/char/tpm/tpm.h
··· 19 19 * 20 20 */ 21 21 #include <linux/module.h> 22 - #include <linux/pci.h> 23 22 #include <linux/delay.h> 24 23 #include <linux/fs.h> 25 24 #include <linux/sched.h>
-1
drivers/char/watchdog/sc1200wdt.c
··· 38 38 #include <linux/init.h> 39 39 #include <linux/pnp.h> 40 40 #include <linux/fs.h> 41 - #include <linux/pci.h> 42 41 43 42 #include <asm/semaphore.h> 44 43 #include <asm/io.h>
+1 -1
drivers/char/watchdog/scx200_wdt.c
··· 25 25 #include <linux/notifier.h> 26 26 #include <linux/reboot.h> 27 27 #include <linux/fs.h> 28 - #include <linux/pci.h> 28 + #include <linux/ioport.h> 29 29 #include <linux/scx200.h> 30 30 31 31 #include <asm/uaccess.h>
-1
drivers/i2c/busses/i2c-at91.c
··· 17 17 #include <linux/version.h> 18 18 #include <linux/kernel.h> 19 19 #include <linux/slab.h> 20 - #include <linux/pci.h> 21 20 #include <linux/types.h> 22 21 #include <linux/delay.h> 23 22 #include <linux/i2c.h>
-1
drivers/i2c/busses/i2c-mpc.c
··· 17 17 #include <linux/module.h> 18 18 #include <linux/sched.h> 19 19 #include <linux/init.h> 20 - #include <linux/pci.h> 21 20 #include <linux/platform_device.h> 22 21 23 22 #include <asm/io.h>
-1
drivers/i2c/busses/i2c-pca-isa.c
··· 25 25 #include <linux/slab.h> 26 26 #include <linux/init.h> 27 27 #include <linux/interrupt.h> 28 - #include <linux/pci.h> 29 28 #include <linux/wait.h> 30 29 31 30 #include <linux/isa.h>
-1
drivers/ieee1394/hosts.c
··· 15 15 #include <linux/list.h> 16 16 #include <linux/init.h> 17 17 #include <linux/slab.h> 18 - #include <linux/pci.h> 19 18 #include <linux/timer.h> 20 19 #include <linux/jiffies.h> 21 20 #include <linux/mutex.h>
-1
drivers/infiniband/core/cm.c
··· 40 40 #include <linux/err.h> 41 41 #include <linux/idr.h> 42 42 #include <linux/interrupt.h> 43 - #include <linux/pci.h> 44 43 #include <linux/random.h> 45 44 #include <linux/rbtree.h> 46 45 #include <linux/spinlock.h>
-1
drivers/infiniband/core/iwcm.c
··· 39 39 #include <linux/err.h> 40 40 #include <linux/idr.h> 41 41 #include <linux/interrupt.h> 42 - #include <linux/pci.h> 43 42 #include <linux/rbtree.h> 44 43 #include <linux/spinlock.h> 45 44 #include <linux/workqueue.h>
-1
drivers/infiniband/core/mad_priv.h
··· 39 39 40 40 #include <linux/completion.h> 41 41 #include <linux/err.h> 42 - #include <linux/pci.h> 43 42 #include <linux/workqueue.h> 44 43 #include <rdma/ib_mad.h> 45 44 #include <rdma/ib_smi.h>
-1
drivers/infiniband/core/multicast.c
··· 34 34 #include <linux/dma-mapping.h> 35 35 #include <linux/err.h> 36 36 #include <linux/interrupt.h> 37 - #include <linux/pci.h> 38 37 #include <linux/bitops.h> 39 38 #include <linux/random.h> 40 39
-1
drivers/infiniband/core/sa_query.c
··· 40 40 #include <linux/random.h> 41 41 #include <linux/spinlock.h> 42 42 #include <linux/slab.h> 43 - #include <linux/pci.h> 44 43 #include <linux/dma-mapping.h> 45 44 #include <linux/kref.h> 46 45 #include <linux/idr.h>
-1
drivers/infiniband/core/user_mad.c
··· 40 40 #include <linux/err.h> 41 41 #include <linux/fs.h> 42 42 #include <linux/cdev.h> 43 - #include <linux/pci.h> 44 43 #include <linux/dma-mapping.h> 45 44 #include <linux/poll.h> 46 45 #include <linux/rwsem.h>
-1
drivers/infiniband/hw/ipath/ipath_fs.c
··· 38 38 #include <linux/pagemap.h> 39 39 #include <linux/init.h> 40 40 #include <linux/namei.h> 41 - #include <linux/pci.h> 42 41 43 42 #include "ipath_kernel.h" 44 43
-1
drivers/infiniband/hw/ipath/ipath_layer.c
··· 37 37 */ 38 38 39 39 #include <linux/io.h> 40 - #include <linux/pci.h> 41 40 #include <asm/byteorder.h> 42 41 43 42 #include "ipath_kernel.h"
-2
drivers/infiniband/hw/ipath/ipath_stats.c
··· 31 31 * SOFTWARE. 32 32 */ 33 33 34 - #include <linux/pci.h> 35 - 36 34 #include "ipath_kernel.h" 37 35 38 36 struct infinipath_stats ipath_stats;
-1
drivers/infiniband/hw/ipath/ipath_sysfs.c
··· 32 32 */ 33 33 34 34 #include <linux/ctype.h> 35 - #include <linux/pci.h> 36 35 37 36 #include "ipath_kernel.h" 38 37 #include "ipath_common.h"
-1
drivers/infiniband/hw/mthca/mthca_memfree.h
··· 38 38 #define MTHCA_MEMFREE_H 39 39 40 40 #include <linux/list.h> 41 - #include <linux/pci.h> 42 41 #include <linux/mutex.h> 43 42 44 43 #define MTHCA_ICM_CHUNK_LEN \
-1
drivers/infiniband/ulp/ipoib/ipoib.h
··· 41 41 #include <linux/skbuff.h> 42 42 #include <linux/netdevice.h> 43 43 #include <linux/workqueue.h> 44 - #include <linux/pci.h> 45 44 #include <linux/kref.h> 46 45 #include <linux/if_infiniband.h> 47 46 #include <linux/mutex.h>
-1
drivers/isdn/hisax/netjet.c
··· 19 19 #include "isac.h" 20 20 #include "hscx.h" 21 21 #include "isdnl1.h" 22 - #include <linux/pci.h> 23 22 #include <linux/interrupt.h> 24 23 #include <linux/ppp_defs.h> 25 24 #include <asm/io.h>
-1
drivers/isdn/hysdn/hysdn_proclog.c
··· 13 13 #include <linux/module.h> 14 14 #include <linux/poll.h> 15 15 #include <linux/proc_fs.h> 16 - #include <linux/pci.h> 17 16 #include <linux/smp_lock.h> 18 17 19 18 #include "hysdn_defs.h"
+1 -1
drivers/media/dvb/cinergyT2/cinergyT2.c
··· 26 26 #include <linux/module.h> 27 27 #include <linux/slab.h> 28 28 #include <linux/usb.h> 29 - #include <linux/pci.h> 30 29 #include <linux/input.h> 31 30 #include <linux/dvb/frontend.h> 32 31 #include <linux/mutex.h> 33 32 #include <linux/mm.h> 33 + #include <asm/io.h> 34 34 35 35 #include "dmxdev.h" 36 36 #include "dvb_demux.h"
-1
drivers/media/video/adv7170.c
··· 37 37 #include <linux/major.h> 38 38 #include <linux/slab.h> 39 39 #include <linux/mm.h> 40 - #include <linux/pci.h> 41 40 #include <linux/signal.h> 42 41 #include <asm/io.h> 43 42 #include <asm/pgtable.h>
-1
drivers/media/video/adv7175.c
··· 33 33 #include <linux/major.h> 34 34 #include <linux/slab.h> 35 35 #include <linux/mm.h> 36 - #include <linux/pci.h> 37 36 #include <linux/signal.h> 38 37 #include <asm/io.h> 39 38 #include <asm/pgtable.h>
-1
drivers/media/video/bt819.c
··· 37 37 #include <linux/major.h> 38 38 #include <linux/slab.h> 39 39 #include <linux/mm.h> 40 - #include <linux/pci.h> 41 40 #include <linux/signal.h> 42 41 #include <asm/io.h> 43 42 #include <asm/pgtable.h>
-1
drivers/media/video/bt856.c
··· 37 37 #include <linux/major.h> 38 38 #include <linux/slab.h> 39 39 #include <linux/mm.h> 40 - #include <linux/pci.h> 41 40 #include <linux/signal.h> 42 41 #include <asm/io.h> 43 42 #include <asm/pgtable.h>
-1
drivers/media/video/bt866.c
··· 37 37 #include <linux/major.h> 38 38 #include <linux/slab.h> 39 39 #include <linux/mm.h> 40 - #include <linux/pci.h> 41 40 #include <linux/signal.h> 42 41 #include <asm/io.h> 43 42 #include <asm/pgtable.h>
-1
drivers/media/video/cx88/cx88-tvaudio.c
··· 43 43 #include <linux/slab.h> 44 44 #include <linux/mm.h> 45 45 #include <linux/poll.h> 46 - #include <linux/pci.h> 47 46 #include <linux/signal.h> 48 47 #include <linux/ioport.h> 49 48 #include <linux/types.h>
-1
drivers/media/video/em28xx/em28xx-cards.c
··· 23 23 24 24 #include <linux/init.h> 25 25 #include <linux/module.h> 26 - #include <linux/pci.h> 27 26 #include <linux/delay.h> 28 27 #include <linux/i2c.h> 29 28 #include <linux/usb.h>
-1
drivers/media/video/saa7111.c
··· 36 36 #include <linux/major.h> 37 37 #include <linux/slab.h> 38 38 #include <linux/mm.h> 39 - #include <linux/pci.h> 40 39 #include <linux/signal.h> 41 40 #include <asm/io.h> 42 41 #include <asm/pgtable.h>
-1
drivers/media/video/saa7114.c
··· 39 39 #include <linux/slab.h> 40 40 41 41 #include <linux/mm.h> 42 - #include <linux/pci.h> 43 42 #include <linux/signal.h> 44 43 #include <asm/io.h> 45 44 #include <asm/pgtable.h>
-1
drivers/media/video/saa711x.c
··· 30 30 #include <linux/major.h> 31 31 #include <linux/slab.h> 32 32 #include <linux/mm.h> 33 - #include <linux/pci.h> 34 33 #include <linux/signal.h> 35 34 #include <asm/io.h> 36 35 #include <asm/pgtable.h>
-1
drivers/media/video/saa7185.c
··· 33 33 #include <linux/major.h> 34 34 #include <linux/slab.h> 35 35 #include <linux/mm.h> 36 - #include <linux/pci.h> 37 36 #include <linux/signal.h> 38 37 #include <asm/io.h> 39 38 #include <asm/pgtable.h>
-1
drivers/misc/hdpuftrs/hdpu_cpustate.c
··· 18 18 #include <linux/kernel.h> 19 19 #include <linux/spinlock.h> 20 20 #include <linux/miscdevice.h> 21 - #include <linux/pci.h> 22 21 #include <linux/proc_fs.h> 23 22 #include <linux/platform_device.h> 24 23 #include <asm/uaccess.h>
-1
drivers/misc/hdpuftrs/hdpu_nexus.c
··· 18 18 #include <linux/kernel.h> 19 19 #include <linux/proc_fs.h> 20 20 #include <linux/hdpu_features.h> 21 - #include <linux/pci.h> 22 21 23 22 #include <linux/platform_device.h> 24 23
-1
drivers/mtd/devices/doc2000.c
··· 13 13 #include <asm/io.h> 14 14 #include <asm/uaccess.h> 15 15 #include <linux/miscdevice.h> 16 - #include <linux/pci.h> 17 16 #include <linux/delay.h> 18 17 #include <linux/slab.h> 19 18 #include <linux/sched.h>
-1
drivers/mtd/devices/doc2001.c
··· 13 13 #include <asm/io.h> 14 14 #include <asm/uaccess.h> 15 15 #include <linux/miscdevice.h> 16 - #include <linux/pci.h> 17 16 #include <linux/delay.h> 18 17 #include <linux/slab.h> 19 18 #include <linux/init.h>
-1
drivers/mtd/devices/doc2001plus.c
··· 17 17 #include <asm/io.h> 18 18 #include <asm/uaccess.h> 19 19 #include <linux/miscdevice.h> 20 - #include <linux/pci.h> 21 20 #include <linux/delay.h> 22 21 #include <linux/slab.h> 23 22 #include <linux/init.h>
-1
drivers/mtd/devices/docecc.c
··· 29 29 #include <asm/io.h> 30 30 #include <asm/uaccess.h> 31 31 #include <linux/miscdevice.h> 32 - #include <linux/pci.h> 33 32 #include <linux/delay.h> 34 33 #include <linux/slab.h> 35 34 #include <linux/init.h>
-1
drivers/mtd/inftlmount.c
··· 31 31 #include <asm/io.h> 32 32 #include <asm/uaccess.h> 33 33 #include <linux/miscdevice.h> 34 - #include <linux/pci.h> 35 34 #include <linux/delay.h> 36 35 #include <linux/slab.h> 37 36 #include <linux/init.h>
-1
drivers/mtd/nand/cs553x_nand.c
··· 20 20 #include <linux/init.h> 21 21 #include <linux/module.h> 22 22 #include <linux/delay.h> 23 - #include <linux/pci.h> 24 23 #include <linux/mtd/mtd.h> 25 24 #include <linux/mtd/nand.h> 26 25 #include <linux/mtd/nand_ecc.h>
-1
drivers/mtd/nftlcore.c
··· 17 17 #include <asm/io.h> 18 18 #include <asm/uaccess.h> 19 19 #include <linux/miscdevice.h> 20 - #include <linux/pci.h> 21 20 #include <linux/delay.h> 22 21 #include <linux/slab.h> 23 22 #include <linux/init.h>
-1
drivers/net/atl1/atl1_param.c
··· 22 22 */ 23 23 24 24 #include <linux/types.h> 25 - #include <linux/pci.h> 26 25 #include <linux/moduleparam.h> 27 26 #include "atl1.h" 28 27
-1
drivers/net/au1000_eth.c
··· 45 45 #include <linux/bitops.h> 46 46 #include <linux/slab.h> 47 47 #include <linux/interrupt.h> 48 - #include <linux/pci.h> 49 48 #include <linux/init.h> 50 49 #include <linux/netdevice.h> 51 50 #include <linux/etherdevice.h>
-1
drivers/net/fec_8xx/fec_main.c
··· 19 19 #include <linux/ioport.h> 20 20 #include <linux/slab.h> 21 21 #include <linux/interrupt.h> 22 - #include <linux/pci.h> 23 22 #include <linux/init.h> 24 23 #include <linux/delay.h> 25 24 #include <linux/netdevice.h>
-1
drivers/net/fec_8xx/fec_mii.c
··· 19 19 #include <linux/ioport.h> 20 20 #include <linux/slab.h> 21 21 #include <linux/interrupt.h> 22 - #include <linux/pci.h> 23 22 #include <linux/init.h> 24 23 #include <linux/delay.h> 25 24 #include <linux/netdevice.h>
-1
drivers/net/fs_enet/fs_enet-main.c
··· 24 24 #include <linux/ioport.h> 25 25 #include <linux/slab.h> 26 26 #include <linux/interrupt.h> 27 - #include <linux/pci.h> 28 27 #include <linux/init.h> 29 28 #include <linux/delay.h> 30 29 #include <linux/netdevice.h>
-1
drivers/net/fs_enet/mac-fcc.c
··· 21 21 #include <linux/ioport.h> 22 22 #include <linux/slab.h> 23 23 #include <linux/interrupt.h> 24 - #include <linux/pci.h> 25 24 #include <linux/init.h> 26 25 #include <linux/delay.h> 27 26 #include <linux/netdevice.h>
-1
drivers/net/fs_enet/mac-fec.c
··· 21 21 #include <linux/ioport.h> 22 22 #include <linux/slab.h> 23 23 #include <linux/interrupt.h> 24 - #include <linux/pci.h> 25 24 #include <linux/init.h> 26 25 #include <linux/delay.h> 27 26 #include <linux/netdevice.h>
-1
drivers/net/fs_enet/mac-scc.c
··· 21 21 #include <linux/ioport.h> 22 22 #include <linux/slab.h> 23 23 #include <linux/interrupt.h> 24 - #include <linux/pci.h> 25 24 #include <linux/init.h> 26 25 #include <linux/delay.h> 27 26 #include <linux/netdevice.h>
-1
drivers/net/fs_enet/mii-bitbang.c
··· 22 22 #include <linux/ioport.h> 23 23 #include <linux/slab.h> 24 24 #include <linux/interrupt.h> 25 - #include <linux/pci.h> 26 25 #include <linux/init.h> 27 26 #include <linux/delay.h> 28 27 #include <linux/netdevice.h>
-1
drivers/net/fs_enet/mii-fec.c
··· 21 21 #include <linux/ioport.h> 22 22 #include <linux/slab.h> 23 23 #include <linux/interrupt.h> 24 - #include <linux/pci.h> 25 24 #include <linux/init.h> 26 25 #include <linux/delay.h> 27 26 #include <linux/netdevice.h>
-1
drivers/net/ibm_emac/ibm_emac_core.c
··· 27 27 #include <linux/delay.h> 28 28 #include <linux/init.h> 29 29 #include <linux/types.h> 30 - #include <linux/pci.h> 31 30 #include <linux/netdevice.h> 32 31 #include <linux/etherdevice.h> 33 32 #include <linux/skbuff.h>
-1
drivers/net/ixgb/ixgb_osdep.h
··· 34 34 #define _IXGB_OSDEP_H_ 35 35 36 36 #include <linux/types.h> 37 - #include <linux/pci.h> 38 37 #include <linux/delay.h> 39 38 #include <asm/io.h> 40 39 #include <linux/interrupt.h>
-1
drivers/net/lasi_82596.c
··· 81 81 #include <linux/etherdevice.h> 82 82 #include <linux/skbuff.h> 83 83 #include <linux/init.h> 84 - #include <linux/pci.h> 85 84 #include <linux/types.h> 86 85 #include <linux/bitops.h> 87 86
-1
drivers/net/tokenring/madgemc.c
··· 23 23 #include <linux/mca.h> 24 24 #include <linux/kernel.h> 25 25 #include <linux/errno.h> 26 - #include <linux/pci.h> 27 26 #include <linux/init.h> 28 27 #include <linux/netdevice.h> 29 28 #include <linux/trdevice.h>
-1
drivers/net/tokenring/smctr.c
··· 41 41 #include <linux/time.h> 42 42 #include <linux/errno.h> 43 43 #include <linux/init.h> 44 - #include <linux/pci.h> 45 44 #include <linux/mca-legacy.h> 46 45 #include <linux/delay.h> 47 46 #include <linux/netdevice.h>
-1
drivers/net/tulip/21142.c
··· 14 14 15 15 */ 16 16 17 - #include <linux/pci.h> 18 17 #include <linux/delay.h> 19 18 #include "tulip.h" 20 19
-1
drivers/net/tulip/pnic.c
··· 15 15 */ 16 16 17 17 #include <linux/kernel.h> 18 - #include <linux/pci.h> 19 18 #include <linux/jiffies.h> 20 19 #include "tulip.h" 21 20
-1
drivers/net/tulip/pnic2.c
··· 76 76 77 77 78 78 79 - #include <linux/pci.h> 80 79 #include "tulip.h" 81 80 #include <linux/delay.h> 82 81
-1
drivers/net/tulip/timer.c
··· 14 14 15 15 */ 16 16 17 - #include <linux/pci.h> 18 17 #include "tulip.h" 19 18 20 19
+1
drivers/net/tulip/tulip.h
··· 22 22 #include <linux/netdevice.h> 23 23 #include <linux/timer.h> 24 24 #include <linux/delay.h> 25 + #include <linux/pci.h> 25 26 #include <asm/io.h> 26 27 #include <asm/irq.h> 27 28
-1
drivers/net/wan/lmc/lmc_media.c
··· 8 8 #include <linux/ioport.h> 9 9 #include <linux/slab.h> 10 10 #include <linux/interrupt.h> 11 - #include <linux/pci.h> 12 11 #include <linux/in.h> 13 12 #include <linux/if_arp.h> 14 13 #include <linux/netdevice.h>
-1
drivers/net/wan/lmc/lmc_proto.c
··· 27 27 #include <linux/ioport.h> 28 28 #include <linux/slab.h> 29 29 #include <linux/interrupt.h> 30 - #include <linux/pci.h> 31 30 #include <linux/in.h> 32 31 #include <linux/if_arp.h> 33 32 #include <linux/netdevice.h>
-1
drivers/net/wan/pc300_tty.c
··· 38 38 39 39 #include <linux/module.h> 40 40 #include <linux/kernel.h> 41 - #include <linux/pci.h> 42 41 #include <linux/errno.h> 43 42 #include <linux/string.h> 44 43 #include <linux/init.h>
-2
drivers/parisc/hppb.c
··· 22 22 #include <asm/hardware.h> 23 23 #include <asm/parisc-device.h> 24 24 25 - #include <linux/pci.h> 26 - 27 25 struct hppb_card { 28 26 unsigned long hpa; 29 27 struct resource mmio_region;
+5 -26
drivers/pci/Kconfig
··· 1 1 # 2 2 # PCI configuration 3 3 # 4 + config ARCH_SUPPORTS_MSI 5 + bool 6 + default n 7 + 4 8 config PCI_MSI 5 9 bool "Message Signaled Interrupts (MSI and MSI-X)" 6 10 depends on PCI 7 - depends on (X86_LOCAL_APIC && X86_IO_APIC) || IA64 || SPARC64 11 + depends on ARCH_SUPPORTS_MSI 8 12 help 9 13 This allows device drivers to enable MSI (Message Signaled 10 14 Interrupts). Message Signaled Interrupts enable a device to ··· 20 16 entire system. 21 17 22 18 If you don't know what to do here, say N. 23 - 24 - config PCI_MULTITHREAD_PROBE 25 - bool "PCI Multi-threaded probe (EXPERIMENTAL)" 26 - depends on PCI && EXPERIMENTAL && BROKEN 27 - help 28 - Say Y here if you want the PCI core to spawn a new thread for 29 - every PCI device that is probed. This can cause a huge 30 - speedup in boot times on multiprocessor machines, and even a 31 - smaller speedup on single processor machines. 32 - 33 - But it can also cause lots of bad things to happen. A number 34 - of PCI drivers cannot properly handle running in this way, 35 - some will just not work properly at all, while others might 36 - decide to blow up power supplies with a huge load all at once, 37 - so use this option at your own risk. 38 - 39 - It is very unwise to use this option if you are not using a 40 - boot process that can handle devices being created in any 41 - order. A program that can create persistent block and network 42 - device names (like udev) is a good idea if you wish to use 43 - this option. 44 - 45 - Again, use this option at your own risk, you have been warned! 46 - 47 - When in doubt, say N. 48 19 49 20 config PCI_DEBUG 50 21 bool "PCI Debugging"
+2 -2
drivers/pci/bus.c
··· 77 77 * This adds a single pci device to the global 78 78 * device list and adds sysfs and procfs entries 79 79 */ 80 - int __devinit pci_bus_add_device(struct pci_dev *dev) 80 + int pci_bus_add_device(struct pci_dev *dev) 81 81 { 82 82 int retval; 83 83 retval = device_add(&dev->dev); ··· 105 105 * 106 106 * Call hotplug for each new devices. 107 107 */ 108 - void __devinit pci_bus_add_devices(struct pci_bus *bus) 108 + void pci_bus_add_devices(struct pci_bus *bus) 109 109 { 110 110 struct pci_dev *dev; 111 111 int retval;
+10 -15
drivers/pci/hotplug/Kconfig
··· 2 2 # PCI Hotplug support 3 3 # 4 4 5 - menu "PCI Hotplug Support" 6 - 7 - config HOTPLUG_PCI 5 + menuconfig HOTPLUG_PCI 8 6 tristate "Support for PCI Hotplug (EXPERIMENTAL)" 9 7 depends on PCI && EXPERIMENTAL && HOTPLUG 10 8 ---help--- ··· 15 17 16 18 When in doubt, say N. 17 19 20 + if HOTPLUG_PCI 21 + 18 22 config HOTPLUG_PCI_FAKE 19 23 tristate "Fake PCI Hotplug driver" 20 - depends on HOTPLUG_PCI 21 24 help 22 25 Say Y here if you want to use the fake PCI hotplug driver. It can 23 26 be used to simulate PCI hotplug events if even if your system is ··· 41 42 42 43 config HOTPLUG_PCI_COMPAQ 43 44 tristate "Compaq PCI Hotplug driver" 44 - depends on HOTPLUG_PCI && X86 && PCI_BIOS 45 + depends on X86 && PCI_BIOS 45 46 help 46 47 Say Y here if you have a motherboard with a Compaq PCI Hotplug 47 48 controller. ··· 63 64 64 65 config HOTPLUG_PCI_IBM 65 66 tristate "IBM PCI Hotplug driver" 66 - depends on HOTPLUG_PCI && X86_IO_APIC && X86 && PCI_BIOS 67 + depends on X86_IO_APIC && X86 && PCI_BIOS 67 68 help 68 69 Say Y here if you have a motherboard with a IBM PCI Hotplug 69 70 controller. ··· 75 76 76 77 config HOTPLUG_PCI_ACPI 77 78 tristate "ACPI PCI Hotplug driver" 78 - depends on HOTPLUG_PCI 79 79 depends on (!ACPI_DOCK && ACPI) || (ACPI_DOCK) 80 80 help 81 81 Say Y here if you have a system that supports PCI Hotplug using ··· 99 101 100 102 config HOTPLUG_PCI_CPCI 101 103 bool "CompactPCI Hotplug driver" 102 - depends on HOTPLUG_PCI 103 104 help 104 105 Say Y here if you have a CompactPCI system card with CompactPCI 105 106 hotswap support per the PICMG 2.1 specification. ··· 107 110 108 111 config HOTPLUG_PCI_CPCI_ZT5550 109 112 tristate "Ziatech ZT5550 CompactPCI Hotplug driver" 110 - depends on HOTPLUG_PCI && HOTPLUG_PCI_CPCI && X86 113 + depends on HOTPLUG_PCI_CPCI && X86 111 114 help 112 115 Say Y here if you have an Performance Technologies (formerly Intel, 113 116 formerly just Ziatech) Ziatech ZT5550 CompactPCI system card. ··· 119 122 120 123 config HOTPLUG_PCI_CPCI_GENERIC 121 124 tristate "Generic port I/O CompactPCI Hotplug driver" 122 - depends on HOTPLUG_PCI && HOTPLUG_PCI_CPCI && X86 125 + depends on HOTPLUG_PCI_CPCI && X86 123 126 help 124 127 Say Y here if you have a CompactPCI system card that exposes the #ENUM 125 128 hotswap signal as a bit in a system register that can be read through ··· 132 135 133 136 config HOTPLUG_PCI_SHPC 134 137 tristate "SHPC PCI Hotplug driver" 135 - depends on HOTPLUG_PCI 136 138 help 137 139 Say Y here if you have a motherboard with a SHPC PCI Hotplug 138 140 controller. ··· 143 147 144 148 config HOTPLUG_PCI_RPA 145 149 tristate "RPA PCI Hotplug driver" 146 - depends on HOTPLUG_PCI && PPC_PSERIES && PPC64 && !HOTPLUG_PCI_FAKE 150 + depends on PPC_PSERIES && PPC64 && !HOTPLUG_PCI_FAKE 147 151 help 148 152 Say Y here if you have a RPA system that supports PCI Hotplug. 149 153 ··· 166 170 167 171 config HOTPLUG_PCI_SGI 168 172 tristate "SGI PCI Hotplug Support" 169 - depends on HOTPLUG_PCI && (IA64_SGI_SN2 || IA64_GENERIC) 173 + depends on IA64_SGI_SN2 || IA64_GENERIC 170 174 help 171 175 Say Y here if you want to use the SGI Altix Hotplug 172 176 Driver for PCI devices. 173 177 174 178 When in doubt, say N. 175 179 176 - endmenu 177 - 180 + endif # HOTPLUG_PCI
+5 -1
drivers/pci/hotplug/cpcihp_zt5550.c
··· 296 296 static int __init zt5550_init(void) 297 297 { 298 298 struct resource* r; 299 + int rc; 299 300 300 301 info(DRIVER_DESC " version: " DRIVER_VERSION); 301 302 r = request_region(ENUM_PORT, 1, "#ENUM hotswap signal register"); 302 303 if(!r) 303 304 return -EBUSY; 304 305 305 - return pci_register_driver(&zt5550_hc_driver); 306 + rc = pci_register_driver(&zt5550_hc_driver); 307 + if(rc < 0) 308 + release_region(ENUM_PORT, 1); 309 + return rc; 306 310 } 307 311 308 312 static void __exit
+1 -1
drivers/pci/hotplug/fakephp.c
··· 238 238 { 239 239 unsigned int devfn; 240 240 struct pci_dev *dev; 241 - dev = kzalloc(sizeof(struct pci_dev), GFP_KERNEL); 241 + dev = alloc_pci_dev(); 242 242 if (!dev) 243 243 return; 244 244
+8 -11
drivers/pci/hotplug/pciehp.h
··· 43 43 extern int pciehp_poll_time; 44 44 extern int pciehp_debug; 45 45 extern int pciehp_force; 46 + extern struct workqueue_struct *pciehp_wq; 46 47 47 48 #define dbg(format, arg...) \ 48 49 do { \ ··· 71 70 struct list_head slot_list; 72 71 char name[SLOT_NAME_SIZE]; 73 72 unsigned long last_emi_toggle; 73 + struct delayed_work work; /* work for button event */ 74 + struct mutex lock; 74 75 }; 75 76 76 77 struct event_info { 77 78 u32 event_type; 78 - u8 hp_slot; 79 + struct slot *p_slot; 80 + struct work_struct work; 79 81 }; 80 82 81 - #define MAX_EVENTS 10 82 83 struct controller { 83 84 struct controller *next; 84 85 struct mutex crit_sect; /* critical section mutex */ ··· 89 86 int slot_num_inc; /* 1 or -1 */ 90 87 struct pci_dev *pci_dev; 91 88 struct list_head slot_list; 92 - struct event_info event_queue[MAX_EVENTS]; 93 89 struct slot *slot; 94 90 struct hpc_ops *hpc_ops; 95 91 wait_queue_head_t queue; /* sleep & wake process */ 96 - u8 next_event; 97 92 u8 bus; 98 93 u8 device; 99 94 u8 function; ··· 150 149 #define HP_SUPR_RM(cap) (cap & HP_SUPR_RM_SUP) 151 150 #define EMI(cap) (cap & EMI_PRSN) 152 151 153 - extern int pciehp_event_start_thread(void); 154 - extern void pciehp_event_stop_thread(void); 155 - extern int pciehp_enable_slot(struct slot *slot); 156 - extern int pciehp_disable_slot(struct slot *slot); 152 + extern int pciehp_sysfs_enable_slot(struct slot *slot); 153 + extern int pciehp_sysfs_disable_slot(struct slot *slot); 157 154 extern u8 pciehp_handle_attention_button(u8 hp_slot, struct controller *ctrl); 158 155 extern u8 pciehp_handle_switch_change(u8 hp_slot, struct controller *ctrl); 159 156 extern u8 pciehp_handle_presence_change(u8 hp_slot, struct controller *ctrl); 160 157 extern u8 pciehp_handle_power_fault(u8 hp_slot, struct controller *ctrl); 161 158 extern int pciehp_configure_device(struct slot *p_slot); 162 159 extern int pciehp_unconfigure_device(struct slot *p_slot); 160 + extern void pciehp_queue_pushbutton_work(struct work_struct *work); 163 161 int pcie_init(struct controller *ctrl, struct pcie_device *dev); 164 - 165 - /* Global variables */ 166 - extern struct controller *pciehp_ctrl_list; 167 162 168 163 static inline struct slot *pciehp_find_slot(struct controller *ctrl, u8 device) 169 164 {
+14 -68
drivers/pci/hotplug/pciehp_core.c
··· 41 41 int pciehp_poll_mode; 42 42 int pciehp_poll_time; 43 43 int pciehp_force; 44 - struct controller *pciehp_ctrl_list; 44 + struct workqueue_struct *pciehp_wq; 45 45 46 46 #define DRIVER_VERSION "0.4" 47 47 #define DRIVER_AUTHOR "Dan Zink <dan.zink@compaq.com>, Greg Kroah-Hartman <greg@kroah.com>, Dely Sy <dely.l.sy@intel.com>" ··· 62 62 63 63 #define PCIE_MODULE_NAME "pciehp" 64 64 65 - static int pcie_start_thread (void); 66 65 static int set_attention_status (struct hotplug_slot *slot, u8 value); 67 66 static int enable_slot (struct hotplug_slot *slot); 68 67 static int disable_slot (struct hotplug_slot *slot); ··· 228 229 slot->device = ctrl->slot_device_offset + i; 229 230 slot->hpc_ops = ctrl->hpc_ops; 230 231 slot->number = ctrl->first_slot; 232 + mutex_init(&slot->lock); 233 + INIT_DELAYED_WORK(&slot->work, pciehp_queue_pushbutton_work); 231 234 232 235 /* register this slot with the hotplug pci core */ 233 236 hotplug_slot->private = slot; ··· 287 286 if (EMI(ctrl->ctrlcap)) 288 287 sysfs_remove_file(&slot->hotplug_slot->kobj, 289 288 &hotplug_slot_attr_lock.attr); 289 + cancel_delayed_work(&slot->work); 290 + flush_scheduled_work(); 291 + flush_workqueue(pciehp_wq); 290 292 pci_hp_deregister(slot->hotplug_slot); 291 293 } 292 294 } ··· 318 314 319 315 dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); 320 316 321 - return pciehp_enable_slot(slot); 317 + return pciehp_sysfs_enable_slot(slot); 322 318 } 323 319 324 320 ··· 328 324 329 325 dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); 330 326 331 - return pciehp_disable_slot(slot); 327 + return pciehp_sysfs_disable_slot(slot); 332 328 } 333 329 334 330 static int get_power_status(struct hotplug_slot *hotplug_slot, u8 *value) ··· 470 466 471 467 t_slot = pciehp_find_slot(ctrl, ctrl->slot_device_offset); 472 468 473 - /* Finish setting up the hot plug ctrl device */ 474 - ctrl->next_event = 0; 475 - 476 - if (!pciehp_ctrl_list) { 477 - pciehp_ctrl_list = ctrl; 478 - ctrl->next = NULL; 479 - } else { 480 - ctrl->next = pciehp_ctrl_list; 481 - pciehp_ctrl_list = ctrl; 482 - } 483 - 484 469 t_slot->hpc_ops->get_adapter_status(t_slot, &value); /* Check if slot is occupied */ 485 470 if ((POWER_CTRL(ctrl->ctrlcap)) && !value) { 486 471 rc = t_slot->hpc_ops->power_off_slot(t_slot); /* Power off slot if not occupied*/ ··· 489 496 return -ENODEV; 490 497 } 491 498 492 - 493 - static int pcie_start_thread(void) 499 + static void pciehp_remove (struct pcie_device *dev) 494 500 { 495 - int retval = 0; 496 - 497 - dbg("Initialize + Start the notification/polling mechanism \n"); 501 + struct pci_dev *pdev = dev->port; 502 + struct controller *ctrl = pci_get_drvdata(pdev); 498 503 499 - retval = pciehp_event_start_thread(); 500 - if (retval) { 501 - dbg("pciehp_event_start_thread() failed\n"); 502 - return retval; 503 - } 504 - 505 - return retval; 506 - } 507 - 508 - static void __exit unload_pciehpd(void) 509 - { 510 - struct controller *ctrl; 511 - struct controller *tctrl; 512 - 513 - ctrl = pciehp_ctrl_list; 514 - 515 - while (ctrl) { 516 - cleanup_slots(ctrl); 517 - 518 - ctrl->hpc_ops->release_ctlr(ctrl); 519 - 520 - tctrl = ctrl; 521 - ctrl = ctrl->next; 522 - 523 - kfree(tctrl); 524 - } 525 - 526 - /* Stop the notification mechanism */ 527 - pciehp_event_stop_thread(); 528 - 529 - } 530 - 531 - static void pciehp_remove (struct pcie_device *device) 532 - { 533 - /* XXX - Needs to be adapted to device driver model */ 504 + cleanup_slots(ctrl); 505 + ctrl->hpc_ops->release_ctlr(ctrl); 506 + kfree(ctrl); 534 507 } 535 508 536 509 #ifdef CONFIG_PM ··· 544 585 pciehp_poll_mode = 1; 545 586 #endif 546 587 547 - retval = pcie_start_thread(); 548 - if (retval) 549 - goto error_hpc_init; 550 - 551 588 retval = pcie_port_service_register(&hpdriver_portdrv); 552 589 dbg("pcie_port_service_register = %d\n", retval); 553 590 info(DRIVER_DESC " version: " DRIVER_VERSION "\n"); 554 591 if (retval) 555 592 dbg("%s: Failure to register service\n", __FUNCTION__); 556 - 557 - error_hpc_init: 558 - if (retval) { 559 - pciehp_event_stop_thread(); 560 - }; 561 - 562 593 return retval; 563 594 } 564 595 565 596 static void __exit pcied_cleanup(void) 566 597 { 567 598 dbg("unload_pciehpd()\n"); 568 - unload_pciehpd(); 569 - 570 599 pcie_port_service_unregister(&hpdriver_portdrv); 571 - 572 600 info(DRIVER_DESC " version: " DRIVER_VERSION " unloaded\n"); 573 601 } 574 602
+280 -332
drivers/pci/hotplug/pciehp_ctrl.c
··· 32 32 #include <linux/types.h> 33 33 #include <linux/smp_lock.h> 34 34 #include <linux/pci.h> 35 + #include <linux/workqueue.h> 35 36 #include "../pci.h" 36 37 #include "pciehp.h" 37 38 38 - static void interrupt_event_handler(struct controller *ctrl); 39 + static void interrupt_event_handler(struct work_struct *work); 40 + static int pciehp_enable_slot(struct slot *p_slot); 41 + static int pciehp_disable_slot(struct slot *p_slot); 39 42 40 - static struct semaphore event_semaphore; /* mutex for process loop (up if something to process) */ 41 - static struct semaphore event_exit; /* guard ensure thread has exited before calling it quits */ 42 - static int event_finished; 43 - static unsigned long pushbutton_pending; /* = 0 */ 44 - static unsigned long surprise_rm_pending; /* = 0 */ 45 - 46 - static inline char *slot_name(struct slot *p_slot) 43 + static int queue_interrupt_event(struct slot *p_slot, u32 event_type) 47 44 { 48 - return p_slot->hotplug_slot->name; 45 + struct event_info *info; 46 + 47 + info = kmalloc(sizeof(*info), GFP_ATOMIC); 48 + if (!info) 49 + return -ENOMEM; 50 + 51 + info->event_type = event_type; 52 + info->p_slot = p_slot; 53 + INIT_WORK(&info->work, interrupt_event_handler); 54 + 55 + schedule_work(&info->work); 56 + 57 + return 0; 49 58 } 50 59 51 60 u8 pciehp_handle_attention_button(u8 hp_slot, struct controller *ctrl) 52 61 { 53 62 struct slot *p_slot; 54 - u8 rc = 0; 55 - u8 getstatus; 56 - struct event_info *taskInfo; 63 + u32 event_type; 57 64 58 65 /* Attention Button Change */ 59 66 dbg("pciehp: Attention button interrupt received.\n"); 60 - 61 - /* This is the structure that tells the worker thread what to do */ 62 - taskInfo = &(ctrl->event_queue[ctrl->next_event]); 67 + 63 68 p_slot = pciehp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); 64 - 65 - p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); 66 - 67 - ctrl->next_event = (ctrl->next_event + 1) % MAX_EVENTS; 68 - taskInfo->hp_slot = hp_slot; 69 - 70 - rc++; 71 69 72 70 /* 73 71 * Button pressed - See if need to TAKE ACTION!!! 74 72 */ 75 - info("Button pressed on Slot(%s)\n", slot_name(p_slot)); 76 - taskInfo->event_type = INT_BUTTON_PRESS; 73 + info("Button pressed on Slot(%s)\n", p_slot->name); 74 + event_type = INT_BUTTON_PRESS; 77 75 78 - if ((p_slot->state == BLINKINGON_STATE) 79 - || (p_slot->state == BLINKINGOFF_STATE)) { 80 - /* Cancel if we are still blinking; this means that we press the 81 - * attention again before the 5 sec. limit expires to cancel hot-add 82 - * or hot-remove 83 - */ 84 - taskInfo->event_type = INT_BUTTON_CANCEL; 85 - info("Button cancel on Slot(%s)\n", slot_name(p_slot)); 86 - } else if ((p_slot->state == POWERON_STATE) 87 - || (p_slot->state == POWEROFF_STATE)) { 88 - /* Ignore if the slot is on power-on or power-off state; this 89 - * means that the previous attention button action to hot-add or 90 - * hot-remove is undergoing 91 - */ 92 - taskInfo->event_type = INT_BUTTON_IGNORE; 93 - info("Button ignore on Slot(%s)\n", slot_name(p_slot)); 94 - } 95 - 96 - if (rc) 97 - up(&event_semaphore); /* signal event thread that new event is posted */ 76 + queue_interrupt_event(p_slot, event_type); 98 77 99 78 return 0; 100 - 101 79 } 102 80 103 81 u8 pciehp_handle_switch_change(u8 hp_slot, struct controller *ctrl) 104 82 { 105 83 struct slot *p_slot; 106 - u8 rc = 0; 107 84 u8 getstatus; 108 - struct event_info *taskInfo; 85 + u32 event_type; 109 86 110 87 /* Switch Change */ 111 88 dbg("pciehp: Switch interrupt received.\n"); 112 89 113 - /* This is the structure that tells the worker thread 114 - * what to do 115 - */ 116 - taskInfo = &(ctrl->event_queue[ctrl->next_event]); 117 - ctrl->next_event = (ctrl->next_event + 1) % MAX_EVENTS; 118 - taskInfo->hp_slot = hp_slot; 119 - 120 - rc++; 121 90 p_slot = pciehp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); 122 91 p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); 123 92 ··· 94 125 /* 95 126 * Switch opened 96 127 */ 97 - info("Latch open on Slot(%s)\n", slot_name(p_slot)); 98 - taskInfo->event_type = INT_SWITCH_OPEN; 128 + info("Latch open on Slot(%s)\n", p_slot->name); 129 + event_type = INT_SWITCH_OPEN; 99 130 } else { 100 131 /* 101 132 * Switch closed 102 133 */ 103 - info("Latch close on Slot(%s)\n", slot_name(p_slot)); 104 - taskInfo->event_type = INT_SWITCH_CLOSE; 134 + info("Latch close on Slot(%s)\n", p_slot->name); 135 + event_type = INT_SWITCH_CLOSE; 105 136 } 106 137 107 - if (rc) 108 - up(&event_semaphore); /* signal event thread that new event is posted */ 138 + queue_interrupt_event(p_slot, event_type); 109 139 110 - return rc; 140 + return 1; 111 141 } 112 142 113 143 u8 pciehp_handle_presence_change(u8 hp_slot, struct controller *ctrl) 114 144 { 115 145 struct slot *p_slot; 116 - u8 presence_save, rc = 0; 117 - struct event_info *taskInfo; 146 + u32 event_type; 147 + u8 presence_save; 118 148 119 149 /* Presence Change */ 120 150 dbg("pciehp: Presence/Notify input change.\n"); 121 151 122 - /* This is the structure that tells the worker thread 123 - * what to do 124 - */ 125 - taskInfo = &(ctrl->event_queue[ctrl->next_event]); 126 - ctrl->next_event = (ctrl->next_event + 1) % MAX_EVENTS; 127 - taskInfo->hp_slot = hp_slot; 128 - 129 - rc++; 130 152 p_slot = pciehp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); 131 153 132 154 /* Switch is open, assume a presence change ··· 128 168 /* 129 169 * Card Present 130 170 */ 131 - info("Card present on Slot(%s)\n", slot_name(p_slot)); 132 - taskInfo->event_type = INT_PRESENCE_ON; 171 + info("Card present on Slot(%s)\n", p_slot->name); 172 + event_type = INT_PRESENCE_ON; 133 173 } else { 134 174 /* 135 175 * Not Present 136 176 */ 137 - info("Card not present on Slot(%s)\n", slot_name(p_slot)); 138 - taskInfo->event_type = INT_PRESENCE_OFF; 177 + info("Card not present on Slot(%s)\n", p_slot->name); 178 + event_type = INT_PRESENCE_OFF; 139 179 } 140 180 141 - if (rc) 142 - up(&event_semaphore); /* signal event thread that new event is posted */ 181 + queue_interrupt_event(p_slot, event_type); 143 182 144 - return rc; 183 + return 1; 145 184 } 146 185 147 186 u8 pciehp_handle_power_fault(u8 hp_slot, struct controller *ctrl) 148 187 { 149 188 struct slot *p_slot; 150 - u8 rc = 0; 151 - struct event_info *taskInfo; 189 + u32 event_type; 152 190 153 191 /* power fault */ 154 192 dbg("pciehp: Power fault interrupt received.\n"); 155 193 156 - /* this is the structure that tells the worker thread 157 - * what to do 158 - */ 159 - taskInfo = &(ctrl->event_queue[ctrl->next_event]); 160 - ctrl->next_event = (ctrl->next_event + 1) % MAX_EVENTS; 161 - taskInfo->hp_slot = hp_slot; 162 - 163 - rc++; 164 194 p_slot = pciehp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); 165 195 166 196 if ( !(p_slot->hpc_ops->query_power_fault(p_slot))) { 167 197 /* 168 198 * power fault Cleared 169 199 */ 170 - info("Power fault cleared on Slot(%s)\n", slot_name(p_slot)); 171 - taskInfo->event_type = INT_POWER_FAULT_CLEAR; 200 + info("Power fault cleared on Slot(%s)\n", p_slot->name); 201 + event_type = INT_POWER_FAULT_CLEAR; 172 202 } else { 173 203 /* 174 204 * power fault 175 205 */ 176 - info("Power fault on Slot(%s)\n", slot_name(p_slot)); 177 - taskInfo->event_type = INT_POWER_FAULT; 206 + info("Power fault on Slot(%s)\n", p_slot->name); 207 + event_type = INT_POWER_FAULT; 178 208 info("power fault bit %x set\n", hp_slot); 179 209 } 180 - if (rc) 181 - up(&event_semaphore); /* signal event thread that new event is posted */ 182 210 183 - return rc; 211 + queue_interrupt_event(p_slot, event_type); 212 + 213 + return 1; 184 214 } 185 215 186 216 /* The following routines constitute the bulk of the ··· 307 357 return 0; 308 358 } 309 359 310 - 311 - static void pushbutton_helper_thread(unsigned long data) 312 - { 313 - pushbutton_pending = data; 314 - 315 - up(&event_semaphore); 316 - } 360 + struct power_work_info { 361 + struct slot *p_slot; 362 + struct work_struct work; 363 + }; 317 364 318 365 /** 319 366 * pciehp_pushbutton_thread ··· 319 372 * Handles all pending events and exits. 320 373 * 321 374 */ 322 - static void pciehp_pushbutton_thread(unsigned long slot) 375 + static void pciehp_power_thread(struct work_struct *work) 323 376 { 324 - struct slot *p_slot = (struct slot *) slot; 325 - u8 getstatus; 326 - 327 - pushbutton_pending = 0; 377 + struct power_work_info *info = 378 + container_of(work, struct power_work_info, work); 379 + struct slot *p_slot = info->p_slot; 328 380 329 - if (!p_slot) { 330 - dbg("%s: Error! slot NULL\n", __FUNCTION__); 331 - return; 332 - } 333 - 334 - p_slot->hpc_ops->get_power_status(p_slot, &getstatus); 335 - if (getstatus) { 336 - p_slot->state = POWEROFF_STATE; 337 - dbg("%s: disabling bus:device(%x:%x)\n", __FUNCTION__, 338 - p_slot->bus, p_slot->device); 339 - 381 + mutex_lock(&p_slot->lock); 382 + switch (p_slot->state) { 383 + case POWEROFF_STATE: 384 + mutex_unlock(&p_slot->lock); 385 + dbg("%s: disabling bus:device(%x:%x)\n", 386 + __FUNCTION__, p_slot->bus, p_slot->device); 340 387 pciehp_disable_slot(p_slot); 388 + mutex_lock(&p_slot->lock); 341 389 p_slot->state = STATIC_STATE; 342 - } else { 343 - p_slot->state = POWERON_STATE; 344 - dbg("%s: adding bus:device(%x:%x)\n", __FUNCTION__, 345 - p_slot->bus, p_slot->device); 346 - 390 + break; 391 + case POWERON_STATE: 392 + mutex_unlock(&p_slot->lock); 347 393 if (pciehp_enable_slot(p_slot) && 348 394 PWR_LED(p_slot->ctrl->ctrlcap)) 349 395 p_slot->hpc_ops->green_led_off(p_slot); 350 - 396 + mutex_lock(&p_slot->lock); 351 397 p_slot->state = STATIC_STATE; 398 + break; 399 + default: 400 + break; 352 401 } 402 + mutex_unlock(&p_slot->lock); 353 403 354 - return; 404 + kfree(info); 355 405 } 356 406 357 - /** 358 - * pciehp_surprise_rm_thread 359 - * 360 - * Scheduled procedure to handle blocking stuff for the surprise removal 361 - * Handles all pending events and exits. 362 - * 363 - */ 364 - static void pciehp_surprise_rm_thread(unsigned long slot) 407 + void pciehp_queue_pushbutton_work(struct work_struct *work) 365 408 { 366 - struct slot *p_slot = (struct slot *) slot; 367 - u8 getstatus; 368 - 369 - surprise_rm_pending = 0; 409 + struct slot *p_slot = container_of(work, struct slot, work.work); 410 + struct power_work_info *info; 370 411 371 - if (!p_slot) { 372 - dbg("%s: Error! slot NULL\n", __FUNCTION__); 412 + info = kmalloc(sizeof(*info), GFP_KERNEL); 413 + if (!info) { 414 + err("%s: Cannot allocate memory\n", __FUNCTION__); 373 415 return; 374 416 } 417 + info->p_slot = p_slot; 418 + INIT_WORK(&info->work, pciehp_power_thread); 375 419 376 - p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus); 377 - if (!getstatus) { 420 + mutex_lock(&p_slot->lock); 421 + switch (p_slot->state) { 422 + case BLINKINGOFF_STATE: 378 423 p_slot->state = POWEROFF_STATE; 379 - dbg("%s: removing bus:device(%x:%x)\n", 380 - __FUNCTION__, p_slot->bus, p_slot->device); 381 - 382 - pciehp_disable_slot(p_slot); 383 - p_slot->state = STATIC_STATE; 384 - } else { 424 + break; 425 + case BLINKINGON_STATE: 385 426 p_slot->state = POWERON_STATE; 386 - dbg("%s: adding bus:device(%x:%x)\n", 387 - __FUNCTION__, p_slot->bus, p_slot->device); 388 - 389 - if (pciehp_enable_slot(p_slot) && 390 - PWR_LED(p_slot->ctrl->ctrlcap)) 391 - p_slot->hpc_ops->green_led_off(p_slot); 392 - 393 - p_slot->state = STATIC_STATE; 427 + break; 428 + default: 429 + goto out; 394 430 } 395 - 396 - return; 431 + queue_work(pciehp_wq, &info->work); 432 + out: 433 + mutex_unlock(&p_slot->lock); 397 434 } 398 - 399 - 400 - 401 - /* this is the main worker thread */ 402 - static int event_thread(void* data) 403 - { 404 - struct controller *ctrl; 405 - lock_kernel(); 406 - daemonize("pciehpd_event"); 407 - 408 - unlock_kernel(); 409 - 410 - while (1) { 411 - dbg("!!!!event_thread sleeping\n"); 412 - down_interruptible (&event_semaphore); 413 - dbg("event_thread woken finished = %d\n", event_finished); 414 - if (event_finished || signal_pending(current)) 415 - break; 416 - /* Do stuff here */ 417 - if (pushbutton_pending) 418 - pciehp_pushbutton_thread(pushbutton_pending); 419 - else if (surprise_rm_pending) 420 - pciehp_surprise_rm_thread(surprise_rm_pending); 421 - else 422 - for (ctrl = pciehp_ctrl_list; ctrl; ctrl=ctrl->next) 423 - interrupt_event_handler(ctrl); 424 - } 425 - dbg("event_thread signals exit\n"); 426 - up(&event_exit); 427 - return 0; 428 - } 429 - 430 - int pciehp_event_start_thread(void) 431 - { 432 - int pid; 433 - 434 - /* initialize our semaphores */ 435 - init_MUTEX_LOCKED(&event_exit); 436 - event_finished=0; 437 - 438 - init_MUTEX_LOCKED(&event_semaphore); 439 - pid = kernel_thread(event_thread, NULL, 0); 440 - 441 - if (pid < 0) { 442 - err ("Can't start up our event thread\n"); 443 - return -1; 444 - } 445 - return 0; 446 - } 447 - 448 - 449 - void pciehp_event_stop_thread(void) 450 - { 451 - event_finished = 1; 452 - up(&event_semaphore); 453 - down(&event_exit); 454 - } 455 - 456 435 457 436 static int update_slot_info(struct slot *slot) 458 437 { 459 438 struct hotplug_slot_info *info; 460 - /* char buffer[SLOT_NAME_SIZE]; */ 461 439 int result; 462 440 463 - info = kmalloc(sizeof(struct hotplug_slot_info), GFP_KERNEL); 441 + info = kmalloc(sizeof(*info), GFP_KERNEL); 464 442 if (!info) 465 443 return -ENOMEM; 466 - 467 - /* make_slot_name (&buffer[0], SLOT_NAME_SIZE, slot); */ 468 444 469 445 slot->hpc_ops->get_power_status(slot, &(info->power_status)); 470 446 slot->hpc_ops->get_attention_status(slot, &(info->attention_status)); 471 447 slot->hpc_ops->get_latch_status(slot, &(info->latch_status)); 472 448 slot->hpc_ops->get_adapter_status(slot, &(info->adapter_status)); 473 449 474 - /* result = pci_hp_change_slot_info(buffer, info); */ 475 450 result = pci_hp_change_slot_info(slot->hotplug_slot, info); 476 451 kfree (info); 477 452 return result; 478 453 } 479 454 480 - static void interrupt_event_handler(struct controller *ctrl) 455 + /* 456 + * Note: This function must be called with slot->lock held 457 + */ 458 + static void handle_button_press_event(struct slot *p_slot) 481 459 { 482 - int loop = 0; 483 - int change = 1; 484 - u8 hp_slot; 460 + struct controller *ctrl = p_slot->ctrl; 485 461 u8 getstatus; 486 - struct slot *p_slot; 487 462 488 - while (change) { 489 - change = 0; 463 + switch (p_slot->state) { 464 + case STATIC_STATE: 465 + p_slot->hpc_ops->get_power_status(p_slot, &getstatus); 466 + if (getstatus) { 467 + p_slot->state = BLINKINGOFF_STATE; 468 + info("PCI slot #%s - powering off due to button " 469 + "press.\n", p_slot->name); 470 + } else { 471 + p_slot->state = BLINKINGON_STATE; 472 + info("PCI slot #%s - powering on due to button " 473 + "press.\n", p_slot->name); 474 + } 475 + /* blink green LED and turn off amber */ 476 + if (PWR_LED(ctrl->ctrlcap)) 477 + p_slot->hpc_ops->green_led_blink(p_slot); 478 + if (ATTN_LED(ctrl->ctrlcap)) 479 + p_slot->hpc_ops->set_attention_status(p_slot, 0); 490 480 491 - for (loop = 0; loop < MAX_EVENTS; loop++) { 492 - if (ctrl->event_queue[loop].event_type != 0) { 493 - hp_slot = ctrl->event_queue[loop].hp_slot; 494 - 495 - p_slot = pciehp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); 496 - 497 - if (ctrl->event_queue[loop].event_type == INT_BUTTON_CANCEL) { 498 - dbg("button cancel\n"); 499 - del_timer(&p_slot->task_event); 500 - 501 - switch (p_slot->state) { 502 - case BLINKINGOFF_STATE: 503 - if (PWR_LED(ctrl->ctrlcap)) 504 - p_slot->hpc_ops->green_led_on(p_slot); 505 - 506 - if (ATTN_LED(ctrl->ctrlcap)) 507 - p_slot->hpc_ops->set_attention_status(p_slot, 0); 508 - break; 509 - case BLINKINGON_STATE: 510 - if (PWR_LED(ctrl->ctrlcap)) 511 - p_slot->hpc_ops->green_led_off(p_slot); 512 - 513 - if (ATTN_LED(ctrl->ctrlcap)) 514 - p_slot->hpc_ops->set_attention_status(p_slot, 0); 515 - break; 516 - default: 517 - warn("Not a valid state\n"); 518 - return; 519 - } 520 - info("PCI slot #%s - action canceled due to button press.\n", slot_name(p_slot)); 521 - p_slot->state = STATIC_STATE; 522 - } 523 - /* ***********Button Pressed (No action on 1st press...) */ 524 - else if (ctrl->event_queue[loop].event_type == INT_BUTTON_PRESS) { 525 - 526 - if (ATTN_BUTTN(ctrl->ctrlcap)) { 527 - dbg("Button pressed\n"); 528 - p_slot->hpc_ops->get_power_status(p_slot, &getstatus); 529 - if (getstatus) { 530 - /* slot is on */ 531 - dbg("slot is on\n"); 532 - p_slot->state = BLINKINGOFF_STATE; 533 - info("PCI slot #%s - powering off due to button press.\n", slot_name(p_slot)); 534 - } else { 535 - /* slot is off */ 536 - dbg("slot is off\n"); 537 - p_slot->state = BLINKINGON_STATE; 538 - info("PCI slot #%s - powering on due to button press.\n", slot_name(p_slot)); 539 - } 540 - 541 - /* blink green LED and turn off amber */ 542 - if (PWR_LED(ctrl->ctrlcap)) 543 - p_slot->hpc_ops->green_led_blink(p_slot); 544 - 545 - if (ATTN_LED(ctrl->ctrlcap)) 546 - p_slot->hpc_ops->set_attention_status(p_slot, 0); 547 - 548 - init_timer(&p_slot->task_event); 549 - p_slot->task_event.expires = jiffies + 5 * HZ; /* 5 second delay */ 550 - p_slot->task_event.function = (void (*)(unsigned long)) pushbutton_helper_thread; 551 - p_slot->task_event.data = (unsigned long) p_slot; 552 - 553 - add_timer(&p_slot->task_event); 554 - } 555 - } 556 - /***********POWER FAULT********************/ 557 - else if (ctrl->event_queue[loop].event_type == INT_POWER_FAULT) { 558 - if (POWER_CTRL(ctrl->ctrlcap)) { 559 - dbg("power fault\n"); 560 - if (ATTN_LED(ctrl->ctrlcap)) 561 - p_slot->hpc_ops->set_attention_status(p_slot, 1); 562 - 563 - if (PWR_LED(ctrl->ctrlcap)) 564 - p_slot->hpc_ops->green_led_off(p_slot); 565 - } 566 - } 567 - /***********SURPRISE REMOVAL********************/ 568 - else if ((ctrl->event_queue[loop].event_type == INT_PRESENCE_ON) || 569 - (ctrl->event_queue[loop].event_type == INT_PRESENCE_OFF)) { 570 - if (HP_SUPR_RM(ctrl->ctrlcap)) { 571 - dbg("Surprise Removal\n"); 572 - if (p_slot) { 573 - surprise_rm_pending = (unsigned long) p_slot; 574 - up(&event_semaphore); 575 - update_slot_info(p_slot); 576 - } 577 - } 578 - } else { 579 - /* refresh notification */ 580 - if (p_slot) 581 - update_slot_info(p_slot); 582 - } 583 - 584 - ctrl->event_queue[loop].event_type = 0; 585 - 586 - change = 1; 587 - } 588 - } /* End of FOR loop */ 481 + schedule_delayed_work(&p_slot->work, 5*HZ); 482 + break; 483 + case BLINKINGOFF_STATE: 484 + case BLINKINGON_STATE: 485 + /* 486 + * Cancel if we are still blinking; this means that we 487 + * press the attention again before the 5 sec. limit 488 + * expires to cancel hot-add or hot-remove 489 + */ 490 + info("Button cancel on Slot(%s)\n", p_slot->name); 491 + dbg("%s: button cancel\n", __FUNCTION__); 492 + cancel_delayed_work(&p_slot->work); 493 + if (p_slot->state == BLINKINGOFF_STATE) { 494 + if (PWR_LED(ctrl->ctrlcap)) 495 + p_slot->hpc_ops->green_led_on(p_slot); 496 + } else { 497 + if (PWR_LED(ctrl->ctrlcap)) 498 + p_slot->hpc_ops->green_led_off(p_slot); 499 + } 500 + if (ATTN_LED(ctrl->ctrlcap)) 501 + p_slot->hpc_ops->set_attention_status(p_slot, 0); 502 + info("PCI slot #%s - action canceled due to button press\n", 503 + p_slot->name); 504 + p_slot->state = STATIC_STATE; 505 + break; 506 + case POWEROFF_STATE: 507 + case POWERON_STATE: 508 + /* 509 + * Ignore if the slot is on power-on or power-off state; 510 + * this means that the previous attention button action 511 + * to hot-add or hot-remove is undergoing 512 + */ 513 + info("Button ignore on Slot(%s)\n", p_slot->name); 514 + update_slot_info(p_slot); 515 + break; 516 + default: 517 + warn("Not a valid state\n"); 518 + break; 589 519 } 520 + } 521 + 522 + /* 523 + * Note: This function must be called with slot->lock held 524 + */ 525 + static void handle_surprise_event(struct slot *p_slot) 526 + { 527 + u8 getstatus; 528 + struct power_work_info *info; 529 + 530 + info = kmalloc(sizeof(*info), GFP_KERNEL); 531 + if (!info) { 532 + err("%s: Cannot allocate memory\n", __FUNCTION__); 533 + return; 534 + } 535 + info->p_slot = p_slot; 536 + INIT_WORK(&info->work, pciehp_power_thread); 537 + 538 + p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus); 539 + if (!getstatus) 540 + p_slot->state = POWEROFF_STATE; 541 + else 542 + p_slot->state = POWERON_STATE; 543 + 544 + queue_work(pciehp_wq, &info->work); 545 + } 546 + 547 + static void interrupt_event_handler(struct work_struct *work) 548 + { 549 + struct event_info *info = container_of(work, struct event_info, work); 550 + struct slot *p_slot = info->p_slot; 551 + struct controller *ctrl = p_slot->ctrl; 552 + 553 + mutex_lock(&p_slot->lock); 554 + switch (info->event_type) { 555 + case INT_BUTTON_PRESS: 556 + handle_button_press_event(p_slot); 557 + break; 558 + case INT_POWER_FAULT: 559 + if (!POWER_CTRL(ctrl->ctrlcap)) 560 + break; 561 + if (ATTN_LED(ctrl->ctrlcap)) 562 + p_slot->hpc_ops->set_attention_status(p_slot, 1); 563 + if (PWR_LED(ctrl->ctrlcap)) 564 + p_slot->hpc_ops->green_led_off(p_slot); 565 + break; 566 + case INT_PRESENCE_ON: 567 + case INT_PRESENCE_OFF: 568 + if (!HP_SUPR_RM(ctrl->ctrlcap)) 569 + break; 570 + dbg("Surprise Removal\n"); 571 + update_slot_info(p_slot); 572 + handle_surprise_event(p_slot); 573 + break; 574 + default: 575 + update_slot_info(p_slot); 576 + break; 577 + } 578 + mutex_unlock(&p_slot->lock); 579 + 580 + kfree(info); 590 581 } 591 582 592 583 int pciehp_enable_slot(struct slot *p_slot) ··· 538 653 rc = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus); 539 654 if (rc || !getstatus) { 540 655 info("%s: no adapter on slot(%s)\n", __FUNCTION__, 541 - slot_name(p_slot)); 656 + p_slot->name); 542 657 mutex_unlock(&p_slot->ctrl->crit_sect); 543 658 return -ENODEV; 544 659 } ··· 546 661 rc = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); 547 662 if (rc || getstatus) { 548 663 info("%s: latch open on slot(%s)\n", __FUNCTION__, 549 - slot_name(p_slot)); 664 + p_slot->name); 550 665 mutex_unlock(&p_slot->ctrl->crit_sect); 551 666 return -ENODEV; 552 667 } ··· 556 671 rc = p_slot->hpc_ops->get_power_status(p_slot, &getstatus); 557 672 if (rc || getstatus) { 558 673 info("%s: already enabled on slot(%s)\n", __FUNCTION__, 559 - slot_name(p_slot)); 674 + p_slot->name); 560 675 mutex_unlock(&p_slot->ctrl->crit_sect); 561 676 return -EINVAL; 562 677 } ··· 591 706 ret = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus); 592 707 if (ret || !getstatus) { 593 708 info("%s: no adapter on slot(%s)\n", __FUNCTION__, 594 - slot_name(p_slot)); 709 + p_slot->name); 595 710 mutex_unlock(&p_slot->ctrl->crit_sect); 596 711 return -ENODEV; 597 712 } ··· 601 716 ret = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); 602 717 if (ret || getstatus) { 603 718 info("%s: latch open on slot(%s)\n", __FUNCTION__, 604 - slot_name(p_slot)); 719 + p_slot->name); 605 720 mutex_unlock(&p_slot->ctrl->crit_sect); 606 721 return -ENODEV; 607 722 } ··· 611 726 ret = p_slot->hpc_ops->get_power_status(p_slot, &getstatus); 612 727 if (ret || !getstatus) { 613 728 info("%s: already disabled slot(%s)\n", __FUNCTION__, 614 - slot_name(p_slot)); 729 + p_slot->name); 615 730 mutex_unlock(&p_slot->ctrl->crit_sect); 616 731 return -EINVAL; 617 732 } ··· 624 739 return ret; 625 740 } 626 741 742 + int pciehp_sysfs_enable_slot(struct slot *p_slot) 743 + { 744 + int retval = -ENODEV; 745 + 746 + mutex_lock(&p_slot->lock); 747 + switch (p_slot->state) { 748 + case BLINKINGON_STATE: 749 + cancel_delayed_work(&p_slot->work); 750 + case STATIC_STATE: 751 + p_slot->state = POWERON_STATE; 752 + mutex_unlock(&p_slot->lock); 753 + retval = pciehp_enable_slot(p_slot); 754 + mutex_lock(&p_slot->lock); 755 + p_slot->state = STATIC_STATE; 756 + break; 757 + case POWERON_STATE: 758 + info("Slot %s is already in powering on state\n", 759 + p_slot->name); 760 + break; 761 + case BLINKINGOFF_STATE: 762 + case POWEROFF_STATE: 763 + info("Already enabled on slot %s\n", p_slot->name); 764 + break; 765 + default: 766 + err("Not a valid state on slot %s\n", p_slot->name); 767 + break; 768 + } 769 + mutex_unlock(&p_slot->lock); 770 + 771 + return retval; 772 + } 773 + 774 + int pciehp_sysfs_disable_slot(struct slot *p_slot) 775 + { 776 + int retval = -ENODEV; 777 + 778 + mutex_lock(&p_slot->lock); 779 + switch (p_slot->state) { 780 + case BLINKINGOFF_STATE: 781 + cancel_delayed_work(&p_slot->work); 782 + case STATIC_STATE: 783 + p_slot->state = POWEROFF_STATE; 784 + mutex_unlock(&p_slot->lock); 785 + retval = pciehp_disable_slot(p_slot); 786 + mutex_lock(&p_slot->lock); 787 + p_slot->state = STATIC_STATE; 788 + break; 789 + case POWEROFF_STATE: 790 + info("Slot %s is already in powering off state\n", 791 + p_slot->name); 792 + break; 793 + case BLINKINGON_STATE: 794 + case POWERON_STATE: 795 + info("Already disabled on slot %s\n", p_slot->name); 796 + break; 797 + default: 798 + err("Not a valid state on slot %s\n", p_slot->name); 799 + break; 800 + } 801 + mutex_unlock(&p_slot->lock); 802 + 803 + return retval; 804 + }
+23 -11
drivers/pci/hotplug/pciehp_hpc.c
··· 71 71 #define DBG_LEAVE_ROUTINE 72 72 #endif /* DEBUG */ 73 73 74 + static atomic_t pciehp_num_controllers = ATOMIC_INIT(0); 75 + 74 76 struct ctrl_reg { 75 77 u8 cap_id; 76 78 u8 nxt_ptr; ··· 221 219 #define EMI_STATE 0x0080 222 220 #define EMI_STATUS_BIT 7 223 221 224 - static spinlock_t hpc_event_lock; 225 - 226 222 DEFINE_DBG_BUFFER /* Debug string buffer for entire HPC defined here */ 227 - static int ctlr_seq_num = 0; /* Controller sequence # */ 228 223 229 224 static irqreturn_t pcie_isr(int irq, void *dev_id); 230 225 static void start_int_poll_timer(struct controller *ctrl, int sec); ··· 654 655 del_timer(&ctrl->poll_timer); 655 656 else 656 657 free_irq(ctrl->pci_dev->irq, ctrl); 658 + 659 + /* 660 + * If this is the last controller to be released, destroy the 661 + * pciehp work queue 662 + */ 663 + if (atomic_dec_and_test(&pciehp_num_controllers)) 664 + destroy_workqueue(pciehp_wq); 657 665 658 666 DBG_LEAVE_ROUTINE 659 667 } ··· 1158 1152 int pcie_init(struct controller * ctrl, struct pcie_device *dev) 1159 1153 { 1160 1154 int rc; 1161 - static int first = 1; 1162 1155 u16 temp_word; 1163 1156 u16 cap_reg; 1164 1157 u16 intr_enable = 0; ··· 1226 1221 dbg("%s: SLOTCTRL offset %x slot_ctrl %x\n", 1227 1222 __FUNCTION__, ctrl->cap_base + SLOTCTRL, slot_ctrl); 1228 1223 1229 - if (first) { 1230 - spin_lock_init(&hpc_event_lock); 1231 - first = 0; 1232 - } 1233 - 1234 1224 for ( rc = 0; rc < DEVICE_COUNT_RESOURCE; rc++) 1235 1225 if (pci_resource_len(pdev, rc) > 0) 1236 1226 dbg("pci resource[%d] start=0x%llx(len=0x%llx)\n", rc, ··· 1286 1286 rc = request_irq(ctrl->pci_dev->irq, pcie_isr, IRQF_SHARED, 1287 1287 MY_NAME, (void *)ctrl); 1288 1288 dbg("%s: request_irq %d for hpc%d (returns %d)\n", 1289 - __FUNCTION__, ctrl->pci_dev->irq, ctlr_seq_num, rc); 1289 + __FUNCTION__, ctrl->pci_dev->irq, 1290 + atomic_read(&pciehp_num_controllers), rc); 1290 1291 if (rc) { 1291 1292 err("Can't get irq %d for the hotplug controller\n", 1292 1293 ctrl->pci_dev->irq); ··· 1296 1295 } 1297 1296 dbg("pciehp ctrl b:d:f:irq=0x%x:%x:%x:%x\n", pdev->bus->number, 1298 1297 PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn), dev->irq); 1298 + 1299 + /* 1300 + * If this is the first controller to be initialized, 1301 + * initialize the pciehp work queue 1302 + */ 1303 + if (atomic_add_return(1, &pciehp_num_controllers) == 1) { 1304 + pciehp_wq = create_singlethread_workqueue("pciehpd"); 1305 + if (!pciehp_wq) { 1306 + rc = -ENOMEM; 1307 + goto abort_free_irq; 1308 + } 1309 + } 1299 1310 1300 1311 rc = pciehp_readw(ctrl, SLOTCTRL, &temp_word); 1301 1312 if (rc) { ··· 1362 1349 goto abort_disable_intr; 1363 1350 } 1364 1351 1365 - ctlr_seq_num++; 1366 1352 ctrl->hpc_ops = &pciehp_hpc_ops; 1367 1353 1368 1354 DBG_LEAVE_ROUTINE
+15 -12
drivers/pci/hotplug/rpadlpar_core.c
··· 98 98 return NULL; 99 99 } 100 100 101 - static struct slot *find_slot(struct device_node *dn) 101 + /** 102 + * find_php_slot - return hotplug slot structure for device node 103 + * 104 + * This routine will return the hotplug slot structure 105 + * for a given device node. Note that built-in PCI slots 106 + * may be dlpar-able, but not hot-pluggable, so this routine 107 + * will return NULL for built-in PCI slots. 108 + */ 109 + static struct slot *find_php_slot(struct device_node *dn) 102 110 { 103 111 struct list_head *tmp, *n; 104 112 struct slot *slot; ··· 232 224 if (!pcibios_find_pci_bus(dn)) 233 225 return -EINVAL; 234 226 235 - slot = find_slot(dn); 227 + /* If pci slot is hotplugable, use hotplug to remove it */ 228 + slot = find_php_slot(dn); 236 229 if (slot) { 237 - /* Remove hotplug slot */ 238 230 if (rpaphp_deregister_slot(slot)) { 239 231 printk(KERN_ERR 240 232 "%s: unable to remove hotplug slot %s\n", ··· 378 370 if (!bus) 379 371 return -EINVAL; 380 372 381 - slot = find_slot(dn); 373 + /* If pci slot is hotplugable, use hotplug to remove it */ 374 + slot = find_php_slot(dn); 382 375 if (slot) { 383 - /* Remove hotplug slot */ 384 376 if (rpaphp_deregister_slot(slot)) { 385 377 printk(KERN_ERR 386 378 "%s: unable to remove hotplug slot %s\n", 387 379 __FUNCTION__, drc_name); 388 380 return -EIO; 389 381 } 390 - } else { 391 - struct pci_dev *dev, *tmp; 392 - list_for_each_entry_safe(dev, tmp, &bus->devices, bus_list) { 393 - eeh_remove_bus_device(dev); 394 - pci_remove_bus_device(dev); 395 - } 396 - } 382 + } else 383 + pcibios_remove_pci_devices(bus); 397 384 398 385 if (unmap_bus_range(bus)) { 399 386 printk(KERN_ERR "%s: failed to unmap bus range\n",
+1 -7
drivers/pci/hotplug/rpaphp.h
··· 83 83 84 84 extern struct hotplug_slot_ops rpaphp_hotplug_slot_ops; 85 85 extern struct list_head rpaphp_slot_head; 86 - extern int num_slots; 87 86 88 87 /* function prototypes */ 89 88 90 89 /* rpaphp_pci.c */ 91 - extern int rpaphp_enable_pci_slot(struct slot *slot); 92 - extern int rpaphp_register_pci_slot(struct slot *slot); 93 - extern int rpaphp_get_pci_adapter_status(struct slot *slot, int is_init, u8 * value); 90 + extern int rpaphp_enable_slot(struct slot *slot); 94 91 extern int rpaphp_get_sensor_state(struct slot *slot, int *state); 95 92 96 93 /* rpaphp_core.c */ 97 94 extern int rpaphp_add_slot(struct device_node *dn); 98 - extern int rpaphp_remove_slot(struct slot *slot); 99 95 extern int rpaphp_get_drc_props(struct device_node *dn, int *drc_index, 100 96 char **drc_name, char **drc_type, int *drc_power_domain); 101 97 ··· 100 104 extern struct slot *alloc_slot_struct(struct device_node *dn, int drc_index, char *drc_name, int power_domain); 101 105 extern int rpaphp_register_slot(struct slot *slot); 102 106 extern int rpaphp_deregister_slot(struct slot *slot); 103 - extern int rpaphp_get_power_status(struct slot *slot, u8 * value); 104 - extern int rpaphp_set_attention_status(struct slot *slot, u8 status); 105 107 106 108 #endif /* _PPC64PHP_H */
+92 -110
drivers/pci/hotplug/rpaphp_core.c
··· 39 39 #include "rpaphp.h" 40 40 41 41 int debug; 42 - static struct semaphore rpaphp_sem; 43 42 LIST_HEAD(rpaphp_slot_head); 44 - int num_slots; 45 43 46 44 #define DRIVER_VERSION "0.1" 47 45 #define DRIVER_AUTHOR "Linda Xie <lxie@us.ibm.com>" ··· 53 55 54 56 module_param(debug, bool, 0644); 55 57 56 - static int rpaphp_get_attention_status(struct slot *slot) 57 - { 58 - return slot->hotplug_slot->info->attention_status; 59 - } 60 - 61 58 /** 62 59 * set_attention_status - set attention LED 63 60 * echo 0 > attention -- set LED OFF ··· 62 69 */ 63 70 static int set_attention_status(struct hotplug_slot *hotplug_slot, u8 value) 64 71 { 65 - int retval = 0; 72 + int rc; 66 73 struct slot *slot = (struct slot *)hotplug_slot->private; 67 74 68 - down(&rpaphp_sem); 69 75 switch (value) { 70 76 case 0: 71 - retval = rpaphp_set_attention_status(slot, LED_OFF); 72 - hotplug_slot->info->attention_status = 0; 73 - break; 74 77 case 1: 75 - default: 76 - retval = rpaphp_set_attention_status(slot, LED_ON); 77 - hotplug_slot->info->attention_status = 1; 78 - break; 79 78 case 2: 80 - retval = rpaphp_set_attention_status(slot, LED_ID); 81 - hotplug_slot->info->attention_status = 2; 79 + break; 80 + default: 81 + value = 1; 82 82 break; 83 83 } 84 - up(&rpaphp_sem); 85 - return retval; 84 + 85 + rc = rtas_set_indicator(DR_INDICATOR, slot->index, value); 86 + if (!rc) 87 + hotplug_slot->info->attention_status = value; 88 + 89 + return rc; 86 90 } 87 91 88 92 /** 89 93 * get_power_status - get power status of a slot 90 94 * @hotplug_slot: slot to get status 91 95 * @value: pointer to store status 92 - * 93 - * 94 96 */ 95 97 static int get_power_status(struct hotplug_slot *hotplug_slot, u8 * value) 96 98 { 97 - int retval; 99 + int retval, level; 98 100 struct slot *slot = (struct slot *)hotplug_slot->private; 99 101 100 - down(&rpaphp_sem); 101 - retval = rpaphp_get_power_status(slot, value); 102 - up(&rpaphp_sem); 102 + retval = rtas_get_power_level (slot->power_domain, &level); 103 + if (!retval) 104 + *value = level; 103 105 return retval; 104 106 } 105 107 106 108 /** 107 109 * get_attention_status - get attention LED status 108 - * 109 - * 110 110 */ 111 111 static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 * value) 112 112 { 113 - int retval = 0; 114 113 struct slot *slot = (struct slot *)hotplug_slot->private; 115 - 116 - down(&rpaphp_sem); 117 - *value = rpaphp_get_attention_status(slot); 118 - up(&rpaphp_sem); 119 - return retval; 114 + *value = slot->hotplug_slot->info->attention_status; 115 + return 0; 120 116 } 121 117 122 118 static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 * value) 123 119 { 124 120 struct slot *slot = (struct slot *)hotplug_slot->private; 125 - int retval = 0; 121 + int rc, state; 126 122 127 - down(&rpaphp_sem); 128 - retval = rpaphp_get_pci_adapter_status(slot, 0, value); 129 - up(&rpaphp_sem); 130 - return retval; 123 + rc = rpaphp_get_sensor_state(slot, &state); 124 + 125 + *value = NOT_VALID; 126 + if (rc) 127 + return rc; 128 + 129 + if (state == EMPTY) 130 + *value = EMPTY; 131 + else if (state == PRESENT) 132 + *value = slot->state; 133 + 134 + return 0; 131 135 } 132 136 133 137 static int get_max_bus_speed(struct hotplug_slot *hotplug_slot, enum pci_bus_speed *value) 134 138 { 135 139 struct slot *slot = (struct slot *)hotplug_slot->private; 136 140 137 - down(&rpaphp_sem); 138 141 switch (slot->type) { 139 142 case 1: 140 143 case 2: ··· 161 172 break; 162 173 163 174 } 164 - up(&rpaphp_sem); 165 175 return 0; 166 176 } 167 177 ··· 253 265 return 1; 254 266 } 255 267 268 + /** 269 + * is_php_dn() - return 1 if this is a hotpluggable pci slot, else 0 270 + * 271 + * This routine will return true only if the device node is 272 + * a hotpluggable slot. This routine will return false 273 + * for built-in pci slots (even when the built-in slots are 274 + * dlparable.) 275 + */ 256 276 static int is_php_dn(struct device_node *dn, const int **indexes, 257 277 const int **names, const int **types, const int **power_domains) 258 278 { ··· 268 272 int rc; 269 273 270 274 rc = get_children_props(dn, indexes, names, &drc_types, power_domains); 271 - if (rc >= 0) { 272 - if (is_php_type((char *) &drc_types[1])) { 273 - *types = drc_types; 274 - return 1; 275 - } 276 - } 275 + if (rc < 0) 276 + return 0; 277 277 278 - return 0; 278 + if (!is_php_type((char *) &drc_types[1])) 279 + return 0; 280 + 281 + *types = drc_types; 282 + return 1; 279 283 } 280 284 281 285 /** 282 - * rpaphp_add_slot -- add hotplug or dlpar slot 286 + * rpaphp_add_slot -- declare a hotplug slot to the hotplug subsystem. 287 + * @dn device node of slot 283 288 * 284 - * rpaphp not only registers PCI hotplug slots(HOTPLUG), 285 - * but also logical DR slots(EMBEDDED). 286 - * HOTPLUG slot: An adapter can be physically added/removed. 287 - * EMBEDDED slot: An adapter can be logically removed/added 288 - * from/to a partition with the slot. 289 + * This subroutine will register a hotplugable slot with the 290 + * PCI hotplug infrastructure. This routine is typicaly called 291 + * during boot time, if the hotplug slots are present at boot time, 292 + * or is called later, by the dlpar add code, if the slot is 293 + * being dynamically added during runtime. 294 + * 295 + * If the device node points at an embedded (built-in) slot, this 296 + * routine will just return without doing anything, since embedded 297 + * slots cannot be hotplugged. 298 + * 299 + * To remove a slot, it suffices to call rpaphp_deregister_slot() 289 300 */ 290 301 int rpaphp_add_slot(struct device_node *dn) 291 302 { ··· 302 299 const int *indexes, *names, *types, *power_domains; 303 300 char *name, *type; 304 301 302 + if (!dn->name || strcmp(dn->name, "pci")) 303 + return 0; 304 + 305 + /* If this is not a hotplug slot, return without doing anything. */ 306 + if (!is_php_dn(dn, &indexes, &names, &types, &power_domains)) 307 + return 0; 308 + 305 309 dbg("Entry %s: dn->full_name=%s\n", __FUNCTION__, dn->full_name); 306 310 307 311 /* register PCI devices */ 308 - if (dn->name != 0 && strcmp(dn->name, "pci") == 0) { 309 - if (!is_php_dn(dn, &indexes, &names, &types, &power_domains)) 310 - goto exit; 312 + name = (char *) &names[1]; 313 + type = (char *) &types[1]; 314 + for (i = 0; i < indexes[0]; i++) { 311 315 312 - name = (char *) &names[1]; 313 - type = (char *) &types[1]; 314 - for (i = 0; i < indexes[0]; i++, 315 - name += (strlen(name) + 1), type += (strlen(type) + 1)) { 316 + slot = alloc_slot_struct(dn, indexes[i + 1], name, power_domains[i + 1]); 317 + if (!slot) 318 + return -ENOMEM; 316 319 317 - if (!(slot = alloc_slot_struct(dn, indexes[i + 1], name, 318 - power_domains[i + 1]))) { 319 - retval = -ENOMEM; 320 - goto exit; 321 - } 322 - slot->type = simple_strtoul(type, NULL, 10); 320 + slot->type = simple_strtoul(type, NULL, 10); 323 321 324 - dbg("Found drc-index:0x%x drc-name:%s drc-type:%s\n", 325 - indexes[i + 1], name, type); 322 + dbg("Found drc-index:0x%x drc-name:%s drc-type:%s\n", 323 + indexes[i + 1], name, type); 326 324 327 - retval = rpaphp_register_pci_slot(slot); 328 - } 325 + retval = rpaphp_enable_slot(slot); 326 + if (!retval) 327 + retval = rpaphp_register_slot(slot); 328 + 329 + if (retval) 330 + dealloc_slot_struct(slot); 331 + 332 + name += strlen(name) + 1; 333 + type += strlen(type) + 1; 329 334 } 330 - exit: 331 - dbg("%s - Exit: num_slots=%d rc[%d]\n", 332 - __FUNCTION__, num_slots, retval); 335 + dbg("%s - Exit: rc[%d]\n", __FUNCTION__, retval); 336 + 337 + /* XXX FIXME: reports a failure only if last entry in loop failed */ 333 338 return retval; 334 339 } 335 340 ··· 365 354 struct device_node *dn = NULL; 366 355 367 356 info(DRIVER_DESC " version: " DRIVER_VERSION "\n"); 368 - init_MUTEX(&rpaphp_sem); 369 357 370 358 while ((dn = of_find_node_by_name(dn, "pci"))) 371 359 rpaphp_add_slot(dn); ··· 377 367 cleanup_slots(); 378 368 } 379 369 380 - static int __enable_slot(struct slot *slot) 370 + static int enable_slot(struct hotplug_slot *hotplug_slot) 381 371 { 372 + struct slot *slot = (struct slot *)hotplug_slot->private; 382 373 int state; 383 374 int retval; 384 375 ··· 403 392 return 0; 404 393 } 405 394 406 - static int enable_slot(struct hotplug_slot *hotplug_slot) 407 - { 408 - int retval; 409 - struct slot *slot = (struct slot *)hotplug_slot->private; 410 - 411 - down(&rpaphp_sem); 412 - retval = __enable_slot(slot); 413 - up(&rpaphp_sem); 414 - 415 - return retval; 416 - } 417 - 418 - static int __disable_slot(struct slot *slot) 419 - { 420 - struct pci_dev *dev, *tmp; 421 - 422 - if (slot->state == NOT_CONFIGURED) 423 - return -EINVAL; 424 - 425 - list_for_each_entry_safe(dev, tmp, &slot->bus->devices, bus_list) { 426 - eeh_remove_bus_device(dev); 427 - pci_remove_bus_device(dev); 428 - } 429 - 430 - slot->state = NOT_CONFIGURED; 431 - return 0; 432 - } 433 - 434 395 static int disable_slot(struct hotplug_slot *hotplug_slot) 435 396 { 436 397 struct slot *slot = (struct slot *)hotplug_slot->private; 437 - int retval; 398 + if (slot->state == NOT_CONFIGURED) 399 + return -EINVAL; 438 400 439 - down(&rpaphp_sem); 440 - retval = __disable_slot (slot); 441 - up(&rpaphp_sem); 442 - 443 - return retval; 401 + pcibios_remove_pci_devices(slot->bus); 402 + slot->state = NOT_CONFIGURED; 403 + return 0; 444 404 } 445 405 446 406 struct hotplug_slot_ops rpaphp_hotplug_slot_ops = {
+51 -116
drivers/pci/hotplug/rpaphp_pci.c
··· 64 64 return rc; 65 65 } 66 66 67 - /** 68 - * get_pci_adapter_status - get the status of a slot 69 - * 70 - * 0-- slot is empty 71 - * 1-- adapter is configured 72 - * 2-- adapter is not configured 73 - * 3-- not valid 74 - */ 75 - int rpaphp_get_pci_adapter_status(struct slot *slot, int is_init, u8 * value) 76 - { 77 - struct pci_bus *bus; 78 - int state, rc; 79 - 80 - *value = NOT_VALID; 81 - rc = rpaphp_get_sensor_state(slot, &state); 82 - if (rc) 83 - goto exit; 84 - 85 - if (state == EMPTY) 86 - *value = EMPTY; 87 - else if (state == PRESENT) { 88 - if (!is_init) { 89 - /* at run-time slot->state can be changed by */ 90 - /* config/unconfig adapter */ 91 - *value = slot->state; 92 - } else { 93 - bus = pcibios_find_pci_bus(slot->dn); 94 - if (bus && !list_empty(&bus->devices)) 95 - *value = CONFIGURED; 96 - else 97 - *value = NOT_CONFIGURED; 98 - } 99 - } 100 - exit: 101 - return rc; 102 - } 103 - 104 - static void print_slot_pci_funcs(struct pci_bus *bus) 105 - { 106 - struct device_node *dn; 107 - struct pci_dev *dev; 108 - 109 - dn = pci_bus_to_OF_node(bus); 110 - if (!dn) 111 - return; 112 - 113 - dbg("%s: pci_devs of slot[%s]\n", __FUNCTION__, dn->full_name); 114 - list_for_each_entry (dev, &bus->devices, bus_list) 115 - dbg("\t%s\n", pci_name(dev)); 116 - return; 117 - } 118 - 119 - static int setup_pci_hotplug_slot_info(struct slot *slot) 120 - { 121 - struct hotplug_slot_info *hotplug_slot_info = slot->hotplug_slot->info; 122 - 123 - dbg("%s Initilize the PCI slot's hotplug->info structure ...\n", 124 - __FUNCTION__); 125 - rpaphp_get_power_status(slot, &hotplug_slot_info->power_status); 126 - rpaphp_get_pci_adapter_status(slot, 1, 127 - &hotplug_slot_info->adapter_status); 128 - if (hotplug_slot_info->adapter_status == NOT_VALID) { 129 - err("%s: NOT_VALID: skip dn->full_name=%s\n", 130 - __FUNCTION__, slot->dn->full_name); 131 - return -EINVAL; 132 - } 133 - return 0; 134 - } 135 - 136 67 static void set_slot_name(struct slot *slot) 137 68 { 138 69 struct pci_bus *bus = slot->bus; ··· 77 146 bus->number); 78 147 } 79 148 80 - static int setup_pci_slot(struct slot *slot) 149 + /** 150 + * rpaphp_enable_slot - record slot state, config pci device 151 + * 152 + * Initialize values in the slot, and the hotplug_slot info 153 + * structures to indicate if there is a pci card plugged into 154 + * the slot. If the slot is not empty, run the pcibios routine 155 + * to get pcibios stuff correctly set up. 156 + */ 157 + int rpaphp_enable_slot(struct slot *slot) 81 158 { 82 - struct device_node *dn = slot->dn; 159 + int rc, level, state; 83 160 struct pci_bus *bus; 161 + struct hotplug_slot_info *info = slot->hotplug_slot->info; 84 162 85 - BUG_ON(!dn); 86 - bus = pcibios_find_pci_bus(dn); 163 + info->adapter_status = NOT_VALID; 164 + slot->state = EMPTY; 165 + 166 + /* Find out if the power is turned on for the slot */ 167 + rc = rtas_get_power_level(slot->power_domain, &level); 168 + if (rc) 169 + return rc; 170 + info->power_status = level; 171 + 172 + /* Figure out if there is an adapter in the slot */ 173 + rc = rpaphp_get_sensor_state(slot, &state); 174 + if (rc) 175 + return rc; 176 + 177 + bus = pcibios_find_pci_bus(slot->dn); 87 178 if (!bus) { 88 - err("%s: no pci_bus for dn %s\n", __FUNCTION__, dn->full_name); 89 - goto exit_rc; 179 + err("%s: no pci_bus for dn %s\n", __FUNCTION__, slot->dn->full_name); 180 + return -EINVAL; 90 181 } 91 182 183 + info->adapter_status = EMPTY; 92 184 slot->bus = bus; 93 185 slot->pci_devs = &bus->devices; 94 186 set_slot_name(slot); 95 187 96 - /* find slot's pci_dev if it's not empty */ 97 - if (slot->hotplug_slot->info->adapter_status == EMPTY) { 98 - slot->state = EMPTY; /* slot is empty */ 99 - } else { 100 - /* slot is occupied */ 101 - if (!dn->child) { 102 - /* non-empty slot has to have child */ 103 - err("%s: slot[%s]'s device_node doesn't have child for adapter\n", 104 - __FUNCTION__, slot->name); 105 - goto exit_rc; 188 + /* if there's an adapter in the slot, go add the pci devices */ 189 + if (state == PRESENT) { 190 + info->adapter_status = NOT_CONFIGURED; 191 + slot->state = NOT_CONFIGURED; 192 + 193 + /* non-empty slot has to have child */ 194 + if (!slot->dn->child) { 195 + err("%s: slot[%s]'s device_node doesn't have child for adapter\n", 196 + __FUNCTION__, slot->name); 197 + return -EINVAL; 106 198 } 107 199 108 - if (slot->hotplug_slot->info->adapter_status == NOT_CONFIGURED) { 109 - dbg("%s CONFIGURING pci adapter in slot[%s]\n", 110 - __FUNCTION__, slot->name); 111 - pcibios_add_pci_devices(slot->bus); 200 + if (list_empty(&bus->devices)) 201 + pcibios_add_pci_devices(bus); 112 202 113 - } else if (slot->hotplug_slot->info->adapter_status != CONFIGURED) { 114 - err("%s: slot[%s]'s adapter_status is NOT_VALID.\n", 115 - __FUNCTION__, slot->name); 116 - goto exit_rc; 117 - } 118 - print_slot_pci_funcs(slot->bus); 119 - if (!list_empty(slot->pci_devs)) { 203 + if (!list_empty(&bus->devices)) { 204 + info->adapter_status = CONFIGURED; 120 205 slot->state = CONFIGURED; 121 - } else { 122 - /* DLPAR add as opposed to 123 - * boot time */ 124 - slot->state = NOT_CONFIGURED; 206 + } 207 + 208 + if (debug) { 209 + struct pci_dev *dev; 210 + dbg("%s: pci_devs of slot[%s]\n", __FUNCTION__, slot->dn->full_name); 211 + list_for_each_entry (dev, &bus->devices, bus_list) 212 + dbg("\t%s\n", pci_name(dev)); 125 213 } 126 214 } 215 + 127 216 return 0; 128 - exit_rc: 129 - dealloc_slot_struct(slot); 130 - return -EINVAL; 131 - } 132 - 133 - int rpaphp_register_pci_slot(struct slot *slot) 134 - { 135 - int rc = -EINVAL; 136 - 137 - if (setup_pci_hotplug_slot_info(slot)) 138 - goto exit_rc; 139 - if (setup_pci_slot(slot)) 140 - goto exit_rc; 141 - rc = rpaphp_register_slot(slot); 142 - exit_rc: 143 - return rc; 144 217 } 145 218
+6 -43
drivers/pci/hotplug/rpaphp_slot.c
··· 56 56 static void rpaphp_release_slot(struct hotplug_slot *hotplug_slot) 57 57 { 58 58 struct slot *slot = (struct slot *) hotplug_slot->private; 59 - 60 59 dealloc_slot_struct(slot); 61 60 } 62 61 ··· 64 65 kfree(slot->hotplug_slot->info); 65 66 kfree(slot->hotplug_slot->name); 66 67 kfree(slot->hotplug_slot); 68 + kfree(slot->location); 67 69 kfree(slot); 68 - return; 69 70 } 70 71 71 - struct slot *alloc_slot_struct(struct device_node *dn, int drc_index, char *drc_name, 72 - int power_domain) 72 + struct slot *alloc_slot_struct(struct device_node *dn, 73 + int drc_index, char *drc_name, int power_domain) 73 74 { 74 75 struct slot *slot; 75 76 ··· 114 115 115 116 static int is_registered(struct slot *slot) 116 117 { 117 - struct slot *tmp_slot; 118 + struct slot *tmp_slot; 118 119 119 120 list_for_each_entry(tmp_slot, &rpaphp_slot_head, rpaphp_slot_list) { 120 121 if (!strcmp(tmp_slot->name, slot->name)) ··· 139 140 retval = pci_hp_deregister(php_slot); 140 141 if (retval) 141 142 err("Problem unregistering a slot %s\n", slot->name); 142 - else 143 - num_slots--; 144 143 145 144 dbg("%s - Exit: rc[%d]\n", __FUNCTION__, retval); 146 145 return retval; ··· 157 160 /* should not try to register the same slot twice */ 158 161 if (is_registered(slot)) { 159 162 err("rpaphp_register_slot: slot[%s] is already registered\n", slot->name); 160 - retval = -EAGAIN; 161 - goto register_fail; 163 + return -EAGAIN; 162 164 } 163 165 164 166 retval = pci_hp_register(php_slot); 165 167 if (retval) { 166 168 err("pci_hp_register failed with error %d\n", retval); 167 - goto register_fail; 169 + return retval; 168 170 } 169 171 170 172 /* create "phy_location" file */ ··· 177 181 list_add(&slot->rpaphp_slot_list, &rpaphp_slot_head); 178 182 info("Slot [%s](PCI location=%s) registered\n", slot->name, 179 183 slot->location); 180 - num_slots++; 181 184 return 0; 182 185 183 186 sysfs_fail: 184 187 pci_hp_deregister(php_slot); 185 - register_fail: 186 - rpaphp_release_slot(php_slot); 187 188 return retval; 188 189 } 189 190 190 - int rpaphp_get_power_status(struct slot *slot, u8 * value) 191 - { 192 - int rc = 0, level; 193 - 194 - rc = rtas_get_power_level(slot->power_domain, &level); 195 - if (rc < 0) { 196 - err("failed to get power-level for slot(%s), rc=0x%x\n", 197 - slot->location, rc); 198 - return rc; 199 - } 200 - 201 - dbg("%s the power level of slot %s(pwd-domain:0x%x) is %d\n", 202 - __FUNCTION__, slot->name, slot->power_domain, level); 203 - *value = level; 204 - 205 - return rc; 206 - } 207 - 208 - int rpaphp_set_attention_status(struct slot *slot, u8 status) 209 - { 210 - int rc; 211 - 212 - /* status: LED_OFF or LED_ON */ 213 - rc = rtas_set_indicator(DR_INDICATOR, slot->index, status); 214 - if (rc < 0) 215 - err("slot(name=%s location=%s index=0x%x) set attention-status(%d) failed! rc=0x%x\n", 216 - slot->name, slot->location, slot->index, status, rc); 217 - 218 - return rc; 219 - }
+1 -1
drivers/pci/hotplug/shpchp.h
··· 166 166 extern int shpchp_configure_device(struct slot *p_slot); 167 167 extern int shpchp_unconfigure_device(struct slot *p_slot); 168 168 extern void cleanup_slots(struct controller *ctrl); 169 - extern void queue_pushbutton_work(struct work_struct *work); 169 + extern void shpchp_queue_pushbutton_work(struct work_struct *work); 170 170 extern int shpc_init( struct controller *ctrl, struct pci_dev *pdev); 171 171 172 172 #ifdef CONFIG_ACPI
+1 -1
drivers/pci/hotplug/shpchp_core.c
··· 136 136 slot->hpc_ops = ctrl->hpc_ops; 137 137 slot->number = ctrl->first_slot + (ctrl->slot_num_inc * i); 138 138 mutex_init(&slot->lock); 139 - INIT_DELAYED_WORK(&slot->work, queue_pushbutton_work); 139 + INIT_DELAYED_WORK(&slot->work, shpchp_queue_pushbutton_work); 140 140 141 141 /* register this slot with the hotplug pci core */ 142 142 hotplug_slot->private = slot;
+1 -1
drivers/pci/hotplug/shpchp_ctrl.c
··· 433 433 kfree(info); 434 434 } 435 435 436 - void queue_pushbutton_work(struct work_struct *work) 436 + void shpchp_queue_pushbutton_work(struct work_struct *work) 437 437 { 438 438 struct slot *p_slot = container_of(work, struct slot, work.work); 439 439 struct pushbutton_work_info *info;
+183 -205
drivers/pci/msi.c
··· 24 24 #include "pci.h" 25 25 #include "msi.h" 26 26 27 - static struct kmem_cache* msi_cachep; 28 - 29 27 static int pci_msi_enable = 1; 30 - 31 - static int msi_cache_init(void) 32 - { 33 - msi_cachep = kmem_cache_create("msi_cache", sizeof(struct msi_desc), 34 - 0, SLAB_HWCACHE_ALIGN, NULL, NULL); 35 - if (!msi_cachep) 36 - return -ENOMEM; 37 - 38 - return 0; 39 - } 40 28 41 29 static void msi_set_enable(struct pci_dev *dev, int enable) 42 30 { ··· 53 65 if (enable) 54 66 control |= PCI_MSIX_FLAGS_ENABLE; 55 67 pci_write_config_word(dev, pos + PCI_MSIX_FLAGS, control); 68 + } 69 + } 70 + 71 + static void msix_flush_writes(unsigned int irq) 72 + { 73 + struct msi_desc *entry; 74 + 75 + entry = get_irq_msi(irq); 76 + BUG_ON(!entry || !entry->dev); 77 + switch (entry->msi_attrib.type) { 78 + case PCI_CAP_ID_MSI: 79 + /* nothing to do */ 80 + break; 81 + case PCI_CAP_ID_MSIX: 82 + { 83 + int offset = entry->msi_attrib.entry_nr * PCI_MSIX_ENTRY_SIZE + 84 + PCI_MSIX_ENTRY_VECTOR_CTRL_OFFSET; 85 + readl(entry->mask_base + offset); 86 + break; 87 + } 88 + default: 89 + BUG(); 90 + break; 56 91 } 57 92 } 58 93 ··· 198 187 void mask_msi_irq(unsigned int irq) 199 188 { 200 189 msi_set_mask_bit(irq, 1); 190 + msix_flush_writes(irq); 201 191 } 202 192 203 193 void unmask_msi_irq(unsigned int irq) 204 194 { 205 195 msi_set_mask_bit(irq, 0); 196 + msix_flush_writes(irq); 206 197 } 207 198 208 - static int msi_free_irq(struct pci_dev* dev, int irq); 199 + static int msi_free_irqs(struct pci_dev* dev); 209 200 210 - static int msi_init(void) 211 - { 212 - static int status = -ENOMEM; 213 - 214 - if (!status) 215 - return status; 216 - 217 - status = msi_cache_init(); 218 - if (status < 0) { 219 - pci_msi_enable = 0; 220 - printk(KERN_WARNING "PCI: MSI cache init failed\n"); 221 - return status; 222 - } 223 - 224 - return status; 225 - } 226 201 227 202 static struct msi_desc* alloc_msi_entry(void) 228 203 { 229 204 struct msi_desc *entry; 230 205 231 - entry = kmem_cache_zalloc(msi_cachep, GFP_KERNEL); 206 + entry = kzalloc(sizeof(struct msi_desc), GFP_KERNEL); 232 207 if (!entry) 233 208 return NULL; 234 209 235 - entry->link.tail = entry->link.head = 0; /* single message */ 210 + INIT_LIST_HEAD(&entry->list); 211 + entry->irq = 0; 236 212 entry->dev = NULL; 237 213 238 214 return entry; ··· 254 256 static void __pci_restore_msix_state(struct pci_dev *dev) 255 257 { 256 258 int pos; 257 - int irq, head, tail = 0; 258 259 struct msi_desc *entry; 259 260 u16 control; 260 261 ··· 263 266 /* route the table */ 264 267 pci_intx(dev, 0); /* disable intx */ 265 268 msix_set_enable(dev, 0); 266 - irq = head = dev->first_msi_irq; 267 - entry = get_irq_msi(irq); 268 - pos = entry->msi_attrib.pos; 269 - while (head != tail) { 270 - entry = get_irq_msi(irq); 271 - write_msi_msg(irq, &entry->msg); 272 - msi_set_mask_bit(irq, entry->msi_attrib.masked); 273 269 274 - tail = entry->link.tail; 275 - irq = tail; 270 + list_for_each_entry(entry, &dev->msi_list, list) { 271 + write_msi_msg(entry->irq, &entry->msg); 272 + msi_set_mask_bit(entry->irq, entry->msi_attrib.masked); 276 273 } 277 274 275 + BUG_ON(list_empty(&dev->msi_list)); 276 + entry = list_entry(dev->msi_list.next, struct msi_desc, list); 277 + pos = entry->msi_attrib.pos; 278 278 pci_read_config_word(dev, pos + PCI_MSIX_FLAGS, &control); 279 279 control &= ~PCI_MSIX_FLAGS_MASKALL; 280 280 control |= PCI_MSIX_FLAGS_ENABLE; ··· 297 303 static int msi_capability_init(struct pci_dev *dev) 298 304 { 299 305 struct msi_desc *entry; 300 - int pos, irq; 306 + int pos, ret; 301 307 u16 control; 302 308 303 309 msi_set_enable(dev, 0); /* Ensure msi is disabled as I set it up */ ··· 334 340 msi_mask_bits_reg(pos, is_64bit_address(control)), 335 341 maskbits); 336 342 } 343 + list_add(&entry->list, &dev->msi_list); 344 + 337 345 /* Configure MSI capability structure */ 338 - irq = arch_setup_msi_irq(dev, entry); 339 - if (irq < 0) { 340 - kmem_cache_free(msi_cachep, entry); 341 - return irq; 346 + ret = arch_setup_msi_irqs(dev, 1, PCI_CAP_ID_MSI); 347 + if (ret) { 348 + msi_free_irqs(dev); 349 + return ret; 342 350 } 343 - entry->link.head = irq; 344 - entry->link.tail = irq; 345 - dev->first_msi_irq = irq; 346 - set_irq_msi(irq, entry); 347 351 348 352 /* Set MSI enabled bits */ 349 353 pci_intx(dev, 0); /* disable intx */ 350 354 msi_set_enable(dev, 1); 351 355 dev->msi_enabled = 1; 352 356 353 - dev->irq = irq; 357 + dev->irq = entry->irq; 354 358 return 0; 355 359 } 356 360 ··· 365 373 static int msix_capability_init(struct pci_dev *dev, 366 374 struct msix_entry *entries, int nvec) 367 375 { 368 - struct msi_desc *head = NULL, *tail = NULL, *entry = NULL; 369 - int irq, pos, i, j, nr_entries, temp = 0; 376 + struct msi_desc *entry; 377 + int pos, i, j, nr_entries, ret; 370 378 unsigned long phys_addr; 371 379 u32 table_offset; 372 380 u16 control; ··· 405 413 entry->dev = dev; 406 414 entry->mask_base = base; 407 415 408 - /* Configure MSI-X capability structure */ 409 - irq = arch_setup_msi_irq(dev, entry); 410 - if (irq < 0) { 411 - kmem_cache_free(msi_cachep, entry); 412 - break; 413 - } 414 - entries[i].vector = irq; 415 - if (!head) { 416 - entry->link.head = irq; 417 - entry->link.tail = irq; 418 - head = entry; 419 - } else { 420 - entry->link.head = temp; 421 - entry->link.tail = tail->link.tail; 422 - tail->link.tail = irq; 423 - head->link.head = irq; 424 - } 425 - temp = irq; 426 - tail = entry; 427 - 428 - set_irq_msi(irq, entry); 416 + list_add(&entry->list, &dev->msi_list); 429 417 } 430 - if (i != nvec) { 431 - int avail = i - 1; 432 - i--; 433 - for (; i >= 0; i--) { 434 - irq = (entries + i)->vector; 435 - msi_free_irq(dev, irq); 436 - (entries + i)->vector = 0; 418 + 419 + ret = arch_setup_msi_irqs(dev, nvec, PCI_CAP_ID_MSIX); 420 + if (ret) { 421 + int avail = 0; 422 + list_for_each_entry(entry, &dev->msi_list, list) { 423 + if (entry->irq != 0) { 424 + avail++; 425 + } 437 426 } 427 + 428 + msi_free_irqs(dev); 429 + 438 430 /* If we had some success report the number of irqs 439 431 * we succeeded in setting up. 440 432 */ 441 - if (avail <= 0) 442 - avail = -EBUSY; 433 + if (avail == 0) 434 + avail = ret; 443 435 return avail; 444 436 } 445 - dev->first_msi_irq = entries[0].vector; 437 + 438 + i = 0; 439 + list_for_each_entry(entry, &dev->msi_list, list) { 440 + entries[i].vector = entry->irq; 441 + set_irq_msi(entry->irq, entry); 442 + i++; 443 + } 446 444 /* Set MSI-X enabled bits */ 447 445 pci_intx(dev, 0); /* disable intx */ 448 446 msix_set_enable(dev, 1); ··· 442 460 } 443 461 444 462 /** 445 - * pci_msi_supported - check whether MSI may be enabled on device 463 + * pci_msi_check_device - check whether MSI may be enabled on a device 446 464 * @dev: pointer to the pci_dev data structure of MSI device function 465 + * @nvec: how many MSIs have been requested ? 466 + * @type: are we checking for MSI or MSI-X ? 447 467 * 448 468 * Look at global flags, the device itself, and its parent busses 449 - * to return 0 if MSI are supported for the device. 469 + * to determine if MSI/-X are supported for the device. If MSI/-X is 470 + * supported return 0, else return an error code. 450 471 **/ 451 - static 452 - int pci_msi_supported(struct pci_dev * dev) 472 + static int pci_msi_check_device(struct pci_dev* dev, int nvec, int type) 453 473 { 454 474 struct pci_bus *bus; 475 + int ret; 455 476 456 477 /* MSI must be globally enabled and supported by the device */ 457 478 if (!pci_msi_enable || !dev || dev->no_msi) 458 479 return -EINVAL; 480 + 481 + /* 482 + * You can't ask to have 0 or less MSIs configured. 483 + * a) it's stupid .. 484 + * b) the list manipulation code assumes nvec >= 1. 485 + */ 486 + if (nvec < 1) 487 + return -ERANGE; 459 488 460 489 /* Any bridge which does NOT route MSI transactions from it's 461 490 * secondary bus to it's primary bus must set NO_MSI flag on ··· 477 484 for (bus = dev->bus; bus; bus = bus->parent) 478 485 if (bus->bus_flags & PCI_BUS_FLAGS_NO_MSI) 479 486 return -EINVAL; 487 + 488 + ret = arch_msi_check_device(dev, nvec, type); 489 + if (ret) 490 + return ret; 491 + 492 + if (!pci_find_capability(dev, type)) 493 + return -EINVAL; 480 494 481 495 return 0; 482 496 } ··· 500 500 **/ 501 501 int pci_enable_msi(struct pci_dev* dev) 502 502 { 503 - int pos, status; 503 + int status; 504 504 505 - if (pci_msi_supported(dev) < 0) 506 - return -EINVAL; 507 - 508 - status = msi_init(); 509 - if (status < 0) 505 + status = pci_msi_check_device(dev, 1, PCI_CAP_ID_MSI); 506 + if (status) 510 507 return status; 511 - 512 - pos = pci_find_capability(dev, PCI_CAP_ID_MSI); 513 - if (!pos) 514 - return -EINVAL; 515 508 516 509 WARN_ON(!!dev->msi_enabled); 517 510 ··· 518 525 status = msi_capability_init(dev); 519 526 return status; 520 527 } 528 + EXPORT_SYMBOL(pci_enable_msi); 521 529 522 530 void pci_disable_msi(struct pci_dev* dev) 523 531 { 524 532 struct msi_desc *entry; 525 533 int default_irq; 526 534 527 - if (!pci_msi_enable) 528 - return; 529 - if (!dev) 530 - return; 531 - 532 - if (!dev->msi_enabled) 535 + if (!pci_msi_enable || !dev || !dev->msi_enabled) 533 536 return; 534 537 535 538 msi_set_enable(dev, 0); 536 539 pci_intx(dev, 1); /* enable intx */ 537 540 dev->msi_enabled = 0; 538 541 539 - entry = get_irq_msi(dev->first_msi_irq); 540 - if (!entry || !entry->dev || entry->msi_attrib.type != PCI_CAP_ID_MSI) { 542 + BUG_ON(list_empty(&dev->msi_list)); 543 + entry = list_entry(dev->msi_list.next, struct msi_desc, list); 544 + if (!entry->dev || entry->msi_attrib.type != PCI_CAP_ID_MSI) { 541 545 return; 542 546 } 543 - if (irq_has_action(dev->first_msi_irq)) { 544 - printk(KERN_WARNING "PCI: %s: pci_disable_msi() called without " 545 - "free_irq() on MSI irq %d\n", 546 - pci_name(dev), dev->first_msi_irq); 547 - BUG_ON(irq_has_action(dev->first_msi_irq)); 548 - } else { 549 - default_irq = entry->msi_attrib.default_irq; 550 - msi_free_irq(dev, dev->first_msi_irq); 551 547 552 - /* Restore dev->irq to its default pin-assertion irq */ 553 - dev->irq = default_irq; 554 - } 555 - dev->first_msi_irq = 0; 548 + default_irq = entry->msi_attrib.default_irq; 549 + msi_free_irqs(dev); 550 + 551 + /* Restore dev->irq to its default pin-assertion irq */ 552 + dev->irq = default_irq; 556 553 } 554 + EXPORT_SYMBOL(pci_disable_msi); 557 555 558 - static int msi_free_irq(struct pci_dev* dev, int irq) 556 + static int msi_free_irqs(struct pci_dev* dev) 559 557 { 560 - struct msi_desc *entry; 561 - int head, entry_nr, type; 562 - void __iomem *base; 558 + struct msi_desc *entry, *tmp; 563 559 564 - entry = get_irq_msi(irq); 565 - if (!entry || entry->dev != dev) { 566 - return -EINVAL; 567 - } 568 - type = entry->msi_attrib.type; 569 - entry_nr = entry->msi_attrib.entry_nr; 570 - head = entry->link.head; 571 - base = entry->mask_base; 572 - get_irq_msi(entry->link.head)->link.tail = entry->link.tail; 573 - get_irq_msi(entry->link.tail)->link.head = entry->link.head; 560 + list_for_each_entry(entry, &dev->msi_list, list) 561 + BUG_ON(irq_has_action(entry->irq)); 574 562 575 - arch_teardown_msi_irq(irq); 576 - kmem_cache_free(msi_cachep, entry); 563 + arch_teardown_msi_irqs(dev); 577 564 578 - if (type == PCI_CAP_ID_MSIX) { 579 - writel(1, base + entry_nr * PCI_MSIX_ENTRY_SIZE + 580 - PCI_MSIX_ENTRY_VECTOR_CTRL_OFFSET); 565 + list_for_each_entry_safe(entry, tmp, &dev->msi_list, list) { 566 + if (entry->msi_attrib.type == PCI_CAP_ID_MSIX) { 567 + if (list_is_last(&entry->list, &dev->msi_list)) 568 + iounmap(entry->mask_base); 581 569 582 - if (head == irq) 583 - iounmap(base); 570 + writel(1, entry->mask_base + entry->msi_attrib.entry_nr 571 + * PCI_MSIX_ENTRY_SIZE 572 + + PCI_MSIX_ENTRY_VECTOR_CTRL_OFFSET); 573 + } 574 + list_del(&entry->list); 575 + kfree(entry); 584 576 } 585 577 586 578 return 0; ··· 592 614 int i, j; 593 615 u16 control; 594 616 595 - if (!entries || pci_msi_supported(dev) < 0) 617 + if (!entries) 596 618 return -EINVAL; 597 619 598 - status = msi_init(); 599 - if (status < 0) 620 + status = pci_msi_check_device(dev, nvec, PCI_CAP_ID_MSIX); 621 + if (status) 600 622 return status; 601 623 602 624 pos = pci_find_capability(dev, PCI_CAP_ID_MSIX); 603 - if (!pos) 604 - return -EINVAL; 605 - 606 625 pci_read_config_word(dev, msi_control_reg(pos), &control); 607 626 nr_entries = multi_msix_capable(control); 608 627 if (nvec > nr_entries) ··· 626 651 status = msix_capability_init(dev, entries, nvec); 627 652 return status; 628 653 } 654 + EXPORT_SYMBOL(pci_enable_msix); 655 + 656 + static void msix_free_all_irqs(struct pci_dev *dev) 657 + { 658 + msi_free_irqs(dev); 659 + } 629 660 630 661 void pci_disable_msix(struct pci_dev* dev) 631 662 { 632 - int irq, head, tail = 0, warning = 0; 633 - 634 - if (!pci_msi_enable) 635 - return; 636 - if (!dev) 637 - return; 638 - 639 - if (!dev->msix_enabled) 663 + if (!pci_msi_enable || !dev || !dev->msix_enabled) 640 664 return; 641 665 642 666 msix_set_enable(dev, 0); 643 667 pci_intx(dev, 1); /* enable intx */ 644 668 dev->msix_enabled = 0; 645 669 646 - irq = head = dev->first_msi_irq; 647 - while (head != tail) { 648 - tail = get_irq_msi(irq)->link.tail; 649 - if (irq_has_action(irq)) 650 - warning = 1; 651 - else if (irq != head) /* Release MSI-X irq */ 652 - msi_free_irq(dev, irq); 653 - irq = tail; 654 - } 655 - msi_free_irq(dev, irq); 656 - if (warning) { 657 - printk(KERN_WARNING "PCI: %s: pci_disable_msix() called without " 658 - "free_irq() on all MSI-X irqs\n", 659 - pci_name(dev)); 660 - BUG_ON(warning > 0); 661 - } 662 - dev->first_msi_irq = 0; 670 + msix_free_all_irqs(dev); 663 671 } 672 + EXPORT_SYMBOL(pci_disable_msix); 664 673 665 674 /** 666 675 * msi_remove_pci_irq_vectors - reclaim MSI(X) irqs to unused state ··· 660 701 if (!pci_msi_enable || !dev) 661 702 return; 662 703 663 - if (dev->msi_enabled) { 664 - if (irq_has_action(dev->first_msi_irq)) { 665 - printk(KERN_WARNING "PCI: %s: msi_remove_pci_irq_vectors() " 666 - "called without free_irq() on MSI irq %d\n", 667 - pci_name(dev), dev->first_msi_irq); 668 - BUG_ON(irq_has_action(dev->first_msi_irq)); 669 - } else /* Release MSI irq assigned to this device */ 670 - msi_free_irq(dev, dev->first_msi_irq); 671 - } 672 - if (dev->msix_enabled) { 673 - int irq, head, tail = 0, warning = 0; 674 - void __iomem *base = NULL; 704 + if (dev->msi_enabled) 705 + msi_free_irqs(dev); 675 706 676 - irq = head = dev->first_msi_irq; 677 - while (head != tail) { 678 - tail = get_irq_msi(irq)->link.tail; 679 - base = get_irq_msi(irq)->mask_base; 680 - if (irq_has_action(irq)) 681 - warning = 1; 682 - else if (irq != head) /* Release MSI-X irq */ 683 - msi_free_irq(dev, irq); 684 - irq = tail; 685 - } 686 - msi_free_irq(dev, irq); 687 - if (warning) { 688 - iounmap(base); 689 - printk(KERN_WARNING "PCI: %s: msi_remove_pci_irq_vectors() " 690 - "called without free_irq() on all MSI-X irqs\n", 691 - pci_name(dev)); 692 - BUG_ON(warning > 0); 693 - } 694 - } 707 + if (dev->msix_enabled) 708 + msix_free_all_irqs(dev); 695 709 } 696 710 697 711 void pci_no_msi(void) ··· 672 740 pci_msi_enable = 0; 673 741 } 674 742 675 - EXPORT_SYMBOL(pci_enable_msi); 676 - EXPORT_SYMBOL(pci_disable_msi); 677 - EXPORT_SYMBOL(pci_enable_msix); 678 - EXPORT_SYMBOL(pci_disable_msix); 743 + void pci_msi_init_pci_dev(struct pci_dev *dev) 744 + { 745 + INIT_LIST_HEAD(&dev->msi_list); 746 + } 747 + 748 + 749 + /* Arch hooks */ 750 + 751 + int __attribute__ ((weak)) 752 + arch_msi_check_device(struct pci_dev* dev, int nvec, int type) 753 + { 754 + return 0; 755 + } 756 + 757 + int __attribute__ ((weak)) 758 + arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *entry) 759 + { 760 + return 0; 761 + } 762 + 763 + int __attribute__ ((weak)) 764 + arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type) 765 + { 766 + struct msi_desc *entry; 767 + int ret; 768 + 769 + list_for_each_entry(entry, &dev->msi_list, list) { 770 + ret = arch_setup_msi_irq(dev, entry); 771 + if (ret) 772 + return ret; 773 + } 774 + 775 + return 0; 776 + } 777 + 778 + void __attribute__ ((weak)) arch_teardown_msi_irq(unsigned int irq) 779 + { 780 + return; 781 + } 782 + 783 + void __attribute__ ((weak)) 784 + arch_teardown_msi_irqs(struct pci_dev *dev) 785 + { 786 + struct msi_desc *entry; 787 + 788 + list_for_each_entry(entry, &dev->msi_list, list) { 789 + if (entry->irq != 0) 790 + arch_teardown_msi_irq(entry->irq); 791 + } 792 + }
+2 -17
drivers/pci/pci-driver.c
··· 14 14 #include "pci.h" 15 15 16 16 /* 17 - * Registration of PCI drivers and handling of hot-pluggable devices. 18 - */ 19 - 20 - /* multithreaded probe logic */ 21 - static int pci_multithread_probe = 22 - #ifdef CONFIG_PCI_MULTITHREAD_PROBE 23 - 1; 24 - #else 25 - 0; 26 - #endif 27 - __module_param_call("", pci_multithread_probe, param_set_bool, param_get_bool, &pci_multithread_probe, 0644); 28 - 29 - 30 - /* 31 17 * Dynamic device IDs are disabled for !CONFIG_HOTPLUG 32 18 */ 33 19 ··· 38 52 { 39 53 struct pci_dynid *dynid; 40 54 struct pci_driver *pdrv = to_pci_driver(driver); 41 - __u32 vendor=PCI_ANY_ID, device=PCI_ANY_ID, subvendor=PCI_ANY_ID, 55 + __u32 vendor, device, subvendor=PCI_ANY_ID, 42 56 subdevice=PCI_ANY_ID, class=0, class_mask=0; 43 57 unsigned long driver_data=0; 44 58 int fields=0; ··· 47 61 fields = sscanf(buf, "%x %x %x %x %x %x %lux", 48 62 &vendor, &device, &subvendor, &subdevice, 49 63 &class, &class_mask, &driver_data); 50 - if (fields < 0) 64 + if (fields < 2) 51 65 return -EINVAL; 52 66 53 67 dynid = kzalloc(sizeof(*dynid), GFP_KERNEL); ··· 555 569 556 570 static int __init pci_driver_init(void) 557 571 { 558 - pci_bus_type.multithread_probe = pci_multithread_probe; 559 572 return bus_register(&pci_bus_type); 560 573 } 561 574
+6 -3
drivers/pci/pci-sysfs.c
··· 620 620 goto err_bin_file; 621 621 622 622 /* If the device has a ROM, try to expose it in sysfs. */ 623 - if (pci_resource_len(pdev, PCI_ROM_RESOURCE)) { 623 + if (pci_resource_len(pdev, PCI_ROM_RESOURCE) || 624 + (pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW)) { 624 625 rom_attr = kzalloc(sizeof(*rom_attr), GFP_ATOMIC); 625 626 if (rom_attr) { 626 627 pdev->rom_attr = rom_attr; ··· 636 635 goto err_rom; 637 636 } else { 638 637 retval = -ENOMEM; 639 - goto err_bin_file; 638 + goto err_resource_files; 640 639 } 641 640 } 642 641 /* add platform-specific attributes */ ··· 646 645 647 646 err_rom: 648 647 kfree(rom_attr); 648 + err_resource_files: 649 + pci_remove_resource_files(pdev); 649 650 err_bin_file: 650 651 if (pdev->cfg_size < 4096) 651 652 sysfs_remove_bin_file(&pdev->dev.kobj, &pci_config_attr); ··· 698 695 return 0; 699 696 } 700 697 701 - __initcall(pci_sysfs_init); 698 + late_initcall(pci_sysfs_init);
+31 -3
drivers/pci/pci.c
··· 35 35 * Given a PCI bus, returns the highest PCI bus number present in the set 36 36 * including the given PCI bus and its list of child PCI buses. 37 37 */ 38 - unsigned char __devinit 39 - pci_bus_max_busnr(struct pci_bus* bus) 38 + unsigned char pci_bus_max_busnr(struct pci_bus* bus) 40 39 { 41 40 struct list_head *tmp; 42 41 unsigned char max, n; ··· 891 892 } 892 893 893 894 /** 895 + * pcibios_set_pcie_reset_state - set reset state for device dev 896 + * @dev: the PCI-E device reset 897 + * @state: Reset state to enter into 898 + * 899 + * 900 + * Sets the PCI-E reset state for the device. This is the default 901 + * implementation. Architecture implementations can override this. 902 + */ 903 + int __attribute__ ((weak)) pcibios_set_pcie_reset_state(struct pci_dev *dev, 904 + enum pcie_reset_state state) 905 + { 906 + return -EINVAL; 907 + } 908 + 909 + /** 910 + * pci_set_pcie_reset_state - set reset state for device dev 911 + * @dev: the PCI-E device reset 912 + * @state: Reset state to enter into 913 + * 914 + * 915 + * Sets the PCI reset state for the device. 916 + */ 917 + int pci_set_pcie_reset_state(struct pci_dev *dev, enum pcie_reset_state state) 918 + { 919 + return pcibios_set_pcie_reset_state(dev, state); 920 + } 921 + 922 + /** 894 923 * pci_enable_wake - enable PCI device as wakeup event source 895 924 * @dev: PCI device affected 896 925 * @state: PCI state from which device will issue wakeup events ··· 1322 1295 1323 1296 /** 1324 1297 * pci_msi_off - disables any msi or msix capabilities 1325 - * @pdev: the PCI device to operate on 1298 + * @dev: the PCI device to operate on 1326 1299 * 1327 1300 * If you want to use msi see pci_enable_msi and friends. 1328 1301 * This is a lower level primitive that allows us to disable ··· 1454 1427 EXPORT_SYMBOL(pci_save_state); 1455 1428 EXPORT_SYMBOL(pci_restore_state); 1456 1429 EXPORT_SYMBOL(pci_enable_wake); 1430 + EXPORT_SYMBOL_GPL(pci_set_pcie_reset_state); 1457 1431
+2
drivers/pci/pci.h
··· 47 47 48 48 #ifdef CONFIG_PCI_MSI 49 49 void pci_no_msi(void); 50 + extern void pci_msi_init_pci_dev(struct pci_dev *dev); 50 51 #else 51 52 static inline void pci_no_msi(void) { } 53 + static inline void pci_msi_init_pci_dev(struct pci_dev *dev) { } 52 54 #endif 53 55 54 56 #if defined(CONFIG_PCI_MSI) && defined(CONFIG_PM)
+29 -13
drivers/pci/probe.c
··· 364 364 } 365 365 } 366 366 367 - static struct pci_bus * __devinit pci_alloc_bus(void) 367 + static struct pci_bus * pci_alloc_bus(void) 368 368 { 369 369 struct pci_bus *b; 370 370 ··· 432 432 return NULL; 433 433 } 434 434 435 - struct pci_bus * __devinit pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, int busnr) 435 + struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, int busnr) 436 436 { 437 437 struct pci_bus *child; 438 438 ··· 461 461 pci_write_config_word(dev, rpcap + PCI_EXP_RTCTL, rpctl); 462 462 } 463 463 464 - static void __devinit pci_fixup_parent_subordinate_busnr(struct pci_bus *child, int max) 464 + static void pci_fixup_parent_subordinate_busnr(struct pci_bus *child, int max) 465 465 { 466 466 struct pci_bus *parent = child->parent; 467 467 ··· 477 477 } 478 478 } 479 479 480 - unsigned int __devinit pci_scan_child_bus(struct pci_bus *bus); 480 + unsigned int pci_scan_child_bus(struct pci_bus *bus); 481 481 482 482 /* 483 483 * If it's a bridge, configure it and scan the bus behind it. ··· 489 489 * them, we proceed to assigning numbers to the remaining buses in 490 490 * order to avoid overlaps between old and new bus numbers. 491 491 */ 492 - int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max, int pass) 492 + int pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max, int pass) 493 493 { 494 494 struct pci_bus *child; 495 495 int is_cardbus = (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS); ··· 846 846 kfree(dev); 847 847 } 848 848 849 + struct pci_dev *alloc_pci_dev(void) 850 + { 851 + struct pci_dev *dev; 852 + 853 + dev = kzalloc(sizeof(struct pci_dev), GFP_KERNEL); 854 + if (!dev) 855 + return NULL; 856 + 857 + INIT_LIST_HEAD(&dev->global_list); 858 + INIT_LIST_HEAD(&dev->bus_list); 859 + 860 + pci_msi_init_pci_dev(dev); 861 + 862 + return dev; 863 + } 864 + EXPORT_SYMBOL(alloc_pci_dev); 865 + 849 866 /* 850 867 * Read the config data for a PCI device, sanity-check it 851 868 * and fill in the dev structure... ··· 902 885 if (pci_bus_read_config_byte(bus, devfn, PCI_HEADER_TYPE, &hdr_type)) 903 886 return NULL; 904 887 905 - dev = kzalloc(sizeof(struct pci_dev), GFP_KERNEL); 888 + dev = alloc_pci_dev(); 906 889 if (!dev) 907 890 return NULL; 908 891 ··· 929 912 return dev; 930 913 } 931 914 932 - void __devinit pci_device_add(struct pci_dev *dev, struct pci_bus *bus) 915 + void pci_device_add(struct pci_dev *dev, struct pci_bus *bus) 933 916 { 934 917 device_initialize(&dev->dev); 935 918 dev->dev.release = pci_release_dev; ··· 952 935 up_write(&pci_bus_sem); 953 936 } 954 937 955 - struct pci_dev * __devinit 956 - pci_scan_single_device(struct pci_bus *bus, int devfn) 938 + struct pci_dev *pci_scan_single_device(struct pci_bus *bus, int devfn) 957 939 { 958 940 struct pci_dev *dev; 959 941 ··· 974 958 * discovered devices to the @bus->devices list. New devices 975 959 * will have an empty dev->global_list head. 976 960 */ 977 - int __devinit pci_scan_slot(struct pci_bus *bus, int devfn) 961 + int pci_scan_slot(struct pci_bus *bus, int devfn) 978 962 { 979 963 int func, nr = 0; 980 964 int scan_all_fns; ··· 1007 991 return nr; 1008 992 } 1009 993 1010 - unsigned int __devinit pci_scan_child_bus(struct pci_bus *bus) 994 + unsigned int pci_scan_child_bus(struct pci_bus *bus) 1011 995 { 1012 996 unsigned int devfn, pass, max = bus->secondary; 1013 997 struct pci_dev *dev; ··· 1057 1041 return max; 1058 1042 } 1059 1043 1060 - struct pci_bus * __devinit pci_create_bus(struct device *parent, 1044 + struct pci_bus * pci_create_bus(struct device *parent, 1061 1045 int bus, struct pci_ops *ops, void *sysdata) 1062 1046 { 1063 1047 int error; ··· 1135 1119 } 1136 1120 EXPORT_SYMBOL_GPL(pci_create_bus); 1137 1121 1138 - struct pci_bus * __devinit pci_scan_bus_parented(struct device *parent, 1122 + struct pci_bus *pci_scan_bus_parented(struct device *parent, 1139 1123 int bus, struct pci_ops *ops, void *sysdata) 1140 1124 { 1141 1125 struct pci_bus *b;
+2
drivers/pci/quirks.c
··· 1648 1648 } 1649 1649 } 1650 1650 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8131_BRIDGE, quirk_disable_msi); 1651 + DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS400_200, quirk_disable_msi); 1652 + DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS480, quirk_disable_msi); 1651 1653 1652 1654 /* Go through the list of Hypertransport capabilities and 1653 1655 * return 1 if a HT MSI capability is found and enabled */
+1 -2
drivers/pci/search.c
··· 15 15 16 16 DECLARE_RWSEM(pci_bus_sem); 17 17 18 - static struct pci_bus * 19 - pci_do_find_bus(struct pci_bus* bus, unsigned char busnr) 18 + static struct pci_bus *pci_do_find_bus(struct pci_bus *bus, unsigned char busnr) 20 19 { 21 20 struct pci_bus* child; 22 21 struct list_head *tmp;
+7 -14
drivers/pci/setup-bus.c
··· 36 36 37 37 #define ROUND_UP(x, a) (((x) + (a) - 1) & ~((a) - 1)) 38 38 39 - static void __devinit 40 - pbus_assign_resources_sorted(struct pci_bus *bus) 39 + static void pbus_assign_resources_sorted(struct pci_bus *bus) 41 40 { 42 41 struct pci_dev *dev; 43 42 struct resource *res; ··· 219 220 /* Check whether the bridge supports optional I/O and 220 221 prefetchable memory ranges. If not, the respective 221 222 base/limit registers must be read-only and read as 0. */ 222 - static void __devinit 223 - pci_bridge_check_ranges(struct pci_bus *bus) 223 + static void pci_bridge_check_ranges(struct pci_bus *bus) 224 224 { 225 225 u16 io; 226 226 u32 pmem; ··· 257 259 bus resource of a given type. Note: we intentionally skip 258 260 the bus resources which have already been assigned (that is, 259 261 have non-NULL parent resource). */ 260 - static struct resource * __devinit 261 - find_free_bus_resource(struct pci_bus *bus, unsigned long type) 262 + static struct resource *find_free_bus_resource(struct pci_bus *bus, unsigned long type) 262 263 { 263 264 int i; 264 265 struct resource *r; ··· 278 281 since these windows have 4K granularity and the IO ranges 279 282 of non-bridge PCI devices are limited to 256 bytes. 280 283 We must be careful with the ISA aliasing though. */ 281 - static void __devinit 282 - pbus_size_io(struct pci_bus *bus) 284 + static void pbus_size_io(struct pci_bus *bus) 283 285 { 284 286 struct pci_dev *dev; 285 287 struct resource *b_res = find_free_bus_resource(bus, IORESOURCE_IO); ··· 322 326 323 327 /* Calculate the size of the bus and minimal alignment which 324 328 guarantees that all child resources fit in this size. */ 325 - static int __devinit 326 - pbus_size_mem(struct pci_bus *bus, unsigned long mask, unsigned long type) 329 + static int pbus_size_mem(struct pci_bus *bus, unsigned long mask, unsigned long type) 327 330 { 328 331 struct pci_dev *dev; 329 332 unsigned long min_align, align, size; ··· 442 447 } 443 448 } 444 449 445 - void __devinit 446 - pci_bus_size_bridges(struct pci_bus *bus) 450 + void pci_bus_size_bridges(struct pci_bus *bus) 447 451 { 448 452 struct pci_dev *dev; 449 453 unsigned long mask, prefmask; ··· 492 498 } 493 499 EXPORT_SYMBOL(pci_bus_size_bridges); 494 500 495 - void __devinit 496 - pci_bus_assign_resources(struct pci_bus *bus) 501 + void pci_bus_assign_resources(struct pci_bus *bus) 497 502 { 498 503 struct pci_bus *b; 499 504 struct pci_dev *dev;
+2 -4
drivers/pci/setup-res.c
··· 101 101 new & ~PCI_REGION_FLAG_MASK); 102 102 } 103 103 104 - int __devinit 105 - pci_claim_resource(struct pci_dev *dev, int resource) 104 + int pci_claim_resource(struct pci_dev *dev, int resource) 106 105 { 107 106 struct resource *res = &dev->resource[resource]; 108 107 struct resource *root = NULL; ··· 211 212 #endif 212 213 213 214 /* Sort resources by alignment */ 214 - void __devinit 215 - pdev_sort_resources(struct pci_dev *dev, struct resource_list *head) 215 + void pdev_sort_resources(struct pci_dev *dev, struct resource_list *head) 216 216 { 217 217 int i; 218 218
-1
drivers/pcmcia/cs.c
··· 26 26 #include <linux/ioport.h> 27 27 #include <linux/delay.h> 28 28 #include <linux/pm.h> 29 - #include <linux/pci.h> 30 29 #include <linux/device.h> 31 30 #include <linux/kthread.h> 32 31 #include <linux/freezer.h>
-1
drivers/pcmcia/socket_sysfs.c
··· 22 22 #include <linux/ioport.h> 23 23 #include <linux/delay.h> 24 24 #include <linux/pm.h> 25 - #include <linux/pci.h> 26 25 #include <linux/device.h> 27 26 #include <linux/mutex.h> 28 27 #include <asm/system.h>
-1
drivers/sbus/sbus.c
··· 6 6 #include <linux/kernel.h> 7 7 #include <linux/slab.h> 8 8 #include <linux/init.h> 9 - #include <linux/pci.h> 10 9 #include <linux/device.h> 11 10 12 11 #include <asm/system.h>
-1
drivers/scsi/aacraid/dpcsup.c
··· 32 32 #include <linux/kernel.h> 33 33 #include <linux/init.h> 34 34 #include <linux/types.h> 35 - #include <linux/pci.h> 36 35 #include <linux/spinlock.h> 37 36 #include <linux/slab.h> 38 37 #include <linux/completion.h>
-1
drivers/scsi/aacraid/sa.c
··· 31 31 #include <linux/kernel.h> 32 32 #include <linux/init.h> 33 33 #include <linux/types.h> 34 - #include <linux/pci.h> 35 34 #include <linux/spinlock.h> 36 35 #include <linux/slab.h> 37 36 #include <linux/blkdev.h>
-1
drivers/scsi/aha1542.c
··· 35 35 #include <linux/proc_fs.h> 36 36 #include <linux/init.h> 37 37 #include <linux/spinlock.h> 38 - #include <linux/pci.h> 39 38 #include <linux/isapnp.h> 40 39 #include <linux/blkdev.h> 41 40 #include <linux/mca.h>
-1
drivers/scsi/aic94xx/aic94xx_scb.c
··· 24 24 * 25 25 */ 26 26 27 - #include <linux/pci.h> 28 27 #include <scsi/scsi_host.h> 29 28 30 29 #include "aic94xx.h"
-1
drivers/scsi/arcmsr/arcmsr_attr.c
··· 49 49 #include <linux/init.h> 50 50 #include <linux/errno.h> 51 51 #include <linux/delay.h> 52 - #include <linux/pci.h> 53 52 54 53 #include <scsi/scsi_cmnd.h> 55 54 #include <scsi/scsi_device.h>
-1
drivers/scsi/libsas/sas_expander.c
··· 22 22 * 23 23 */ 24 24 25 - #include <linux/pci.h> 26 25 #include <linux/scatterlist.h> 27 26 28 27 #include "sas_internal.h"
-1
drivers/scsi/libsrp.c
··· 22 22 #include <linux/kfifo.h> 23 23 #include <linux/scatterlist.h> 24 24 #include <linux/dma-mapping.h> 25 - #include <linux/pci.h> 26 25 #include <scsi/scsi.h> 27 26 #include <scsi/scsi_cmnd.h> 28 27 #include <scsi/scsi_tcq.h>
+1 -1
drivers/scsi/megaraid.c
··· 2088 2088 static inline int 2089 2089 make_local_pdev(adapter_t *adapter, struct pci_dev **pdev) 2090 2090 { 2091 - *pdev = kmalloc(sizeof(struct pci_dev), GFP_KERNEL); 2091 + *pdev = alloc_pci_dev(); 2092 2092 2093 2093 if( *pdev == NULL ) return -1; 2094 2094
-1
drivers/usb/net/kaweth.c
··· 55 55 #include <linux/usb.h> 56 56 #include <linux/types.h> 57 57 #include <linux/ethtool.h> 58 - #include <linux/pci.h> 59 58 #include <linux/dma-mapping.h> 60 59 #include <linux/wait.h> 61 60 #include <asm/uaccess.h>
-1
drivers/video/aty/radeon_i2c.c
··· 1 1 #include <linux/module.h> 2 2 #include <linux/kernel.h> 3 3 #include <linux/delay.h> 4 - #include <linux/pci.h> 5 4 #include <linux/fb.h> 6 5 7 6
-1
drivers/video/g364fb.c
··· 26 26 #include <linux/interrupt.h> 27 27 #include <linux/fb.h> 28 28 #include <linux/init.h> 29 - #include <linux/pci.h> 30 29 #include <asm/io.h> 31 30 #include <asm/jazz.h> 32 31
-1
drivers/video/platinumfb.c
··· 28 28 #include <linux/interrupt.h> 29 29 #include <linux/fb.h> 30 30 #include <linux/init.h> 31 - #include <linux/pci.h> 32 31 #include <linux/nvram.h> 33 32 #include <asm/io.h> 34 33 #include <asm/prom.h>
-1
drivers/video/stifb.c
··· 64 64 #include <linux/fb.h> 65 65 #include <linux/init.h> 66 66 #include <linux/ioport.h> 67 - #include <linux/pci.h> 68 67 69 68 #include <asm/grfioctl.h> /* for HP-UX compatibility */ 70 69 #include <asm/uaccess.h>
-1
drivers/video/valkyriefb.c
··· 51 51 #include <linux/fb.h> 52 52 #include <linux/selection.h> 53 53 #include <linux/init.h> 54 - #include <linux/pci.h> 55 54 #include <linux/nvram.h> 56 55 #include <linux/adb.h> 57 56 #include <linux/cuda.h>
+1
include/asm-alpha/scatterlist.h
··· 2 2 #define _ALPHA_SCATTERLIST_H 3 3 4 4 #include <asm/page.h> 5 + #include <asm/types.h> 5 6 6 7 struct scatterlist { 7 8 struct page *page;
-1
include/asm-arm/arch-ixp4xx/dma.h
··· 12 12 #define __ASM_ARCH_DMA_H 13 13 14 14 #include <linux/device.h> 15 - #include <linux/pci.h> 16 15 #include <asm/page.h> 17 16 #include <asm/sizes.h> 18 17 #include <asm/hardware.h>
+2
include/asm-avr32/scatterlist.h
··· 1 1 #ifndef __ASM_AVR32_SCATTERLIST_H 2 2 #define __ASM_AVR32_SCATTERLIST_H 3 3 4 + #include <asm/types.h> 5 + 4 6 struct scatterlist { 5 7 struct page *page; 6 8 unsigned int offset;
+2
include/asm-frv/scatterlist.h
··· 1 1 #ifndef _ASM_SCATTERLIST_H 2 2 #define _ASM_SCATTERLIST_H 3 3 4 + #include <asm/types.h> 5 + 4 6 /* 5 7 * Drivers must set either ->address or (preferred) ->page and ->offset 6 8 * to indicate where data must be transferred to/from.
+2
include/asm-h8300/scatterlist.h
··· 1 1 #ifndef _H8300_SCATTERLIST_H 2 2 #define _H8300_SCATTERLIST_H 3 3 4 + #include <asm/types.h> 5 + 4 6 struct scatterlist { 5 7 struct page *page; 6 8 unsigned int offset;
+2
include/asm-i386/scatterlist.h
··· 1 1 #ifndef _I386_SCATTERLIST_H 2 2 #define _I386_SCATTERLIST_H 3 3 4 + #include <asm/types.h> 5 + 4 6 struct scatterlist { 5 7 struct page *page; 6 8 unsigned int offset;
+2
include/asm-ia64/scatterlist.h
··· 6 6 * David Mosberger-Tang <davidm@hpl.hp.com>, Hewlett-Packard Co 7 7 */ 8 8 9 + #include <asm/types.h> 10 + 9 11 struct scatterlist { 10 12 struct page *page; 11 13 unsigned int offset;
+2
include/asm-m32r/scatterlist.h
··· 1 1 #ifndef _ASM_M32R_SCATTERLIST_H 2 2 #define _ASM_M32R_SCATTERLIST_H 3 3 4 + #include <asm/types.h> 5 + 4 6 struct scatterlist { 5 7 char * address; /* Location data is to be transferred to, NULL for 6 8 * highmem page */
+1
include/asm-m68knommu/scatterlist.h
··· 2 2 #define _M68KNOMMU_SCATTERLIST_H 3 3 4 4 #include <linux/mm.h> 5 + #include <asm/types.h> 5 6 6 7 struct scatterlist { 7 8 struct page *page;
+2
include/asm-mips/scatterlist.h
··· 1 1 #ifndef __ASM_SCATTERLIST_H 2 2 #define __ASM_SCATTERLIST_H 3 3 4 + #include <asm/types.h> 5 + 4 6 struct scatterlist { 5 7 struct page * page; 6 8 unsigned int offset;
+1
include/asm-parisc/scatterlist.h
··· 2 2 #define _ASM_PARISC_SCATTERLIST_H 3 3 4 4 #include <asm/page.h> 5 + #include <asm/types.h> 5 6 6 7 struct scatterlist { 7 8 struct page *page;
+2
include/asm-sh/scatterlist.h
··· 1 1 #ifndef __ASM_SH_SCATTERLIST_H 2 2 #define __ASM_SH_SCATTERLIST_H 3 3 4 + #include <asm/types.h> 5 + 4 6 struct scatterlist { 5 7 struct page * page; /* Location for highmem page, if any */ 6 8 unsigned int offset;/* for highmem, page offset */
+2
include/asm-sh64/scatterlist.h
··· 11 11 #ifndef __ASM_SH64_SCATTERLIST_H 12 12 #define __ASM_SH64_SCATTERLIST_H 13 13 14 + #include <asm/types.h> 15 + 14 16 struct scatterlist { 15 17 struct page * page; /* Location for highmem page, if any */ 16 18 unsigned int offset;/* for highmem, page offset */
+1
include/asm-sparc64/scatterlist.h
··· 3 3 #define _SPARC64_SCATTERLIST_H 4 4 5 5 #include <asm/page.h> 6 + #include <asm/types.h> 6 7 7 8 struct scatterlist { 8 9 struct page *page;
+2
include/asm-v850/scatterlist.h
··· 14 14 #ifndef __V850_SCATTERLIST_H__ 15 15 #define __V850_SCATTERLIST_H__ 16 16 17 + #include <asm/types.h> 18 + 17 19 struct scatterlist { 18 20 struct page *page; 19 21 unsigned offset;
+2
include/asm-x86_64/scatterlist.h
··· 1 1 #ifndef _X8664_SCATTERLIST_H 2 2 #define _X8664_SCATTERLIST_H 3 3 4 + #include <asm/types.h> 5 + 4 6 struct scatterlist { 5 7 struct page *page; 6 8 unsigned int offset;
+2
include/asm-xtensa/scatterlist.h
··· 11 11 #ifndef _XTENSA_SCATTERLIST_H 12 12 #define _XTENSA_SCATTERLIST_H 13 13 14 + #include <asm/types.h> 15 + 14 16 struct scatterlist { 15 17 struct page *page; 16 18 unsigned int offset;
-1
include/linux/device.h
··· 80 80 int (*resume)(struct device * dev); 81 81 82 82 unsigned int drivers_autoprobe:1; 83 - unsigned int multithread_probe:1; 84 83 }; 85 84 86 85 extern int __must_check bus_register(struct bus_type * bus);
+7 -4
include/linux/msi.h
··· 1 1 #ifndef LINUX_MSI_H 2 2 #define LINUX_MSI_H 3 3 4 + #include <linux/list.h> 5 + 4 6 struct msi_msg { 5 7 u32 address_lo; /* low 32 bits of msi message address */ 6 8 u32 address_hi; /* high 32 bits of msi message address */ ··· 26 24 unsigned default_irq; /* default pre-assigned irq */ 27 25 }msi_attrib; 28 26 29 - struct { 30 - __u16 head; 31 - __u16 tail; 32 - }link; 27 + unsigned int irq; 28 + struct list_head list; 33 29 34 30 void __iomem *mask_base; 35 31 struct pci_dev *dev; ··· 41 41 */ 42 42 int arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc); 43 43 void arch_teardown_msi_irq(unsigned int irq); 44 + extern int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type); 45 + extern void arch_teardown_msi_irqs(struct pci_dev *dev); 46 + extern int arch_msi_check_device(struct pci_dev* dev, int nvec, int type); 44 47 45 48 46 49 #endif /* LINUX_MSI_H */
+20 -7
include/linux/pci.h
··· 96 96 pci_channel_io_perm_failure = (__force pci_channel_state_t) 3, 97 97 }; 98 98 99 + typedef unsigned int __bitwise pcie_reset_state_t; 100 + 101 + enum pcie_reset_state { 102 + /* Reset is NOT asserted (Use to deassert reset) */ 103 + pcie_deassert_reset = (__force pcie_reset_state_t) 1, 104 + 105 + /* Use #PERST to reset PCI-E device */ 106 + pcie_warm_reset = (__force pcie_reset_state_t) 2, 107 + 108 + /* Use PCI-E Hot Reset to reset device */ 109 + pcie_hot_reset = (__force pcie_reset_state_t) 3 110 + }; 111 + 99 112 typedef unsigned short __bitwise pci_bus_flags_t; 100 113 enum pci_bus_flags { 101 114 PCI_BUS_FLAGS_NO_MSI = (__force pci_bus_flags_t) 1, ··· 189 176 int rom_attr_enabled; /* has display of the rom attribute been enabled? */ 190 177 struct bin_attribute *res_attr[DEVICE_COUNT_RESOURCE]; /* sysfs file for resources */ 191 178 #ifdef CONFIG_PCI_MSI 192 - unsigned int first_msi_irq; 179 + struct list_head msi_list; 193 180 #endif 194 181 }; 182 + 183 + extern struct pci_dev *alloc_pci_dev(void); 195 184 196 185 #define pci_dev_g(n) list_entry(n, struct pci_dev, global_list) 197 186 #define pci_dev_b(n) list_entry(n, struct pci_dev, bus_list) ··· 407 392 .vendor = PCI_ANY_ID, .device = PCI_ANY_ID, \ 408 393 .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID 409 394 410 - /* 411 - * pci_module_init is obsolete, this stays here till we fix up all usages of it 412 - * in the tree. 413 - */ 414 - #define pci_module_init pci_register_driver 415 - 416 395 /** 417 396 * PCI_VDEVICE - macro used to describe a specific pci device in short form 418 397 * @vend: the vendor name ··· 541 532 542 533 void pci_disable_device(struct pci_dev *dev); 543 534 void pci_set_master(struct pci_dev *dev); 535 + int pci_set_pcie_reset_state(struct pci_dev *dev, enum pcie_reset_state state); 544 536 #define HAVE_PCI_SET_MWI 545 537 int __must_check pci_set_mwi(struct pci_dev *dev); 546 538 void pci_clear_mwi(struct pci_dev *dev); ··· 739 729 static inline int pci_set_power_state(struct pci_dev *dev, pci_power_t state) { return 0; } 740 730 static inline pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state) { return PCI_D0; } 741 731 static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable) { return 0; } 732 + 733 + static inline int pci_request_regions(struct pci_dev *dev, const char *res_name) { return -EIO; } 734 + static inline void pci_release_regions(struct pci_dev *dev) { } 742 735 743 736 #define pci_dma_burst_advice(pdev, strat, strategy_parameter) do { } while (0) 744 737
-2
include/rdma/ib_mad.h
··· 39 39 #if !defined( IB_MAD_H ) 40 40 #define IB_MAD_H 41 41 42 - #include <linux/pci.h> 43 - 44 42 #include <rdma/ib_verbs.h> 45 43 46 44 /* Management base version */
+3
kernel/irq/chip.c
··· 11 11 */ 12 12 13 13 #include <linux/irq.h> 14 + #include <linux/msi.h> 14 15 #include <linux/module.h> 15 16 #include <linux/interrupt.h> 16 17 #include <linux/kernel_stat.h> ··· 186 185 desc = irq_desc + irq; 187 186 spin_lock_irqsave(&desc->lock, flags); 188 187 desc->msi_desc = entry; 188 + if (entry) 189 + entry->irq = irq; 189 190 spin_unlock_irqrestore(&desc->lock, flags); 190 191 return 0; 191 192 }
-1
sound/core/init.c
··· 26 26 #include <linux/slab.h> 27 27 #include <linux/time.h> 28 28 #include <linux/ctype.h> 29 - #include <linux/pci.h> 30 29 #include <linux/pm.h> 31 30 32 31 #include <sound/core.h>
-1
sound/oss/au1550_ac97.c
··· 47 47 #include <linux/interrupt.h> 48 48 #include <linux/kernel.h> 49 49 #include <linux/poll.h> 50 - #include <linux/pci.h> 51 50 #include <linux/bitops.h> 52 51 #include <linux/spinlock.h> 53 52 #include <linux/smp_lock.h>
+1
sound/oss/soundcard.c
··· 44 44 #include <linux/smp_lock.h> 45 45 #include <linux/module.h> 46 46 #include <linux/mm.h> 47 + #include <linux/device.h> 47 48 48 49 /* 49 50 * This ought to be moved into include/asm/dma.h
+1 -1
sound/pci/ca0106/ca0106_mixer.c
··· 62 62 #include <linux/delay.h> 63 63 #include <linux/init.h> 64 64 #include <linux/interrupt.h> 65 - #include <linux/pci.h> 66 65 #include <linux/slab.h> 67 66 #include <linux/moduleparam.h> 68 67 #include <sound/core.h> ··· 70 71 #include <sound/ac97_codec.h> 71 72 #include <sound/info.h> 72 73 #include <sound/tlv.h> 74 + #include <asm/io.h> 73 75 74 76 #include "ca0106.h" 75 77
+1 -1
sound/pci/ca0106/ca0106_proc.c
··· 64 64 #include <linux/delay.h> 65 65 #include <linux/init.h> 66 66 #include <linux/interrupt.h> 67 - #include <linux/pci.h> 68 67 #include <linux/slab.h> 69 68 #include <linux/moduleparam.h> 70 69 #include <sound/core.h> ··· 72 73 #include <sound/ac97_codec.h> 73 74 #include <sound/info.h> 74 75 #include <sound/asoundef.h> 76 + #include <asm/io.h> 75 77 76 78 #include "ca0106.h" 77 79
-1
sound/pci/cs46xx/dsp_spos.c
··· 23 23 #include <sound/driver.h> 24 24 #include <asm/io.h> 25 25 #include <linux/delay.h> 26 - #include <linux/pci.h> 27 26 #include <linux/pm.h> 28 27 #include <linux/init.h> 29 28 #include <linux/slab.h>
-1
sound/pci/cs46xx/dsp_spos_scb_lib.c
··· 24 24 #include <sound/driver.h> 25 25 #include <asm/io.h> 26 26 #include <linux/delay.h> 27 - #include <linux/pci.h> 28 27 #include <linux/pm.h> 29 28 #include <linux/init.h> 30 29 #include <linux/slab.h>
-1
sound/pci/hda/hda_generic.c
··· 23 23 #include <sound/driver.h> 24 24 #include <linux/init.h> 25 25 #include <linux/slab.h> 26 - #include <linux/pci.h> 27 26 #include <sound/core.h> 28 27 #include "hda_codec.h" 29 28 #include "hda_local.h"
-1
sound/pci/hda/hda_proc.c
··· 23 23 24 24 #include <sound/driver.h> 25 25 #include <linux/init.h> 26 - #include <linux/pci.h> 27 26 #include <sound/core.h> 28 27 #include "hda_codec.h" 29 28 #include "hda_local.h"
-1
sound/pci/hda/patch_atihdmi.c
··· 25 25 #include <linux/init.h> 26 26 #include <linux/delay.h> 27 27 #include <linux/slab.h> 28 - #include <linux/pci.h> 29 28 #include <sound/core.h> 30 29 #include "hda_codec.h" 31 30 #include "hda_local.h"
-1
sound/pci/hda/patch_si3054.c
··· 26 26 #include <linux/init.h> 27 27 #include <linux/delay.h> 28 28 #include <linux/slab.h> 29 - #include <linux/pci.h> 30 29 #include <sound/core.h> 31 30 #include "hda_codec.h" 32 31 #include "hda_local.h"
-1
sound/pci/hda/patch_via.c
··· 35 35 #include <linux/init.h> 36 36 #include <linux/delay.h> 37 37 #include <linux/slab.h> 38 - #include <linux/pci.h> 39 38 #include <sound/core.h> 40 39 #include "hda_codec.h" 41 40 #include "hda_local.h"