last.c 628 B

1234567891011121314151617181920212223242526272829
  1. // SPDX-License-Identifier: GPL-2.0-or-later
  2. /*
  3. * Advanced Linux Sound Architecture
  4. * Copyright (c) by Jaroslav Kysela <perex@perex.cz>
  5. */
  6. #include <linux/init.h>
  7. #include <sound/core.h>
  8. static int __init alsa_sound_last_init(void)
  9. {
  10. struct snd_card *card;
  11. int idx, ok = 0;
  12. printk(KERN_INFO "ALSA device list:\n");
  13. for (idx = 0; idx < SNDRV_CARDS; idx++) {
  14. card = snd_card_ref(idx);
  15. if (card) {
  16. printk(KERN_INFO " #%i: %s\n", idx, card->longname);
  17. snd_card_unref(card);
  18. ok++;
  19. }
  20. }
  21. if (ok == 0)
  22. printk(KERN_INFO " No soundcards found.\n");
  23. return 0;
  24. }
  25. late_initcall_sync(alsa_sound_last_init);