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 <redacted>
{
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];