summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--py/obj.h2
-rw-r--r--stmhal/can.c7
-rw-r--r--stmhal/modcc3k.c7
-rw-r--r--stmhal/moduselect.c4
-rw-r--r--stmhal/uart.c7
-rw-r--r--stmhal/usb.c7
6 files changed, 11 insertions, 23 deletions
diff --git a/py/obj.h b/py/obj.h
index 592ae8afd0..ab5123417f 100644
--- a/py/obj.h
+++ b/py/obj.h
@@ -238,7 +238,7 @@ typedef struct _mp_stream_p_t {
// are implementation-dependent, but will be exposed to user, e.g. via exception).
mp_uint_t (*read)(mp_obj_t obj, void *buf, mp_uint_t size, int *errcode);
mp_uint_t (*write)(mp_obj_t obj, const void *buf, mp_uint_t size, int *errcode);
- mp_uint_t (*ioctl)(mp_obj_t obj, mp_uint_t request, int *errcode, ...);
+ mp_uint_t (*ioctl)(mp_obj_t obj, mp_uint_t request, mp_uint_t arg, int *errcode);
mp_uint_t is_text : 1; // default is bytes, set this for text stream
} mp_stream_p_t;
diff --git a/stmhal/can.c b/stmhal/can.c
index 4b06b13eda..13b876c9fc 100644
--- a/stmhal/can.c
+++ b/stmhal/can.c
@@ -418,13 +418,11 @@ STATIC const mp_map_elem_t pyb_can_locals_dict_table[] = {
STATIC MP_DEFINE_CONST_DICT(pyb_can_locals_dict, pyb_can_locals_dict_table);
-mp_uint_t can_ioctl(mp_obj_t self_in, mp_uint_t request, int *errcode, ...) {
+mp_uint_t can_ioctl(mp_obj_t self_in, mp_uint_t request, mp_uint_t arg, int *errcode) {
pyb_can_obj_t *self = self_in;
- va_list vargs;
- va_start(vargs, 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)
&& ((__HAL_CAN_MSG_PENDING(&self->can, CAN_FIFO0) != 0)
@@ -438,7 +436,6 @@ mp_uint_t can_ioctl(mp_obj_t self_in, mp_uint_t request, int *errcode, ...) {
*errcode = EINVAL;
ret = -1;
}
- va_end(vargs);
return ret;
}
diff --git a/stmhal/modcc3k.c b/stmhal/modcc3k.c
index 7b908e8950..5eab86101b 100644
--- a/stmhal/modcc3k.c
+++ b/stmhal/modcc3k.c
@@ -583,13 +583,11 @@ STATIC const mp_map_elem_t cc3k_socket_locals_dict_table[] = {
STATIC MP_DEFINE_CONST_DICT(cc3k_socket_locals_dict, cc3k_socket_locals_dict_table);
-mp_uint_t cc3k_ioctl(mp_obj_t self_in, mp_uint_t request, int *errcode, ...) {
+mp_uint_t cc3k_ioctl(mp_obj_t self_in, mp_uint_t request, mp_uint_t arg, int *errcode) {
cc3k_socket_obj_t *self = self_in;
- va_list vargs;
- va_start(vargs, 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;
int fd = self->fd;
@@ -642,7 +640,6 @@ mp_uint_t cc3k_ioctl(mp_obj_t self_in, mp_uint_t request, int *errcode, ...) {
*errcode = EINVAL;
ret = -1;
}
- va_end(vargs);
return ret;
}
diff --git a/stmhal/moduselect.c b/stmhal/moduselect.c
index d1bf522893..ec5910a712 100644
--- a/stmhal/moduselect.c
+++ b/stmhal/moduselect.c
@@ -44,7 +44,7 @@
typedef struct _poll_obj_t {
mp_obj_t obj;
- mp_uint_t (*ioctl)(mp_obj_t obj, mp_uint_t request, int *errcode, ...);
+ mp_uint_t (*ioctl)(mp_obj_t obj, mp_uint_t request, mp_uint_t arg, int *errcode);
mp_uint_t flags;
mp_uint_t flags_ret;
} poll_obj_t;
@@ -85,7 +85,7 @@ STATIC mp_uint_t poll_map_poll(mp_map_t *poll_map, mp_uint_t *rwx_num) {
poll_obj_t *poll_obj = (poll_obj_t*)poll_map->table[i].value;
int errcode;
- mp_int_t ret = poll_obj->ioctl(poll_obj->obj, MP_IOCTL_POLL, &errcode, poll_obj->flags);
+ mp_int_t ret = poll_obj->ioctl(poll_obj->obj, MP_IOCTL_POLL, poll_obj->flags, &errcode);
poll_obj->flags_ret = ret;
if (ret == -1) {
diff --git a/stmhal/uart.c b/stmhal/uart.c
index f29ccfeb31..870fa49837 100644
--- a/stmhal/uart.c
+++ b/stmhal/uart.c
@@ -713,13 +713,11 @@ STATIC mp_uint_t pyb_uart_write(mp_obj_t self_in, const void *buf_in, mp_uint_t
}
}
-STATIC mp_uint_t pyb_uart_ioctl(mp_obj_t self_in, mp_uint_t request, int *errcode, ...) {
+STATIC mp_uint_t pyb_uart_ioctl(mp_obj_t self_in, mp_uint_t request, mp_uint_t arg, int *errcode) {
pyb_uart_obj_t *self = self_in;
- va_list vargs;
- va_start(vargs, 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) && uart_rx_any(self)) {
ret |= MP_IOCTL_POLL_RD;
@@ -731,7 +729,6 @@ STATIC mp_uint_t pyb_uart_ioctl(mp_obj_t self_in, mp_uint_t request, int *errcod
*errcode = EINVAL;
ret = MP_STREAM_ERROR;
}
- va_end(vargs);
return ret;
}
diff --git a/stmhal/usb.c b/stmhal/usb.c
index ea2bd1c449..2dc7898944 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;
}