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

Commit 21f569af authored by Brian Norris's avatar Brian Norris Committed by Kalle Valo
Browse files

mwifiex: initiate card-specific work atomically



The non-atomic test + set is a little awkward here, and it technically
means we might double-schedule work unnecessarily. AFAICT, this is not
really a problem, since the extra "work" will be a no-op (the flag(s)
will be cleared by then), but it's still an anti-pattern.

Rewrite this to use the atomic test_and_set_bit() helper instead.

Signed-off-by: default avatarBrian Norris <briannorris@chromium.org>
Reviewed-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 83625a40
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
@@ -2837,11 +2837,8 @@ static void mwifiex_pcie_device_dump(struct mwifiex_adapter *adapter)
{
	struct pcie_service_card *card = adapter->card;

	if (test_bit(MWIFIEX_IFACE_WORK_DEVICE_DUMP, &card->work_flags))
		return;

	set_bit(MWIFIEX_IFACE_WORK_DEVICE_DUMP, &card->work_flags);

	if (!test_and_set_bit(MWIFIEX_IFACE_WORK_DEVICE_DUMP,
			      &card->work_flags))
		schedule_work(&card->work);
}

+5 −11
Original line number Diff line number Diff line
@@ -2533,11 +2533,7 @@ static void mwifiex_sdio_card_reset(struct mwifiex_adapter *adapter)
{
	struct sdio_mmc_card *card = adapter->card;

	if (test_bit(MWIFIEX_IFACE_WORK_CARD_RESET, &card->work_flags))
		return;

	set_bit(MWIFIEX_IFACE_WORK_CARD_RESET, &card->work_flags);

	if (!test_and_set_bit(MWIFIEX_IFACE_WORK_CARD_RESET, &card->work_flags))
		schedule_work(&card->work);
}

@@ -2546,10 +2542,8 @@ static void mwifiex_sdio_device_dump(struct mwifiex_adapter *adapter)
{
	struct sdio_mmc_card *card = adapter->card;

	if (test_bit(MWIFIEX_IFACE_WORK_DEVICE_DUMP, &card->work_flags))
		return;

	set_bit(MWIFIEX_IFACE_WORK_DEVICE_DUMP, &card->work_flags);
	if (!test_and_set_bit(MWIFIEX_IFACE_WORK_DEVICE_DUMP,
			      &card->work_flags))
		schedule_work(&card->work);
}