Merge tag 'trace-printf-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/trace...
[drm/drm-misc.git] / drivers / md / dm-vdo / thread-device.c
blobdf13ca914db811466328065afd932cb12a3097fe
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3 * Copyright 2023 Red Hat
4 */
6 #include "thread-device.h"
8 /* A registry of threads associated with device id numbers. */
9 static struct thread_registry device_id_thread_registry;
11 /* Any registered thread must be unregistered. */
12 void vdo_register_thread_device_id(struct registered_thread *new_thread,
13 unsigned int *id_ptr)
15 vdo_register_thread(&device_id_thread_registry, new_thread, id_ptr);
18 void vdo_unregister_thread_device_id(void)
20 vdo_unregister_thread(&device_id_thread_registry);
23 int vdo_get_thread_device_id(void)
25 const unsigned int *pointer;
27 pointer = vdo_lookup_thread(&device_id_thread_registry);
28 return (pointer != NULL) ? *pointer : -1;
31 void vdo_initialize_thread_device_registry(void)
33 vdo_initialize_thread_registry(&device_id_thread_registry);