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

Commit 06e912d4 authored by Borislav Petkov's avatar Borislav Petkov
Browse files

EDAC: Cleanup/sync workqueue functions



They're both running only when ->edac_check is initialized so remove
that check from the workqueue function itself. Synchronize/generalize
the ->op_state check between the two.

Kill useless comments, while at it.

Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
parent 626a7a4d
Loading
Loading
Loading
Loading
+3 −5
Original line number Original line Diff line number Diff line
@@ -535,19 +535,17 @@ static void edac_mc_workq_function(struct work_struct *work_req)


	mutex_lock(&mem_ctls_mutex);
	mutex_lock(&mem_ctls_mutex);


	/* if this control struct has movd to offline state, we are done */
	if (mci->op_state != OP_RUNNING_POLL) {
	if (mci->op_state == OP_OFFLINE) {
		mutex_unlock(&mem_ctls_mutex);
		mutex_unlock(&mem_ctls_mutex);
		return;
		return;
	}
	}


	/* Only poll controllers that are running polled and have a check */
	if (edac_mc_assert_error_check_and_clear())
	if (edac_mc_assert_error_check_and_clear() && (mci->edac_check != NULL))
		mci->edac_check(mci);
		mci->edac_check(mci);


	mutex_unlock(&mem_ctls_mutex);
	mutex_unlock(&mem_ctls_mutex);


	/* Reschedule */
	/* Queue ourselves again. */
	edac_queue_work(&mci->work, msecs_to_jiffies(edac_mc_get_poll_msec()));
	edac_queue_work(&mci->work, msecs_to_jiffies(edac_mc_get_poll_msec()));
}
}


+15 −15
Original line number Original line Diff line number Diff line
@@ -195,10 +195,12 @@ static void edac_pci_workq_function(struct work_struct *work_req)


	mutex_lock(&edac_pci_ctls_mutex);
	mutex_lock(&edac_pci_ctls_mutex);


	if (pci->op_state == OP_RUNNING_POLL) {
	if (pci->op_state != OP_RUNNING_POLL) {
		/* we might be in POLL mode, but there may NOT be a poll func
		mutex_unlock(&edac_pci_ctls_mutex);
		 */
		return;
		if ((pci->edac_check != NULL) && edac_pci_get_check_errors())
	}

	if (edac_pci_get_check_errors())
		pci->edac_check(pci);
		pci->edac_check(pci);


	/* if we are on a one second period, then use round */
	/* if we are on a one second period, then use round */
@@ -208,9 +210,7 @@ static void edac_pci_workq_function(struct work_struct *work_req)
	else
	else
		delay = msecs_to_jiffies(msec);
		delay = msecs_to_jiffies(msec);


		/* Reschedule only if we are in POLL mode */
	edac_queue_work(&pci->work, delay);
	edac_queue_work(&pci->work, delay);
	}


	mutex_unlock(&edac_pci_ctls_mutex);
	mutex_unlock(&edac_pci_ctls_mutex);
}
}