msm-audio-event-notify.c 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /* Copyright (c) 2018, The Linux Foundation. All rights reserved.
  2. *
  3. * This program is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License version 2 and
  5. * only version 2 as published by the Free Software Foundation.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. */
  12. #include <dsp/msm-audio-event-notify.h>
  13. #include <linux/export.h>
  14. static ATOMIC_NOTIFIER_HEAD(msm_aud_evt_notifier_list);
  15. /**
  16. * msm_aud_evt_register_client - register a client notifier
  17. * @nb: notifier block to callback on events
  18. */
  19. int msm_aud_evt_register_client(struct notifier_block *nb)
  20. {
  21. return atomic_notifier_chain_register(&msm_aud_evt_notifier_list, nb);
  22. }
  23. EXPORT_SYMBOL(msm_aud_evt_register_client);
  24. /**
  25. * msm_aud_evt_unregister_client - unregister a client notifier
  26. * @nb: notifier block to callback on events
  27. */
  28. int msm_aud_evt_unregister_client(struct notifier_block *nb)
  29. {
  30. return atomic_notifier_chain_unregister(&msm_aud_evt_notifier_list, nb);
  31. }
  32. EXPORT_SYMBOL(msm_aud_evt_unregister_client);
  33. /**
  34. * msm_aud_evt_notifier_call_chain - notify clients of fb_events
  35. *
  36. */
  37. int msm_aud_evt_notifier_call_chain(unsigned long val, void *v)
  38. {
  39. return atomic_notifier_call_chain(&msm_aud_evt_notifier_list, val, v);
  40. }
  41. EXPORT_SYMBOL_GPL(msm_aud_evt_notifier_call_chain);