Loading drivers/soc/qcom/subsystem_restart.c +34 −0 Original line number Diff line number Diff line Loading @@ -148,6 +148,7 @@ struct restart_log { * @count: reference count of subsystem_get()/subsystem_put() * @id: ida * @restart_level: restart level (0 - panic, 1 - related, 2 - independent, etc.) * @keep_alive: whether keep alive during AP's panic * @restart_order: order of other devices this devices restarts with * @crash_count: number of times the device has crashed * @dentry: debugfs directory for this device Loading @@ -170,6 +171,7 @@ struct subsys_device { int count; int id; int restart_level; bool keep_alive; int crash_count; struct subsys_soc_restart_order *restart_order; #ifdef CONFIG_DEBUG_FS Loading Loading @@ -308,6 +310,31 @@ static ssize_t system_debug_store(struct device *dev, return orig_count; } static ssize_t keep_alive_show(struct device *dev, struct device_attribute *attr, char *buf) { struct subsys_device *subsys = to_subsys(dev); return snprintf(buf, PAGE_SIZE, "%d\n", subsys->keep_alive); } static ssize_t keep_alive_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct subsys_device *subsys = to_subsys(dev); unsigned long value; if (kstrtoul(buf, 0, &value) != 0) return -EINVAL; if (value > 1) return -EINVAL; subsys->keep_alive = (bool)value; return count; } int subsys_get_restart_level(struct subsys_device *dev) { return dev->restart_level; Loading Loading @@ -350,6 +377,7 @@ static struct device_attribute subsys_attrs[] = { __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), __ATTR(keep_alive, 0644, keep_alive_show, keep_alive_store), __ATTR_NULL, }; Loading Loading @@ -1779,6 +1807,12 @@ static int subsys_panic(struct device *dev, void *data) { struct subsys_device *subsys = to_subsys(dev); /* Keeping the subsys alive during panic */ if (!panic_timeout && subsys->keep_alive) { dev_warn(dev, "keeping %s alive\n", subsys->desc->name); return 0; } if (subsys->desc->crash_shutdown) subsys->desc->crash_shutdown(subsys->desc); return 0; Loading Loading
drivers/soc/qcom/subsystem_restart.c +34 −0 Original line number Diff line number Diff line Loading @@ -148,6 +148,7 @@ struct restart_log { * @count: reference count of subsystem_get()/subsystem_put() * @id: ida * @restart_level: restart level (0 - panic, 1 - related, 2 - independent, etc.) * @keep_alive: whether keep alive during AP's panic * @restart_order: order of other devices this devices restarts with * @crash_count: number of times the device has crashed * @dentry: debugfs directory for this device Loading @@ -170,6 +171,7 @@ struct subsys_device { int count; int id; int restart_level; bool keep_alive; int crash_count; struct subsys_soc_restart_order *restart_order; #ifdef CONFIG_DEBUG_FS Loading Loading @@ -308,6 +310,31 @@ static ssize_t system_debug_store(struct device *dev, return orig_count; } static ssize_t keep_alive_show(struct device *dev, struct device_attribute *attr, char *buf) { struct subsys_device *subsys = to_subsys(dev); return snprintf(buf, PAGE_SIZE, "%d\n", subsys->keep_alive); } static ssize_t keep_alive_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct subsys_device *subsys = to_subsys(dev); unsigned long value; if (kstrtoul(buf, 0, &value) != 0) return -EINVAL; if (value > 1) return -EINVAL; subsys->keep_alive = (bool)value; return count; } int subsys_get_restart_level(struct subsys_device *dev) { return dev->restart_level; Loading Loading @@ -350,6 +377,7 @@ static struct device_attribute subsys_attrs[] = { __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), __ATTR(keep_alive, 0644, keep_alive_show, keep_alive_store), __ATTR_NULL, }; Loading Loading @@ -1779,6 +1807,12 @@ static int subsys_panic(struct device *dev, void *data) { struct subsys_device *subsys = to_subsys(dev); /* Keeping the subsys alive during panic */ if (!panic_timeout && subsys->keep_alive) { dev_warn(dev, "keeping %s alive\n", subsys->desc->name); return 0; } if (subsys->desc->crash_shutdown) subsys->desc->crash_shutdown(subsys->desc); return 0; Loading