Skip to content

Commit cf3a7d1

Browse files
marc-hblgirdwood
authored andcommitted
notifier.h: document the API
... and rename some parameter names. Signed-off-by: Marc Herbert <marc.herbert@intel.com>
1 parent 130bffa commit cf3a7d1

1 file changed

Lines changed: 34 additions & 6 deletions

File tree

src/include/sof/lib/notifier.h

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,43 @@ struct notify_data {
5858

5959
struct notify **arch_notify_get(void);
6060

61-
int notifier_register(void *receiver, void *caller, enum notify_id type,
62-
void (*cb)(void *arg, enum notify_id type, void *data),
61+
/** Register a callback to be run when event 'type' happens.
62+
*
63+
* The identifier for un-registration is the tuple (receiver_data,
64+
* caller_id_filter, event_type), the callback argument is not part of
65+
* it.
66+
*
67+
* caller_data argument from notifier_event()
68+
*
69+
* @param receiver_data private data passed to the callback.
70+
* @param caller_id_filter optional, can be used to be notified only by
71+
* some specific notifier_event() calls when not NULL.
72+
* @param event_type list of callbacks to be added to
73+
* @param callback callback function
74+
* @param flags see NOTIFIER_FLAG_* above
75+
*/
76+
int notifier_register(void *receiver_data, void *caller_id_filter, enum notify_id event_type,
77+
void (*callback)(void *receiver_data, enum notify_id event_type,
78+
void *caller_data),
6379
uint32_t flags);
64-
void notifier_unregister(void *receiver, void *caller, enum notify_id type);
65-
void notifier_unregister_all(void *receiver, void *caller);
80+
81+
/** Unregister all callbacks matching that arguments tuple. NULL acts
82+
* as a wildcard.
83+
*/
84+
void notifier_unregister(void *receiver_data_filter, void *caller_id_filter, enum notify_id type);
85+
86+
/** Unregister callbacks matching the arguments for every notify_id.
87+
* A NULL parameter acts as a wildcard.
88+
*/
89+
void notifier_unregister_all(void *receiver_data_filter, void *caller_id_filter);
6690

6791
void notifier_notify_remote(void);
68-
void notifier_event(const void *caller, enum notify_id type, uint32_t core_mask,
69-
void *data, uint32_t data_size);
92+
93+
/* data_size is required to manage cache coherency for notifications
94+
* across cores.
95+
*/
96+
void notifier_event(const void *caller_id, enum notify_id event_type, uint32_t core_mask,
97+
void *caller_data, uint32_t data_size);
7098

7199
void init_system_notify(struct sof *sof);
72100

0 commit comments

Comments
 (0)