summaryrefslogtreecommitdiffstats
path: root/drivers/edac/edac_pci.c
diff options
context:
space:
mode:
authorHarry Ciao <qingtao.cao@windriver.com>2009-04-02 16:58:47 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2009-04-02 19:05:03 -0700
commit8641a3845d066f841ca591ac1c480b13bea7d849 (patch)
tree2d9a496c18e1b9838022816adfa3e9cf72386617 /drivers/edac/edac_pci.c
parent697dab6484fad0e636b0677c010b15cc449d1b9b (diff)
downloadop-kernel-dev-8641a3845d066f841ca591ac1c480b13bea7d849.zip
op-kernel-dev-8641a3845d066f841ca591ac1c480b13bea7d849.tar.gz
edac: Add edac_pci_alloc_index()
Add edac_pci_alloc_index(), because for MAPLE platform there may exist several EDAC driver modules that could make use of edac_pci_ctl_info structure at the same time. The index allocation for these structures should be taken care of by EDAC core. Signed-off-by: Harry Ciao <qingtao.cao@windriver.com> Cc: Doug Thompson <norsk5@yahoo.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/edac/edac_pci.c')
-rw-r--r--drivers/edac/edac_pci.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/edac/edac_pci.c b/drivers/edac/edac_pci.c
index 5d3c808..5b150ae 100644
--- a/drivers/edac/edac_pci.c
+++ b/drivers/edac/edac_pci.c
@@ -30,6 +30,7 @@
static DEFINE_MUTEX(edac_pci_ctls_mutex);
static LIST_HEAD(edac_pci_list);
+static atomic_t pci_indexes = ATOMIC_INIT(0);
/*
* edac_pci_alloc_ctl_info
@@ -318,6 +319,19 @@ void edac_pci_reset_delay_period(struct edac_pci_ctl_info *pci,
EXPORT_SYMBOL_GPL(edac_pci_reset_delay_period);
/*
+ * edac_pci_alloc_index: Allocate a unique PCI index number
+ *
+ * Return:
+ * allocated index number
+ *
+ */
+int edac_pci_alloc_index(void)
+{
+ return atomic_inc_return(&pci_indexes) - 1;
+}
+EXPORT_SYMBOL_GPL(edac_pci_alloc_index);
+
+/*
* edac_pci_add_device: Insert the 'edac_dev' structure into the
* edac_pci global list and create sysfs entries associated with
* edac_pci structure.
OpenPOWER on IntegriCloud