Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 16113
b: refs/heads/master
c: 2af677f
h: refs/heads/master
i:
  16111: 7065e8d
v: v3
  • Loading branch information
Clemens Ladisch authored and Jaroslav Kysela committed Jan 3, 2006
1 parent a1eaf81 commit 26c6fd6
Show file tree
Hide file tree
Showing 15 changed files with 109 additions and 115 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a106cd3d9e88c8761bd0eac2ce402cc82bd11fea
refs/heads/master: 2af677fc884fc6dc79e65c99050ea607ac8bab9b
8 changes: 5 additions & 3 deletions trunk/include/sound/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ static inline int snd_power_wait(struct snd_card *card, unsigned int state, stru
struct snd_minor {
struct list_head list; /* list of all minors per card */
int number; /* minor number */
int type; /* SNDRV_DEVICE_TYPE_XXX */
int device; /* device number */
const char *comment; /* for /proc/asound/devices */
struct file_operations *f_ops; /* file operations */
char name[0]; /* device name (keep at the end of
structure) */
Expand All @@ -199,11 +199,13 @@ extern int snd_ecards_limit;

void snd_request_card(int card);

int snd_register_device(int type, struct snd_card *card, int dev, struct snd_minor *reg, const char *name);
int snd_register_device(int type, struct snd_card *card, int dev,
struct file_operations *f_ops, const char *name);
int snd_unregister_device(int type, struct snd_card *card, int dev);

#ifdef CONFIG_SND_OSSEMUL
int snd_register_oss_device(int type, struct snd_card *card, int dev, struct snd_minor *reg, const char *name);
int snd_register_oss_device(int type, struct snd_card *card, int dev,
struct file_operations *f_ops, const char *name);
int snd_unregister_oss_device(int type, struct snd_card *card, int dev);
#endif

Expand Down
3 changes: 1 addition & 2 deletions trunk/include/sound/pcm.h
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,6 @@ struct snd_pcm_str {
struct snd_pcm_oss_stream oss;
#endif
struct snd_pcm_file *files;
struct snd_minor *reg;
struct snd_info_entry *proc_root;
struct snd_info_entry *proc_info_entry;
#ifdef CONFIG_SND_DEBUG
Expand Down Expand Up @@ -441,7 +440,7 @@ struct snd_pcm_notify {
*/

extern struct snd_pcm *snd_pcm_devices[];
extern struct snd_minor snd_pcm_reg[2];
extern struct file_operations snd_pcm_f_ops[2];

int snd_pcm_new(struct snd_card *card, char *id, int device,
int playback_count, int capture_count,
Expand Down
11 changes: 3 additions & 8 deletions trunk/sound/core/control.c
Original file line number Diff line number Diff line change
Expand Up @@ -1264,12 +1264,6 @@ static struct file_operations snd_ctl_f_ops =
.fasync = snd_ctl_fasync,
};

static struct snd_minor snd_ctl_reg =
{
.comment = "ctl",
.f_ops = &snd_ctl_f_ops,
};

/*
* registration of the control device
*/
Expand All @@ -1284,7 +1278,7 @@ static int snd_ctl_dev_register(struct snd_device *device)
snd_assert(cardnum >= 0 && cardnum < SNDRV_CARDS, return -ENXIO);
sprintf(name, "controlC%i", cardnum);
if ((err = snd_register_device(SNDRV_DEVICE_TYPE_CONTROL,
card, 0, &snd_ctl_reg, name)) < 0)
card, -1, &snd_ctl_f_ops, name)) < 0)
return err;
return 0;
}
Expand Down Expand Up @@ -1336,7 +1330,8 @@ static int snd_ctl_dev_unregister(struct snd_device *device)
snd_assert(card != NULL, return -ENXIO);
cardnum = card->number;
snd_assert(cardnum >= 0 && cardnum < SNDRV_CARDS, return -ENXIO);
if ((err = snd_unregister_device(SNDRV_DEVICE_TYPE_CONTROL, card, 0)) < 0)
if ((err = snd_unregister_device(SNDRV_DEVICE_TYPE_CONTROL,
card, -1)) < 0)
return err;
return snd_ctl_dev_free(device);
}
Expand Down
11 changes: 3 additions & 8 deletions trunk/sound/core/hwdep.c
Original file line number Diff line number Diff line change
Expand Up @@ -330,12 +330,6 @@ static struct file_operations snd_hwdep_f_ops =
.mmap = snd_hwdep_mmap,
};

