From 1dc9b70d7d48abd8a5c6f83021f38992f3b5a77f Mon Sep 17 00:00:00 2001 From: Harry Ciao Date: Wed, 17 Jun 2009 16:27:59 -0700 Subject: edac: add edac_device_alloc_index() Add edac_device_alloc_index(), because for MAPLE platform there may exist several EDAC driver modules that could make use of edac_device_ctl_info structure at the same time. The index allocation for these structures should be taken care of by EDAC core. [akpm@linux-foundation.org: cleanups] Signed-off-by: Harry Ciao Cc: Doug Thompson Cc: Michael Ellerman Cc: Benjamin Herrenschmidt Cc: Kumar Gala Cc: Paul Mackerras Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/edac/edac_device.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'drivers/edac/edac_device.c') diff --git a/drivers/edac/edac_device.c b/drivers/edac/edac_device.c index a7d2c717d033..b02a6a69a8f0 100644 --- a/drivers/edac/edac_device.c +++ b/drivers/edac/edac_device.c @@ -490,6 +490,20 @@ void edac_device_reset_delay_period(struct edac_device_ctl_info *edac_dev, mutex_unlock(&device_ctls_mutex); } +/* + * edac_device_alloc_index: Allocate a unique device index number + * + * Return: + * allocated index number + */ +int edac_device_alloc_index(void) +{ + static atomic_t device_indexes = ATOMIC_INIT(0); + + return atomic_inc_return(&device_indexes) - 1; +} +EXPORT_SYMBOL_GPL(edac_device_alloc_index); + /** * edac_device_add_device: Insert the 'edac_dev' structure into the * edac_device global list and create sysfs entries associated with -- cgit v1.2.3