From f4a6a577ab133781c06aec029c806c878555730a Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Mon, 17 Nov 2014 00:16:14 +0200 Subject: stream: Convert .ioctl() to take fixed number of args. This is more efficient, as allows to use register calling convention. If needed, a structure pointer can be passed as argument to pass more data. --- stmhal/usb.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'stmhal/usb.c') diff --git a/stmhal/usb.c b/stmhal/usb.c index ea2bd1c44..2dc789894 100644 --- a/stmhal/usb.c +++ b/stmhal/usb.c @@ -292,12 +292,10 @@ STATIC mp_uint_t pyb_usb_vcp_write(mp_obj_t self_in, const void *buf, mp_uint_t return ret; } -STATIC mp_uint_t pyb_usb_vcp_ioctl(mp_obj_t self_in, mp_uint_t request, int *errcode, ...) { - va_list vargs; - va_start(vargs, errcode); +STATIC mp_uint_t pyb_usb_vcp_ioctl(mp_obj_t self_in, mp_uint_t request, mp_uint_t arg, int *errcode) { mp_uint_t ret; if (request == MP_IOCTL_POLL) { - mp_uint_t flags = va_arg(vargs, mp_uint_t); + mp_uint_t flags = arg; ret = 0; if ((flags & MP_IOCTL_POLL_RD) && USBD_CDC_RxNum() > 0) { ret |= MP_IOCTL_POLL_RD; @@ -309,7 +307,6 @@ STATIC mp_uint_t pyb_usb_vcp_ioctl(mp_obj_t self_in, mp_uint_t request, int *err *errcode = EINVAL; ret = MP_STREAM_ERROR; } - va_end(vargs); return ret; } -- cgit v1.2.3