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

Commit 38ef0779 authored by Bhaumik Bhatt's avatar Bhaumik Bhatt
Browse files

mhi: core: remove the system error worker thread



Remove the system error worker thread and instead have the
execution environment worker handle that transition to serialize
processing and avoid any possible race conditions during
shutdown.

Change-Id: Ia9c0dbcdcd516383e235a63689cb022bbae7117c
Signed-off-by: default avatarBhaumik Bhatt <bbhatt@codeaurora.org>
parent 7e711cbf
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -1342,7 +1342,6 @@ int of_register_mhi_controller(struct mhi_controller *mhi_cntrl)
	spin_lock_init(&mhi_cntrl->wlock);
	INIT_WORK(&mhi_cntrl->st_worker, mhi_pm_st_worker);
	INIT_WORK(&mhi_cntrl->fw_worker, mhi_fw_load_worker);
	INIT_WORK(&mhi_cntrl->syserr_worker, mhi_pm_sys_err_worker);
	INIT_WORK(&mhi_cntrl->low_priority_worker, mhi_low_priority_worker);
	init_waitqueue_head(&mhi_cntrl->state_event);

+1 −1
Original line number Diff line number Diff line
@@ -746,7 +746,7 @@ int mhi_queue_state_transition(struct mhi_controller *mhi_cntrl,
			       enum MHI_ST_TRANSITION state);
void mhi_pm_st_worker(struct work_struct *work);
void mhi_fw_load_worker(struct work_struct *work);
void mhi_pm_sys_err_worker(struct work_struct *work);
void mhi_process_sys_err(struct mhi_controller *mhi_cntrl);
void mhi_low_priority_worker(struct work_struct *work);
int mhi_ready_state_transition(struct mhi_controller *mhi_cntrl);
void mhi_ctrl_ev_task(unsigned long data);
+3 −4
Original line number Diff line number Diff line
@@ -1194,8 +1194,7 @@ int mhi_process_ctrl_ev_ring(struct mhi_controller *mhi_cntrl,
							MHI_PM_SYS_ERR_DETECT);
				write_unlock_irq(&mhi_cntrl->pm_lock);
				if (new_state == MHI_PM_SYS_ERR_DETECT)
					schedule_work(
						&mhi_cntrl->syserr_worker);
					mhi_process_sys_err(mhi_cntrl);
				break;
			}
			default:
@@ -1539,7 +1538,7 @@ void mhi_ctrl_ev_task(unsigned long data)
		}
		write_unlock_irq(&mhi_cntrl->pm_lock);
		if (pm_state == MHI_PM_SYS_ERR_DETECT)
			schedule_work(&mhi_cntrl->syserr_worker);
			mhi_process_sys_err(mhi_cntrl);
	}
}

@@ -1624,7 +1623,7 @@ irqreturn_t mhi_intvec_threaded_handlr(int irq_number, void *dev)
			mhi_cntrl->status_cb(mhi_cntrl, mhi_cntrl->priv_data,
					     MHI_CB_FATAL_ERROR);
		else
			schedule_work(&mhi_cntrl->syserr_worker);
			mhi_process_sys_err(mhi_cntrl);
	}

exit_intvec:
+11 −21
Original line number Diff line number Diff line
@@ -549,20 +549,9 @@ static void mhi_pm_disable_transition(struct mhi_controller *mhi_cntrl,
		to_mhi_pm_state_str(transition_state));

	/* We must notify MHI control driver so it can clean up first */
	if (transition_state == MHI_PM_SYS_ERR_PROCESS) {
		/*
		 * if controller support rddm, we do not process
		 * sys error state, instead we will jump directly
		 * to rddm state
		 */
		if (mhi_cntrl->rddm_image) {
			MHI_LOG(
				"Controller Support RDDM, skipping SYS_ERR_PROCESS\n");
			return;
		}
	if (transition_state == MHI_PM_SYS_ERR_PROCESS)
		mhi_cntrl->status_cb(mhi_cntrl, mhi_cntrl->priv_data,
				     MHI_CB_SYS_ERROR);
	}

	mutex_lock(&mhi_cntrl->pm_mutex);
	write_lock_irq(&mhi_cntrl->pm_lock);
@@ -724,7 +713,7 @@ int mhi_debugfs_trigger_reset(void *data, u64 val)
	write_unlock_irq(&mhi_cntrl->pm_lock);

	if (cur_state == MHI_PM_SYS_ERR_DETECT)
		schedule_work(&mhi_cntrl->syserr_worker);
		mhi_process_sys_err(mhi_cntrl);

	return 0;
}
@@ -808,15 +797,16 @@ void mhi_low_priority_worker(struct work_struct *work)
	}
}

void mhi_pm_sys_err_worker(struct work_struct *work)
void mhi_process_sys_err(struct mhi_controller *mhi_cntrl)
{
	struct mhi_controller *mhi_cntrl = container_of(work,
							struct mhi_controller,
							syserr_worker);

	MHI_LOG("Enter with pm_state:%s MHI_STATE:%s\n",
		to_mhi_pm_state_str(mhi_cntrl->pm_state),
		TO_MHI_STATE_STR(mhi_cntrl->dev_state));
	/*
	 * if controller supports rddm, we do not process sys error state,
	 * instead we will jump directly to rddm state
	 */
	if (mhi_cntrl->rddm_image) {
		MHI_LOG("Controller supports RDDM, skipping SYS_ERR_PROCESS\n");
		return;
	}

	mhi_queue_disable_transition(mhi_cntrl, MHI_PM_SYS_ERR_PROCESS);
}
+0 −1
Original line number Diff line number Diff line
@@ -330,7 +330,6 @@ struct mhi_controller {
	/* worker for different state transitions */
	struct work_struct st_worker;
	struct work_struct fw_worker;
	struct work_struct syserr_worker;
	struct work_struct low_priority_worker;
	wait_queue_head_t state_event;