From: Harry Ciao <qingtao.cao@windriver.com>
To: linux-kernel@vger.kernel.org, bluesmoke-devel@lists.sourceforge.net
Subject: [v1 PATCH 4/8] EDAC: Add edac_pci_alloc_index()
Date: Mon, 9 Mar 2009 16:08:13 +0800 [thread overview]
Message-ID: <1236586097-3830-5-git-send-email-qingtao.cao@windriver.com> (raw)
In-Reply-To: <1236586097-3830-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
next prev parent reply other threads:[~2009-03-09 8:21 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-09 8:08 [v1 PATCH 0/8] Add AMD8111 and AMD8131 EDAC drivers Harry Ciao
2009-03-09 8:08 ` [v1 PATCH 1/8] EDAC: AMD8111 driver Kconfig & Makefile Harry Ciao
2009-03-09 8:08 ` [v1 PATCH 2/8] EDAC: AMD8111 driver header file Harry Ciao
2009-03-09 8:08 ` [v1 PATCH 3/8] EDAC: AMD8111 driver source file Harry Ciao
2009-03-09 8:08 ` Harry Ciao [this message]
2009-03-09 8:08 ` [v1 PATCH 5/8] PCI: Add AMD8111 PCI Bridge PCI Device ID Harry Ciao
2009-03-09 8:08 ` [v1 PATCH 6/8] EDAC: AMD8131 driver header file Harry Ciao
2009-03-09 8:08 ` [v1 PATCH 7/8] EDAC: AMD8131 driver source file Harry Ciao
2009-03-09 8:08 ` [v1 PATCH 8/8] EDAC: AMD8131 driver Kconfig & Makefile Harry Ciao
2009-03-10 20:46 ` [v1 PATCH 3/8] EDAC: AMD8111 driver source file Andrew Morton
2009-03-11 2:15 ` Harry Ciao
2009-03-09 9:04 ` [v1 PATCH 1/8] EDAC: AMD8111 driver Kconfig & Makefile Bert Wesarg
2009-03-11 1:05 ` 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=1236586097-3830-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®