qdf_idr.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*
  2. * Copyright (c) 2018 The Linux Foundation. All rights reserved.
  3. * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
  4. *
  5. * Permission to use, copy, modify, and/or distribute this software for
  6. * any purpose with or without fee is hereby granted, provided that the
  7. * above copyright notice and this permission notice appear in all
  8. * copies.
  9. *
  10. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  11. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  12. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  13. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  14. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  15. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  16. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  17. * PERFORMANCE OF THIS SOFTWARE.
  18. */
  19. /**
  20. * DOC: qdf_idr(ID Allocation)
  21. * QCA driver framework (QDF) ID allocation APIs
  22. */
  23. #if !defined(__QDF_IDR_H)
  24. #define __QDF_IDR_H
  25. /* Include Files */
  26. #include <qdf_types.h>
  27. #include <qdf_status.h>
  28. #include <i_qdf_idr.h>
  29. /**
  30. * typedef qdf_idr - platform idr object
  31. */
  32. typedef __qdf_idr qdf_idr;
  33. /**
  34. * qdf_idr_create() - idr initialization function
  35. * @idp: pointer to qdf idr
  36. *
  37. * Return: QDF status
  38. */
  39. QDF_STATUS qdf_idr_create(qdf_idr *idp);
  40. /**
  41. * qdf_idr_destroy() - idr deinitialization function
  42. * @idp: pointer to qdf idr
  43. *
  44. * Return: QDF status
  45. */
  46. QDF_STATUS qdf_idr_destroy(qdf_idr *idp);
  47. /**
  48. * qdf_idr_alloc() - Allocates an unused ID
  49. * @idp: pointer to qdf idr
  50. * @ptr: pointer to be associated with the new ID
  51. * @id: pointer to return new ID
  52. *
  53. * Return: QDF status
  54. */
  55. QDF_STATUS qdf_idr_alloc(qdf_idr *idp, void *ptr, int32_t *id);
  56. /**
  57. * qdf_idr_remove() - Removes this ID from the IDR.
  58. * @idp: pointer to qdf idr
  59. * @id: ID to be remove
  60. *
  61. * Return: QDF status
  62. */
  63. QDF_STATUS qdf_idr_remove(qdf_idr *idp, int32_t id);
  64. /**
  65. * qdf_idr_find() - find the user pointer from the IDR by id.
  66. * @idp: pointer to qdf idr
  67. * @id: ID to be remove
  68. * @ptr: pointer to return user pointer for given ID
  69. *
  70. * Return: QDF status
  71. */
  72. QDF_STATUS qdf_idr_find(qdf_idr *idp, int32_t id, void **ptr);
  73. #endif /* __QDF_IDR_H */