From f53ff6436923b99260a6cbac241fa054ec78d503 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Mon, 23 May 2016 18:21:40 +0200 Subject: [PATCH] link-mso19: mso_receive_data: Simplify device instance lookup The link-mso19 driver currently iterates the device instance list of the driver to get the device instance for which the callback is called. But the device instance is actually passed to the callback as the cb_data parameter, so just use that instead and remove the lookup loop. Besides that the current lookup loop does not even compile either. Signed-off-by: Lars-Peter Clausen --- src/hardware/link-mso19/protocol.c | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/src/hardware/link-mso19/protocol.c b/src/hardware/link-mso19/protocol.c index ae4d1615..5c263adb 100644 --- a/src/hardware/link-mso19/protocol.c +++ b/src/hardware/link-mso19/protocol.c @@ -349,25 +349,10 @@ SR_PRIV int mso_receive_data(int fd, int revents, void *cb_data) { struct sr_datafeed_packet packet; struct sr_datafeed_logic logic; - struct sr_dev_inst *sdi; - GSList *l; + struct sr_dev_inst *sdi = cb_data; + struct dev_context *devc = sdi->priv; int i; - struct drv_context *drvc = di->context; - - /* Find this device's devc struct by its fd. */ - struct dev_context *devc = NULL; - for (l = drvc->instances; l; l = l->next) { - sdi = l->data; - devc = sdi->priv; - if (devc->serial->fd == fd) - break; - devc = NULL; - } - if (!devc) - /* Shouldn't happen. */ - return TRUE; - (void)revents; uint8_t in[1024];