aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/remoteproc/remoteproc.c79
-rw-r--r--include/linux/remoteproc.h9
2 files changed, 15 insertions, 73 deletions
diff --git a/drivers/remoteproc/remoteproc.c b/drivers/remoteproc/remoteproc.c
index 007fc99..13e5c32 100644
--- a/drivers/remoteproc/remoteproc.c
+++ b/drivers/remoteproc/remoteproc.c
@@ -578,17 +578,13 @@ static void complete_remoteproc_crash(struct rproc *rproc)
memcpy(rproc->last_trace_buf1, rproc->trace_buf1,
rproc->last_trace_len1);
pr_info("remoteproc: resetting %s...\n", rproc->name);
- (void)blocking_notifier_call_chain(&rproc->nb_error,
+ (void)blocking_notifier_call_chain(&rproc->nbh,
RPROC_ERROR, NULL);
}
static int _event_notify(struct rproc *rproc, int type, void *data)
{
- struct blocking_notifier_head *nh;
-
- switch (type) {
- case RPROC_ERROR:
- nh = &rproc->nb_error;
+ if (type == RPROC_ERROR) {
mutex_lock(&rproc->lock);
init_completion(&rproc->error_comp);
rproc->state = RPROC_CRASHED;
@@ -599,36 +595,21 @@ static int _event_notify(struct rproc *rproc, int type, void *data)
if (rproc->ops->dump_registers)
rproc->ops->dump_registers(rproc);
- if (!rproc->halt_on_crash)
+ if (!rproc->halt_on_crash) {
complete_remoteproc_crash(rproc);
- else
+ return 0;
+ } else {
pr_info("remoteproc %s: halt-on-crash enabled: " \
"deferring crash recovery\n",
rproc->name);
- break;
-#ifdef CONFIG_REMOTE_PROC_AUTOSUSPEND
- case RPROC_PRE_SUSPEND:
- nh = &rproc->nb_presus;
- break;
- case RPROC_POS_SUSPEND:
- nh = &rproc->nb_possus;
- break;
- case RPROC_RESUME:
- nh = &rproc->nb_resume;
- break;
-#endif
- default:
- return -EINVAL;
- }
-
- if (type == RPROC_ERROR) {
+ }
/* FIXME: send uevent here */
pr_info("remoteproc: %s has crashed (core dump available)\n",
rproc->name);
return 0;
}
- return blocking_notifier_call_chain(nh, type, data);
+ return blocking_notifier_call_chain(&rproc->nbh, type, data);
}
/**
@@ -1367,45 +1348,15 @@ static void rproc_error_work(struct work_struct *work)
_event_notify(rproc, RPROC_ERROR, NULL);
}
-static int _register(struct rproc *rproc,
- struct notifier_block *nb, int type, bool reg)
+int rproc_event_register(struct rproc *rproc, struct notifier_block *nb)
{
- struct blocking_notifier_head *nh;
-
- switch (type) {
- case RPROC_ERROR:
- nh = &rproc->nb_error;
- break;
-#ifdef CONFIG_REMOTE_PROC_AUTOSUSPEND
- case RPROC_PRE_SUSPEND:
- nh = &rproc->nb_presus;
- break;
- case RPROC_POS_SUSPEND:
- nh = &rproc->nb_possus;
- break;
- case RPROC_RESUME:
- nh = &rproc->nb_resume;
- break;
-#endif
- default:
- return -EINVAL;
- }
-
- return (reg) ? blocking_notifier_chain_register(nh, nb) :
- blocking_notifier_chain_unregister(nh, nb);
-}
-
-int rproc_event_register(struct rproc *rproc,
- struct notifier_block *nb, int type)
-{
- return _register(rproc, nb, type, true);
+ return blocking_notifier_chain_register(&rproc->nbh, nb);
}
EXPORT_SYMBOL_GPL(rproc_event_register);
-int rproc_event_unregister(struct rproc *rproc,
- struct notifier_block *nb, int type)
+int rproc_event_unregister(struct rproc *rproc, struct notifier_block *nb)
{
- return _register(rproc, nb, type, false);
+ return blocking_notifier_chain_unregister(&rproc->nbh, nb);
}
EXPORT_SYMBOL_GPL(rproc_event_unregister);
@@ -1669,7 +1620,7 @@ int rproc_register(struct device *dev, const char *name,
#endif
mutex_init(&rproc->lock);
INIT_WORK(&rproc->error_work, rproc_error_work);
- BLOCKING_INIT_NOTIFIER_HEAD(&rproc->nb_error);
+ BLOCKING_INIT_NOTIFIER_HEAD(&rproc->nbh);
rproc->state = RPROC_OFFLINE;
@@ -1707,12 +1658,6 @@ int rproc_register(struct device *dev, const char *name,
debugfs_create_file("name", 0400, rproc->dbg_dir, rproc,
&rproc_name_ops);
-#ifdef CONFIG_REMOTE_PROC_AUTOSUSPEND
- BLOCKING_INIT_NOTIFIER_HEAD(&rproc->nb_presus);
- BLOCKING_INIT_NOTIFIER_HEAD(&rproc->nb_possus);
- BLOCKING_INIT_NOTIFIER_HEAD(&rproc->nb_resume);
-#endif
-
out:
return 0;
}
diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h
index 9249a13..29cfe1c 100644
--- a/include/linux/remoteproc.h
+++ b/include/linux/remoteproc.h
@@ -266,15 +266,12 @@ struct rproc {
int cdump_len0, cdump_len1;
struct completion firmware_loading_complete;
struct work_struct error_work;
- struct blocking_notifier_head nb_error;
+ struct blocking_notifier_head nbh;
struct completion error_comp;
#ifdef CONFIG_REMOTE_PROC_AUTOSUSPEND
unsigned sus_timeout;
bool force_suspend;
bool need_resume;
- struct blocking_notifier_head nb_presus;
- struct blocking_notifier_head nb_possus;
- struct blocking_notifier_head nb_resume;
struct mutex pm_lock;
#endif
struct pm_qos_request_list *qos_request;
@@ -288,8 +285,8 @@ struct rproc {
int rproc_set_secure(const char *, bool);
struct rproc *rproc_get(const char *);
void rproc_put(struct rproc *);
-int rproc_event_register(struct rproc *, struct notifier_block *, int);
-int rproc_event_unregister(struct rproc *, struct notifier_block *, int);
+int rproc_event_register(struct rproc *, struct notifier_block *);
+int rproc_event_unregister(struct rproc *, struct notifier_block *);
int rproc_register(struct device *, const char *, const struct rproc_ops *,
const char *, struct rproc_mem_pool *, struct module *,
unsigned int timeout);