diff options
Diffstat (limited to 'sound/core/seq')
27 files changed, 161 insertions, 182 deletions
diff --git a/sound/core/seq/oss/seq_oss.c b/sound/core/seq/oss/seq_oss.c index a1f1a2f00cc..16d42679e43 100644 --- a/sound/core/seq/oss/seq_oss.c +++ b/sound/core/seq/oss/seq_oss.c @@ -21,7 +21,7 @@   */  #include <linux/init.h> -#include <linux/moduleparam.h> +#include <linux/module.h>  #include <linux/mutex.h>  #include <sound/core.h>  #include <sound/minors.h> @@ -39,12 +39,6 @@ MODULE_LICENSE("GPL");  MODULE_ALIAS_SNDRV_MINOR(SNDRV_MINOR_OSS_SEQUENCER);  MODULE_ALIAS_SNDRV_MINOR(SNDRV_MINOR_OSS_MUSIC); -#ifdef SNDRV_SEQ_OSS_DEBUG -module_param(seq_oss_debug, int, 0644); -MODULE_PARM_DESC(seq_oss_debug, "debug option"); -int seq_oss_debug = 0; -#endif -  /*   * prototypes @@ -231,22 +225,19 @@ register_device(void)  	mutex_lock(®ister_mutex);  	if ((rc = snd_register_oss_device(SNDRV_OSS_DEVICE_TYPE_SEQUENCER,  					  NULL, 0, -					  &seq_oss_f_ops, NULL, -					  SNDRV_SEQ_OSS_DEVNAME)) < 0) { -		snd_printk(KERN_ERR "can't register device seq\n"); +					  &seq_oss_f_ops, NULL)) < 0) { +		pr_err("ALSA: seq_oss: can't register device seq\n");  		mutex_unlock(®ister_mutex);  		return rc;  	}  	if ((rc = snd_register_oss_device(SNDRV_OSS_DEVICE_TYPE_MUSIC,  					  NULL, 0, -					  &seq_oss_f_ops, NULL, -					  SNDRV_SEQ_OSS_DEVNAME)) < 0) { -		snd_printk(KERN_ERR "can't register device music\n"); +					  &seq_oss_f_ops, NULL)) < 0) { +		pr_err("ALSA: seq_oss: can't register device music\n");  		snd_unregister_oss_device(SNDRV_OSS_DEVICE_TYPE_SEQUENCER, NULL, 0);  		mutex_unlock(®ister_mutex);  		return rc;  	} -	debug_printk(("device registered\n"));  	mutex_unlock(®ister_mutex);  	return 0;  } @@ -255,11 +246,10 @@ static void  unregister_device(void)  {  	mutex_lock(®ister_mutex); -	debug_printk(("device unregistered\n"));  	if (snd_unregister_oss_device(SNDRV_OSS_DEVICE_TYPE_MUSIC, NULL, 0) < 0)		 -		snd_printk(KERN_ERR "error unregister device music\n"); +		pr_err("ALSA: seq_oss: error unregister device music\n");  	if (snd_unregister_oss_device(SNDRV_OSS_DEVICE_TYPE_SEQUENCER, NULL, 0) < 0) -		snd_printk(KERN_ERR "error unregister device seq\n"); +		pr_err("ALSA: seq_oss: error unregister device seq\n");  	mutex_unlock(®ister_mutex);  } diff --git a/sound/core/seq/oss/seq_oss_device.h b/sound/core/seq/oss/seq_oss_device.h index c0154a959d5..b4392432524 100644 --- a/sound/core/seq/oss/seq_oss_device.h +++ b/sound/core/seq/oss/seq_oss_device.h @@ -31,9 +31,6 @@  #include <sound/seq_kernel.h>  #include <sound/info.h> -/* enable debug print */ -#define SNDRV_SEQ_OSS_DEBUG -  /* max. applications */  #define SNDRV_SEQ_OSS_MAX_CLIENTS	16  #define SNDRV_SEQ_OSS_MAX_SYNTH_DEVS	16 @@ -46,7 +43,6 @@  #define SNDRV_SEQ_OSS_VERSION_STR	"0.1.8"  /* device and proc interface name */ -#define SNDRV_SEQ_OSS_DEVNAME		"seq_oss"  #define SNDRV_SEQ_OSS_PROCNAME		"oss" @@ -177,13 +173,4 @@ snd_seq_oss_fill_addr(struct seq_oss_devinfo *dp, struct snd_seq_event *ev,  /* misc. functions for proc interface */  char *enabled_str(int bool); - -/* for debug */ -#ifdef SNDRV_SEQ_OSS_DEBUG -extern int seq_oss_debug; -#define debug_printk(x)	do { if (seq_oss_debug > 0) snd_printd x; } while (0) -#else -#define debug_printk(x)	/**/ -#endif -  #endif /* __SEQ_OSS_DEVICE_H */ diff --git a/sound/core/seq/oss/seq_oss_event.c b/sound/core/seq/oss/seq_oss_event.c index 066f5f3e3f4..c3908862bc8 100644 --- a/sound/core/seq/oss/seq_oss_event.c +++ b/sound/core/seq/oss/seq_oss_event.c @@ -285,7 +285,12 @@ local_event(struct seq_oss_devinfo *dp, union evrec *q, struct snd_seq_event *ev  static int  note_on_event(struct seq_oss_devinfo *dp, int dev, int ch, int note, int vel, struct snd_seq_event *ev)  { -	struct seq_oss_synthinfo *info = &dp->synths[dev]; +	struct seq_oss_synthinfo *info; + +	if (!snd_seq_oss_synth_is_valid(dp, dev)) +		return -ENXIO; + +	info = &dp->synths[dev];  	switch (info->arg.event_passing) {  	case SNDRV_SEQ_OSS_PROCESS_EVENTS:  		if (! info->ch || ch < 0 || ch >= info->nr_voices) { @@ -340,7 +345,12 @@ note_on_event(struct seq_oss_devinfo *dp, int dev, int ch, int note, int vel, st  static int  note_off_event(struct seq_oss_devinfo *dp, int dev, int ch, int note, int vel, struct snd_seq_event *ev)  { -	struct seq_oss_synthinfo *info = &dp->synths[dev]; +	struct seq_oss_synthinfo *info; + +	if (!snd_seq_oss_synth_is_valid(dp, dev)) +		return -ENXIO; + +	info = &dp->synths[dev];  	switch (info->arg.event_passing) {  	case SNDRV_SEQ_OSS_PROCESS_EVENTS:  		if (! info->ch || ch < 0 || ch >= info->nr_voices) { diff --git a/sound/core/seq/oss/seq_oss_init.c b/sound/core/seq/oss/seq_oss_init.c index 69cd7b3c362..b9184d20c39 100644 --- a/sound/core/seq/oss/seq_oss_init.c +++ b/sound/core/seq/oss/seq_oss_init.c @@ -28,8 +28,10 @@  #include "seq_oss_timer.h"  #include "seq_oss_event.h"  #include <linux/init.h> +#include <linux/export.h>  #include <linux/moduleparam.h>  #include <linux/slab.h> +#include <linux/workqueue.h>  /*   * common variables @@ -59,6 +61,14 @@ static void free_devinfo(void *private);  #define call_ctl(type,rec) snd_seq_kernel_client_ctl(system_client, type, rec) +/* call snd_seq_oss_midi_lookup_ports() asynchronously */ +static void async_call_lookup_ports(struct work_struct *work) +{ +	snd_seq_oss_midi_lookup_ports(system_client); +} + +static DECLARE_WORK(async_lookup_work, async_call_lookup_ports); +  /*   * create sequencer client for OSS sequencer   */ @@ -82,10 +92,6 @@ snd_seq_oss_create_client(void)  		goto __error;  	system_client = rc; -	debug_printk(("new client = %d\n", rc)); - -	/* look up midi devices */ -	snd_seq_oss_midi_lookup_ports(system_client);  	/* create annoucement receiver port */  	memset(port, 0, sizeof(*port)); @@ -114,6 +120,9 @@ snd_seq_oss_create_client(void)  	}  	rc = 0; +	/* look up midi devices */ +	schedule_work(&async_lookup_work); +   __error:  	kfree(port);  	return rc; @@ -159,6 +168,7 @@ receive_announce(struct snd_seq_event *ev, int direct, void *private, int atomic  int  snd_seq_oss_delete_client(void)  { +	cancel_work_sync(&async_lookup_work);  	if (system_client >= 0)  		snd_seq_delete_kernel_client(system_client); @@ -179,10 +189,9 @@ snd_seq_oss_open(struct file *file, int level)  	dp = kzalloc(sizeof(*dp), GFP_KERNEL);  	if (!dp) { -		snd_printk(KERN_ERR "can't malloc device info\n"); +		pr_err("ALSA: seq_oss: can't malloc device info\n");  		return -ENOMEM;  	} -	debug_printk(("oss_open: dp = %p\n", dp));  	dp->cseq = system_client;  	dp->port = -1; @@ -195,7 +204,7 @@ snd_seq_oss_open(struct file *file, int level)  	dp->index = i;  	if (i >= SNDRV_SEQ_OSS_MAX_CLIENTS) { -		snd_printk(KERN_ERR "too many applications\n"); +		pr_err("ALSA: seq_oss: too many applications\n");  		rc = -ENOMEM;  		goto _error;  	} @@ -205,21 +214,19 @@ snd_seq_oss_open(struct file *file, int level)  	snd_seq_oss_midi_setup(dp);  	if (dp->synth_opened == 0 && dp->max_mididev == 0) { -		/* snd_printk(KERN_ERR "no device found\n"); */ +		/* pr_err("ALSA: seq_oss: no device found\n"); */  		rc = -ENODEV;  		goto _error;  	}  	/* create port */ -	debug_printk(("create new port\n"));  	rc = create_port(dp);  	if (rc < 0) { -		snd_printk(KERN_ERR "can't create port\n"); +		pr_err("ALSA: seq_oss: can't create port\n");  		goto _error;  	}  	/* allocate queue */ -	debug_printk(("allocate queue\n"));  	rc = alloc_seq_queue(dp);  	if (rc < 0)  		goto _error; @@ -236,7 +243,6 @@ snd_seq_oss_open(struct file *file, int level)  	dp->file_mode = translate_mode(file);  	/* initialize read queue */ -	debug_printk(("initialize read queue\n"));  	if (is_read_mode(dp->file_mode)) {  		dp->readq = snd_seq_oss_readq_new(dp, maxqlen);  		if (!dp->readq) { @@ -246,7 +252,6 @@ snd_seq_oss_open(struct file *file, int level)  	}  	/* initialize write queue */ -	debug_printk(("initialize write queue\n"));  	if (is_write_mode(dp->file_mode)) {  		dp->writeq = snd_seq_oss_writeq_new(dp, maxqlen);  		if (!dp->writeq) { @@ -256,14 +261,12 @@ snd_seq_oss_open(struct file *file, int level)  	}  	/* initialize timer */ -	debug_printk(("initialize timer\n"));  	dp->timer = snd_seq_oss_timer_new(dp);  	if (!dp->timer) { -		snd_printk(KERN_ERR "can't alloc timer\n"); +		pr_err("ALSA: seq_oss: can't alloc timer\n");  		rc = -ENOMEM;  		goto _error;  	} -	debug_printk(("timer initialized\n"));  	/* set private data pointer */  	file->private_data = dp; @@ -277,7 +280,6 @@ snd_seq_oss_open(struct file *file, int level)  	client_table[dp->index] = dp;  	num_clients++; -	debug_printk(("open done\n"));  	return 0;   _error: @@ -336,7 +338,6 @@ create_port(struct seq_oss_devinfo *dp)  		return rc;  	dp->port = port.addr.port; -	debug_printk(("new port = %d\n", port.addr.port));  	return 0;  } @@ -352,7 +353,6 @@ delete_port(struct seq_oss_devinfo *dp)  		return 0;  	} -	debug_printk(("delete_port %i\n", dp->port));  	return snd_seq_event_port_detach(dp->cseq, dp->port);  } @@ -390,7 +390,7 @@ delete_seq_queue(int queue)  	qinfo.queue = queue;  	rc = call_ctl(SNDRV_SEQ_IOCTL_DELETE_QUEUE, &qinfo);  	if (rc < 0) -		printk(KERN_ERR "seq-oss: unable to delete queue %d (%d)\n", queue, rc); +		pr_err("ALSA: seq_oss: unable to delete queue %d (%d)\n", queue, rc);  	return rc;  } @@ -427,21 +427,16 @@ snd_seq_oss_release(struct seq_oss_devinfo *dp)  	client_table[dp->index] = NULL;  	num_clients--; -	debug_printk(("resetting..\n"));  	snd_seq_oss_reset(dp); -	debug_printk(("cleaning up..\n"));  	snd_seq_oss_synth_cleanup(dp);  	snd_seq_oss_midi_cleanup(dp);  	/* clear slot */ -	debug_printk(("releasing resource..\n"));  	queue = dp->queue;  	if (dp->port >= 0)  		delete_port(dp);  	delete_seq_queue(queue); - -	debug_printk(("release done\n"));  } @@ -455,7 +450,6 @@ snd_seq_oss_drain_write(struct seq_oss_devinfo *dp)  		return;  	if (is_write_mode(dp->file_mode) && !is_nonblock_mode(dp->file_mode) &&  	    dp->writeq) { -		debug_printk(("syncing..\n"));  		while (snd_seq_oss_writeq_sync(dp->writeq))  			;  	} diff --git a/sound/core/seq/oss/seq_oss_ioctl.c b/sound/core/seq/oss/seq_oss_ioctl.c index 5ac701c903c..5b8520177b0 100644 --- a/sound/core/seq/oss/seq_oss_ioctl.c +++ b/sound/core/seq/oss/seq_oss_ioctl.c @@ -90,12 +90,10 @@ snd_seq_oss_ioctl(struct seq_oss_devinfo *dp, unsigned int cmd, unsigned long ca  		return snd_seq_oss_timer_ioctl(dp->timer, cmd, arg);  	case SNDCTL_SEQ_PANIC: -		debug_printk(("panic\n"));  		snd_seq_oss_reset(dp);  		return -EINVAL;  	case SNDCTL_SEQ_SYNC: -		debug_printk(("sync\n"));  		if (! is_write_mode(dp->file_mode) || dp->writeq == NULL)  			return 0;  		while (snd_seq_oss_writeq_sync(dp->writeq)) @@ -105,55 +103,45 @@ snd_seq_oss_ioctl(struct seq_oss_devinfo *dp, unsigned int cmd, unsigned long ca  		return 0;  	case SNDCTL_SEQ_RESET: -		debug_printk(("reset\n"));  		snd_seq_oss_reset(dp);  		return 0;  	case SNDCTL_SEQ_TESTMIDI: -		debug_printk(("test midi\n"));  		if (get_user(dev, p))  			return -EFAULT;  		return snd_seq_oss_midi_open(dp, dev, dp->file_mode);  	case SNDCTL_SEQ_GETINCOUNT: -		debug_printk(("get in count\n"));  		if (dp->readq == NULL || ! is_read_mode(dp->file_mode))  			return 0;  		return put_user(dp->readq->qlen, p) ? -EFAULT : 0;  	case SNDCTL_SEQ_GETOUTCOUNT: -		debug_printk(("get out count\n"));  		if (! is_write_mode(dp->file_mode) || dp->writeq == NULL)  			return 0;  		return put_user(snd_seq_oss_writeq_get_free_size(dp->writeq), p) ? -EFAULT : 0;  	case SNDCTL_SEQ_GETTIME: -		debug_printk(("get time\n"));  		return put_user(snd_seq_oss_timer_cur_tick(dp->timer), p) ? -EFAULT : 0;  	case SNDCTL_SEQ_RESETSAMPLES: -		debug_printk(("reset samples\n"));  		if (get_user(dev, p))  			return -EFAULT;  		return snd_seq_oss_synth_ioctl(dp, dev, cmd, carg);  	case SNDCTL_SEQ_NRSYNTHS: -		debug_printk(("nr synths\n"));  		return put_user(dp->max_synthdev, p) ? -EFAULT : 0;  	case SNDCTL_SEQ_NRMIDIS: -		debug_printk(("nr midis\n"));  		return put_user(dp->max_mididev, p) ? -EFAULT : 0;  	case SNDCTL_SYNTH_MEMAVL: -		debug_printk(("mem avail\n"));  		if (get_user(dev, p))  			return -EFAULT;  		val = snd_seq_oss_synth_ioctl(dp, dev, cmd, carg);  		return put_user(val, p) ? -EFAULT : 0;  	case SNDCTL_FM_4OP_ENABLE: -		debug_printk(("4op\n"));  		if (get_user(dev, p))  			return -EFAULT;  		snd_seq_oss_synth_ioctl(dp, dev, cmd, carg); @@ -161,19 +149,15 @@ snd_seq_oss_ioctl(struct seq_oss_devinfo *dp, unsigned int cmd, unsigned long ca  	case SNDCTL_SYNTH_INFO:  	case SNDCTL_SYNTH_ID: -		debug_printk(("synth info\n"));  		return snd_seq_oss_synth_info_user(dp, arg);  	case SNDCTL_SEQ_OUTOFBAND: -		debug_printk(("out of band\n"));  		return snd_seq_oss_oob_user(dp, arg);  	case SNDCTL_MIDI_INFO: -		debug_printk(("midi info\n"));  		return snd_seq_oss_midi_info_user(dp, arg);  	case SNDCTL_SEQ_THRESHOLD: -		debug_printk(("threshold\n"));  		if (! is_write_mode(dp->file_mode))  			return 0;  		if (get_user(val, p)) @@ -186,7 +170,6 @@ snd_seq_oss_ioctl(struct seq_oss_devinfo *dp, unsigned int cmd, unsigned long ca  		return 0;  	case SNDCTL_MIDI_PRETIME: -		debug_printk(("pretime\n"));  		if (dp->readq == NULL || !is_read_mode(dp->file_mode))  			return 0;  		if (get_user(val, p)) @@ -199,7 +182,6 @@ snd_seq_oss_ioctl(struct seq_oss_devinfo *dp, unsigned int cmd, unsigned long ca  		return put_user(val, p) ? -EFAULT : 0;  	default: -		debug_printk(("others\n"));  		if (! is_write_mode(dp->file_mode))  			return -EIO;  		return snd_seq_oss_synth_ioctl(dp, 0, cmd, carg); diff --git a/sound/core/seq/oss/seq_oss_midi.c b/sound/core/seq/oss/seq_oss_midi.c index 677dc84590c..3a4569669ef 100644 --- a/sound/core/seq/oss/seq_oss_midi.c +++ b/sound/core/seq/oss/seq_oss_midi.c @@ -72,7 +72,7 @@ static int send_midi_event(struct seq_oss_devinfo *dp, struct snd_seq_event *ev,   * look up the existing ports   * this looks a very exhausting job.   */ -int __init +int  snd_seq_oss_midi_lookup_ports(int client)  {  	struct snd_seq_client_info *clinfo; @@ -153,7 +153,6 @@ snd_seq_oss_midi_check_new_port(struct snd_seq_port_info *pinfo)  	struct seq_oss_midi *mdev;  	unsigned long flags; -	debug_printk(("check for MIDI client %d port %d\n", pinfo->addr.client, pinfo->addr.port));  	/* the port must include generic midi */  	if (! (pinfo->type & SNDRV_SEQ_PORT_TYPE_MIDI_GENERIC))  		return 0; @@ -175,7 +174,7 @@ snd_seq_oss_midi_check_new_port(struct snd_seq_port_info *pinfo)  	 * allocate midi info record  	 */  	if ((mdev = kzalloc(sizeof(*mdev), GFP_KERNEL)) == NULL) { -		snd_printk(KERN_ERR "can't malloc midi info\n"); +		pr_err("ALSA: seq_oss: can't malloc midi info\n");  		return -ENOMEM;  	} @@ -191,7 +190,7 @@ snd_seq_oss_midi_check_new_port(struct snd_seq_port_info *pinfo)  	/* create MIDI coder */  	if (snd_midi_event_new(MAX_MIDI_EVENT_BUF, &mdev->coder) < 0) { -		snd_printk(KERN_ERR "can't malloc midi coder\n"); +		pr_err("ALSA: seq_oss: can't malloc midi coder\n");  		kfree(mdev);  		return -ENOMEM;  	} @@ -406,7 +405,6 @@ snd_seq_oss_midi_close(struct seq_oss_devinfo *dp, int dev)  		return 0;  	} -	debug_printk(("closing client %d port %d mode %d\n", mdev->client, mdev->port, mdev->opened));  	memset(&subs, 0, sizeof(subs));  	if (mdev->opened & PERM_WRITE) {  		subs.sender = dp->addr; @@ -470,7 +468,6 @@ snd_seq_oss_midi_reset(struct seq_oss_devinfo *dp, int dev)  		struct snd_seq_event ev;  		int c; -		debug_printk(("resetting client %d port %d\n", mdev->client, mdev->port));  		memset(&ev, 0, sizeof(ev));  		ev.dest.client = mdev->client;  		ev.dest.port = mdev->port; diff --git a/sound/core/seq/oss/seq_oss_readq.c b/sound/core/seq/oss/seq_oss_readq.c index 73661c4ab82..654d17a5023 100644 --- a/sound/core/seq/oss/seq_oss_readq.c +++ b/sound/core/seq/oss/seq_oss_readq.c @@ -48,12 +48,12 @@ snd_seq_oss_readq_new(struct seq_oss_devinfo *dp, int maxlen)  	struct seq_oss_readq *q;  	if ((q = kzalloc(sizeof(*q), GFP_KERNEL)) == NULL) { -		snd_printk(KERN_ERR "can't malloc read queue\n"); +		pr_err("ALSA: seq_oss: can't malloc read queue\n");  		return NULL;  	}  	if ((q->q = kcalloc(maxlen, sizeof(union evrec), GFP_KERNEL)) == NULL) { -		snd_printk(KERN_ERR "can't malloc read queue buffer\n"); +		pr_err("ALSA: seq_oss: can't malloc read queue buffer\n");  		kfree(q);  		return NULL;  	} diff --git a/sound/core/seq/oss/seq_oss_synth.c b/sound/core/seq/oss/seq_oss_synth.c index ee44ab9593c..701feb71b70 100644 --- a/sound/core/seq/oss/seq_oss_synth.c +++ b/sound/core/seq/oss/seq_oss_synth.c @@ -24,6 +24,7 @@  #include "seq_oss_midi.h"  #include "../seq_lock.h"  #include <linux/init.h> +#include <linux/module.h>  #include <linux/slab.h>  /* @@ -105,7 +106,7 @@ snd_seq_oss_synth_register(struct snd_seq_device *dev)  	unsigned long flags;  	if ((rec = kzalloc(sizeof(*rec), GFP_KERNEL)) == NULL) { -		snd_printk(KERN_ERR "can't malloc synth info\n"); +		pr_err("ALSA: seq_oss: can't malloc synth info\n");  		return -ENOMEM;  	}  	rec->seq_device = -1; @@ -129,7 +130,7 @@ snd_seq_oss_synth_register(struct snd_seq_device *dev)  	if (i >= max_synth_devs) {  		if (max_synth_devs >= SNDRV_SEQ_OSS_MAX_SYNTH_DEVS) {  			spin_unlock_irqrestore(®ister_lock, flags); -			snd_printk(KERN_ERR "no more synth slot\n"); +			pr_err("ALSA: seq_oss: no more synth slot\n");  			kfree(rec);  			return -ENOMEM;  		} @@ -137,7 +138,6 @@ snd_seq_oss_synth_register(struct snd_seq_device *dev)  	}  	rec->seq_device = i;  	synth_devs[i] = rec; -	debug_printk(("synth %s registered %d\n", rec->name, i));  	spin_unlock_irqrestore(®ister_lock, flags);  	dev->driver_data = rec;  #ifdef SNDRV_OSS_INFO_DEV_SYNTH @@ -162,7 +162,7 @@ snd_seq_oss_synth_unregister(struct snd_seq_device *dev)  	}  	if (index >= max_synth_devs) {  		spin_unlock_irqrestore(®ister_lock, flags); -		snd_printk(KERN_ERR "can't unregister synth\n"); +		pr_err("ALSA: seq_oss: can't unregister synth\n");  		return -EINVAL;  	}  	synth_devs[index] = NULL; @@ -247,7 +247,7 @@ snd_seq_oss_synth_setup(struct seq_oss_devinfo *dp)  		if (info->nr_voices > 0) {  			info->ch = kcalloc(info->nr_voices, sizeof(struct seq_oss_chinfo), GFP_KERNEL);  			if (!info->ch) { -				snd_printk(KERN_ERR "Cannot malloc\n"); +				pr_err("ALSA: seq_oss: Cannot malloc voices\n");  				rec->oper.close(&info->arg);  				module_put(rec->oper.owner);  				snd_use_lock_free(&rec->use_lock); @@ -255,7 +255,6 @@ snd_seq_oss_synth_setup(struct seq_oss_devinfo *dp)  			}  			reset_channels(info);  		} -		debug_printk(("synth %d assigned\n", i));  		info->opened++;  		rec->opened++;  		dp->synth_opened++; @@ -325,7 +324,6 @@ snd_seq_oss_synth_cleanup(struct seq_oss_devinfo *dp)  			if (rec == NULL)  				continue;  			if (rec->opened > 0) { -				debug_printk(("synth %d closed\n", i));  				rec->oper.close(&info->arg);  				module_put(rec->oper.owner);  				rec->opened = 0; diff --git a/sound/core/seq/oss/seq_oss_timer.c b/sound/core/seq/oss/seq_oss_timer.c index ab59cbfbcaf..4f24ea9fad9 100644 --- a/sound/core/seq/oss/seq_oss_timer.c +++ b/sound/core/seq/oss/seq_oss_timer.c @@ -233,7 +233,6 @@ snd_seq_oss_timer_ioctl(struct seq_oss_timer *timer, unsigned int cmd, int __use  	int value;  	if (cmd == SNDCTL_SEQ_CTRLRATE) { -		debug_printk(("ctrl rate\n"));  		/* if *arg == 0, just return the current rate */  		if (get_user(value, arg))  			return -EFAULT; @@ -248,21 +247,16 @@ snd_seq_oss_timer_ioctl(struct seq_oss_timer *timer, unsigned int cmd, int __use  	switch (cmd) {  	case SNDCTL_TMR_START: -		debug_printk(("timer start\n"));  		return snd_seq_oss_timer_start(timer);  	case SNDCTL_TMR_STOP: -		debug_printk(("timer stop\n"));  		return snd_seq_oss_timer_stop(timer);  	case SNDCTL_TMR_CONTINUE: -		debug_printk(("timer continue\n"));  		return snd_seq_oss_timer_continue(timer);  	case SNDCTL_TMR_TEMPO: -		debug_printk(("timer tempo\n"));  		if (get_user(value, arg))  			return -EFAULT;  		return snd_seq_oss_timer_tempo(timer, value);  	case SNDCTL_TMR_TIMEBASE: -		debug_printk(("timer timebase\n"));  		if (get_user(value, arg))  			return -EFAULT;  		if (value < MIN_OSS_TIMEBASE) @@ -276,7 +270,6 @@ snd_seq_oss_timer_ioctl(struct seq_oss_timer *timer, unsigned int cmd, int __use  	case SNDCTL_TMR_METRONOME:  	case SNDCTL_TMR_SELECT:  	case SNDCTL_TMR_SOURCE: -		debug_printk(("timer XXX\n"));  		/* not supported */  		return 0;  	} diff --git a/sound/core/seq/seq.c b/sound/core/seq/seq.c index bf09a5ad186..71211056108 100644 --- a/sound/core/seq/seq.c +++ b/sound/core/seq/seq.c @@ -20,7 +20,8 @@   */  #include <linux/init.h> -#include <linux/moduleparam.h> +#include <linux/module.h> +#include <linux/device.h>  #include <sound/core.h>  #include <sound/initval.h> @@ -32,6 +33,7 @@  #include "seq_timer.h"  #include "seq_system.h"  #include "seq_info.h" +#include <sound/minors.h>  #include <sound/seq_device.h>  #if defined(CONFIG_SND_SEQ_DUMMY_MODULE) @@ -73,6 +75,9 @@ MODULE_PARM_DESC(seq_default_timer_subdevice, "The default timer subdevice numbe  module_param(seq_default_timer_resolution, int, 0644);  MODULE_PARM_DESC(seq_default_timer_resolution, "The default timer resolution in Hz."); +MODULE_ALIAS_CHARDEV(CONFIG_SND_MAJOR, SNDRV_MINOR_SEQUENCER); +MODULE_ALIAS("devname:snd/seq"); +  /*   *  INIT PART   */ diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c index 99a485f1364..225c73152ee 100644 --- a/sound/core/seq/seq_clientmgr.c +++ b/sound/core/seq/seq_clientmgr.c @@ -22,6 +22,7 @@   */  #include <linux/init.h> +#include <linux/export.h>  #include <linux/slab.h>  #include <sound/core.h>  #include <sound/minors.h> @@ -122,7 +123,7 @@ static inline int snd_seq_write_pool_allocated(struct snd_seq_client *client)  static struct snd_seq_client *clientptr(int clientid)  {  	if (clientid < 0 || clientid >= SNDRV_SEQ_MAX_CLIENTS) { -		snd_printd("Seq: oops. Trying to get pointer to client %d\n", +		pr_debug("ALSA: seq: oops. Trying to get pointer to client %d\n",  			   clientid);  		return NULL;  	} @@ -135,7 +136,7 @@ struct snd_seq_client *snd_seq_client_use_ptr(int clientid)  	struct snd_seq_client *client;  	if (clientid < 0 || clientid >= SNDRV_SEQ_MAX_CLIENTS) { -		snd_printd("Seq: oops. Trying to get pointer to client %d\n", +		pr_debug("ALSA: seq: oops. Trying to get pointer to client %d\n",  			   clientid);  		return NULL;  	} @@ -290,8 +291,8 @@ static void seq_free_client(struct snd_seq_client * client)  	mutex_lock(®ister_mutex);  	switch (client->type) {  	case NO_CLIENT: -		snd_printk(KERN_WARNING "Seq: Trying to free unused client %d\n", -			   client->number); +		pr_warn("ALSA: seq: Trying to free unused client %d\n", +			client->number);  		break;  	case USER_CLIENT:  	case KERNEL_CLIENT: @@ -300,7 +301,7 @@ static void seq_free_client(struct snd_seq_client * client)  		break;  	default: -		snd_printk(KERN_ERR "Seq: Trying to free client %d with undefined type = %d\n", +		pr_err("ALSA: seq: Trying to free client %d with undefined type = %d\n",  			   client->number, client->type);  	}  	mutex_unlock(®ister_mutex); @@ -659,7 +660,7 @@ static int deliver_to_subscribers(struct snd_seq_client *client,  				  int atomic, int hop)  {  	struct snd_seq_subscribers *subs; -	int err = 0, num_ev = 0; +	int err, result = 0, num_ev = 0;  	struct snd_seq_event event_saved;  	struct snd_seq_client_port *src_port;  	struct snd_seq_port_subs_info *grp; @@ -684,8 +685,12 @@ static int deliver_to_subscribers(struct snd_seq_client *client,  						  subs->info.flags & SNDRV_SEQ_PORT_SUBS_TIME_REAL);  		err = snd_seq_deliver_single_event(client, event,  						   0, atomic, hop); -		if (err < 0) -			break; +		if (err < 0) { +			/* save first error that occurs and continue */ +			if (!result) +				result = err; +			continue; +		}  		num_ev++;  		/* restore original event record */  		*event = event_saved; @@ -696,7 +701,7 @@ static int deliver_to_subscribers(struct snd_seq_client *client,  		up_read(&grp->list_mutex);  	*event = event_saved; /* restore */  	snd_seq_port_unlock(src_port); -	return (err < 0) ? err : num_ev; +	return (result < 0) ? result : num_ev;  } @@ -708,7 +713,7 @@ static int port_broadcast_event(struct snd_seq_client *client,  				struct snd_seq_event *event,  				int atomic, int hop)  { -	int num_ev = 0, err = 0; +	int num_ev = 0, err, result = 0;  	struct snd_seq_client *dest_client;  	struct snd_seq_client_port *port; @@ -723,14 +728,18 @@ static int port_broadcast_event(struct snd_seq_client *client,  		err = snd_seq_deliver_single_event(NULL, event,  						   SNDRV_SEQ_FILTER_BROADCAST,  						   atomic, hop); -		if (err < 0) -			break; +		if (err < 0) { +			/* save first error that occurs and continue */ +			if (!result) +				result = err; +			continue; +		}  		num_ev++;  	}  	read_unlock(&dest_client->ports_lock);  	snd_seq_client_unlock(dest_client);  	event->dest.port = SNDRV_SEQ_ADDRESS_BROADCAST; /* restore */ -	return (err < 0) ? err : num_ev; +	return (result < 0) ? result : num_ev;  }  /* @@ -740,7 +749,7 @@ static int port_broadcast_event(struct snd_seq_client *client,  static int broadcast_event(struct snd_seq_client *client,  			   struct snd_seq_event *event, int atomic, int hop)  { -	int err = 0, num_ev = 0; +	int err, result = 0, num_ev = 0;  	int dest;  	struct snd_seq_addr addr; @@ -759,12 +768,16 @@ static int broadcast_event(struct snd_seq_client *client,  			err = snd_seq_deliver_single_event(NULL, event,  							   SNDRV_SEQ_FILTER_BROADCAST,  							   atomic, hop); -		if (err < 0) -			break; +		if (err < 0) { +			/* save first error that occurs and continue */ +			if (!result) +				result = err; +			continue; +		}  		num_ev += err;  	}  	event->dest = addr; /* restore */ -	return (err < 0) ? err : num_ev; +	return (result < 0) ? result : num_ev;  } @@ -772,7 +785,7 @@ static int broadcast_event(struct snd_seq_client *client,  static int multicast_event(struct snd_seq_client *client, struct snd_seq_event *event,  			   int atomic, int hop)  { -	snd_printd("seq: multicast not supported yet.\n"); +	pr_debug("ALSA: seq: multicast not supported yet.\n");  	return 0; /* ignored */  }  #endif /* SUPPORT_BROADCAST */ @@ -793,7 +806,7 @@ static int snd_seq_deliver_event(struct snd_seq_client *client, struct snd_seq_e  	hop++;  	if (hop >= SNDRV_SEQ_MAX_HOPS) { -		snd_printd("too long delivery path (%d:%d->%d:%d)\n", +		pr_debug("ALSA: seq: too long delivery path (%d:%d->%d:%d)\n",  			   event->source.client, event->source.port,  			   event->dest.client, event->dest.port);  		return -EMLINK; @@ -1052,7 +1065,7 @@ static ssize_t snd_seq_write(struct file *file, const char __user *buf,  		} else {  #ifdef CONFIG_COMPAT  			if (client->convert32 && snd_seq_ev_is_varusr(&event)) { -				void *ptr = compat_ptr(event.data.raw32.d[1]); +				void *ptr = (void __force *)compat_ptr(event.data.raw32.d[1]);  				event.data.ext.ptr = ptr;  			}  #endif @@ -2195,7 +2208,7 @@ static int snd_seq_do_ioctl(struct snd_seq_client *client, unsigned int cmd,  		if (p->cmd == cmd)  			return p->func(client, arg);  	} -	snd_printd("seq unknown ioctl() 0x%x (type='%c', number=0x%02x)\n", +	pr_debug("ALSA: seq unknown ioctl() 0x%x (type='%c', number=0x%02x)\n",  		   cmd, _IOC_TYPE(cmd), _IOC_NR(cmd));  	return -ENOTTY;  } @@ -2407,7 +2420,7 @@ int snd_seq_kernel_client_ctl(int clientid, unsigned int cmd, void *arg)  	if (client == NULL)  		return -ENXIO;  	fs = snd_enter_user(); -	result = snd_seq_do_ioctl(client, cmd, (void __user *)arg); +	result = snd_seq_do_ioctl(client, cmd, (void __force __user *)arg);  	snd_leave_user(fs);  	return result;  } @@ -2497,9 +2510,6 @@ static void snd_seq_info_dump_ports(struct snd_info_buffer *buffer,  } -void snd_seq_info_pool(struct snd_info_buffer *buffer, -		       struct snd_seq_pool *pool, char *space); -  /* exported to seq_info.c */  void snd_seq_info_clients_read(struct snd_info_entry *entry,   			       struct snd_info_buffer *buffer) diff --git a/sound/core/seq/seq_device.c b/sound/core/seq/seq_device.c index 1f997675c89..91a786a783e 100644 --- a/sound/core/seq/seq_device.c +++ b/sound/core/seq/seq_device.c @@ -37,6 +37,7 @@   */  #include <linux/init.h> +#include <linux/module.h>  #include <sound/core.h>  #include <sound/info.h>  #include <sound/seq_device.h> @@ -65,7 +66,7 @@ struct ops_list {  	/* operators */  	struct snd_seq_dev_ops ops; -	/* registred devices */ +	/* registered devices */  	struct list_head dev_list;	/* list of devices */  	int num_devices;	/* number of associated devices */  	int num_init_devices;	/* number of initialized devices */ @@ -167,7 +168,7 @@ void snd_seq_device_load_drivers(void)  /*   * register a sequencer device - * card = card info (NULL allowed) + * card = card info   * device = device number (if any)   * id = id of driver   * result = return pointer (NULL allowed if unnecessary) @@ -324,7 +325,7 @@ int snd_seq_device_register_driver(char *id, struct snd_seq_dev_ops *entry,  		return -ENOMEM;  	}  	if (ops->driver & DRIVER_LOADED) { -		snd_printk(KERN_WARNING "driver_register: driver '%s' already exists\n", id); +		pr_warn("ALSA: seq: driver_register: driver '%s' already exists\n", id);  		unlock_driver(ops);  		snd_seq_autoload_unlock();  		return -EBUSY; @@ -397,7 +398,7 @@ int snd_seq_device_unregister_driver(char *id)  		return -ENXIO;  	if (! (ops->driver & DRIVER_LOADED) ||  	    (ops->driver & DRIVER_LOCKED)) { -		snd_printk(KERN_ERR "driver_unregister: cannot unload driver '%s': status=%x\n", +		pr_err("ALSA: seq: driver_unregister: cannot unload driver '%s': status=%x\n",  			   id, ops->driver);  		unlock_driver(ops);  		return -EBUSY; @@ -412,7 +413,7 @@ int snd_seq_device_unregister_driver(char *id)  	ops->driver = 0;  	if (ops->num_init_devices > 0) -		snd_printk(KERN_ERR "free_driver: init_devices > 0!! (%d)\n", +		pr_err("ALSA: seq: free_driver: init_devices > 0!! (%d)\n",  			   ops->num_init_devices);  	mutex_unlock(&ops->reg_mutex); @@ -458,7 +459,7 @@ static int init_device(struct snd_seq_device *dev, struct ops_list *ops)  	if (dev->status != SNDRV_SEQ_DEVICE_FREE)  		return 0; /* already initialized */  	if (ops->argsize != dev->argsize) { -		snd_printk(KERN_ERR "incompatible device '%s' for plug-in '%s' (%d %d)\n", +		pr_err("ALSA: seq: incompatible device '%s' for plug-in '%s' (%d %d)\n",  			   dev->name, ops->id, ops->argsize, dev->argsize);  		return -EINVAL;  	} @@ -466,7 +467,7 @@ static int init_device(struct snd_seq_device *dev, struct ops_list *ops)  		dev->status = SNDRV_SEQ_DEVICE_REGISTERED;  		ops->num_init_devices++;  	} else { -		snd_printk(KERN_ERR "init_device failed: %s: %s\n", +		pr_err("ALSA: seq: init_device failed: %s: %s\n",  			   dev->name, dev->id);  	} @@ -485,7 +486,7 @@ static int free_device(struct snd_seq_device *dev, struct ops_list *ops)  	if (dev->status != SNDRV_SEQ_DEVICE_REGISTERED)  		return 0; /* not registered */  	if (ops->argsize != dev->argsize) { -		snd_printk(KERN_ERR "incompatible device '%s' for plug-in '%s' (%d %d)\n", +		pr_err("ALSA: seq: incompatible device '%s' for plug-in '%s' (%d %d)\n",  			   dev->name, ops->id, ops->argsize, dev->argsize);  		return -EINVAL;  	} @@ -494,7 +495,7 @@ static int free_device(struct snd_seq_device *dev, struct ops_list *ops)  		dev->driver_data = NULL;  		ops->num_init_devices--;  	} else { -		snd_printk(KERN_ERR "free_device failed: %s: %s\n", +		pr_err("ALSA: seq: free_device failed: %s: %s\n",  			   dev->name, dev->id);  	} @@ -558,7 +559,7 @@ static void __exit alsa_seq_device_exit(void)  	snd_info_free_entry(info_entry);  #endif  	if (num_ops) -		snd_printk(KERN_ERR "drivers not released (%d)\n", num_ops); +		pr_err("ALSA: seq: drivers not released (%d)\n", num_ops);  }  module_init(alsa_seq_device_init) @@ -568,5 +569,7 @@ EXPORT_SYMBOL(snd_seq_device_load_drivers);  EXPORT_SYMBOL(snd_seq_device_new);  EXPORT_SYMBOL(snd_seq_device_register_driver);  EXPORT_SYMBOL(snd_seq_device_unregister_driver); +#ifdef CONFIG_MODULES  EXPORT_SYMBOL(snd_seq_autoload_lock);  EXPORT_SYMBOL(snd_seq_autoload_unlock); +#endif diff --git a/sound/core/seq/seq_dummy.c b/sound/core/seq/seq_dummy.c index f3bdc54b429..ec667f158f1 100644 --- a/sound/core/seq/seq_dummy.c +++ b/sound/core/seq/seq_dummy.c @@ -20,7 +20,7 @@  #include <linux/init.h>  #include <linux/slab.h> -#include <linux/moduleparam.h> +#include <linux/module.h>  #include <sound/core.h>  #include "seq_clientmgr.h"  #include <sound/initval.h> @@ -46,11 +46,11 @@    The number of ports to be created can be specified via the module    parameter "ports".  For example, to create four ports, add the -  following option in /etc/modprobe.conf: +  following option in a configuration file under /etc/modprobe.d/:  	option snd-seq-dummy ports=4 -  The modle option "duplex=1" enables duplex operation to the port. +  The model option "duplex=1" enables duplex operation to the port.    In duplex mode, a pair of ports are created instead of single port,    and events are tunneled between pair-ports.  For example, input to    port A is sent to output port of another port B and vice versa. @@ -65,7 +65,7 @@ MODULE_LICENSE("GPL");  MODULE_ALIAS("snd-seq-client-" __stringify(SNDRV_SEQ_CLIENT_DUMMY));  static int ports = 1; -static int duplex; +static bool duplex;  module_param(ports, int, 0444);  MODULE_PARM_DESC(ports, "number of ports to be created"); @@ -198,7 +198,7 @@ register_client(void)  	int i;  	if (ports < 1) { -		snd_printk(KERN_ERR "invalid number of ports %d\n", ports); +		pr_err("ALSA: seq_dummy: invalid number of ports %d\n", ports);  		return -EINVAL;  	} diff --git a/sound/core/seq/seq_fifo.c b/sound/core/seq/seq_fifo.c index 0d75afa786b..53a403e17c5 100644 --- a/sound/core/seq/seq_fifo.c +++ b/sound/core/seq/seq_fifo.c @@ -34,7 +34,7 @@ struct snd_seq_fifo *snd_seq_fifo_new(int poolsize)  	f = kzalloc(sizeof(*f), GFP_KERNEL);  	if (f == NULL) { -		snd_printd("malloc failed for snd_seq_fifo_new() \n"); +		pr_debug("ALSA: seq: malloc failed for snd_seq_fifo_new() \n");  		return NULL;  	} @@ -124,7 +124,7 @@ int snd_seq_fifo_event_in(struct snd_seq_fifo *f,  	snd_use_lock_use(&f->use_lock);  	err = snd_seq_event_dup(f->pool, event, &cell, 1, NULL); /* always non-blocking */  	if (err < 0) { -		if (err == -ENOMEM) +		if ((err == -ENOMEM) || (err == -EAGAIN))  			atomic_inc(&f->overflow);  		snd_use_lock_free(&f->use_lock);  		return err; diff --git a/sound/core/seq/seq_info.c b/sound/core/seq/seq_info.c index 201f8106ffd..acf7769419f 100644 --- a/sound/core/seq/seq_info.c +++ b/sound/core/seq/seq_info.c @@ -20,6 +20,7 @@   */  #include <linux/init.h> +#include <linux/export.h>  #include <sound/core.h>  #include "seq_info.h" diff --git a/sound/core/seq/seq_lock.c b/sound/core/seq/seq_lock.c index 54f921edda7..3b693e924db 100644 --- a/sound/core/seq/seq_lock.c +++ b/sound/core/seq/seq_lock.c @@ -19,6 +19,7 @@   *   */ +#include <linux/export.h>  #include <sound/core.h>  #include "seq_lock.h" @@ -30,12 +31,12 @@ void snd_use_lock_sync_helper(snd_use_lock_t *lockp, const char *file, int line)  	int max_count = 5 * HZ;  	if (atomic_read(lockp) < 0) { -		printk(KERN_WARNING "seq_lock: lock trouble [counter = %d] in %s:%d\n", atomic_read(lockp), file, line); +		pr_warn("ALSA: seq_lock: lock trouble [counter = %d] in %s:%d\n", atomic_read(lockp), file, line);  		return;  	}  	while (atomic_read(lockp) > 0) {  		if (max_count == 0) { -			snd_printk(KERN_WARNING "seq_lock: timeout [%d left] in %s:%d\n", atomic_read(lockp), file, line); +			pr_warn("ALSA: seq_lock: timeout [%d left] in %s:%d\n", atomic_read(lockp), file, line);  			break;  		}  		schedule_timeout_uninterruptible(1); diff --git a/sound/core/seq/seq_memory.c b/sound/core/seq/seq_memory.c index 7fb55436287..1e206de0c2d 100644 --- a/sound/core/seq/seq_memory.c +++ b/sound/core/seq/seq_memory.c @@ -21,6 +21,7 @@   */  #include <linux/init.h> +#include <linux/export.h>  #include <linux/slab.h>  #include <linux/vmalloc.h>  #include <sound/core.h> @@ -86,7 +87,7 @@ int snd_seq_dump_var_event(const struct snd_seq_event *event,  	if (event->data.ext.len & SNDRV_SEQ_EXT_USRPTR) {  		char buf[32]; -		char __user *curptr = (char __user *)event->data.ext.ptr; +		char __user *curptr = (char __force __user *)event->data.ext.ptr;  		while (len > 0) {  			int size = sizeof(buf);  			if (len < size) @@ -157,7 +158,7 @@ int snd_seq_expand_var_event(const struct snd_seq_event *event, int count, char  	if (event->data.ext.len & SNDRV_SEQ_EXT_USRPTR) {  		if (! in_kernel)  			return -EINVAL; -		if (copy_from_user(buf, (void __user *)event->data.ext.ptr, len)) +		if (copy_from_user(buf, (void __force __user *)event->data.ext.ptr, len))  			return -EFAULT;  		return newlen;  	} @@ -235,7 +236,7 @@ static int snd_seq_cell_alloc(struct snd_seq_pool *pool,  	init_waitqueue_entry(&wait, current);  	spin_lock_irqsave(&pool->lock, flags);  	if (pool->ptr == NULL) {	/* not initialized */ -		snd_printd("seq: pool is not initialized\n"); +		pr_debug("ALSA: seq: pool is not initialized\n");  		err = -EINVAL;  		goto __error;  	} @@ -343,7 +344,7 @@ int snd_seq_event_dup(struct snd_seq_pool *pool, struct snd_seq_event *event,  				tmp->event = src->event;  				src = src->next;  			} else if (is_usrptr) { -				if (copy_from_user(&tmp->event, (char __user *)buf, size)) { +				if (copy_from_user(&tmp->event, (char __force __user *)buf, size)) {  					err = -EFAULT;  					goto __error;  				} @@ -387,7 +388,7 @@ int snd_seq_pool_init(struct snd_seq_pool *pool)  	pool->ptr = vmalloc(sizeof(struct snd_seq_event_cell) * pool->size);  	if (pool->ptr == NULL) { -		snd_printd("seq: malloc for sequencer events failed\n"); +		pr_debug("ALSA: seq: malloc for sequencer events failed\n");  		return -ENOMEM;  	} @@ -430,7 +431,7 @@ int snd_seq_pool_done(struct snd_seq_pool *pool)  	while (atomic_read(&pool->counter) > 0) {  		if (max_count == 0) { -			snd_printk(KERN_WARNING "snd_seq_pool_done timeout: %d cells remain\n", atomic_read(&pool->counter)); +			pr_warn("ALSA: snd_seq_pool_done timeout: %d cells remain\n", atomic_read(&pool->counter));  			break;  		}  		schedule_timeout_uninterruptible(1); @@ -463,7 +464,7 @@ struct snd_seq_pool *snd_seq_pool_new(int poolsize)  	/* create pool block */  	pool = kzalloc(sizeof(*pool), GFP_KERNEL);  	if (pool == NULL) { -		snd_printd("seq: malloc failed for pool\n"); +		pr_debug("ALSA: seq: malloc failed for pool\n");  		return NULL;  	}  	spin_lock_init(&pool->lock); diff --git a/sound/core/seq/seq_memory.h b/sound/core/seq/seq_memory.h index 63e91431a29..4a2ec779b8a 100644 --- a/sound/core/seq/seq_memory.h +++ b/sound/core/seq/seq_memory.h @@ -24,6 +24,8 @@  #include <sound/seq_kernel.h>  #include <linux/poll.h> +struct snd_info_buffer; +  /* container for sequencer event (internal use) */  struct snd_seq_event_cell {  	struct snd_seq_event event; @@ -99,5 +101,7 @@ void snd_sequencer_memory_done(void);  /* polling */  int snd_seq_pool_poll_wait(struct snd_seq_pool *pool, struct file *file, poll_table *wait); +void snd_seq_info_pool(struct snd_info_buffer *buffer, +		       struct snd_seq_pool *pool, char *space);  #endif diff --git a/sound/core/seq/seq_midi.c b/sound/core/seq/seq_midi.c index ebaf1b541dc..a1fd77af605 100644 --- a/sound/core/seq/seq_midi.c +++ b/sound/core/seq/seq_midi.c @@ -30,7 +30,7 @@ Possible options for midisynth module:  #include <linux/slab.h>  #include <linux/errno.h>  #include <linux/string.h> -#include <linux/moduleparam.h> +#include <linux/module.h>  #include <linux/mutex.h>  #include <sound/core.h>  #include <sound/rawmidi.h> @@ -121,7 +121,7 @@ static int dump_midi(struct snd_rawmidi_substream *substream, const char *buf, i  	runtime = substream->runtime;  	if ((tmp = runtime->avail) < count) {  		if (printk_ratelimit()) -			snd_printk(KERN_ERR "MIDI output buffer overrun\n"); +			pr_err("ALSA: seq_midi: MIDI output buffer overrun\n");  		return -ENOMEM;  	}  	if (snd_rawmidi_kernel_write(substream, buf, count) < count) @@ -145,7 +145,7 @@ static int event_process_midi(struct snd_seq_event *ev, int direct,  	if (ev->type == SNDRV_SEQ_EVENT_SYSEX) {	/* special case, to save space */  		if ((ev->flags & SNDRV_SEQ_EVENT_LENGTH_MASK) != SNDRV_SEQ_EVENT_LENGTH_VARIABLE) {  			/* invalid event */ -			snd_printd("seq_midi: invalid sysex event flags = 0x%x\n", ev->flags); +			pr_debug("ALSA: seq_midi: invalid sysex event flags = 0x%x\n", ev->flags);  			return 0;  		}  		snd_seq_dump_var_event(ev, (snd_seq_dump_func_t)dump_midi, substream); @@ -189,7 +189,7 @@ static int midisynth_subscribe(void *private_data, struct snd_seq_port_subscribe  					   msynth->subdevice,  					   SNDRV_RAWMIDI_LFLG_INPUT,  					   &msynth->input_rfile)) < 0) { -		snd_printd("midi input open failed!!!\n"); +		pr_debug("ALSA: seq_midi: midi input open failed!!!\n");  		return err;  	}  	runtime = msynth->input_rfile.input->runtime; @@ -231,7 +231,7 @@ static int midisynth_use(void *private_data, struct snd_seq_port_subscribe *info  					   msynth->subdevice,  					   SNDRV_RAWMIDI_LFLG_OUTPUT,  					   &msynth->output_rfile)) < 0) { -		snd_printd("midi output open failed!!!\n"); +		pr_debug("ALSA: seq_midi: midi output open failed!!!\n");  		return err;  	}  	memset(¶ms, 0, sizeof(params)); @@ -362,13 +362,13 @@ snd_seq_midisynth_register_port(struct snd_seq_device *dev)  		if (! port->name[0]) {  			if (info->name[0]) {  				if (ports > 1) -					snprintf(port->name, sizeof(port->name), "%s-%d", info->name, p); +					snprintf(port->name, sizeof(port->name), "%s-%u", info->name, p);  				else  					snprintf(port->name, sizeof(port->name), "%s", info->name);  			} else {  				/* last resort */  				if (ports > 1) -					sprintf(port->name, "MIDI %d-%d-%d", card->number, device, p); +					sprintf(port->name, "MIDI %d-%d-%u", card->number, device, p);  				else  					sprintf(port->name, "MIDI %d-%d", card->number, device);  			} diff --git a/sound/core/seq/seq_midi_emul.c b/sound/core/seq/seq_midi_emul.c index 07c663135c6..9b6470cdcf2 100644 --- a/sound/core/seq/seq_midi_emul.c +++ b/sound/core/seq/seq_midi_emul.c @@ -32,6 +32,7 @@  #include <linux/init.h>  #include <linux/slab.h>  #include <linux/string.h> +#include <linux/module.h>  #include <sound/core.h>  #include <sound/seq_kernel.h>  #include <sound/seq_midi_emul.h> @@ -88,7 +89,7 @@ snd_midi_process_event(struct snd_midi_op *ops,  	int dest_channel = 0;  	if (ev == NULL || chanset == NULL) { -		snd_printd("ev or chanbase NULL (snd_midi_process_event)\n"); +		pr_debug("ALSA: seq_midi_emul: ev or chanbase NULL (snd_midi_process_event)\n");  		return;  	}  	if (chanset->channels == NULL) @@ -97,7 +98,7 @@ snd_midi_process_event(struct snd_midi_op *ops,  	if (snd_seq_ev_is_channel_type(ev)) {  		dest_channel = ev->data.note.channel;  		if (dest_channel >= chanset->max_channels) { -			snd_printd("dest channel is %d, max is %d\n", +			pr_debug("ALSA: seq_midi_emul: dest channel is %d, max is %d\n",  				   dest_channel, chanset->max_channels);  			return;  		} @@ -231,7 +232,7 @@ snd_midi_process_event(struct snd_midi_op *ops,  	case SNDRV_SEQ_EVENT_ECHO:  	not_yet:  	default: -		/*snd_printd("Unimplemented event %d\n", ev->type);*/ +		/*pr_debug("ALSA: seq_midi_emul: Unimplemented event %d\n", ev->type);*/  		break;  	}  } diff --git a/sound/core/seq/seq_midi_event.c b/sound/core/seq/seq_midi_event.c index b5d6ea4904c..37db7ba492a 100644 --- a/sound/core/seq/seq_midi_event.c +++ b/sound/core/seq/seq_midi_event.c @@ -22,6 +22,7 @@  #include <linux/slab.h>  #include <linux/errno.h>  #include <linux/string.h> +#include <linux/module.h>  #include <sound/core.h>  #include <sound/seq_kernel.h>  #include <sound/seq_midi_event.h> diff --git a/sound/core/seq/seq_ports.c b/sound/core/seq/seq_ports.c index 3bf7d73ac52..794a341bf0e 100644 --- a/sound/core/seq/seq_ports.c +++ b/sound/core/seq/seq_ports.c @@ -22,6 +22,7 @@  #include <sound/core.h>  #include <linux/slab.h> +#include <linux/module.h>  #include "seq_system.h"  #include "seq_ports.h"  #include "seq_clientmgr.h" @@ -134,14 +135,14 @@ struct snd_seq_client_port *snd_seq_create_port(struct snd_seq_client *client,  		return NULL;  	if (client->num_ports >= SNDRV_SEQ_MAX_PORTS - 1) { -		snd_printk(KERN_WARNING "too many ports for client %d\n", client->number); +		pr_warn("ALSA: seq: too many ports for client %d\n", client->number);  		return NULL;  	}  	/* create a new port */  	new_port = kzalloc(sizeof(*new_port), GFP_KERNEL);  	if (! new_port) { -		snd_printd("malloc failed for registering client port\n"); +		pr_debug("ALSA: seq: malloc failed for registering client port\n");  		return NULL;	/* failure, out of memory */  	}  	/* init port data */ @@ -412,7 +413,7 @@ int snd_seq_get_port_info(struct snd_seq_client_port * port,   * initialization or termination of devices (see seq_midi.c).   *   * If callback_all option is set, the callback function is invoked - * at each connnection/disconnection.  + * at each connection/disconnection.    */  static int subscribe_port(struct snd_seq_client *client, diff --git a/sound/core/seq/seq_prioq.c b/sound/core/seq/seq_prioq.c index 29896ab2340..021b02bc933 100644 --- a/sound/core/seq/seq_prioq.c +++ b/sound/core/seq/seq_prioq.c @@ -60,7 +60,7 @@ struct snd_seq_prioq *snd_seq_prioq_new(void)  	f = kzalloc(sizeof(*f), GFP_KERNEL);  	if (f == NULL) { -		snd_printd("oops: malloc failed for snd_seq_prioq_new()\n"); +		pr_debug("ALSA: seq: malloc failed for snd_seq_prioq_new()\n");  		return NULL;  	} @@ -79,7 +79,7 @@ void snd_seq_prioq_delete(struct snd_seq_prioq **fifo)  	*fifo = NULL;  	if (f == NULL) { -		snd_printd("oops: snd_seq_prioq_delete() called with NULL prioq\n"); +		pr_debug("ALSA: seq: snd_seq_prioq_delete() called with NULL prioq\n");  		return;  	} @@ -197,7 +197,7 @@ int snd_seq_prioq_cell_in(struct snd_seq_prioq * f,  		cur = cur->next;  		if (! --count) {  			spin_unlock_irqrestore(&f->lock, flags); -			snd_printk(KERN_ERR "cannot find a pointer.. infinite loop?\n"); +			pr_err("ALSA: seq: cannot find a pointer.. infinite loop?\n");  			return -EINVAL;  		}  	} @@ -223,7 +223,7 @@ struct snd_seq_event_cell *snd_seq_prioq_cell_out(struct snd_seq_prioq *f)  	unsigned long flags;  	if (f == NULL) { -		snd_printd("oops: snd_seq_prioq_cell_in() called with NULL prioq\n"); +		pr_debug("ALSA: seq: snd_seq_prioq_cell_in() called with NULL prioq\n");  		return NULL;  	}  	spin_lock_irqsave(&f->lock, flags); @@ -248,7 +248,7 @@ struct snd_seq_event_cell *snd_seq_prioq_cell_out(struct snd_seq_prioq *f)  int snd_seq_prioq_avail(struct snd_seq_prioq * f)  {  	if (f == NULL) { -		snd_printd("oops: snd_seq_prioq_cell_in() called with NULL prioq\n"); +		pr_debug("ALSA: seq: snd_seq_prioq_cell_in() called with NULL prioq\n");  		return 0;  	}  	return f->cells; @@ -259,7 +259,7 @@ int snd_seq_prioq_avail(struct snd_seq_prioq * f)  struct snd_seq_event_cell *snd_seq_prioq_cell_peek(struct snd_seq_prioq * f)  {  	if (f == NULL) { -		snd_printd("oops: snd_seq_prioq_cell_in() called with NULL prioq\n"); +		pr_debug("ALSA: seq: snd_seq_prioq_cell_in() called with NULL prioq\n");  		return NULL;  	}  	return f->head; @@ -321,7 +321,7 @@ void snd_seq_prioq_leave(struct snd_seq_prioq * f, int client, int timestamp)  			freeprev = cell;  		} else {  #if 0 -			printk(KERN_DEBUG "type = %i, source = %i, dest = %i, " +			pr_debug("ALSA: seq: type = %i, source = %i, dest = %i, "  			       "client = %i\n",  				cell->event.type,  				cell->event.source.client, diff --git a/sound/core/seq/seq_queue.c b/sound/core/seq/seq_queue.c index e7a8e9e4edb..aad4878cee5 100644 --- a/sound/core/seq/seq_queue.c +++ b/sound/core/seq/seq_queue.c @@ -112,7 +112,7 @@ static struct snd_seq_queue *queue_new(int owner, int locked)  	q = kzalloc(sizeof(*q), GFP_KERNEL);  	if (q == NULL) { -		snd_printd("malloc failed for snd_seq_queue_new()\n"); +		pr_debug("ALSA: seq: malloc failed for snd_seq_queue_new()\n");  		return NULL;  	} @@ -467,13 +467,11 @@ int snd_seq_queue_timer_open(int queueid)  int snd_seq_queue_timer_close(int queueid)  {  	struct snd_seq_queue *queue; -	struct snd_seq_timer *tmr;  	int result = 0;  	queue = queueptr(queueid);  	if (queue == NULL)  		return -EINVAL; -	tmr = queue->timer;  	snd_seq_timer_close(queue);  	queuefree(queue);  	return result; diff --git a/sound/core/seq/seq_system.c b/sound/core/seq/seq_system.c index c38b90cf3cb..8ce1d0b40dc 100644 --- a/sound/core/seq/seq_system.c +++ b/sound/core/seq/seq_system.c @@ -20,6 +20,7 @@   */  #include <linux/init.h> +#include <linux/export.h>  #include <linux/slab.h>  #include <sound/core.h>  #include "seq_system.h" diff --git a/sound/core/seq/seq_timer.c b/sound/core/seq/seq_timer.c index 160b1bd0cd6..e73605393ee 100644 --- a/sound/core/seq/seq_timer.c +++ b/sound/core/seq/seq_timer.c @@ -57,7 +57,7 @@ struct snd_seq_timer *snd_seq_timer_new(void)  	tmr = kzalloc(sizeof(*tmr), GFP_KERNEL);  	if (tmr == NULL) { -		snd_printd("malloc failed for snd_seq_timer_new() \n"); +		pr_debug("ALSA: seq: malloc failed for snd_seq_timer_new() \n");  		return NULL;  	}  	spin_lock_init(&tmr->lock); @@ -78,7 +78,7 @@ void snd_seq_timer_delete(struct snd_seq_timer **tmr)  	*tmr = NULL;  	if (t == NULL) { -		snd_printd("oops: snd_seq_timer_delete() called with NULL timer\n"); +		pr_debug("ALSA: seq: snd_seq_timer_delete() called with NULL timer\n");  		return;  	}  	t->running = 0; @@ -199,7 +199,7 @@ int snd_seq_timer_set_ppq(struct snd_seq_timer * tmr, int ppq)  		/* refuse to change ppq on running timers */  		/* because it will upset the song position (ticks) */  		spin_unlock_irqrestore(&tmr->lock, flags); -		snd_printd("seq: cannot change ppq of a running timer\n"); +		pr_debug("ALSA: seq: cannot change ppq of a running timer\n");  		return -EBUSY;  	} @@ -252,7 +252,7 @@ int snd_seq_timer_set_skew(struct snd_seq_timer *tmr, unsigned int skew,  	/* FIXME */  	if (base != SKEW_BASE) { -		snd_printd("invalid skew base 0x%x\n", base); +		pr_debug("ALSA: seq: invalid skew base 0x%x\n", base);  		return -EINVAL;  	}  	spin_lock_irqsave(&tmr->lock, flags); @@ -290,10 +290,10 @@ int snd_seq_timer_open(struct snd_seq_queue *q)  			tid.device = SNDRV_TIMER_GLOBAL_SYSTEM;  			err = snd_timer_open(&t, str, &tid, q->queue);  		} -		if (err < 0) { -			snd_printk(KERN_ERR "seq fatal error: cannot create timer (%i)\n", err); -			return err; -		} +	} +	if (err < 0) { +		pr_err("ALSA: seq fatal error: cannot create timer (%i)\n", err); +		return err;  	}  	t->callback = snd_seq_timer_interrupt;  	t->callback_data = q; diff --git a/sound/core/seq/seq_virmidi.c b/sound/core/seq/seq_virmidi.c index 86e7739269c..56e0f4cd3f8 100644 --- a/sound/core/seq/seq_virmidi.c +++ b/sound/core/seq/seq_virmidi.c @@ -37,6 +37,7 @@  #include <linux/init.h>  #include <linux/wait.h> +#include <linux/module.h>  #include <linux/slab.h>  #include <sound/core.h>  #include <sound/rawmidi.h> @@ -445,7 +446,7 @@ static int snd_virmidi_dev_register(struct snd_rawmidi *rmidi)  		/* should check presence of port more strictly.. */  		break;  	default: -		snd_printk(KERN_ERR "seq_mode is not set: %d\n", rdev->seq_mode); +		pr_err("ALSA: seq_virmidi: seq_mode is not set: %d\n", rdev->seq_mode);  		return -EINVAL;  	}  	return 0;  | 