static struct snd_minor snd_hwdep_reg =
{
.comment = "hardware dependent",
.f_ops = &snd_hwdep_f_ops,
};

/**
* snd_hwdep_new - create a new hwdep instance
* @card: the card instance
Expand Down Expand Up @@ -416,7 +410,7 @@ static int snd_hwdep_dev_register(struct snd_device *device)
sprintf(name, "hwC%iD%i", hwdep->card->number, hwdep->device);
if ((err = snd_register_device(SNDRV_DEVICE_TYPE_HWDEP,
hwdep->card, hwdep->device,
&snd_hwdep_reg, name)) < 0) {
&snd_hwdep_f_ops, name)) < 0) {
snd_printk(KERN_ERR "unable to register hardware dependent device %i:%i\n",
hwdep->card->number, hwdep->device);
snd_hwdep_devices[idx] = NULL;
Expand All @@ -431,7 +425,8 @@ static int snd_hwdep_dev_register(struct snd_device *device)
} else {
if (snd_register_oss_device(hwdep->oss_type,
hwdep->card, hwdep->device,
&snd_hwdep_reg, hwdep->oss_dev) < 0) {
&snd_hwdep_f_ops,
hwdep->oss_dev) < 0) {
snd_printk(KERN_ERR "unable to register OSS compatibility device %i:%i\n",
hwdep->card->number, hwdep->device);
} else
Expand Down
8 changes: 1 addition & 7 deletions trunk/sound/core/oss/mixer_oss.c
Original file line number Diff line number Diff line change
Expand Up @@ -398,12 +398,6 @@ static struct file_operations snd_mixer_oss_f_ops =
.compat_ioctl = snd_mixer_oss_ioctl_compat,
};

static struct snd_minor snd_mixer_oss_reg =
{
.comment = "mixer",
.f_ops = &snd_mixer_oss_f_ops,
};

/*
* utilities
*/
Expand Down Expand Up @@ -1292,7 +1286,7 @@ static int snd_mixer_oss_notify_handler(struct snd_card *card, int cmd)
sprintf(name, "mixer%i%i", card->number, 0);
if ((err = snd_register_oss_device(SNDRV_OSS_DEVICE_TYPE_MIXER,
card, 0,
&snd_mixer_oss_reg,
&snd_mixer_oss_f_ops,
name)) < 0) {
snd_printk(KERN_ERR "unable to register OSS mixer device %i:%i\n",
card->number, 0);
Expand Down
8 changes: 1 addition & 7 deletions trunk/sound/core/oss/pcm_oss.c
Original file line number Diff line number Diff line change
Expand Up @@ -2444,18 +2444,12 @@ static struct file_operations snd_pcm_oss_f_reg =
.mmap = snd_pcm_oss_mmap,
};

static struct snd_minor snd_pcm_oss_reg =
{
.comment = "digital audio",
.f_ops = &snd_pcm_oss_f_reg,
};

