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

Commit 31741b5c authored by Karthikeyan Ramasubramanian's avatar Karthikeyan Ramasubramanian Committed by Gerrit - the friendly Code Review server
Browse files

slimbus: Sequentialize the device state notifications



During subsystem restart, queue all the device state notification work
in the same workqueue. This ensures that those notifications reach the
slave drivers in the expected order.

CRs-Fixed: 2139743
Change-Id: I3cdfbdd7ca500c5470c6c29b3a16780dcd2208dc
Signed-off-by: default avatarKarthikeyan Ramasubramanian <kramasub@codeaurora.org>
parent b98e655c
Loading
Loading
Loading
Loading
+17 −9
Original line number Diff line number Diff line
@@ -333,6 +333,20 @@ static void slim_report(struct work_struct *work)
	}
}

static void slim_device_reset(struct work_struct *work)
{
	struct slim_driver *sbdrv;
	struct slim_device *sbdev =
			container_of(work, struct slim_device, device_reset);

	if (!sbdev->dev.driver)
		return;

	sbdrv = to_slim_driver(sbdev->dev.driver);
	if (sbdrv && sbdrv->reset_device)
		sbdrv->reset_device(sbdev);
}

/*
 * slim_add_device: Add a new device without register board info.
 * @ctrl: Controller to which this device is to be added to.
@@ -353,6 +367,7 @@ int slim_add_device(struct slim_controller *ctrl, struct slim_device *sbdev)
	INIT_LIST_HEAD(&sbdev->mark_suspend);
	INIT_LIST_HEAD(&sbdev->mark_removal);
	INIT_WORK(&sbdev->wd, slim_report);
	INIT_WORK(&sbdev->device_reset, slim_device_reset);
	mutex_lock(&ctrl->m_ctrl);
	list_add_tail(&sbdev->dev_list, &ctrl->devs);
	mutex_unlock(&ctrl->m_ctrl);
@@ -684,16 +699,9 @@ void slim_framer_booted(struct slim_controller *ctrl)
	mutex_unlock(&ctrl->sched.m_reconf);
	mutex_lock(&ctrl->m_ctrl);
	list_for_each_safe(pos, next, &ctrl->devs) {
		struct slim_driver *sbdrv;

		sbdev = list_entry(pos, struct slim_device, dev_list);
		mutex_unlock(&ctrl->m_ctrl);
		if (sbdev && sbdev->dev.driver) {
			sbdrv = to_slim_driver(sbdev->dev.driver);
			if (sbdrv->reset_device)
				sbdrv->reset_device(sbdev);
		}
		mutex_lock(&ctrl->m_ctrl);
		if (sbdev)
			queue_work(ctrl->wq, &sbdev->device_reset);
	}
	mutex_unlock(&ctrl->m_ctrl);
}
+2 −0
Original line number Diff line number Diff line
@@ -684,6 +684,7 @@ struct slim_pending_ch {
 *	first time it has reported present.
 *  @dev_list: List of devices on a controller
 *  @wd: Work structure associated with workqueue for presence notification
 *  @device_reset: Work structure for device reset notification
 *  @sldev_reconf: Mutex to protect the pending data-channel lists.
 *  @pending_msgsl: Message bandwidth reservation request by this client in
 *	slots that's pending reconfiguration.
@@ -706,6 +707,7 @@ struct slim_device {
	bool			notified;
	struct list_head	dev_list;
	struct work_struct	wd;
	struct work_struct	device_reset;
	struct mutex		sldev_reconf;
	u32			pending_msgsl;
	u32			cur_msgsl;