Commit 83e8ad69 authored by Clemens Ladisch's avatar Clemens Ladisch Committed by Jaroslav Kysela

[ALSA] seq: remove struct snd_seq_client_callback

The fields of struct snd_seq_client_callback either aren't used or are
always set to the same value, so we can get rid of it altogether.
Signed-off-by: default avatarClemens Ladisch <clemens@ladisch.de>
parent 255bd169
...@@ -60,15 +60,6 @@ typedef union snd_seq_timestamp snd_seq_timestamp_t; ...@@ -60,15 +60,6 @@ typedef union snd_seq_timestamp snd_seq_timestamp_t;
/* max size of event size */ /* max size of event size */
#define SNDRV_SEQ_MAX_EVENT_LEN 0x3fffffff #define SNDRV_SEQ_MAX_EVENT_LEN 0x3fffffff
/* call-backs for kernel client */
struct snd_seq_client_callback {
void *private_data;
unsigned allow_input: 1,
allow_output: 1;
/*...*/
};
/* call-backs for kernel port */ /* call-backs for kernel port */
struct snd_seq_port_callback { struct snd_seq_port_callback {
struct module *owner; struct module *owner;
...@@ -84,8 +75,7 @@ struct snd_seq_port_callback { ...@@ -84,8 +75,7 @@ struct snd_seq_port_callback {
}; };
/* interface for kernel client */ /* interface for kernel client */
int snd_seq_create_kernel_client(struct snd_card *card, int client_index, int snd_seq_create_kernel_client(struct snd_card *card, int client_index);
struct snd_seq_client_callback *callback);
int snd_seq_delete_kernel_client(int client); int snd_seq_delete_kernel_client(int client);
int snd_seq_kernel_client_enqueue(int client, struct snd_seq_event *ev, int atomic, int hop); int snd_seq_kernel_client_enqueue(int client, struct snd_seq_event *ev, int atomic, int hop);
int snd_seq_kernel_client_dispatch(int client, struct snd_seq_event *ev, int atomic, int hop); int snd_seq_kernel_client_dispatch(int client, struct snd_seq_event *ev, int atomic, int hop);
......
...@@ -65,7 +65,6 @@ int __init ...@@ -65,7 +65,6 @@ int __init
snd_seq_oss_create_client(void) snd_seq_oss_create_client(void)
{ {
int rc; int rc;
struct snd_seq_client_callback callback;
struct snd_seq_client_info *info; struct snd_seq_client_info *info;
struct snd_seq_port_info *port; struct snd_seq_port_info *port;
struct snd_seq_port_callback port_callback; struct snd_seq_port_callback port_callback;
...@@ -78,13 +77,7 @@ snd_seq_oss_create_client(void) ...@@ -78,13 +77,7 @@ snd_seq_oss_create_client(void)
} }
/* create ALSA client */ /* create ALSA client */
memset(&callback, 0, sizeof(callback)); rc = snd_seq_create_kernel_client(NULL, SNDRV_SEQ_CLIENT_OSS);
callback.private_data = NULL;
callback.allow_input = 1;
callback.allow_output = 1;
rc = snd_seq_create_kernel_client(NULL, SNDRV_SEQ_CLIENT_OSS, &callback);
if (rc < 0) if (rc < 0)
goto __error; goto __error;
......
...@@ -2212,15 +2212,12 @@ static long snd_seq_ioctl(struct file *file, unsigned int cmd, unsigned long arg ...@@ -2212,15 +2212,12 @@ static long snd_seq_ioctl(struct file *file, unsigned int cmd, unsigned long arg
/* exported to kernel modules */ /* exported to kernel modules */
int snd_seq_create_kernel_client(struct snd_card *card, int client_index, int snd_seq_create_kernel_client(struct snd_card *card, int client_index)
struct snd_seq_client_callback *callback)
{ {
struct snd_seq_client *client; struct snd_seq_client *client;
snd_assert(! in_interrupt(), return -EBUSY); snd_assert(! in_interrupt(), return -EBUSY);
if (callback == NULL)
return -EINVAL;
if (card && client_index > 3) if (card && client_index > 3)
return -EINVAL; return -EINVAL;
if (card == NULL && client_index > 63) if (card == NULL && client_index > 63)
...@@ -2244,8 +2241,8 @@ int snd_seq_create_kernel_client(struct snd_card *card, int client_index, ...@@ -2244,8 +2241,8 @@ int snd_seq_create_kernel_client(struct snd_card *card, int client_index,
} }
usage_alloc(&client_usage, 1); usage_alloc(&client_usage, 1);
client->accept_input = callback->allow_output; client->accept_input = 1;
client->accept_output = callback->allow_input; client->accept_output = 1;
sprintf(client->name, "Client-%d", client->number); sprintf(client->name, "Client-%d", client->number);
......
...@@ -91,8 +91,6 @@ struct snd_seq_client *snd_seq_client_use_ptr(int clientid); ...@@ -91,8 +91,6 @@ struct snd_seq_client *snd_seq_client_use_ptr(int clientid);
int snd_seq_dispatch_event(struct snd_seq_event_cell *cell, int atomic, int hop); int snd_seq_dispatch_event(struct snd_seq_event_cell *cell, int atomic, int hop);
/* exported to other modules */ /* exported to other modules */
int snd_seq_register_kernel_client(struct snd_seq_client_callback *callback, void *private_data);
int snd_seq_unregister_kernel_client(int client);
int snd_seq_kernel_client_enqueue(int client, struct snd_seq_event *ev, int atomic, int hop); int snd_seq_kernel_client_enqueue(int client, struct snd_seq_event *ev, int atomic, int hop);
int snd_seq_kernel_client_enqueue_blocking(int client, struct snd_seq_event * ev, int snd_seq_kernel_client_enqueue_blocking(int client, struct snd_seq_event * ev,
struct file *file, int atomic, int hop); struct file *file, int atomic, int hop);
......
...@@ -193,7 +193,6 @@ create_port(int idx, int type) ...@@ -193,7 +193,6 @@ create_port(int idx, int type)
static int __init static int __init
register_client(void) register_client(void)
{ {
struct snd_seq_client_callback cb;
struct snd_seq_client_info cinfo; struct snd_seq_client_info cinfo;
struct snd_seq_dummy_port *rec1, *rec2; struct snd_seq_dummy_port *rec1, *rec2;
int i; int i;
...@@ -204,10 +203,7 @@ register_client(void) ...@@ -204,10 +203,7 @@ register_client(void)
} }
/* create client */ /* create client */
memset(&cb, 0, sizeof(cb)); my_client = snd_seq_create_kernel_client(NULL, SNDRV_SEQ_CLIENT_DUMMY);
cb.allow_input = 1;
cb.allow_output = 1;
my_client = snd_seq_create_kernel_client(NULL, SNDRV_SEQ_CLIENT_DUMMY, &cb);
if (my_client < 0) if (my_client < 0)
return my_client; return my_client;
......
...@@ -295,7 +295,6 @@ snd_seq_midisynth_register_port(struct snd_seq_device *dev) ...@@ -295,7 +295,6 @@ snd_seq_midisynth_register_port(struct snd_seq_device *dev)
struct snd_rawmidi_info *info; struct snd_rawmidi_info *info;
int newclient = 0; int newclient = 0;
unsigned int p, ports; unsigned int p, ports;
struct snd_seq_client_callback callbacks;
struct snd_seq_port_callback pcallbacks; struct snd_seq_port_callback pcallbacks;
struct snd_card *card = dev->card; struct snd_card *card = dev->card;
int device = dev->device; int device = dev->device;
...@@ -334,10 +333,7 @@ snd_seq_midisynth_register_port(struct snd_seq_device *dev) ...@@ -334,10 +333,7 @@ snd_seq_midisynth_register_port(struct snd_seq_device *dev)
kfree(info); kfree(info);
return -ENOMEM; return -ENOMEM;
} }
memset(&callbacks, 0, sizeof(callbacks)); client->seq_client = snd_seq_create_kernel_client(card, 0);
callbacks.private_data = client;
callbacks.allow_input = callbacks.allow_output = 1;
client->seq_client = snd_seq_create_kernel_client(card, 0, &callbacks);
if (client->seq_client < 0) { if (client->seq_client < 0) {
kfree(client); kfree(client);
up(&register_mutex); up(&register_mutex);
......
...@@ -120,8 +120,6 @@ static int event_input_timer(struct snd_seq_event * ev, int direct, void *privat ...@@ -120,8 +120,6 @@ static int event_input_timer(struct snd_seq_event * ev, int direct, void *privat
/* register our internal client */ /* register our internal client */
int __init snd_seq_system_client_init(void) int __init snd_seq_system_client_init(void)
{ {
struct snd_seq_client_callback callbacks;
struct snd_seq_port_callback pcallbacks; struct snd_seq_port_callback pcallbacks;
struct snd_seq_client_info *inf; struct snd_seq_client_info *inf;
struct snd_seq_port_info *port; struct snd_seq_port_info *port;
...@@ -134,14 +132,12 @@ int __init snd_seq_system_client_init(void) ...@@ -134,14 +132,12 @@ int __init snd_seq_system_client_init(void)
return -ENOMEM; return -ENOMEM;
} }
memset(&callbacks, 0, sizeof(callbacks));
memset(&pcallbacks, 0, sizeof(pcallbacks)); memset(&pcallbacks, 0, sizeof(pcallbacks));
pcallbacks.owner = THIS_MODULE; pcallbacks.owner = THIS_MODULE;
pcallbacks.event_input = event_input_timer; pcallbacks.event_input = event_input_timer;
/* register client */ /* register client */
callbacks.allow_input = callbacks.allow_output = 1; sysclient = snd_seq_create_kernel_client(NULL, 0);
sysclient = snd_seq_create_kernel_client(NULL, 0, &callbacks);
/* set our name */ /* set our name */
inf->client = 0; inf->client = 0;
......
...@@ -359,7 +359,6 @@ static struct snd_rawmidi_ops snd_virmidi_output_ops = { ...@@ -359,7 +359,6 @@ static struct snd_rawmidi_ops snd_virmidi_output_ops = {
static int snd_virmidi_dev_attach_seq(struct snd_virmidi_dev *rdev) static int snd_virmidi_dev_attach_seq(struct snd_virmidi_dev *rdev)
{ {
int client; int client;
struct snd_seq_client_callback callbacks;
struct snd_seq_port_callback pcallbacks; struct snd_seq_port_callback pcallbacks;
struct snd_seq_client_info *info; struct snd_seq_client_info *info;
struct snd_seq_port_info *pinfo; struct snd_seq_port_info *pinfo;
...@@ -375,11 +374,7 @@ static int snd_virmidi_dev_attach_seq(struct snd_virmidi_dev *rdev) ...@@ -375,11 +374,7 @@ static int snd_virmidi_dev_attach_seq(struct snd_virmidi_dev *rdev)
goto __error; goto __error;
} }
memset(&callbacks, 0, sizeof(callbacks)); client = snd_seq_create_kernel_client(rdev->card, rdev->device);
callbacks.private_data = rdev;
callbacks.allow_input = 1;
callbacks.allow_output = 1;
client = snd_seq_create_kernel_client(rdev->card, rdev->device, &callbacks);
if (client < 0) { if (client < 0) {
err = client; err = client;
goto __error; goto __error;
......
...@@ -219,7 +219,6 @@ static int snd_opl3_seq_new_device(struct snd_seq_device *dev) ...@@ -219,7 +219,6 @@ static int snd_opl3_seq_new_device(struct snd_seq_device *dev)
{ {
struct snd_opl3 *opl3; struct snd_opl3 *opl3;
int client; int client;
struct snd_seq_client_callback callbacks;
struct snd_seq_client_info cinfo; struct snd_seq_client_info cinfo;
int opl_ver; int opl_ver;
...@@ -232,11 +231,8 @@ static int snd_opl3_seq_new_device(struct snd_seq_device *dev) ...@@ -232,11 +231,8 @@ static int snd_opl3_seq_new_device(struct snd_seq_device *dev)
opl3->seq_client = -1; opl3->seq_client = -1;
/* allocate new client */ /* allocate new client */
memset(&callbacks, 0, sizeof(callbacks));
callbacks.private_data = opl3;
callbacks.allow_output = callbacks.allow_input = 1;
client = opl3->seq_client = client = opl3->seq_client =
snd_seq_create_kernel_client(opl3->card, opl3->seq_dev_num, &callbacks); snd_seq_create_kernel_client(opl3->card, opl3->seq_dev_num);
if (client < 0) if (client < 0)
return client; return client;
......
...@@ -127,7 +127,6 @@ static int snd_opl4_seq_new_device(struct snd_seq_device *dev) ...@@ -127,7 +127,6 @@ static int snd_opl4_seq_new_device(struct snd_seq_device *dev)
{ {
struct snd_opl4 *opl4; struct snd_opl4 *opl4;
int client; int client;
struct snd_seq_client_callback callbacks;
struct snd_seq_client_info cinfo; struct snd_seq_client_info cinfo;
struct snd_seq_port_callback pcallbacks; struct snd_seq_port_callback pcallbacks;
...@@ -144,10 +143,7 @@ static int snd_opl4_seq_new_device(struct snd_seq_device *dev) ...@@ -144,10 +143,7 @@ static int snd_opl4_seq_new_device(struct snd_seq_device *dev)
opl4->chset->private_data = opl4; opl4->chset->private_data = opl4;
/* allocate new client */ /* allocate new client */
memset(&callbacks, 0, sizeof(callbacks)); client = snd_seq_create_kernel_client(opl4->card, opl4->seq_dev_num);
callbacks.private_data = opl4;
callbacks.allow_output = callbacks.allow_input = 1;
client = snd_seq_create_kernel_client(opl4->card, opl4->seq_dev_num, &callbacks);
if (client < 0) { if (client < 0) {
snd_midi_channel_free_set(opl4->chset); snd_midi_channel_free_set(opl4->chset);
return client; return client;
......
...@@ -214,7 +214,6 @@ static int snd_gus_synth_new_device(struct snd_seq_device *dev) ...@@ -214,7 +214,6 @@ static int snd_gus_synth_new_device(struct snd_seq_device *dev)
{ {
struct snd_gus_card *gus; struct snd_gus_card *gus;
int client, i; int client, i;
struct snd_seq_client_callback callbacks;
struct snd_seq_client_info *cinfo; struct snd_seq_client_info *cinfo;
struct snd_seq_port_subscribe sub; struct snd_seq_port_subscribe sub;
struct snd_iwffff_ops *iwops; struct snd_iwffff_ops *iwops;
...@@ -233,11 +232,8 @@ static int snd_gus_synth_new_device(struct snd_seq_device *dev) ...@@ -233,11 +232,8 @@ static int snd_gus_synth_new_device(struct snd_seq_device *dev)
return -ENOMEM; return -ENOMEM;
/* allocate new client */ /* allocate new client */
memset(&callbacks, 0, sizeof(callbacks));
callbacks.private_data = gus;
callbacks.allow_output = callbacks.allow_input = 1;
client = gus->gf1.seq_client = client = gus->gf1.seq_client =
snd_seq_create_kernel_client(gus->card, 1, &callbacks); snd_seq_create_kernel_client(gus->card, 1);
if (client < 0) { if (client < 0) {
kfree(cinfo); kfree(cinfo);
return client; return client;
......
...@@ -934,7 +934,6 @@ static int snd_trident_synth_new_device(struct snd_seq_device *dev) ...@@ -934,7 +934,6 @@ static int snd_trident_synth_new_device(struct snd_seq_device *dev)
{ {
struct snd_trident *trident; struct snd_trident *trident;
int client, i; int client, i;
struct snd_seq_client_callback callbacks;
struct snd_seq_client_info cinfo; struct snd_seq_client_info cinfo;
struct snd_seq_port_subscribe sub; struct snd_seq_port_subscribe sub;
struct snd_simple_ops *simpleops; struct snd_simple_ops *simpleops;
...@@ -947,11 +946,8 @@ static int snd_trident_synth_new_device(struct snd_seq_device *dev) ...@@ -947,11 +946,8 @@ static int snd_trident_synth_new_device(struct snd_seq_device *dev)
trident->synth.seq_client = -1; trident->synth.seq_client = -1;
/* allocate new client */ /* allocate new client */
memset(&callbacks, 0, sizeof(callbacks));
callbacks.private_data = trident;
callbacks.allow_output = callbacks.allow_input = 1;
client = trident->synth.seq_client = client = trident->synth.seq_client =
snd_seq_create_kernel_client(trident->card, 1, &callbacks); snd_seq_create_kernel_client(trident->card, 1);
if (client < 0) if (client < 0)
return client; return client;
......
...@@ -347,17 +347,11 @@ snd_emux_unuse(void *private_data, struct snd_seq_port_subscribe *info) ...@@ -347,17 +347,11 @@ snd_emux_unuse(void *private_data, struct snd_seq_port_subscribe *info)
static int static int
get_client(struct snd_card *card, int index, char *name) get_client(struct snd_card *card, int index, char *name)
{ {
struct snd_seq_client_callback callbacks;
struct snd_seq_client_info cinfo; struct snd_seq_client_info cinfo;
int client; int client;
memset(&callbacks, 0, sizeof(callbacks));
callbacks.private_data = NULL;
callbacks.allow_input = 1;
callbacks.allow_output = 1;
/* Find a free client, start from 1 as the MPU expects to use 0 */ /* Find a free client, start from 1 as the MPU expects to use 0 */
client = snd_seq_create_kernel_client(card, index, &callbacks); client = snd_seq_create_kernel_client(card, index);
if (client < 0) if (client < 0)
return client; return client;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment