qdf_cpuhp.h 3.0 KB

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