[igt-dev] [PATCH i-g-t v4 1/2] Introduce multi-device selection API
Katarzyna Dec
katarzyna.dec at intel.com
Wed Aug 21 11:58:09 UTC 2019
On Wed, Aug 21, 2019 at 01:04:30PM +0200, Katarzyna Dec wrote:
> > + * igt_device_card_match
> > + * @filter: filter string
> > + * @card: pointer to igt_device_card struct
> > + *
> > + * Function applies filter to match device from device array.
> > + *
> > + * Returns:
> > + * false - no card pointer was passed or card wasn't matched,
> > + * true - card matched and returned.
> > + */
> > +bool igt_device_card_match(const char *filter, struct igt_device_card *card)
> > +{
> > + struct igt_device *dev = NULL;
> > +
> > + if (!card)
> > + return false;
> > + memset(card, 0, sizeof(*card));
> > +
> > + igt_devices_scan(false);
> > +
> > + if (igt_device_filter_apply(filter) == false)
> > + return false;
> > +
> > + if (!igt_devs.view->len)
> > + return false;
> > +
> > + /* We take first one if more than one card matches filter */
> > + dev = g_ptr_array_index(igt_devs.view, 0);
> > + card->chipset = DRIVER_ANY;
> > + if (dev->vs)
> > + card->chipset = dev->vs->chipset;
> > +
> > + safe_strncpy(card->subsystem, dev->subsystem, NAME_MAX);
> > + safe_strncpy(card->card, dev->drm_card, NAME_MAX);
> > + safe_strncpy(card->render, dev->drm_render, NAME_MAX);
> This macro is returing true/false, do we check the results? It looks like magic
> to me :)
Now it is not magic :) After a good lunch I realized what is going on here :)
Kasia :)
More information about the igt-dev
mailing list