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

Commit f373664c authored by Deepak Katragadda's avatar Deepak Katragadda
Browse files

msm: subsystem_restart: Send sysmon event notifications on powerup



Currently, when a subsystem powers up, there is no mechanism
to let it know about the state of the other online subsystems.

Notifications regarding the current status of other subsystems
are sent to the subsystem being brought out of reset/restarted.
This is done immediately after powering up the subsystem. What
this subsystem does with the notification info is left upto it.

Change-Id: I8d9794babd26dcec7af0ee868f66c7fb4c5c8a34
Signed-off-by: default avatarDeepak Katragadda <dkatraga@codeaurora.org>
parent d86deab8
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -146,6 +146,7 @@ struct restart_log {
 * @do_ramdump_on_put: ramdump on subsystem_put() if true
 * @err_ready: completion variable to record error ready from subsystem
 * @crashed: indicates if subsystem has crashed
 * @notif_state: current state of subsystem in terms of subsys notifications
 */
struct subsys_device {
	struct subsys_desc *desc;
@@ -171,6 +172,7 @@ struct subsys_device {
	dev_t dev_no;
	struct completion err_ready;
	bool crashed;
	int notif_state;
	struct list_head list;
};

@@ -376,6 +378,18 @@ out:
	mutex_unlock(&restart_log_mutex);
}

static void send_sysmon_notif(struct subsys_device *dev)
{
	struct subsys_device *subsys;

	mutex_lock(&subsys_list_lock);
	list_for_each_entry(subsys, &subsys_list, list)
		if ((subsys->notif_state > 0) && (subsys != dev))
			sysmon_send_event(dev->desc->name, subsys->desc->name,
						subsys->notif_state);
	mutex_unlock(&subsys_list_lock);
}

static void for_each_subsys_device(struct subsys_device **list, unsigned count,
		void *data, void (*fn)(struct subsys_device *, void *))
{
@@ -403,6 +417,8 @@ static void notify_each_subsys_device(struct subsys_device **list,

		pdev = container_of(dev->desc->dev, struct platform_device,
									dev);
		dev->notif_state = notif;

		mutex_lock(&subsys_list_lock);
		list_for_each_entry(subsys, &subsys_list, list)
			if (dev != subsys)
@@ -411,6 +427,9 @@ static void notify_each_subsys_device(struct subsys_device **list,
						notif);
		mutex_unlock(&subsys_list_lock);

		if (notif == SUBSYS_AFTER_POWERUP)
			send_sysmon_notif(dev);

		notif_data.crashed = subsys_get_crash_status(dev);
		notif_data.enable_ramdump = enable_ramdumps;
		notif_data.no_auth = dev->desc->no_auth;
@@ -1358,6 +1377,7 @@ struct subsys_device *subsys_register(struct subsys_desc *desc)
	subsys->dev.parent = desc->dev;
	subsys->dev.bus = &subsys_bus_type;
	subsys->dev.release = subsys_device_release;
	subsys->notif_state = -1;

	subsys->notify = subsys_notif_add_subsys(desc->name);