Loading include/sound/seq_device.h +29 −17 Original line number Diff line number Diff line Loading @@ -25,29 +25,26 @@ * registered device information */ #define ID_LEN 32 /* status flag */ #define SNDRV_SEQ_DEVICE_FREE 0 #define SNDRV_SEQ_DEVICE_REGISTERED 1 struct snd_seq_device { /* device info */ struct snd_card *card; /* sound card */ int device; /* device number */ char id[ID_LEN]; /* driver id */ const char *id; /* driver id */ char name[80]; /* device name */ int argsize; /* size of the argument */ void *driver_data; /* private data for driver */ int status; /* flag - read only */ void *private_data; /* private data for the caller */ void (*private_free)(struct snd_seq_device *device); struct list_head list; /* link to next device */ struct device dev; }; #define to_seq_dev(_dev) \ container_of(_dev, struct snd_seq_device, dev) /* sequencer driver */ /* driver operators * init_device: * probe: * Initialize the device with given parameters. * Typically, * 1. call snd_hwdep_new Loading @@ -55,25 +52,40 @@ struct snd_seq_device { * 3. call snd_hwdep_register * 4. store the instance to dev->driver_data pointer. * * free_device: * remove: * Release the private data. * Typically, call snd_device_free(dev->card, dev->driver_data) */ struct snd_seq_dev_ops { int (*init_device)(struct snd_seq_device *dev); int (*free_device)(struct snd_seq_device *dev); struct snd_seq_driver { struct device_driver driver; char *id; int argsize; }; #define to_seq_drv(_drv) \ container_of(_drv, struct snd_seq_driver, driver) /* * prototypes */ #ifdef CONFIG_MODULES void snd_seq_device_load_drivers(void); int snd_seq_device_new(struct snd_card *card, int device, char *id, int argsize, struct snd_seq_device **result); int snd_seq_device_register_driver(char *id, struct snd_seq_dev_ops *entry, int argsize); int snd_seq_device_unregister_driver(char *id); #else #define snd_seq_device_load_drivers() #endif int snd_seq_device_new(struct snd_card *card, int device, const char *id, int argsize, struct snd_seq_device **result); #define SNDRV_SEQ_DEVICE_ARGPTR(dev) (void *)((char *)(dev) + sizeof(struct snd_seq_device)) int __must_check __snd_seq_driver_register(struct snd_seq_driver *drv, struct module *mod); #define snd_seq_driver_register(drv) \ __snd_seq_driver_register(drv, THIS_MODULE) void snd_seq_driver_unregister(struct snd_seq_driver *drv); #define module_snd_seq_driver(drv) \ module_driver(drv, snd_seq_driver_register, snd_seq_driver_unregister) /* * id strings for generic devices Loading include/sound/seq_kernel.h +1 −5 Original line number Diff line number Diff line Loading @@ -99,13 +99,9 @@ int snd_seq_event_port_attach(int client, struct snd_seq_port_callback *pcbp, int snd_seq_event_port_detach(int client, int port); #ifdef CONFIG_MODULES void snd_seq_autoload_lock(void); void snd_seq_autoload_unlock(void); void snd_seq_autoload_init(void); #define snd_seq_autoload_exit() snd_seq_autoload_lock() void snd_seq_autoload_exit(void); #else #define snd_seq_autoload_lock() #define snd_seq_autoload_unlock() #define snd_seq_autoload_init() #define snd_seq_autoload_exit() #endif Loading sound/core/seq/oss/seq_oss.c +13 −9 Original line number Diff line number Diff line Loading @@ -65,15 +65,20 @@ static unsigned int odev_poll(struct file *file, poll_table * wait); * module interface */ static struct snd_seq_driver seq_oss_synth_driver = { .driver = { .name = KBUILD_MODNAME, .probe = snd_seq_oss_synth_probe, .remove = snd_seq_oss_synth_remove, }, .id = SNDRV_SEQ_DEV_ID_OSS, .argsize = sizeof(struct snd_seq_oss_reg), }; static int __init alsa_seq_oss_init(void) { int rc; static struct snd_seq_dev_ops ops = { snd_seq_oss_synth_register, snd_seq_oss_synth_unregister, }; snd_seq_autoload_lock(); if ((rc = register_device()) < 0) goto error; if ((rc = register_proc()) < 0) { Loading @@ -86,8 +91,8 @@ static int __init alsa_seq_oss_init(void) goto error; } if ((rc = snd_seq_device_register_driver(SNDRV_SEQ_DEV_ID_OSS, &ops, sizeof(struct snd_seq_oss_reg))) < 0) { rc = snd_seq_driver_register(&seq_oss_synth_driver); if (rc < 0) { snd_seq_oss_delete_client(); unregister_proc(); unregister_device(); Loading @@ -98,13 +103,12 @@ static int __init alsa_seq_oss_init(void) snd_seq_oss_synth_init(); error: snd_seq_autoload_unlock(); return rc; } static void __exit alsa_seq_oss_exit(void) { snd_seq_device_unregister_driver(SNDRV_SEQ_DEV_ID_OSS); snd_seq_driver_unregister(&seq_oss_synth_driver); snd_seq_oss_delete_client(); unregister_proc(); unregister_device(); Loading sound/core/seq/oss/seq_oss_synth.c +4 −2 Original line number Diff line number Diff line Loading @@ -98,8 +98,9 @@ snd_seq_oss_synth_init(void) * registration of the synth device */ int snd_seq_oss_synth_register(struct snd_seq_device *dev) snd_seq_oss_synth_probe(struct device *_dev) { struct snd_seq_device *dev = to_seq_dev(_dev); int i; struct seq_oss_synth *rec; struct snd_seq_oss_reg *reg = SNDRV_SEQ_DEVICE_ARGPTR(dev); Loading Loading @@ -149,8 +150,9 @@ snd_seq_oss_synth_register(struct snd_seq_device *dev) int snd_seq_oss_synth_unregister(struct snd_seq_device *dev) snd_seq_oss_synth_remove(struct device *_dev) { struct snd_seq_device *dev = to_seq_dev(_dev); int index; struct seq_oss_synth *rec = dev->driver_data; unsigned long flags; Loading sound/core/seq/oss/seq_oss_synth.h +2 −2 Original line number Diff line number Diff line Loading @@ -28,8 +28,8 @@ #include <sound/seq_device.h> void snd_seq_oss_synth_init(void); int snd_seq_oss_synth_register(struct snd_seq_device *dev); int snd_seq_oss_synth_unregister(struct snd_seq_device *dev); int snd_seq_oss_synth_probe(struct device *dev); int snd_seq_oss_synth_remove(struct device *dev); void snd_seq_oss_synth_setup(struct seq_oss_devinfo *dp); void snd_seq_oss_synth_setup_midi(struct seq_oss_devinfo *dp); void snd_seq_oss_synth_cleanup(struct seq_oss_devinfo *dp); Loading Loading
include/sound/seq_device.h +29 −17 Original line number Diff line number Diff line Loading @@ -25,29 +25,26 @@ * registered device information */ #define ID_LEN 32 /* status flag */ #define SNDRV_SEQ_DEVICE_FREE 0 #define SNDRV_SEQ_DEVICE_REGISTERED 1 struct snd_seq_device { /* device info */ struct snd_card *card; /* sound card */ int device; /* device number */ char id[ID_LEN]; /* driver id */ const char *id; /* driver id */ char name[80]; /* device name */ int argsize; /* size of the argument */ void *driver_data; /* private data for driver */ int status; /* flag - read only */ void *private_data; /* private data for the caller */ void (*private_free)(struct snd_seq_device *device); struct list_head list; /* link to next device */ struct device dev; }; #define to_seq_dev(_dev) \ container_of(_dev, struct snd_seq_device, dev) /* sequencer driver */ /* driver operators * init_device: * probe: * Initialize the device with given parameters. * Typically, * 1. call snd_hwdep_new Loading @@ -55,25 +52,40 @@ struct snd_seq_device { * 3. call snd_hwdep_register * 4. store the instance to dev->driver_data pointer. * * free_device: * remove: * Release the private data. * Typically, call snd_device_free(dev->card, dev->driver_data) */ struct snd_seq_dev_ops { int (*init_device)(struct snd_seq_device *dev); int (*free_device)(struct snd_seq_device *dev); struct snd_seq_driver { struct device_driver driver; char *id; int argsize; }; #define to_seq_drv(_drv) \ container_of(_drv, struct snd_seq_driver, driver) /* * prototypes */ #ifdef CONFIG_MODULES void snd_seq_device_load_drivers(void); int snd_seq_device_new(struct snd_card *card, int device, char *id, int argsize, struct snd_seq_device **result); int snd_seq_device_register_driver(char *id, struct snd_seq_dev_ops *entry, int argsize); int snd_seq_device_unregister_driver(char *id); #else #define snd_seq_device_load_drivers() #endif int snd_seq_device_new(struct snd_card *card, int device, const char *id, int argsize, struct snd_seq_device **result); #define SNDRV_SEQ_DEVICE_ARGPTR(dev) (void *)((char *)(dev) + sizeof(struct snd_seq_device)) int __must_check __snd_seq_driver_register(struct snd_seq_driver *drv, struct module *mod); #define snd_seq_driver_register(drv) \ __snd_seq_driver_register(drv, THIS_MODULE) void snd_seq_driver_unregister(struct snd_seq_driver *drv); #define module_snd_seq_driver(drv) \ module_driver(drv, snd_seq_driver_register, snd_seq_driver_unregister) /* * id strings for generic devices Loading
include/sound/seq_kernel.h +1 −5 Original line number Diff line number Diff line Loading @@ -99,13 +99,9 @@ int snd_seq_event_port_attach(int client, struct snd_seq_port_callback *pcbp, int snd_seq_event_port_detach(int client, int port); #ifdef CONFIG_MODULES void snd_seq_autoload_lock(void); void snd_seq_autoload_unlock(void); void snd_seq_autoload_init(void); #define snd_seq_autoload_exit() snd_seq_autoload_lock() void snd_seq_autoload_exit(void); #else #define snd_seq_autoload_lock() #define snd_seq_autoload_unlock() #define snd_seq_autoload_init() #define snd_seq_autoload_exit() #endif Loading
sound/core/seq/oss/seq_oss.c +13 −9 Original line number Diff line number Diff line Loading @@ -65,15 +65,20 @@ static unsigned int odev_poll(struct file *file, poll_table * wait); * module interface */ static struct snd_seq_driver seq_oss_synth_driver = { .driver = { .name = KBUILD_MODNAME, .probe = snd_seq_oss_synth_probe, .remove = snd_seq_oss_synth_remove, }, .id = SNDRV_SEQ_DEV_ID_OSS, .argsize = sizeof(struct snd_seq_oss_reg), }; static int __init alsa_seq_oss_init(void) { int rc; static struct snd_seq_dev_ops ops = { snd_seq_oss_synth_register, snd_seq_oss_synth_unregister, }; snd_seq_autoload_lock(); if ((rc = register_device()) < 0) goto error; if ((rc = register_proc()) < 0) { Loading @@ -86,8 +91,8 @@ static int __init alsa_seq_oss_init(void) goto error; } if ((rc = snd_seq_device_register_driver(SNDRV_SEQ_DEV_ID_OSS, &ops, sizeof(struct snd_seq_oss_reg))) < 0) { rc = snd_seq_driver_register(&seq_oss_synth_driver); if (rc < 0) { snd_seq_oss_delete_client(); unregister_proc(); unregister_device(); Loading @@ -98,13 +103,12 @@ static int __init alsa_seq_oss_init(void) snd_seq_oss_synth_init(); error: snd_seq_autoload_unlock(); return rc; } static void __exit alsa_seq_oss_exit(void) { snd_seq_device_unregister_driver(SNDRV_SEQ_DEV_ID_OSS); snd_seq_driver_unregister(&seq_oss_synth_driver); snd_seq_oss_delete_client(); unregister_proc(); unregister_device(); Loading
sound/core/seq/oss/seq_oss_synth.c +4 −2 Original line number Diff line number Diff line Loading @@ -98,8 +98,9 @@ snd_seq_oss_synth_init(void) * registration of the synth device */ int snd_seq_oss_synth_register(struct snd_seq_device *dev) snd_seq_oss_synth_probe(struct device *_dev) { struct snd_seq_device *dev = to_seq_dev(_dev); int i; struct seq_oss_synth *rec; struct snd_seq_oss_reg *reg = SNDRV_SEQ_DEVICE_ARGPTR(dev); Loading Loading @@ -149,8 +150,9 @@ snd_seq_oss_synth_register(struct snd_seq_device *dev) int snd_seq_oss_synth_unregister(struct snd_seq_device *dev) snd_seq_oss_synth_remove(struct device *_dev) { struct snd_seq_device *dev = to_seq_dev(_dev); int index; struct seq_oss_synth *rec = dev->driver_data; unsigned long flags; Loading
sound/core/seq/oss/seq_oss_synth.h +2 −2 Original line number Diff line number Diff line Loading @@ -28,8 +28,8 @@ #include <sound/seq_device.h> void snd_seq_oss_synth_init(void); int snd_seq_oss_synth_register(struct snd_seq_device *dev); int snd_seq_oss_synth_unregister(struct snd_seq_device *dev); int snd_seq_oss_synth_probe(struct device *dev); int snd_seq_oss_synth_remove(struct device *dev); void snd_seq_oss_synth_setup(struct seq_oss_devinfo *dp); void snd_seq_oss_synth_setup_midi(struct seq_oss_devinfo *dp); void snd_seq_oss_synth_cleanup(struct seq_oss_devinfo *dp); Loading