]> Pileus Git - ~andy/linux/blobdiff - drivers/edac/edac_device.c
Merge branch 'for-linus' of git://git.open-osd.org/linux-open-osd
[~andy/linux] / drivers / edac / edac_device.c
index a7d2c717d0338582339ce23198b0a440dc1299e4..b02a6a69a8f0148eebbaa19526a75e89890973d9 100644 (file)
@@ -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