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 <lars@metafoo.de>
This commit is contained in:
parent
e5ff8e9e0a
commit
f53ff64369
|
@ -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];
|
||||
|
|
Loading…
Reference in New Issue