From 60ad9d9691113a036594d735fea8479391bbc776 Mon Sep 17 00:00:00 2001 From: Harry Ciao Date: Thu, 2 Apr 2009 16:58:47 -0700 Subject: [PATCH] --- yaml --- r: 139719 b: refs/heads/master c: 8641a3845d066f841ca591ac1c480b13bea7d849 h: refs/heads/master i: 139717: 04e2152a180a0932b0f5e53a2046913b7e171d79 139715: 459661da6713fb8580fa1bb947708c535a2d2596 139711: bfbdd06ae4d97601d57b5e483d1fb3e04207b0c0 v: v3 --- [refs] | 2 +- trunk/drivers/edac/edac_core.h | 1 + trunk/drivers/edac/edac_pci.c | 14 ++++++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 0ef157a9a417..e165d5e4f094 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 697dab6484fad0e636b0677c010b15cc449d1b9b +refs/heads/master: 8641a3845d066f841ca591ac1c480b13bea7d849 diff --git a/trunk/drivers/edac/edac_core.h b/trunk/drivers/edac/edac_core.h index 3189c76fe62e..28f2c3f959b5 100644 --- a/trunk/drivers/edac/edac_core.h +++ b/trunk/drivers/edac/edac_core.h @@ -844,6 +844,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/trunk/drivers/edac/edac_pci.c b/trunk/drivers/edac/edac_pci.c index 5d3c8083a40e..5b150aea703a 100644 --- a/trunk/drivers/edac/edac_pci.c +++ b/trunk/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 @@ -317,6 +318,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