diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-11-17 00:16:14 +0200 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-11-17 00:16:14 +0200 |
commit | f4a6a577ab133781c06aec029c806c878555730a (patch) | |
tree | 0ef4da33c7e796c215daac7b74167ce74ba1fd28 /stmhal/usb.c | |
parent | 5228854f0e026838c21a1e603dab77bb61d2fada (diff) |
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.
Diffstat (limited to 'stmhal/usb.c')
-rw-r--r-- | stmhal/usb.c | 7 |
1 files changed, 2 insertions, 5 deletions
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; } |