init.c (e9e4e44309f866b115d08ab4a54834008c50a8a4) init.c (e086e3035e0691b362755d1b5e24df631eee335a)
1/*
2 * Initialization routines
3 * Copyright (c) by Jaroslav Kysela <perex@perex.cz>
4 *
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or

--- 386 unchanged lines hidden (view full) ---

395 * Return: Zero, otherwise a negative error code.
396 *
397 * Note: The current implementation replaces all active file->f_op with special
398 * dummy file operations (they do nothing except release).
399 */
400int snd_card_disconnect(struct snd_card *card)
401{
402 struct snd_monitor_file *mfile;
1/*
2 * Initialization routines
3 * Copyright (c) by Jaroslav Kysela <perex@perex.cz>
4 *
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or

--- 386 unchanged lines hidden (view full) ---

395 * Return: Zero, otherwise a negative error code.
396 *
397 * Note: The current implementation replaces all active file->f_op with special
398 * dummy file operations (they do nothing except release).
399 */
400int snd_card_disconnect(struct snd_card *card)
401{
402 struct snd_monitor_file *mfile;
403 int err;
404
405 if (!card)
406 return -EINVAL;
407
408 spin_lock(&card->files_lock);
409 if (card->shutdown) {
410 spin_unlock(&card->files_lock);
411 return 0;

--- 28 unchanged lines hidden (view full) ---

440 /* at this point, they cannot respond to any calls except release() */
441
442#if IS_ENABLED(CONFIG_SND_MIXER_OSS)
443 if (snd_mixer_oss_notify_callback)
444 snd_mixer_oss_notify_callback(card, SND_MIXER_OSS_NOTIFY_DISCONNECT);
445#endif
446
447 /* notify all devices that we are disconnected */
403
404 if (!card)
405 return -EINVAL;
406
407 spin_lock(&card->files_lock);
408 if (card->shutdown) {
409 spin_unlock(&card->files_lock);
410 return 0;

--- 28 unchanged lines hidden (view full) ---

439 /* at this point, they cannot respond to any calls except release() */
440
441#if IS_ENABLED(CONFIG_SND_MIXER_OSS)
442 if (snd_mixer_oss_notify_callback)
443 snd_mixer_oss_notify_callback(card, SND_MIXER_OSS_NOTIFY_DISCONNECT);
444#endif
445
446 /* notify all devices that we are disconnected */
448 err = snd_device_disconnect_all(card);
449 if (err < 0)
450 dev_err(card->dev, "not all devices for card %i can be disconnected\n", card->number);
447 snd_device_disconnect_all(card);
451
452 snd_info_card_disconnect(card);
453 if (card->registered) {
454 device_del(&card->card_dev);
455 card->registered = false;
456 }
457#ifdef CONFIG_PM
458 wake_up(&card->power_sleep);

--- 585 unchanged lines hidden ---
448
449 snd_info_card_disconnect(card);
450 if (card->registered) {
451 device_del(&card->card_dev);
452 card->registered = false;
453 }
454#ifdef CONFIG_PM
455 wake_up(&card->power_sleep);

--- 585 unchanged lines hidden ---