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 <qingtao.cao@windriver.com> Cc: Doug Thompson <norsk5@yahoo.com> Cc: Michael Ellerman <michael@ellerman.id.au> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Kumar Gala <galak@gate.crashing.org> Cc: Paul Mackerras <paulus@samba.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
committed by
Linus Torvalds
parent
2a9036afff
commit
1dc9b70d7d
@@ -37,7 +37,6 @@
|
|||||||
#define AMD8111_EDAC_MOD_STR "amd8111_edac"
|
#define AMD8111_EDAC_MOD_STR "amd8111_edac"
|
||||||
|
|
||||||
#define PCI_DEVICE_ID_AMD_8111_PCI 0x7460
|
#define PCI_DEVICE_ID_AMD_8111_PCI 0x7460
|
||||||
static int edac_dev_idx;
|
|
||||||
|
|
||||||
enum amd8111_edac_devs {
|
enum amd8111_edac_devs {
|
||||||
LPC_BRIDGE = 0,
|
LPC_BRIDGE = 0,
|
||||||
@@ -377,7 +376,7 @@ static int amd8111_dev_probe(struct pci_dev *dev,
|
|||||||
* edac_device_ctl_info, but make use of existing
|
* edac_device_ctl_info, but make use of existing
|
||||||
* one instead.
|
* one instead.
|
||||||
*/
|
*/
|
||||||
dev_info->edac_idx = edac_dev_idx++;
|
dev_info->edac_idx = edac_device_alloc_index();
|
||||||
dev_info->edac_dev =
|
dev_info->edac_dev =
|
||||||
edac_device_alloc_ctl_info(0, dev_info->ctl_name, 1,
|
edac_device_alloc_ctl_info(0, dev_info->ctl_name, 1,
|
||||||
NULL, 0, 0,
|
NULL, 0, 0,
|
||||||
|
@@ -841,6 +841,7 @@ extern void edac_device_handle_ue(struct edac_device_ctl_info *edac_dev,
|
|||||||
int inst_nr, int block_nr, const char *msg);
|
int inst_nr, int block_nr, const char *msg);
|
||||||
extern void edac_device_handle_ce(struct edac_device_ctl_info *edac_dev,
|
extern void edac_device_handle_ce(struct edac_device_ctl_info *edac_dev,
|
||||||
int inst_nr, int block_nr, const char *msg);
|
int inst_nr, int block_nr, const char *msg);
|
||||||
|
extern int edac_device_alloc_index(void);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* edac_pci APIs
|
* edac_pci APIs
|
||||||
|
@@ -490,6 +490,20 @@ void edac_device_reset_delay_period(struct edac_device_ctl_info *edac_dev,
|
|||||||
mutex_unlock(&device_ctls_mutex);
|
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_add_device: Insert the 'edac_dev' structure into the
|
||||||
* edac_device global list and create sysfs entries associated with
|
* edac_device global list and create sysfs entries associated with
|
||||||
|
Reference in New Issue
Block a user