EDAC: Add edac_device_alloc_index()
Doug Thompson
Acked-byQuoted 19 lines · Andrew Morton
From: Andrew Morton <[email protected]>
Subject: Re: [v2 PATCH 2/3] EDAC: Addedac_device_alloc_index()
To: "Harry Ciao" <[email protected]>
Cc: [email protected], [email protected], [email protected], [email protected], [email protected]
Date: Wednesday, April 15, 2009, 4:27 PMQuoted 1 line · On Mon, 13 Apr 2009 14:05:15 +0800 Harry Ciao <[email protected]> wrote:
Add
edac_device_alloc_index(), because for MAPLEplatform there may
Quoted 1 line
exist several EDAC driver modules that could make use
of
Quoted 1 line
edac_device_ctl_infostructure at the same time. Theindex allocation
Quoted 1 line
for these structures should be taken care of by EDAC
core.
Quoted 1 line
Quoted 7 lines
From: Andrew Morton <[email protected]>
keep things neat. Also avoids having global
identifierdevice_index
shadowed by local identifierdevice_index.Cc Benjamin Herrenschmidt <[email protected]>
Quoted 46 lines
Cc Harry Ciao <[email protected]>Cc Kumar Gala <[email protected]>Cc Michael Ellerman <[email protected]>Cc Paul Mackerras <[email protected]>Signed-off-by Andrew Morton <[email protected]>---
drivers/edac/edac_device.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)diff -puN
drivers/edac/amd8111_edac.c~edac-add-edac_device_alloc_index-cleanupdrivers/edac/amd8111_edac.c
diff -puNdrivers/edac/edac_core.h~edac-add-edac_device_alloc_index-cleanupdrivers/edac/edac_core.h
diff -puNdrivers/edac/edac_device.c~edac-add-edac_device_alloc_index-cleanupdrivers/edac/edac_device.c
---
a/drivers/edac/edac_device.c~edac-add-edac_device_alloc_index-cleanup +++a/drivers/edac/edac_device.c(quoted diff) +0
-1@@ -37,7 +37,6 @@ */ static DEFINE_MUTEX(device_ctls_mutex); static LIST_HEAD(edac_device_list); -static atomic_t device_indexes = ATOMIC_INIT(0); #ifdef CONFIG_EDAC_DEBUG static void edac_device_dump_device(struct
edac_device_ctl_info*edac_dev)(quoted diff) +0
-0@@ -499,6 +498,8 @@ voidedac_device_reset_delay_period(stru
*/
intedac_device_alloc_index(void)
{
+ staticatomic_tdevice_indexes=ATOMIC_INIT(0);
+
returnatomic_inc_return(&device_indexes)- 1;
}
EXPORT_SYMBOL_GPL(edac_device_alloc_index);
_