Lines Matching refs:hwdep

17 #include <sound/hwdep.h>
34 struct snd_hwdep *hwdep;
36 list_for_each_entry(hwdep, &snd_hwdep_devices, list)
37 if (hwdep->card == card && hwdep->device == device)
38 return hwdep;
300 struct snd_hwdep *hwdep;
305 hwdep = snd_hwdep_search(card, device);
306 if (hwdep)
307 err = snd_hwdep_info(hwdep, info);
341 static void snd_hwdep_free(struct snd_hwdep *hwdep)
343 if (!hwdep)
345 if (hwdep->private_free)
346 hwdep->private_free(hwdep);
347 put_device(hwdep->dev);
348 kfree(hwdep);
352 * snd_hwdep_new - create a new hwdep instance
356 * @rhwdep: the pointer to store the new hwdep instance
358 * Creates a new hwdep instance with the given index on the card.
359 * The callbacks (hwdep->ops) must be set on the returned instance
367 struct snd_hwdep *hwdep;
379 hwdep = kzalloc(sizeof(*hwdep), GFP_KERNEL);
380 if (!hwdep)
383 init_waitqueue_head(&hwdep->open_wait);
384 mutex_init(&hwdep->open_mutex);
385 hwdep->card = card;
386 hwdep->device = device;
388 strscpy(hwdep->id, id, sizeof(hwdep->id));
390 err = snd_device_alloc(&hwdep->dev, card);
392 snd_hwdep_free(hwdep);
396 dev_set_name(hwdep->dev, "hwC%iD%i", card->number, device);
398 hwdep->oss_type = -1;
401 err = snd_device_new(card, SNDRV_DEV_HWDEP, hwdep, &ops);
403 snd_hwdep_free(hwdep);
408 *rhwdep = hwdep;
421 struct snd_hwdep *hwdep = device->device_data;
422 struct snd_card *card = hwdep->card;
426 if (snd_hwdep_search(card, hwdep->device)) {
430 list_add_tail(&hwdep->list, &snd_hwdep_devices);
432 hwdep->card, hwdep->device,
433 &snd_hwdep_f_ops, hwdep, hwdep->dev);
435 dev_err(hwdep->dev, "unable to register\n");
436 list_del(&hwdep->list);
442 hwdep->ossreg = 0;
443 if (hwdep->oss_type >= 0) {
444 if (hwdep->oss_type == SNDRV_OSS_DEVICE_TYPE_DMFM &&
445 hwdep->device)
446 dev_warn(hwdep->dev,
447 "only hwdep device 0 can be registered as OSS direct FM device!\n");
448 else if (snd_register_oss_device(hwdep->oss_type,
449 card, hwdep->device,
450 &snd_hwdep_f_ops, hwdep) < 0)
451 dev_warn(hwdep->dev,
454 hwdep->ossreg = 1;
463 struct snd_hwdep *hwdep = device->device_data;
465 if (snd_BUG_ON(!hwdep))
468 if (snd_hwdep_search(hwdep->card, hwdep->device) != hwdep) {
472 mutex_lock(&hwdep->open_mutex);
473 wake_up(&hwdep->open_wait);
475 if (hwdep->ossreg)
476 snd_unregister_oss_device(hwdep->oss_type, hwdep->card, hwdep->device);
478 snd_unregister_device(hwdep->dev);
479 list_del_init(&hwdep->list);
480 mutex_unlock(&hwdep->open_mutex);
493 struct snd_hwdep *hwdep;
496 list_for_each_entry(hwdep, &snd_hwdep_devices, list)
498 hwdep->card->number, hwdep->device, hwdep->name);
508 entry = snd_info_create_module_entry(THIS_MODULE, "hwdep", NULL);