aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
authorBrett M Russ <russb@emc.com>2005-08-15 15:23:41 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2005-09-08 18:07:08 -0400
commita04ce0ffcaf561994ecf382cd3caad75556dc499 (patch)
treee891a767810333fe2bf29ddb35f57b0a3ec6e18e /drivers/pci
parent3fe9d19f9e86a55679f5f2b38ec0a43a1a510cee (diff)
[PATCH] PCI/libata INTx cleanup
Simple cleanup to eliminate X copies of the pci_enable_intx() function in libata. Moved ahci.c's pci_intx() to pci.c and use it throughout libata and msi.c. Signed-off-by: Brett Russ <russb@emc.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/msi.c10
-rw-r--r--drivers/pci/pci.c26
2 files changed, 28 insertions, 8 deletions
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index 532f73bb2224..ee8677bda950 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -439,10 +439,7 @@ static void enable_msi_mode(struct pci_dev *dev, int pos, int type)
439 } 439 }
440 if (pci_find_capability(dev, PCI_CAP_ID_EXP)) { 440 if (pci_find_capability(dev, PCI_CAP_ID_EXP)) {
441 /* PCI Express Endpoint device detected */ 441 /* PCI Express Endpoint device detected */
442 u16 cmd; 442 pci_intx(dev, 0); /* disable intx */
443 pci_read_config_word(dev, PCI_COMMAND, &cmd);
444 cmd |= PCI_COMMAND_INTX_DISABLE;
445 pci_write_config_word(dev, PCI_COMMAND, cmd);
446 } 443 }
447} 444}
448 445
@@ -461,10 +458,7 @@ void disable_msi_mode(struct pci_dev *dev, int pos, int type)
461 } 458 }
462 if (pci_find_capability(dev, PCI_CAP_ID_EXP)) { 459 if (pci_find_capability(dev, PCI_CAP_ID_EXP)) {
463 /* PCI Express Endpoint device detected */ 460 /* PCI Express Endpoint device detected */
464 u16 cmd; 461 pci_intx(dev, 1); /* enable intx */
465 pci_read_config_word(dev, PCI_COMMAND, &cmd);
466 cmd &= ~PCI_COMMAND_INTX_DISABLE;
467 pci_write_config_word(dev, PCI_COMMAND, cmd);
468 } 462 }
469} 463}
470 464
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index e179af3186f5..ccff633a3948 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -798,6 +798,31 @@ pci_clear_mwi(struct pci_dev *dev)
798 } 798 }
799} 799}
800 800
801/**
802 * pci_intx - enables/disables PCI INTx for device dev
803 * @dev: the PCI device to operate on
804 * @enable: boolean
805 *
806 * Enables/disables PCI INTx for device dev
807 */
808void
809pci_intx(struct pci_dev *pdev, int enable)
810{
811 u16 pci_command, new;
812
813 pci_read_config_word(pdev, PCI_COMMAND, &pci_command);
814
815 if (enable) {
816 new = pci_command & ~PCI_COMMAND_INTX_DISABLE;
817 } else {
818 new = pci_command | PCI_COMMAND_INTX_DISABLE;
819 }
820
821 if (new != pci_command) {
822 pci_write_config_word(pdev, PCI_COMMAND, pci_command);
823 }
824}
825
801#ifndef HAVE_ARCH_PCI_SET_DMA_MASK 826#ifndef HAVE_ARCH_PCI_SET_DMA_MASK
802/* 827/*
803 * These can be overridden by arch-specific implementations 828 * These can be overridden by arch-specific implementations
@@ -875,6 +900,7 @@ EXPORT_SYMBOL(pci_request_region);
875EXPORT_SYMBOL(pci_set_master); 900EXPORT_SYMBOL(pci_set_master);
876EXPORT_SYMBOL(pci_set_mwi); 901EXPORT_SYMBOL(pci_set_mwi);
877EXPORT_SYMBOL(pci_clear_mwi); 902EXPORT_SYMBOL(pci_clear_mwi);
903EXPORT_SYMBOL_GPL(pci_intx);
878EXPORT_SYMBOL(pci_set_dma_mask); 904EXPORT_SYMBOL(pci_set_dma_mask);
879EXPORT_SYMBOL(pci_set_consistent_dma_mask); 905EXPORT_SYMBOL(pci_set_consistent_dma_mask);
880EXPORT_SYMBOL(pci_assign_resource); 906EXPORT_SYMBOL(pci_assign_resource);