/* Used by a driver to check whether a DIO device present in the system is in its list of supported devices. Returns the matching dio_device_id structure or NULL if there is no match.  */
const struct dio_device_id* dio_match_device(const struct dio_device_id *ids, const struct dio_dev *d)
/* Used by a driver to check whether a DIO device present in the system is in its list of supported devices. Returns the matching dio_device_id structure or NULL if there is no match.  */
const struct dio_device_id* dio_match_device(const struct dio_device_id *ids, const struct dio_dev *d)
{
	while (ids->id) {
		if (ids->id == DIO_WILDCARD)
			return ids;
		if (DIO_NEEDSSECID(ids->id & 0xff)) {
			if (ids->id == d->id)
				return ids;
		} else {
			if ((ids->id & 0xff) == (d->id & 0xff))
				return ids;
		}
		ids++;
	}
	return NULL;
}