qdf_cpuhp.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /*
  2. * Copyright (c) 2017-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_cpuhp (CPU hotplug)
  21. * QCA driver framework (QDF) CPU hotplug APIs
  22. */
  23. #ifndef __QDF_CPUHP_H
  24. #define __QDF_CPUHP_H
  25. #include "qdf_status.h"
  26. #include "qdf_types.h"
  27. /*
  28. * struct qdf_cpuhp_handler - an opaque hotplug event registration handle
  29. */
  30. struct qdf_cpuhp_handler;
  31. typedef void (*qdf_cpuhp_callback)(void *context, uint32_t cpu);
  32. #ifdef QCA_CONFIG_SMP
  33. /**
  34. * qdf_cpuhp_init() - Initialize the CPU hotplug event infrastructure
  35. *
  36. * To be called once, globally.
  37. *
  38. * Return: None
  39. */
  40. QDF_STATUS qdf_cpuhp_init(void);
  41. /**
  42. * qdf_cpuhp_deinit() - De-initialize the CPU hotplug event infrastructure
  43. *
  44. * To be called once, globally.
  45. *
  46. * Return: None
  47. */
  48. QDF_STATUS qdf_cpuhp_deinit(void);
  49. /**
  50. * qdf_cpuhp_register() - Register for CPU up/down event notifications
  51. * @handler: a double pointer to the event registration handle to allocate
  52. * @context: an opaque context to pass back to event listeners
  53. * @up_callback: the function pointer to invoke for CPU up events
  54. * @down_callback: the function pointer to invoke for CPU down events
  55. *
  56. * "Up" happens just after the CPU is up. Inversely, "down" happens just before
  57. * the CPU goes down.
  58. *
  59. * @handler will point to a valid memory address on success, or NULL on failure.
  60. *
  61. * Return: QDF_STATUS
  62. */
  63. QDF_STATUS qdf_cpuhp_register(struct qdf_cpuhp_handler **handler,
  64. void *context,
  65. qdf_cpuhp_callback up_callback,
  66. qdf_cpuhp_callback down_callback);
  67. /**
  68. * qdf_cpuhp_unregister() - Un-register for CPU up/down event notifications
  69. * @handler: a double pointer to the event registration handle to de-allocate
  70. *
  71. * @handler point to NULL upon completion
  72. *
  73. * Return: None
  74. */
  75. void qdf_cpuhp_unregister(struct qdf_cpuhp_handler **handler);
  76. #else
  77. static inline QDF_STATUS qdf_cpuhp_init(void)
  78. {
  79. return QDF_STATUS_SUCCESS;
  80. }
  81. static inline QDF_STATUS qdf_cpuhp_deinit(void)
  82. {
  83. return QDF_STATUS_SUCCESS;
  84. }
  85. static inline QDF_STATUS qdf_cpuhp_register(struct qdf_cpuhp_handler **handler,
  86. void *context,
  87. qdf_cpuhp_callback up_callback,
  88. qdf_cpuhp_callback down_callback)
  89. {
  90. return QDF_STATUS_SUCCESS;
  91. }
  92. static inline void qdf_cpuhp_unregister(struct qdf_cpuhp_handler **handler) {}
  93. #endif /* QCA_CONFIG_SMP */
  94. #endif /* __QDF_CPUHP_H */