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

Commit 8fcb01f1 authored by Meghana Ashok's avatar Meghana Ashok Committed by Gerrit - the friendly Code Review server
Browse files

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: default avatarMeghana Ashok <meghanaa@codeaurora.org>
parent f5c81bb5
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -160,6 +160,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;

@@ -351,6 +352,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
@@ -369,6 +376,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),
@@ -1180,6 +1188,12 @@ bool 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;
+1 −0
Original line number Diff line number Diff line
@@ -125,6 +125,7 @@ extern void subsys_unregister(struct subsys_device *dev);
extern void subsys_default_online(struct subsys_device *dev);
extern void subsys_set_crash_status(struct subsys_device *dev, bool crashed);
extern bool 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);