qdf_idr.h 2.1 KB

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