aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/msi.c
diff options
context:
space:
mode:
authorHidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>2009-08-09 21:14:15 -0400
committerJesse Barnes <jbarnes@virtuousgeek.org>2009-09-09 16:29:35 -0400
commit500559a92dd36af7cee95ed2f5b7722fb95a82e7 (patch)
tree02fa25151702e5c4b63e1d98d27ae605712368fe /drivers/pci/msi.c
parentd9d7070e6117651ecc8fa0ea60b1ff5b68d4db4f (diff)
PCI MSI: Style cleanups
Cleanups (nearly based on checkpatch). Before: total: 11 errors, 2 warnings, 0 checks, 842 lines checked After: total: 0 errors, 0 warnings, 0 checks, 842 lines checked v2: fix it's/its mistakes in comment Reviewed-by: Matthew Wilcox <willy@linux.intel.com> Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/pci/msi.c')
-rw-r--r--drivers/pci/msi.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index 14159cf7d38e..f9cf3173b23d 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -16,9 +16,8 @@
16#include <linux/proc_fs.h> 16#include <linux/proc_fs.h>
17#include <linux/msi.h> 17#include <linux/msi.h>
18#include <linux/smp.h> 18#include <linux/smp.h>
19 19#include <linux/errno.h>
20#include <asm/errno.h> 20#include <linux/io.h>
21#include <asm/io.h>
22 21
23#include "pci.h" 22#include "pci.h"
24#include "msi.h" 23#include "msi.h"
@@ -390,7 +389,7 @@ static int msi_capability_init(struct pci_dev *dev, int nvec)
390 u16 control; 389 u16 control;
391 unsigned mask; 390 unsigned mask;
392 391
393 pos = pci_find_capability(dev, PCI_CAP_ID_MSI); 392 pos = pci_find_capability(dev, PCI_CAP_ID_MSI);
394 msi_set_enable(dev, pos, 0); /* Disable MSI during set up */ 393 msi_set_enable(dev, pos, 0); /* Disable MSI during set up */
395 394
396 pci_read_config_word(dev, msi_control_reg(pos), &control); 395 pci_read_config_word(dev, msi_control_reg(pos), &control);
@@ -399,12 +398,12 @@ static int msi_capability_init(struct pci_dev *dev, int nvec)
399 if (!entry) 398 if (!entry)
400 return -ENOMEM; 399 return -ENOMEM;
401 400
402 entry->msi_attrib.is_msix = 0; 401 entry->msi_attrib.is_msix = 0;
403 entry->msi_attrib.is_64 = is_64bit_address(control); 402 entry->msi_attrib.is_64 = is_64bit_address(control);
404 entry->msi_attrib.entry_nr = 0; 403 entry->msi_attrib.entry_nr = 0;
405 entry->msi_attrib.maskbit = is_mask_bit_support(control); 404 entry->msi_attrib.maskbit = is_mask_bit_support(control);
406 entry->msi_attrib.default_irq = dev->irq; /* Save IOAPIC IRQ */ 405 entry->msi_attrib.default_irq = dev->irq; /* Save IOAPIC IRQ */
407 entry->msi_attrib.pos = pos; 406 entry->msi_attrib.pos = pos;
408 407
409 entry->mask_pos = msi_mask_reg(pos, entry->msi_attrib.is_64); 408 entry->mask_pos = msi_mask_reg(pos, entry->msi_attrib.is_64);
410 /* All MSIs are unmasked by default, Mask them all */ 409 /* All MSIs are unmasked by default, Mask them all */
@@ -513,7 +512,7 @@ static int msix_capability_init(struct pci_dev *dev,
513 u16 control; 512 u16 control;
514 void __iomem *base; 513 void __iomem *base;
515 514
516 pos = pci_find_capability(dev, PCI_CAP_ID_MSIX); 515 pos = pci_find_capability(dev, PCI_CAP_ID_MSIX);
517 pci_read_config_word(dev, pos + PCI_MSIX_FLAGS, &control); 516 pci_read_config_word(dev, pos + PCI_MSIX_FLAGS, &control);
518 517
519 /* Ensure MSI-X is disabled while it is set up */ 518 /* Ensure MSI-X is disabled while it is set up */
@@ -584,7 +583,7 @@ error:
584 * to determine if MSI/-X are supported for the device. If MSI/-X is 583 * to determine if MSI/-X are supported for the device. If MSI/-X is
585 * supported return 0, else return an error code. 584 * supported return 0, else return an error code.
586 **/ 585 **/
587static int pci_msi_check_device(struct pci_dev* dev, int nvec, int type) 586static int pci_msi_check_device(struct pci_dev *dev, int nvec, int type)
588{ 587{
589 struct pci_bus *bus; 588 struct pci_bus *bus;
590 int ret; 589 int ret;
@@ -601,8 +600,9 @@ static int pci_msi_check_device(struct pci_dev* dev, int nvec, int type)
601 if (nvec < 1) 600 if (nvec < 1)
602 return -ERANGE; 601 return -ERANGE;
603 602
604 /* Any bridge which does NOT route MSI transactions from it's 603 /*
605 * secondary bus to it's primary bus must set NO_MSI flag on 604 * Any bridge which does NOT route MSI transactions from its
605 * secondary bus to its primary bus must set NO_MSI flag on
606 * the secondary pci_bus. 606 * the secondary pci_bus.
607 * We expect only arch-specific PCI host bus controller driver 607 * We expect only arch-specific PCI host bus controller driver
608 * or quirks for specific PCI bridges to be setting NO_MSI. 608 * or quirks for specific PCI bridges to be setting NO_MSI.
@@ -693,7 +693,7 @@ void pci_msi_shutdown(struct pci_dev *dev)
693 dev->irq = desc->msi_attrib.default_irq; 693 dev->irq = desc->msi_attrib.default_irq;
694} 694}
695 695
696void pci_disable_msi(struct pci_dev* dev) 696void pci_disable_msi(struct pci_dev *dev)
697{ 697{
698 if (!pci_msi_enable || !dev || !dev->msi_enabled) 698 if (!pci_msi_enable || !dev || !dev->msi_enabled)
699 return; 699 return;
@@ -735,13 +735,13 @@ int pci_msix_table_size(struct pci_dev *dev)
735 * of irqs or MSI-X vectors available. Driver should use the returned value to 735 * of irqs or MSI-X vectors available. Driver should use the returned value to
736 * re-send its request. 736 * re-send its request.
737 **/ 737 **/
738int pci_enable_msix(struct pci_dev* dev, struct msix_entry *entries, int nvec) 738int pci_enable_msix(struct pci_dev *dev, struct msix_entry *entries, int nvec)
739{ 739{
740 int status, nr_entries; 740 int status, nr_entries;
741 int i, j; 741 int i, j;
742 742
743 if (!entries) 743 if (!entries)
744 return -EINVAL; 744 return -EINVAL;
745 745
746 status = pci_msi_check_device(dev, nvec, PCI_CAP_ID_MSIX); 746 status = pci_msi_check_device(dev, nvec, PCI_CAP_ID_MSIX);
747 if (status) 747 if (status)
@@ -763,7 +763,7 @@ int pci_enable_msix(struct pci_dev* dev, struct msix_entry *entries, int nvec)
763 WARN_ON(!!dev->msix_enabled); 763 WARN_ON(!!dev->msix_enabled);
764 764
765 /* Check whether driver already requested for MSI irq */ 765 /* Check whether driver already requested for MSI irq */
766 if (dev->msi_enabled) { 766 if (dev->msi_enabled) {
767 dev_info(&dev->dev, "can't enable MSI-X " 767 dev_info(&dev->dev, "can't enable MSI-X "
768 "(MSI IRQ already assigned)\n"); 768 "(MSI IRQ already assigned)\n");
769 return -EINVAL; 769 return -EINVAL;
@@ -773,7 +773,7 @@ int pci_enable_msix(struct pci_dev* dev, struct msix_entry *entries, int nvec)
773} 773}
774EXPORT_SYMBOL(pci_enable_msix); 774EXPORT_SYMBOL(pci_enable_msix);
775 775
776void pci_msix_shutdown(struct pci_dev* dev) 776void pci_msix_shutdown(struct pci_dev *dev)
777{ 777{
778 struct msi_desc *entry; 778 struct msi_desc *entry;
779 779
@@ -791,7 +791,7 @@ void pci_msix_shutdown(struct pci_dev* dev)
791 dev->msix_enabled = 0; 791 dev->msix_enabled = 0;
792} 792}
793 793
794void pci_disable_msix(struct pci_dev* dev) 794void pci_disable_msix(struct pci_dev *dev)
795{ 795{
796 if (!pci_msi_enable || !dev || !dev->msix_enabled) 796 if (!pci_msi_enable || !dev || !dev->msix_enabled)
797 return; 797 return;
@@ -810,10 +810,10 @@ EXPORT_SYMBOL(pci_disable_msix);
810 * allocated for this device function, are reclaimed to unused state, 810 * allocated for this device function, are reclaimed to unused state,
811 * which may be used later on. 811 * which may be used later on.
812 **/ 812 **/
813void msi_remove_pci_irq_vectors(struct pci_dev* dev) 813void msi_remove_pci_irq_vectors(struct pci_dev *dev)
814{ 814{
815 if (!pci_msi_enable || !dev) 815 if (!pci_msi_enable || !dev)
816 return; 816 return;
817 817
818 if (dev->msi_enabled || dev->msix_enabled) 818 if (dev->msi_enabled || dev->msix_enabled)
819 free_msi_irqs(dev); 819 free_msi_irqs(dev);