[Skiboot] [PATCH v2 1/8] opal: Update opal_del_host_sync_notifier() to accept 'void *data'
Vaibhav Jain
vaibhav at linux.ibm.com
Mon Dec 10 01:17:37 AEDT 2018
Current implementation of opal_del_host_sync_notifier() will only
delete the first entry of the 'notify' callback found from opal_syncers
list irrespective of the 'data' of list-node. This is problematic when
multiple notifiers with same callback function but different 'data'
are registered. In this case when the cleanup code will call
opal_del_host_sync_notifier() it cannot be sure if correct opal_syncer
is removed.
Hence this patch updates the function to accept a new argument named
'void *data' which is then used to iterates over the opal_syncers list
and only remove the first node node having the matching value for
'notify' callback as 'data'.
Signed-off-by: Vaibhav Jain <vaibhav at linux.ibm.com>
---
Change-log:
v2: Instead of introducing a new function, update the existing
function opal_del_host_sync_notifier() to accept 'void *data' [Vasant]
---
core/opal.c | 7 +++++--
include/opal-internal.h | 2 +-
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/core/opal.c b/core/opal.c
index 3a8ea30b..87aca61c 100644
--- a/core/opal.c
+++ b/core/opal.c
@@ -683,12 +683,15 @@ void opal_add_host_sync_notifier(bool (*notify)(void *data), void *data)
list_add_tail(&opal_syncers, &ent->link);
}
-void opal_del_host_sync_notifier(bool (*notify)(void *data))
+/*
+ * Remove a host sync notifier for given callback and data
+ */
+void opal_del_host_sync_notifier(bool (*notify)(void *data), void *data)
{
struct opal_sync_entry *ent;
list_for_each(&opal_syncers, ent, link) {
- if (ent->notify == notify) {
+ if (ent->notify == notify && ent->data == data) {
list_del(&ent->link);
free(ent);
return;
diff --git a/include/opal-internal.h b/include/opal-internal.h
index 40bad457..2ce25adb 100644
--- a/include/opal-internal.h
+++ b/include/opal-internal.h
@@ -76,7 +76,7 @@ extern void opal_run_pollers(void);
* Warning: no locking, only call that from the init processor
*/
extern void opal_add_host_sync_notifier(bool (*notify)(void *data), void *data);
-extern void opal_del_host_sync_notifier(bool (*notify)(void *data));
+extern void opal_del_host_sync_notifier(bool (*notify)(void *data), void *data);
/*
* Opal internal function prototype
--
2.19.2
More information about the Skiboot
mailing list