diff options
| author | Meghana Ashok <meghanaa@codeaurora.org> | 2017-04-13 16:00:16 +0530 |
|---|---|---|
| committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2017-05-23 00:19:49 -0700 |
| commit | 5b22bf499b81f0ffcf76647ce0ee58743f98ca4f (patch) | |
| tree | 82ece25356c01f2dae7c4568f4401f2214496c12 | |
| parent | 60be71604a84d2e047215cb702d6324379a353bb (diff) | |
soc: qcom: ssr: Add subsys_set_error API
Adding a new API subsys_set_error() which can indicate reason why a
subsystem failed to come up. This error reason can be useful for some
userspace helper application to take appropriate action.
Change-Id: I6df3580befd48a6b83bb8fd1099475da42fc9cf2
Signed-off-by: Meghana Ashok <meghanaa@codeaurora.org>
| -rw-r--r-- | drivers/soc/qcom/subsystem_restart.c | 14 | ||||
| -rw-r--r-- | include/soc/qcom/subsystem_restart.h | 1 |
2 files changed, 15 insertions, 0 deletions
diff --git a/drivers/soc/qcom/subsystem_restart.c b/drivers/soc/qcom/subsystem_restart.c index 51f4ec79db10..6afe2fb8cd75 100644 --- a/drivers/soc/qcom/subsystem_restart.c +++ b/drivers/soc/qcom/subsystem_restart.c @@ -158,6 +158,7 @@ struct subsys_device { struct work_struct work; struct wakeup_source ssr_wlock; char wlname[64]; + char error_buf[64]; struct work_struct device_restart_work; struct subsys_tracking track; @@ -323,6 +324,12 @@ static void subsys_set_state(struct subsys_device *subsys, spin_unlock_irqrestore(&subsys->track.s_lock, flags); } +static ssize_t error_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + return snprintf(buf, PAGE_SIZE, "%s\n", to_subsys(dev)->error_buf); +} + /** * subsytem_default_online() - Mark a subsystem as online by default * @dev: subsystem to mark as online @@ -341,6 +348,7 @@ static struct device_attribute subsys_attrs[] = { __ATTR_RO(name), __ATTR_RO(state), __ATTR_RO(crash_count), + __ATTR_RO(error), __ATTR(restart_level, 0644, restart_level_show, restart_level_store), __ATTR(firmware_name, 0644, firmware_name_show, firmware_name_store), __ATTR(system_debug, 0644, system_debug_show, system_debug_store), @@ -1174,6 +1182,12 @@ enum crash_status subsys_get_crash_status(struct subsys_device *dev) return dev->crashed; } +void subsys_set_error(struct subsys_device *dev, const char *error_msg) +{ + snprintf(dev->error_buf, sizeof(dev->error_buf), "%s", error_msg); + sysfs_notify(&dev->dev.kobj, NULL, "error"); +} + static struct subsys_device *desc_to_subsys(struct device *d) { struct subsys_device *device, *subsys_dev = 0; diff --git a/include/soc/qcom/subsystem_restart.h b/include/soc/qcom/subsystem_restart.h index b08cc7ded26e..9a4d013b363c 100644 --- a/include/soc/qcom/subsystem_restart.h +++ b/include/soc/qcom/subsystem_restart.h @@ -133,6 +133,7 @@ extern void subsys_default_online(struct subsys_device *dev); extern void subsys_set_crash_status(struct subsys_device *dev, enum crash_status crashed); extern enum crash_status subsys_get_crash_status(struct subsys_device *dev); +extern void subsys_set_error(struct subsys_device *dev, const char *error_msg); void notify_proxy_vote(struct device *device); void notify_proxy_unvote(struct device *device); void complete_err_ready(struct subsys_device *subsys); |
