Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1767352c authored by Deepak Katragadda's avatar Deepak Katragadda
Browse files

msm: ssr: Add sysfs entry to show number of subsystem crashes



Add a sysfs entry in the subsys* directory for each subsystem
called 'crash_count'. This entry gives the number of times that
a subsystem has crashed in the time that the device has been on.

Change-Id: I234b9dfb0fd59bce4ca19180c5c3d6452098488b
Signed-off-by: default avatarDeepak Katragadda <dkatraga@codeaurora.org>
parent 6f1c4b95
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -134,6 +134,7 @@ struct restart_log {
 * @id: ida
 * @restart_level: restart level (0 - panic, 1 - related, 2 - independent, etc.)
 * @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
 * @do_ramdump_on_put: ramdump on subsystem_put() if true
 * @err_ready: completion variable to record error ready from subsystem
@@ -153,6 +154,7 @@ struct subsys_device {
	int count;
	int id;
	int restart_level;
	int crash_count;
	struct subsys_soc_restart_order *restart_order;
#ifdef CONFIG_DEBUG_FS
	struct dentry *dentry;
@@ -183,6 +185,12 @@ static ssize_t state_show(struct device *dev, struct device_attribute *attr,
	return snprintf(buf, PAGE_SIZE, "%s\n", subsys_states[state]);
}

static ssize_t crash_count_show(struct device *dev,
				struct device_attribute *attr, char *buf)
{
	return snprintf(buf, PAGE_SIZE, "%d\n", to_subsys(dev)->crash_count);
}

static ssize_t
restart_level_show(struct device *dev, struct device_attribute *attr, char *buf)
{
@@ -247,6 +255,7 @@ EXPORT_SYMBOL(subsys_default_online);
static struct device_attribute subsys_attrs[] = {
	__ATTR_RO(name),
	__ATTR_RO(state),
	__ATTR_RO(crash_count),
	__ATTR(restart_level, 0644, restart_level_show, restart_level_store),
	__ATTR_NULL,
};
@@ -437,6 +446,7 @@ static void subsystem_shutdown(struct subsys_device *dev, void *data)
	if (dev->desc->shutdown(dev->desc, true) < 0)
		panic("subsys-restart: [%p]: Failed to shutdown %s!",
			current, name);
	dev->crash_count++;
	subsys_set_state(dev, SUBSYS_OFFLINE);
	disable_all_irqs(dev);
}