mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Doug Thompson <norsk5@yahoo.com>
To: linux-kernel@vger.kernel.org, Andrew Morton <akpm@osdl.org>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>
Subject: [PATCH 2/36] drivers edac add edac_mc_find API
Date: Sun, 3 Jun 2007 07:39:14 -0700 (PDT)	[thread overview]
Message-ID: <147202.82456.qm@web50104.mail.re2.yahoo.com> (raw)

From:	Douglas Thompson <dougthompson@xmission.com>

This simple patch adds an important CORE API for EDAC that
EDAC drivers can use to find their edac_mc control structure by passing
a mem_ctl_info 'instance' value

Needed for subsequent patches

Signed-off-by:  Douglas Thompson <dougthompson@xmission.com>
--
 edac_mc.c |   28 ++++++++++++++++++++++++++++
 edac_mc.h |    1 +
 2 files changed, 29 insertions(+)
--
diff -puN
drivers/edac/edac_mc.c~edac-new-opteron-athlon64-memory-controller-driver
drivers/edac/edac_mc.c
---
a/drivers/edac/edac_mc.c~edac-new-opteron-athlon64-memory-controller-driver
+++ a/drivers/edac/edac_mc.c
@@ -1457,6 +1457,34 @@ static void del_mc_from_global_list(stru
 }
 
 /**
+ * edac_mc_find: Search for a mem_ctl_info structure whose index is
'idx'.
+ *
+ * If found, return a pointer to the structure.
+ * Else return NULL.
+ *
+ * Caller must hold mem_ctls_mutex.
+ */
+struct mem_ctl_info * edac_mc_find(int idx)
+{
+	struct list_head *item;
+	struct mem_ctl_info *mci;
+
+	list_for_each(item, &mc_devices) {
+		mci = list_entry(item, struct mem_ctl_info, link);
+
+		if (mci->mc_idx >= idx) {
+			if (mci->mc_idx == idx)
+				return mci;
+
+			break;
+		}
+	}
+
+	return NULL;
+}
+EXPORT_SYMBOL(edac_mc_find);
+
+/**
  * edac_mc_add_mc: Insert the 'mci' structure into the mci global list
and
  *                 create sysfs entries associated with mci structure
  * @mci: pointer to the mci structure to be added to the list
diff -puN
drivers/edac/edac_mc.h~edac-new-opteron-athlon64-memory-controller-driver
drivers/edac/edac_mc.h
---
a/drivers/edac/edac_mc.h~edac-new-opteron-athlon64-memory-controller-driver
+++ a/drivers/edac/edac_mc.h
@@ -430,6 +430,7 @@ void edac_mc_dump_mci(struct mem_ctl_inf
 void edac_mc_dump_csrow(struct csrow_info *csrow);
 #endif  /* CONFIG_EDAC_DEBUG */
 
+extern struct mem_ctl_info * edac_mc_find(int idx);
 extern int edac_mc_add_mc(struct mem_ctl_info *mci,int mc_idx);
 extern struct mem_ctl_info * edac_mc_del_mc(struct device *dev);
 extern int edac_mc_find_csrow_by_page(struct mem_ctl_info *mci,


                 reply	other threads:[~2007-06-03 14:39 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=147202.82456.qm@web50104.mail.re2.yahoo.com \
    --to=norsk5@yahoo.com \
    --cc=akpm@osdl.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --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®