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

Commit 4d87fd48 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: subsystem_restart: Add workqueue for device restart"

parents 1c57a1cf 952c2c9e
Loading
Loading
Loading
Loading
+16 −3
Original line number Diff line number Diff line
@@ -126,6 +126,7 @@ struct restart_log {
 * @work: context for subsystem_restart_wq_func() for this device
 * @ssr_wlock: prevents suspend during subsystem_restart()
 * @wlname: name of wakeup source
 * @device_restart_work: work struct for device restart
 * @track: state tracking and locking
 * @notify: subsys notify handle
 * @dev: device
@@ -145,6 +146,7 @@ struct subsys_device {
	struct work_struct work;
	struct wakeup_source ssr_wlock;
	char wlname[64];
	struct work_struct device_restart_work;
	struct subsys_tracking track;

	void *notify;
@@ -760,6 +762,16 @@ static void __subsystem_restart_dev(struct subsys_device *dev)
	spin_unlock_irqrestore(&track->s_lock, flags);
}

static void device_restart_work_hdlr(struct work_struct *work)
{
	struct subsys_device *dev = container_of(work, struct subsys_device,
							device_restart_work);

	notify_each_subsys_device(&dev, 1, SUBSYS_SOC_RESET, NULL);
	panic("subsys-restart: Resetting the SoC - %s crashed.",
							dev->desc->name);
}

int subsystem_restart_dev(struct subsys_device *dev)
{
	const char *name;
@@ -794,9 +806,9 @@ int subsystem_restart_dev(struct subsys_device *dev)
		__subsystem_restart_dev(dev);
		break;
	case RESET_SOC:
		notify_each_subsys_device(&dev, 1, SUBSYS_SOC_RESET, NULL);
		panic("subsys-restart: Resetting the SoC - %s crashed.", name);
		break;
		__pm_stay_awake(&dev->ssr_wlock);
		schedule_work(&dev->device_restart_work);
		return 0;
	default:
		panic("subsys-restart: Unknown restart level!\n");
		break;
@@ -1318,6 +1330,7 @@ struct subsys_device *subsys_register(struct subsys_desc *desc)
	snprintf(subsys->wlname, sizeof(subsys->wlname), "ssr(%s)", desc->name);
	wakeup_source_init(&subsys->ssr_wlock, subsys->wlname);
	INIT_WORK(&subsys->work, subsystem_restart_wq_func);
	INIT_WORK(&subsys->device_restart_work, device_restart_work_hdlr);
	spin_lock_init(&subsys->track.s_lock);

	subsys->id = ida_simple_get(&subsys_ida, 0, 0, GFP_KERNEL);