summaryrefslogtreecommitdiff
path: root/drivers/md/dm-vdo/status-codes.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md/dm-vdo/status-codes.c')
-rw-r--r--drivers/md/dm-vdo/status-codes.c30
1 files changed, 6 insertions, 24 deletions
diff --git a/drivers/md/dm-vdo/status-codes.c b/drivers/md/dm-vdo/status-codes.c
index 918e46e7121f..d3493450b169 100644
--- a/drivers/md/dm-vdo/status-codes.c
+++ b/drivers/md/dm-vdo/status-codes.c
@@ -40,10 +40,11 @@ const struct error_info vdo_status_list[] = {
{ "VDO_INVALID_ADMIN_STATE", "Invalid operation for current state" },
};
-static atomic_t vdo_status_codes_registered = ATOMIC_INIT(0);
-static int status_code_registration_result;
-
-static void do_status_code_registration(void)
+/**
+ * vdo_register_status_codes() - Register the VDO status codes.
+ * Return: A success or error code.
+ */
+int vdo_register_status_codes(void)
{
int result;
@@ -53,26 +54,7 @@ static void do_status_code_registration(void)
result = uds_register_error_block("VDO Status", VDO_STATUS_CODE_BASE,
VDO_STATUS_CODE_BLOCK_END, vdo_status_list,
sizeof(vdo_status_list));
- /*
- * The following test handles cases where libvdo is statically linked against both the test
- * modules and the test driver (because multiple instances of this module call their own
- * copy of this function once each, resulting in multiple calls to register_error_block
- * which is shared in libuds).
- */
- if (result == UDS_DUPLICATE_NAME)
- result = UDS_SUCCESS;
-
- status_code_registration_result = (result == UDS_SUCCESS) ? VDO_SUCCESS : result;
-}
-
-/**
- * vdo_register_status_codes() - Register the VDO status codes if needed.
- * Return: A success or error code.
- */
-int vdo_register_status_codes(void)
-{
- vdo_perform_once(&vdo_status_codes_registered, do_status_code_registration);
- return status_code_registration_result;
+ return (result == UDS_SUCCESS) ? VDO_SUCCESS : result;
}
/**