mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Harry Ciao <qingtao.cao@windriver.com>
To: linux-kernel@vger.kernel.org, bluesmoke-devel@lists.sourceforge.net
Subject: [v2 PATCH 4/7] EDAC: Add edac_pci_alloc_index()
Date: Wed, 11 Mar 2009 11:25:54 +0800	[thread overview]
Message-ID: <1236741957-3570-5-git-send-email-qingtao.cao@windriver.com> (raw)
In-Reply-To: <1236741957-3570-4-git-send-email-qingtao.cao@windriver.com>

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>
---
 drivers/edac/edac_core.h |    1 +
 drivers/edac/edac_pci.c  |   14 ++++++++++++++
 2 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/drivers/edac/edac_core.h b/drivers/edac/edac_core.h
index 4b55ec6..76cb7c2 100644
--- a/drivers/edac/edac_core.h
+++ b/drivers/edac/edac_core.h
@@ -831,6 +831,7 @@ extern void edac_pci_free_ctl_info(struct edac_pci_ctl_info *pci);
 extern void edac_pci_reset_delay_period(struct edac_pci_ctl_info *pci,
 				unsigned long value);
 
+extern int edac_pci_alloc_index(void);
 extern int edac_pci_add_device(struct edac_pci_ctl_info *pci, int edac_idx);
 extern struct edac_pci_ctl_info *edac_pci_del_device(struct device *dev);
 
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.
-- 
1.5.6.2


  reply	other threads:[~2009-03-11  3:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-11  3:25 [v2 PATCH 0/7] Add AMD8111 and AMD8131 EDAC drivers Harry Ciao
2009-03-11  3:25 ` [v2 PATCH 1/7] EDAC: AMD8111 driver header file Harry Ciao
2009-03-11  3:25   ` [v2 PATCH 2/7] EDAC: AMD8111 driver source file Harry Ciao
2009-03-11  3:25     ` [v2 PATCH 3/7] EDAC: AMD8111 driver Kconfig and Makefile Harry Ciao
2009-03-11  3:25       ` Harry Ciao [this message]
2009-03-11  3:25         ` [v2 PATCH 5/7] EDAC: AMD8131 driver header file Harry Ciao
2009-03-11  3:25           ` [v2 PATCH 6/7] EDAC: AMD8131 driver source file Harry Ciao
2009-03-11  3:25             ` [v2 PATCH 7/7] EDAC: AMD8131 driver Kconfig and Makefile Harry Ciao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1236741957-3570-5-git-send-email-qingtao.cao@windriver.com \
    --to=qingtao.cao@windriver.com \
    --cc=bluesmoke-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®