From 10b6d88af91815681e16f8e44a803a6b35fffbdf Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Mon, 20 Jun 2011 21:14:14 -0300 Subject: [PATCH] libatrf: simplify use of atrf_interrupt_wait now this it is mandatory - lib/atrf.c (atrf_interrupt_wait): interrupt_wait is no longer optional - atrf-proxy/atrf-proxy.c (cmd_more): we no longer need to handle atrf_interrupt_wait being unsupported - lib/atusb-common.c (atusb_interrupt_wait): clarify what we don't want to return -1 on error --- tools/atrf-proxy/atrf-proxy.c | 2 -- tools/lib/atrf.c | 3 +-- tools/lib/atusb-common.c | 3 +-- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/tools/atrf-proxy/atrf-proxy.c b/tools/atrf-proxy/atrf-proxy.c index fbdf344..f860255 100644 --- a/tools/atrf-proxy/atrf-proxy.c +++ b/tools/atrf-proxy/atrf-proxy.c @@ -176,8 +176,6 @@ static int cmd_more(struct atrf_dsc *dsc, struct netio *netio, const char *cmd) res = atrf_interrupt_wait(dsc, n); if (atrf_error(dsc)) return netio_printf(netio, "-I/O error\n"); - if (res < 0) - return netio_printf(netio, "-not supported\n"); return netio_printf(netio, "+0x%02x\n", res); } if (!strcasecmp(cmd, "getram")) { diff --git a/tools/lib/atrf.c b/tools/lib/atrf.c index 15f1b07..57371e4 100644 --- a/tools/lib/atrf.c +++ b/tools/lib/atrf.c @@ -320,6 +320,5 @@ uint8_t atrf_sram_read(struct atrf_dsc *dsc, uint8_t addr) int atrf_interrupt_wait(struct atrf_dsc *dsc, int timeout_ms) { - return dsc->driver->interrupt_wait ? - dsc->driver->interrupt_wait(dsc->handle, timeout_ms) : -1; + return dsc->driver->interrupt_wait(dsc->handle, timeout_ms); } diff --git a/tools/lib/atusb-common.c b/tools/lib/atusb-common.c index bcb588e..6766eda 100644 --- a/tools/lib/atusb-common.c +++ b/tools/lib/atusb-common.c @@ -221,8 +221,7 @@ int atusb_interrupt_wait(void *handle, int timeout_ms) if (res < 0) { fprintf(stderr, "usb_bulk_read: %d\n", res); dsc->error = 1; - return 0; - /* < 0 is already taken by atrf_interrupt_wait */ + return 0; /* handle this via atrf_error */ } timeout_ms = 1; for (i = 0; i != res; i++)