static void register_oss_dsp(struct snd_pcm *pcm, int index)
{
char name[128];
sprintf(name, "dsp%i%i", pcm->card->number, pcm->device);
if (snd_register_oss_device(SNDRV_OSS_DEVICE_TYPE_PCM,
pcm->card, index, &snd_pcm_oss_reg,
pcm->card, index, &snd_pcm_oss_f_reg,
name) < 0) {
snd_printk(KERN_ERR "unable to register OSS PCM device %i:%i\n",
pcm->card->number, pcm->device);
Expand Down
6 changes: 4 additions & 2 deletions trunk/sound/core/pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,6 @@ int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count)
pstr->stream = stream;
pstr->pcm = pcm;
pstr->substream_count = substream_count;
pstr->reg = &snd_pcm_reg[stream];
if (substream_count > 0) {
err = snd_pcm_stream_proc_init(pstr);
if (err < 0) {
Expand Down Expand Up @@ -897,7 +896,10 @@ static int snd_pcm_dev_register(struct snd_device *device)
devtype = SNDRV_DEVICE_TYPE_PCM_CAPTURE;
break;
}
if ((err = snd_register_device(devtype, pcm->card, pcm->device, pcm->streams[cidx].reg, str)) < 0) {
if ((err = snd_register_device(devtype, pcm->card,
pcm->device,
&snd_pcm_f_ops[cidx], str)) < 0)
{
snd_pcm_devices[idx] = NULL;
up(&register_mutex);
return err;
Expand Down
53 changes: 21 additions & 32 deletions trunk/sound/core/pcm_native.c
Original file line number Diff line number Diff line change
Expand Up @@ -3370,40 +3370,29 @@ static int snd_pcm_hw_params_old_user(struct snd_pcm_substream *substream,
* Register section
*/

static struct file_operations snd_pcm_f_ops_playback = {
.owner = THIS_MODULE,
.write = snd_pcm_write,
.writev = snd_pcm_writev,
.open = snd_pcm_open,
.release = snd_pcm_release,
.poll = snd_pcm_playback_poll,
.unlocked_ioctl = snd_pcm_playback_ioctl,
.compat_ioctl = snd_pcm_ioctl_compat,
.mmap = snd_pcm_mmap,
.fasync = snd_pcm_fasync,
};

static struct file_operations snd_pcm_f_ops_capture = {
.owner = THIS_MODULE,
.read = snd_pcm_read,
.readv = snd_pcm_readv,
.open = snd_pcm_open,
.release = snd_pcm_release,
.poll = snd_pcm_capture_poll,
.unlocked_ioctl = snd_pcm_capture_ioctl,
.compat_ioctl = snd_pcm_ioctl_compat,
.mmap = snd_pcm_mmap,
.fasync = snd_pcm_fasync,
};

struct snd_minor snd_pcm_reg[2] =
{
struct file_operations snd_pcm_f_ops[2] = {
{
.comment = "digital audio playback",
.f_ops = &snd_pcm_f_ops_playback,
.owner = THIS_MODULE,
.write = snd_pcm_write,
.writev = snd_pcm_writev,
.open = snd_pcm_open,
.release = snd_pcm_release,
.poll = snd_pcm_playback_poll,
.unlocked_ioctl = snd_pcm_playback_ioctl,
.compat_ioctl = snd_pcm_ioctl_compat,
.mmap = snd_pcm_mmap,
.fasync = snd_pcm_fasync,
},
{
.comment = "digital audio capture",
.f_ops = &snd_pcm_f_ops_capture,
.owner = THIS_MODULE,
.read = snd_pcm_read,
.readv = snd_pcm_readv,
.open = snd_pcm_open,
.release = snd_pcm_release,
.poll = snd_pcm_capture_poll,
.unlocked_ioctl = snd_pcm_capture_ioctl,
.compat_ioctl = snd_pcm_ioctl_compat,
.mmap = snd_pcm_mmap,
.fasync = snd_pcm_fasync,
}
};
14 changes: 5 additions & 9 deletions trunk/sound/core/rawmidi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1367,12 +1367,6 @@ static struct file_operations snd_rawmidi_f_ops =
.compat_ioctl = snd_rawmidi_ioctl_compat,
};

static struct snd_minor snd_rawmidi_reg =
{
.comment = "raw midi",
.f_ops = &snd_rawmidi_f_ops,
};

static int snd_rawmidi_alloc_substreams(struct snd_rawmidi *rmidi,
struct snd_rawmidi_str *stream,
int direction,
Expand Down Expand Up @@ -1516,7 +1510,7 @@ static int snd_rawmidi_dev_register(struct snd_device *device)
sprintf(name, "midiC%iD%i", rmidi->card->number, rmidi->device);
if ((err = snd_register_device(SNDRV_DEVICE_TYPE_RAWMIDI,
rmidi->card, rmidi->device,
&snd_rawmidi_reg, name)) < 0) {
&snd_rawmidi_f_ops, name)) < 0) {
snd_printk(KERN_ERR "unable to register rawmidi device %i:%i\n", rmidi->card->number, rmidi->device);
snd_rawmidi_devices[idx] = NULL;
up(&register_mutex);
Expand All @@ -1533,7 +1527,8 @@ static int snd_rawmidi_dev_register(struct snd_device *device)
rmidi->ossreg = 0;
if ((int)rmidi->device == midi_map[rmidi->card->number]) {
if (snd_register_oss_device(SNDRV_OSS_DEVICE_TYPE_MIDI,
rmidi->card, 0, &snd_rawmidi_reg, name) < 0) {
rmidi->card, 0,
&snd_rawmidi_f_ops, name) < 0) {
snd_printk(KERN_ERR "unable to register OSS rawmidi device %i:%i\n", rmidi->card->number, 0);
} else {
rmidi->ossreg++;
Expand All @@ -1544,7 +1539,8 @@ static int snd_rawmidi_dev_register(struct snd_device *device)
}
if ((int)rmidi->device == amidi_map[rmidi->card->number]) {
if (snd_register_oss_device(SNDRV_OSS_DEVICE_TYPE_MIDI,
rmidi->card, 1, &snd_rawmidi_reg, name) < 0) {
rmidi->card, 1,
&snd_rawmidi_f_ops, name) < 0) {
snd_printk(KERN_ERR "unable to register OSS rawmidi device %i:%i\n", rmidi->card->number, 1);
} else {
rmidi->ossreg++;
Expand Down
9 changes: 2 additions & 7 deletions trunk/sound/core/seq/oss/seq_oss.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,6 @@ static struct file_operations seq_oss_f_ops =
.compat_ioctl = odev_ioctl_compat,
};

static struct snd_minor seq_oss_reg = {
.comment = "sequencer",
.f_ops = &seq_oss_f_ops,
};

static int __init
register_device(void)
{
Expand All @@ -230,15 +225,15 @@ register_device(void)
down(&register_mutex);
if ((rc = snd_register_oss_device(SNDRV_OSS_DEVICE_TYPE_SEQUENCER,
NULL, 0,
&seq_oss_reg,
&seq_oss_f_ops,
SNDRV_SEQ_OSS_DEVNAME)) < 0) {
snd_printk(KERN_ERR "can't register device seq\n");
up(&register_mutex);
return rc;
}
if ((rc = snd_register_oss_device(SNDRV_OSS_DEVICE_TYPE_MUSIC,
NULL, 0,
&seq_oss_reg,
&seq_oss_f_ops,
SNDRV_SEQ_OSS_DEVNAME)) < 0) {
snd_printk(KERN_ERR "can't register device music\n");
snd_unregister_oss_device(SNDRV_OSS_DEVICE_TYPE_SEQUENCER, NULL, 0);
Expand Down
10 changes: 2 additions & 8 deletions trunk/sound/core/seq/seq_clientmgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -2520,13 +2520,6 @@ static struct file_operations snd_seq_f_ops =
.compat_ioctl = snd_seq_ioctl_compat,
};

static struct snd_minor snd_seq_reg =
{
.comment = "sequencer",
.f_ops = &snd_seq_f_ops,
};


/*
* register sequencer device
*/
Expand All @@ -2537,7 +2530,8 @@ int __init snd_sequencer_device_init(void)
if (down_interruptible(&register_mutex))
return -ERESTARTSYS;

if ((err = snd_register_device(SNDRV_DEVICE_TYPE_SEQUENCER, NULL, 0, &snd_seq_reg, "seq")) < 0) {
if ((err = snd_register_device(SNDRV_DEVICE_TYPE_SEQUENCER, NULL, 0,
&snd_seq_f_ops, "seq")) < 0) {
up(&register_mutex);
return err;
}
Expand Down
Loading

0 comments on commit 26c6fd6

Please sign in to comment.