Lines Matching refs:id

143  * @id: the ctl element id to send notification
145 * This function adds an event record with the given id and mask, appends
150 struct snd_ctl_elem_id *id)
155 if (snd_BUG_ON(!card || !id))
169 if (ev->id.numid == id->numid) {
176 ev->id = *id;
203 struct snd_ctl_elem_id id = kctl->id;
206 id.index += ioff;
207 id.numid += ioff;
208 snd_ctl_notify(card, mask, &id);
292 kctl->id.iface = ncontrol->iface;
293 kctl->id.device = ncontrol->device;
294 kctl->id.subdevice = ncontrol->subdevice;
296 strscpy(kctl->id.name, ncontrol->name, sizeof(kctl->id.name));
297 if (strcmp(ncontrol->name, kctl->id.name) != 0)
299 ncontrol->name, kctl->id.name);
301 kctl->id.index = ncontrol->index;
343 if (kctl->id.numid < card->last_numid + 1 + count &&
344 kctl->id.numid + kctl->count > card->last_numid + 1) {
345 card->last_numid = kctl->id.numid + kctl->count - 1;
366 /* check whether the given id is contained in the given kctl */
368 const struct snd_ctl_elem_id *id)
370 return kctl->id.iface == id->iface &&
371 kctl->id.device == id->device &&
372 kctl->id.subdevice == id->subdevice &&
373 !strncmp(kctl->id.name, id->name, sizeof(kctl->id.name)) &&
374 kctl->id.index <= id->index &&
375 kctl->id.index + kctl->count > id->index;
379 /* Compute a hash key for the corresponding ctl id
384 static unsigned long get_ctl_id_hash(const struct snd_ctl_elem_id *id)
389 h = id->iface;
390 h = MULTIPLIER * h + id->device;
391 h = MULTIPLIER * h + id->subdevice;
392 for (i = 0; i < SNDRV_CTL_ELEM_ID_NAME_MAXLEN && id->name[i]; i++)
393 h = MULTIPLIER * h + id->name[i];
394 h = MULTIPLIER * h + id->index;
403 struct snd_ctl_elem_id id = kcontrol->id;
406 xa_store_range(&card->ctl_numids, kcontrol->id.numid,
407 kcontrol->id.numid + kcontrol->count - 1,
411 id.index = kcontrol->id.index + i;
412 if (xa_insert(&card->ctl_hash, get_ctl_id_hash(&id),
417 id.iface, id.name, id.index);
426 struct snd_ctl_elem_id id = kcontrol->id;
432 xa_erase(&card->ctl_numids, id.numid);
433 h = get_ctl_id_hash(&id);
436 elem_id_matches(matched, &id)))
438 id.index++;
439 id.numid++;
462 struct snd_ctl_elem_id id;
469 id = kcontrol->id;
470 if (id.index > UINT_MAX - kcontrol->count)
473 old = snd_ctl_find_id_locked(card, &id);
481 id.iface, id.device, id.subdevice, id.name,
482 id.index);
496 kcontrol->id.numid = card->last_numid + 1;
620 * snd_ctl_remove_id - remove the control of the given id and release it
622 * @id: the control id to remove
624 * Finds the control instance with the given id, removes it from the
629 int snd_ctl_remove_id(struct snd_card *card, struct snd_ctl_elem_id *id)
634 kctl = snd_ctl_find_id_locked(card, id);
644 * @id: the control id to remove
646 * Finds the control instance with the given id, removes it from the
652 struct snd_ctl_elem_id *id)
659 kctl = snd_ctl_find_id_locked(card, id);
671 * snd_ctl_activate_id - activate/inactivate the control of the given id
673 * @id: the control id to activate/inactivate
676 * Finds the control instance with the given id, and activate or
682 int snd_ctl_activate_id(struct snd_card *card, struct snd_ctl_elem_id *id,
691 kctl = snd_ctl_find_id_locked(card, id);
696 index_offset = snd_ctl_get_ioff(kctl, id);
708 snd_ctl_build_ioff(id, kctl, index_offset);
721 * snd_ctl_rename_id - replace the id of a control on the card
723 * @src_id: the old id
724 * @dst_id: the new id
726 * Finds the control with the old id from the card, and replaces the
727 * id with the new one.
748 saved_numid = kctl->id.numid;
750 kctl->id = *dst_id;
751 kctl->id.numid = saved_numid;
773 if (strscpy(kctl->id.name, name, sizeof(kctl->id.name)) < 0)
775 name, kctl->id.name);
788 if (kctl->id.numid <= numid && kctl->id.numid + kctl->count > numid)
796 * snd_ctl_find_numid_locked - find the control instance with the given number-id
798 * @numid: the number-id to search
800 * Finds the control instance with the given number-id from the card.
822 * snd_ctl_find_numid - find the control instance with the given number-id
824 * @numid: the number-id to search
826 * Finds the control instance with the given number-id from the card.
841 * snd_ctl_find_id_locked - find the control instance with the given id
843 * @id: the id to search
845 * Finds the control instance with the given id from the card.
853 const struct snd_ctl_elem_id *id)
857 if (snd_BUG_ON(!card || !id))
860 if (id->numid != 0)
861 return snd_ctl_find_numid_locked(card, id->numid);
863 kctl = xa_load(&card->ctl_hash, get_ctl_id_hash(id));
864 if (kctl && elem_id_matches(kctl, id))
871 if (elem_id_matches(kctl, id))
879 * snd_ctl_find_id - find the control instance with the given id
881 * @id: the id to search
883 * Finds the control instance with the given id from the card.
890 const struct snd_ctl_elem_id *id)
893 return snd_ctl_find_id_locked(card, id);
907 strscpy(info->id, card->id, sizeof(info->id));
923 struct snd_ctl_elem_id id;
940 snd_ctl_build_ioff(&id, kctl, jidx);
941 if (copy_to_user(list->pids + list->used, &id, sizeof(id)))
987 info->id.iface, info->id.device,
988 info->id.subdevice, info->id.name,
989 info->id.index, info->type);
997 info->id.iface, info->id.device,
998 info->id.subdevice, info->id.name,
999 info->id.index);
1006 info->id.iface, info->id.device,
1007 info->id.subdevice, info->id.name,
1008 info->id.index, info->count);
1078 control->id.iface, control->id.device,
1079 control->id.subdevice, control->id.name,
1080 control->id.index, lval, lmin, lmax, i);
1089 control->id.iface, control->id.device,
1090 control->id.subdevice, control->id.name,
1091 control->id.index, lval, lstep, i);
1173 index_offset = snd_ctl_get_ioff(kctl, &info->id);
1175 snd_ctl_build_ioff(&info->id, kctl, index_offset);
1199 kctl = snd_ctl_find_id_locked(card, &info->id);
1235 kctl = snd_ctl_find_id_locked(card, &control->id);
1239 index_offset = snd_ctl_get_ioff(kctl, &control->id);
1244 snd_ctl_build_ioff(&control->id, kctl, index_offset);
1249 info.id = control->id;
1267 control->id.iface, control->id.device,
1268 control->id.subdevice, control->id.name,
1269 control->id.index);
1303 kctl = snd_ctl_find_id_locked(card, &control->id);
1309 index_offset = snd_ctl_get_ioff(kctl, &control->id);
1317 snd_ctl_build_ioff(&control->id, kctl, index_offset);
1324 info.id = control->id;
1374 struct snd_ctl_elem_id id;
1378 if (copy_from_user(&id, _id, sizeof(id)))
1381 kctl = snd_ctl_find_id_locked(card, &id);
1384 vd = &kctl->vd[snd_ctl_get_ioff(kctl, &id)];
1395 struct snd_ctl_elem_id id;
1399 if (copy_from_user(&id, _id, sizeof(id)))
1402 kctl = snd_ctl_find_id_locked(card, &id);
1405 vd = &kctl->vd[snd_ctl_get_ioff(kctl, &id)];
1436 offset = snd_ctl_get_ioff(kcontrol, &uinfo->id);
1438 snd_ctl_build_ioff(&uinfo->id, kcontrol, offset);
1453 offset = snd_ctl_get_ioff(kcontrol, &uinfo->id);
1455 snd_ctl_build_ioff(&uinfo->id, kcontrol, offset);
1474 snd_ctl_get_ioff(kcontrol, &ucontrol->id) * size;
1487 snd_ctl_get_ioff(kcontrol, &ucontrol->id) * size;
1648 if (!*info->id.name)
1650 if (strnlen(info->id.name, sizeof(info->id.name)) >= sizeof(info->id.name))
1655 info->id.numid = 0;
1656 err = snd_ctl_remove_user_ctl(file, &info->id);
1706 memcpy(&kctl->id, &info->id, sizeof(kctl->id));
1750 offset = snd_ctl_get_ioff(kctl, &info->id);
1751 snd_ctl_build_ioff(&info->id, kctl, offset);
1774 snd_ctl_remove_user_ctl(file, &info.id);
1784 struct snd_ctl_elem_id id;
1786 if (copy_from_user(&id, _id, sizeof(id)))
1788 return snd_ctl_remove_user_ctl(file, &id);
1814 struct snd_ctl_elem_id *id,
1825 struct snd_kcontrol_volatile *vd = &kctl->vd[snd_ctl_get_ioff(kctl, id)];
1851 static int read_tlv_buf(struct snd_kcontrol *kctl, struct snd_ctl_elem_id *id,
1854 struct snd_kcontrol_volatile *vd = &kctl->vd[snd_ctl_get_ioff(kctl, id)];
1881 struct snd_ctl_elem_id id;
1904 id = kctl->id;
1905 snd_ctl_build_ioff(&id, kctl, header.numid - id.numid);
1906 vd = &kctl->vd[snd_ctl_get_ioff(kctl, &id)];
1909 return call_tlv_handler(file, op_flag, kctl, &id, container,
1913 return read_tlv_buf(kctl, &id, container,
2027 ev.data.elem.id = kev->id;