Deleted Added
full compact
sound.c (109236) sound.c (109623)
1/*
2 * Copyright (c) 1999 Cameron Grant <gandalf@vilnya.demon.co.uk>
3 * (C) 1997 Luigi Rizzo (luigi@iet.unipi.it)
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

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

26 */
27
28#include <dev/sound/pcm/sound.h>
29#include <dev/sound/pcm/vchan.h>
30#include <sys/sysctl.h>
31
32#include "feeder_if.h"
33
1/*
2 * Copyright (c) 1999 Cameron Grant <gandalf@vilnya.demon.co.uk>
3 * (C) 1997 Luigi Rizzo (luigi@iet.unipi.it)
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

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

26 */
27
28#include <dev/sound/pcm/sound.h>
29#include <dev/sound/pcm/vchan.h>
30#include <sys/sysctl.h>
31
32#include "feeder_if.h"
33
34SND_DECLARE_FILE("$FreeBSD: head/sys/dev/sound/pcm/sound.c 109236 2003-01-14 17:13:52Z cognet $");
34SND_DECLARE_FILE("$FreeBSD: head/sys/dev/sound/pcm/sound.c 109623 2003-01-21 08:56:16Z alfred $");
35
36struct snddev_channel {
37 SLIST_ENTRY(snddev_channel) link;
38 struct pcm_channel *channel;
39};
40
41struct snddev_info {
42 SLIST_HEAD(, snddev_channel) channels;

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

86}
87
88void *
89snd_mtxcreate(const char *desc, const char *type)
90{
91#ifdef USING_MUTEX
92 struct mtx *m;
93
35
36struct snddev_channel {
37 SLIST_ENTRY(snddev_channel) link;
38 struct pcm_channel *channel;
39};
40
41struct snddev_info {
42 SLIST_HEAD(, snddev_channel) channels;

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

86}
87
88void *
89snd_mtxcreate(const char *desc, const char *type)
90{
91#ifdef USING_MUTEX
92 struct mtx *m;
93
94 m = malloc(sizeof(*m), M_DEVBUF, M_WAITOK | M_ZERO);
94 m = malloc(sizeof(*m), M_DEVBUF, M_ZERO);
95 if (m == NULL)
96 return NULL;
97 mtx_init(m, desc, type, MTX_RECURSE);
98 return m;
99#else
100 return (void *)0xcafebabe;
101#endif
102}

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

359 dir = PCMDIR_PLAY;
360 pnum = &d->vchancount;
361 break;
362
363 default:
364 return NULL;
365 }
366
95 if (m == NULL)
96 return NULL;
97 mtx_init(m, desc, type, MTX_RECURSE);
98 return m;
99#else
100 return (void *)0xcafebabe;
101#endif
102}

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

359 dir = PCMDIR_PLAY;
360 pnum = &d->vchancount;
361 break;
362
363 default:
364 return NULL;
365 }
366
367 ch = malloc(sizeof(*ch), M_DEVBUF, M_WAITOK | M_ZERO);
367 ch = malloc(sizeof(*ch), M_DEVBUF, M_ZERO);
368 if (!ch)
369 return NULL;
370
368 if (!ch)
369 return NULL;
370
371 ch->methods = kobj_create(cls, M_DEVBUF, M_WAITOK);
371 ch->methods = kobj_create(cls, M_DEVBUF, 0);
372 if (!ch->methods) {
373 free(ch, M_DEVBUF);
374
375 return NULL;
376 }
377
378 snd_mtxlock(d->lock);
379 ch->num = (*pnum)++;

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

421
422int
423pcm_chn_add(struct snddev_info *d, struct pcm_channel *ch, int mkdev)
424{
425 struct snddev_channel *sce, *tmp, *after;
426 int unit = device_get_unit(d->dev);
427 int x = -1;
428
372 if (!ch->methods) {
373 free(ch, M_DEVBUF);
374
375 return NULL;
376 }
377
378 snd_mtxlock(d->lock);
379 ch->num = (*pnum)++;

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

421
422int
423pcm_chn_add(struct snddev_info *d, struct pcm_channel *ch, int mkdev)
424{
425 struct snddev_channel *sce, *tmp, *after;
426 int unit = device_get_unit(d->dev);
427 int x = -1;
428
429 sce = malloc(sizeof(*sce), M_DEVBUF, M_WAITOK | M_ZERO);
429 sce = malloc(sizeof(*sce), M_DEVBUF, M_ZERO);
430 if (!sce) {
431 return ENOMEM;
432 }
433
434 snd_mtxlock(d->lock);
435 sce->channel = ch;
436 if (SLIST_EMPTY(&d->channels)) {
437 SLIST_INSERT_HEAD(&d->channels, sce, link);

--- 470 unchanged lines hidden ---
430 if (!sce) {
431 return ENOMEM;
432 }
433
434 snd_mtxlock(d->lock);
435 sce->channel = ch;
436 if (SLIST_EMPTY(&d->channels)) {
437 SLIST_INSERT_HEAD(&d->channels, sce, link);

--- 470 unchanged lines hidden ---