From 0425872203ebf9a53649da3c7922cc5a89aad15f Mon Sep 17 00:00:00 2001 From: Vyacheslav Cherkashin Date: Thu, 17 Oct 2013 17:12:30 +0400 Subject: [PATCH] [FIX] correcting sspt_unregister_feature() feature remove from process instrumentation Change-Id: Iff22ebc90ba0ef1e3af405ac3c8ac5e83bd1c48f Signed-off-by: Vyacheslav Cherkashin --- us_manager/sspt/sspt_feature.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/us_manager/sspt/sspt_feature.c b/us_manager/sspt/sspt_feature.c index 8c468f4..5c41f2f 100644 --- a/us_manager/sspt/sspt_feature.c +++ b/us_manager/sspt/sspt_feature.c @@ -23,6 +23,7 @@ */ #include "sspt_feature.h" +#include "sspt_proc.h" #include #include #include @@ -150,6 +151,26 @@ static void destroy_feature_img(struct sspt_feature_img *fi) kfree(fi); } +static void del_feature_by_img(struct sspt_feature *f, + struct sspt_feature_img *img) +{ + struct sspt_feature_data *fd; + + list_for_each_entry(fd, &f->feature_list, list) { + if (img == fd->img) { + /* delete from list */ + list_del(&fd->list); + destroy_feature_data(fd); + break; + } + } +} + +static void del_feature_from_proc(struct sspt_proc *proc, void *data) +{ + del_feature_by_img(proc->feature, (struct sspt_feature_img *)data); +} + void *sspt_get_feature_data(struct sspt_feature *f, sspt_feature_id_t id) { struct sspt_feature_img *img = (struct sspt_feature_img *)id; @@ -180,7 +201,7 @@ void sspt_unregister_feature(sspt_feature_id_t id) { struct sspt_feature_img *fi = (struct sspt_feature_img *)id; - /* TODO: remove from instrumentation process */ destroy_feature_img(fi); + on_each_proc(del_feature_from_proc, (void *)fi); } EXPORT_SYMBOL_GPL(sspt_unregister_feature); -- 2.7.4