Commit 9c275897 authored by Phillip Potter's avatar Phillip Potter Committed by Greg Kroah-Hartman
Browse files

staging: r8188eu: simplify c2h_evt_hdl function



Simplify c2h_evt_hdl function by removing majority of its code. The
function always returned _FAIL anyway, due to the wrapper function it
calls always returning _FAIL, and its one caller doesn't use the return
value, so this function should just have a return type of void.

Leave the call to c2h_evt_read in place, as without it, event handling
semantics of the driver would be changed, despite nothing actually being
done with the event.

Acked-by: default avatarFabio M. De Francesco <fmdefrancesco@gmail.com>
Acked-by: default avatarMichael Straube <straube.linux@gmail.com>
Signed-off-by: default avatarPhillip Potter <phil@philpotter.co.uk>
Link: https://lore.kernel.org/r/20210829234541.946-3-phil@philpotter.co.uk


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent a6bcac71
Loading
Loading
Loading
Loading
+3 −20
Original line number Diff line number Diff line
@@ -1852,29 +1852,12 @@ u8 rtw_c2h_wk_cmd(struct adapter *padapter, u8 *c2h_evt)
	return res;
}

static s32 c2h_evt_hdl(struct adapter *adapter, struct c2h_evt_hdr *c2h_evt, c2h_id_filter filter)
static void c2h_evt_hdl(struct adapter *adapter, struct c2h_evt_hdr *c2h_evt, c2h_id_filter filter)
{
	s32 ret = _FAIL;
	u8 buf[16];

	if (!c2h_evt) {
		/* No c2h event in cmd_obj, read c2h event before handling*/
		if (c2h_evt_read(adapter, buf) == _SUCCESS) {
			c2h_evt = (struct c2h_evt_hdr *)buf;

			if (filter && !filter(c2h_evt->id))
				goto exit;

			ret = rtw_hal_c2h_handler(adapter, c2h_evt);
		}
	} else {
		if (filter && !filter(c2h_evt->id))
			goto exit;

		ret = rtw_hal_c2h_handler(adapter, c2h_evt);
	}
exit:
	return ret;
	if (!c2h_evt)
		c2h_evt_read(adapter, buf);
}

static void c2h_wk_callback(struct work_struct *work)