[ALSA] Remove xxx_t typedefs: Hwdep

Modules: HWDEP Midlevel

Remove xxx_t typedefs from the core hwdep codes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Takashi Iwai 2005-11-17 13:58:21 +01:00 committed by Jaroslav Kysela
parent 48c9d417d7
commit d9a98de218
3 changed files with 77 additions and 70 deletions

View File

@ -25,27 +25,24 @@
#include <sound/asound.h>
#include <linux/poll.h>
typedef enum sndrv_hwdep_iface snd_hwdep_iface_t;
typedef struct sndrv_hwdep_info snd_hwdep_info_t;
typedef struct sndrv_hwdep_dsp_status snd_hwdep_dsp_status_t;
typedef struct sndrv_hwdep_dsp_image snd_hwdep_dsp_image_t;
struct snd_hwdep;
typedef struct _snd_hwdep_ops {
long long (*llseek) (snd_hwdep_t *hw, struct file * file, long long offset, int orig);
long (*read) (snd_hwdep_t * hw, char __user *buf, long count, loff_t *offset);
long (*write) (snd_hwdep_t * hw, const char __user *buf, long count, loff_t *offset);
int (*open) (snd_hwdep_t * hw, struct file * file);
int (*release) (snd_hwdep_t * hw, struct file * file);
unsigned int (*poll) (snd_hwdep_t * hw, struct file * file, poll_table * wait);
int (*ioctl) (snd_hwdep_t * hw, struct file * file, unsigned int cmd, unsigned long arg);
int (*ioctl_compat) (snd_hwdep_t * hw, struct file * file, unsigned int cmd, unsigned long arg);
int (*mmap) (snd_hwdep_t * hw, struct file * file, struct vm_area_struct * vma);
int (*dsp_status) (snd_hwdep_t * hw, snd_hwdep_dsp_status_t * status);
int (*dsp_load) (snd_hwdep_t * hw, snd_hwdep_dsp_image_t * image);
} snd_hwdep_ops_t;
struct snd_hwdep_ops {
long long (*llseek) (struct snd_hwdep *hw, struct file * file, long long offset, int orig);
long (*read) (struct snd_hwdep *hw, char __user *buf, long count, loff_t *offset);
long (*write) (struct snd_hwdep *hw, const char __user *buf, long count, loff_t *offset);
int (*open) (struct snd_hwdep * hw, struct file * file);
int (*release) (struct snd_hwdep *hw, struct file * file);
unsigned int (*poll) (struct snd_hwdep *hw, struct file * file, poll_table * wait);
int (*ioctl) (struct snd_hwdep *hw, struct file * file, unsigned int cmd, unsigned long arg);
int (*ioctl_compat) (struct snd_hwdep *hw, struct file * file, unsigned int cmd, unsigned long arg);
int (*mmap) (struct snd_hwdep *hw, struct file * file, struct vm_area_struct * vma);
int (*dsp_status) (struct snd_hwdep *hw, struct snd_hwdep_dsp_status *status);
int (*dsp_load) (struct snd_hwdep *hw, struct snd_hwdep_dsp_image *image);
};
struct _snd_hwdep {
snd_card_t *card;
struct snd_hwdep {
struct snd_card *card;
int device;
char id[32];
char name[80];
@ -57,10 +54,10 @@ struct _snd_hwdep {
int ossreg;
#endif
snd_hwdep_ops_t ops;
struct snd_hwdep_ops ops;
wait_queue_head_t open_wait;
void *private_data;
void (*private_free) (snd_hwdep_t *hwdep);
void (*private_free) (struct snd_hwdep *hwdep);
struct semaphore open_mutex;
int used;
@ -68,6 +65,7 @@ struct _snd_hwdep {
unsigned int exclusive: 1;
};
extern int snd_hwdep_new(snd_card_t * card, char *id, int device, snd_hwdep_t ** rhwdep);
extern int snd_hwdep_new(struct snd_card *card, char *id, int device,
struct snd_hwdep **rhwdep);
#endif /* __SOUND_HWDEP_H */

View File

@ -35,14 +35,14 @@ MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
MODULE_DESCRIPTION("Hardware dependent layer");
MODULE_LICENSE("GPL");
static snd_hwdep_t *snd_hwdep_devices[SNDRV_CARDS * SNDRV_MINOR_HWDEPS];
static struct snd_hwdep *snd_hwdep_devices[SNDRV_CARDS * SNDRV_MINOR_HWDEPS];
static DECLARE_MUTEX(register_mutex);
static int snd_hwdep_free(snd_hwdep_t *hwdep);
static int snd_hwdep_dev_free(snd_device_t *device);
static int snd_hwdep_dev_register(snd_device_t *device);
static int snd_hwdep_dev_unregister(snd_device_t *device);
static int snd_hwdep_free(struct snd_hwdep *hwdep);
static int snd_hwdep_dev_free(struct snd_device *device);
static int snd_hwdep_dev_register(struct snd_device *device);
static int snd_hwdep_dev_unregister(struct snd_device *device);
/*
@ -50,23 +50,25 @@ static int snd_hwdep_dev_unregister(snd_device_t *device);
static loff_t snd_hwdep_llseek(struct file * file, loff_t offset, int orig)
{
snd_hwdep_t *hw = file->private_data;
struct snd_hwdep *hw = file->private_data;
if (hw->ops.llseek)
return hw->ops.llseek(hw, file, offset, orig);
return -ENXIO;
}
static ssize_t snd_hwdep_read(struct file * file, char __user *buf, size_t count, loff_t *offset)
static ssize_t snd_hwdep_read(struct file * file, char __user *buf,
size_t count, loff_t *offset)
{
snd_hwdep_t *hw = file->private_data;
struct snd_hwdep *hw = file->private_data;
if (hw->ops.read)
return hw->ops.read(hw, buf, count, offset);
return -ENXIO;
}
static ssize_t snd_hwdep_write(struct file * file, const char __user *buf, size_t count, loff_t *offset)
static ssize_t snd_hwdep_write(struct file * file, const char __user *buf,
size_t count, loff_t *offset)
{
snd_hwdep_t *hw = file->private_data;
struct snd_hwdep *hw = file->private_data;
if (hw->ops.write)
return hw->ops.write(hw, buf, count, offset);
return -ENXIO;
@ -77,7 +79,7 @@ static int snd_hwdep_open(struct inode *inode, struct file * file)
int major = imajor(inode);
int cardnum;
int device;
snd_hwdep_t *hw;
struct snd_hwdep *hw;
int err;
wait_queue_t wait;
@ -154,7 +156,7 @@ static int snd_hwdep_open(struct inode *inode, struct file * file)
static int snd_hwdep_release(struct inode *inode, struct file * file)
{
int err = -ENXIO;
snd_hwdep_t *hw = file->private_data;
struct snd_hwdep *hw = file->private_data;
down(&hw->open_mutex);
if (hw->ops.release) {
err = hw->ops.release(hw, file);
@ -170,15 +172,16 @@ static int snd_hwdep_release(struct inode *inode, struct file * file)
static unsigned int snd_hwdep_poll(struct file * file, poll_table * wait)
{
snd_hwdep_t *hw = file->private_data;
struct snd_hwdep *hw = file->private_data;
if (hw->ops.poll)
return hw->ops.poll(hw, file, wait);
return 0;
}
static int snd_hwdep_info(snd_hwdep_t *hw, snd_hwdep_info_t __user *_info)
static int snd_hwdep_info(struct snd_hwdep *hw,
struct snd_hwdep_info __user *_info)
{
snd_hwdep_info_t info;
struct snd_hwdep_info info;
memset(&info, 0, sizeof(info));
info.card = hw->card->number;
@ -190,9 +193,10 @@ static int snd_hwdep_info(snd_hwdep_t *hw, snd_hwdep_info_t __user *_info)
return 0;
}
static int snd_hwdep_dsp_status(snd_hwdep_t *hw, snd_hwdep_dsp_status_t __user *_info)
static int snd_hwdep_dsp_status(struct snd_hwdep *hw,
struct snd_hwdep_dsp_status __user *_info)
{
snd_hwdep_dsp_status_t info;
struct snd_hwdep_dsp_status info;
int err;
if (! hw->ops.dsp_status)
@ -206,9 +210,10 @@ static int snd_hwdep_dsp_status(snd_hwdep_t *hw, snd_hwdep_dsp_status_t __user *
return 0;
}
static int snd_hwdep_dsp_load(snd_hwdep_t *hw, snd_hwdep_dsp_image_t __user *_info)
static int snd_hwdep_dsp_load(struct snd_hwdep *hw,
struct snd_hwdep_dsp_image __user *_info)
{
snd_hwdep_dsp_image_t info;
struct snd_hwdep_dsp_image info;
int err;
if (! hw->ops.dsp_load)
@ -228,9 +233,10 @@ static int snd_hwdep_dsp_load(snd_hwdep_t *hw, snd_hwdep_dsp_image_t __user *_in
return 0;
}
static long snd_hwdep_ioctl(struct file * file, unsigned int cmd, unsigned long arg)
static long snd_hwdep_ioctl(struct file * file, unsigned int cmd,
unsigned long arg)
{
snd_hwdep_t *hw = file->private_data;
struct snd_hwdep *hw = file->private_data;
void __user *argp = (void __user *)arg;
switch (cmd) {
case SNDRV_HWDEP_IOCTL_PVERSION:
@ -249,13 +255,14 @@ static long snd_hwdep_ioctl(struct file * file, unsigned int cmd, unsigned long
static int snd_hwdep_mmap(struct file * file, struct vm_area_struct * vma)
{
snd_hwdep_t *hw = file->private_data;
struct snd_hwdep *hw = file->private_data;
if (hw->ops.mmap)
return hw->ops.mmap(hw, file, vma);
return -ENXIO;
}
static int snd_hwdep_control_ioctl(snd_card_t * card, snd_ctl_file_t * control,
static int snd_hwdep_control_ioctl(struct snd_card *card,
struct snd_ctl_file * control,
unsigned int cmd, unsigned long arg)
{
unsigned int tmp;
@ -282,9 +289,9 @@ static int snd_hwdep_control_ioctl(snd_card_t * card, snd_ctl_file_t * control,
}
case SNDRV_CTL_IOCTL_HWDEP_INFO:
{
snd_hwdep_info_t __user *info = (snd_hwdep_info_t __user *)arg;
struct snd_hwdep_info __user *info = (struct snd_hwdep_info __user *)arg;
int device;
snd_hwdep_t *hwdep;
struct snd_hwdep *hwdep;
if (get_user(device, &info->device))
return -EFAULT;
@ -323,7 +330,7 @@ static struct file_operations snd_hwdep_f_ops =
.mmap = snd_hwdep_mmap,
};
static snd_minor_t snd_hwdep_reg =
static struct snd_minor snd_hwdep_reg =
{
.comment = "hardware dependent",
.f_ops = &snd_hwdep_f_ops,
@ -342,11 +349,12 @@ static snd_minor_t snd_hwdep_reg =
*
* Returns zero if successful, or a negative error code on failure.
*/
int snd_hwdep_new(snd_card_t * card, char *id, int device, snd_hwdep_t ** rhwdep)
int snd_hwdep_new(struct snd_card *card, char *id, int device,
struct snd_hwdep **rhwdep)
{
snd_hwdep_t *hwdep;
struct snd_hwdep *hwdep;
int err;
static snd_device_ops_t ops = {
static struct snd_device_ops ops = {
.dev_free = snd_hwdep_dev_free,
.dev_register = snd_hwdep_dev_register,
.dev_unregister = snd_hwdep_dev_unregister
@ -376,7 +384,7 @@ int snd_hwdep_new(snd_card_t * card, char *id, int device, snd_hwdep_t ** rhwdep
return 0;
}
static int snd_hwdep_free(snd_hwdep_t *hwdep)
static int snd_hwdep_free(struct snd_hwdep *hwdep)
{
snd_assert(hwdep != NULL, return -ENXIO);
if (hwdep->private_free)
@ -385,15 +393,15 @@ static int snd_hwdep_free(snd_hwdep_t *hwdep)
return 0;
}
static int snd_hwdep_dev_free(snd_device_t *device)
static int snd_hwdep_dev_free(struct snd_device *device)
{
snd_hwdep_t *hwdep = device->device_data;
struct snd_hwdep *hwdep = device->device_data;
return snd_hwdep_free(hwdep);
}
static int snd_hwdep_dev_register(snd_device_t *device)
static int snd_hwdep_dev_register(struct snd_device *device)
{
snd_hwdep_t *hwdep = device->device_data;
struct snd_hwdep *hwdep = device->device_data;
int idx, err;
char name[32];
@ -434,9 +442,9 @@ static int snd_hwdep_dev_register(snd_device_t *device)
return 0;
}
static int snd_hwdep_dev_unregister(snd_device_t *device)
static int snd_hwdep_dev_unregister(struct snd_device *device)
{
snd_hwdep_t *hwdep = device->device_data;
struct snd_hwdep *hwdep = device->device_data;
int idx;
snd_assert(hwdep != NULL, return -ENXIO);
@ -460,11 +468,11 @@ static int snd_hwdep_dev_unregister(snd_device_t *device)
* Info interface
*/
static void snd_hwdep_proc_read(snd_info_entry_t *entry,
snd_info_buffer_t * buffer)
static void snd_hwdep_proc_read(struct snd_info_entry *entry,
struct snd_info_buffer *buffer)
{
int idx;
snd_hwdep_t *hwdep;
struct snd_hwdep *hwdep;
down(&register_mutex);
for (idx = 0; idx < SNDRV_CARDS * SNDRV_MINOR_HWDEPS; idx++) {
@ -483,11 +491,11 @@ static void snd_hwdep_proc_read(snd_info_entry_t *entry,
* ENTRY functions
*/
static snd_info_entry_t *snd_hwdep_proc_entry = NULL;
static struct snd_info_entry *snd_hwdep_proc_entry = NULL;
static int __init alsa_hwdep_init(void)
{
snd_info_entry_t *entry;
struct snd_info_entry *entry;
memset(snd_hwdep_devices, 0, sizeof(snd_hwdep_devices));
if ((entry = snd_info_create_module_entry(THIS_MODULE, "hwdep", NULL)) != NULL) {

View File

@ -22,7 +22,7 @@
#include <linux/compat.h>
struct sndrv_hwdep_dsp_image32 {
struct snd_hwdep_dsp_image32 {
u32 index;
unsigned char name[64];
u32 image; /* pointer */
@ -30,10 +30,10 @@ struct sndrv_hwdep_dsp_image32 {
u32 driver_data;
} /* don't set packed attribute here */;
static int snd_hwdep_dsp_load_compat(snd_hwdep_t *hw,
struct sndrv_hwdep_dsp_image32 __user *src)
static int snd_hwdep_dsp_load_compat(struct snd_hwdep *hw,
struct snd_hwdep_dsp_image32 __user *src)
{
struct sndrv_hwdep_dsp_image *dst;
struct snd_hwdep_dsp_image *dst;
compat_caddr_t ptr;
u32 val;
@ -56,12 +56,13 @@ static int snd_hwdep_dsp_load_compat(snd_hwdep_t *hw,
}
enum {
SNDRV_HWDEP_IOCTL_DSP_LOAD32 = _IOW('H', 0x03, struct sndrv_hwdep_dsp_image32)
SNDRV_HWDEP_IOCTL_DSP_LOAD32 = _IOW('H', 0x03, struct snd_hwdep_dsp_image32)
};
static long snd_hwdep_ioctl_compat(struct file * file, unsigned int cmd, unsigned long arg)
static long snd_hwdep_ioctl_compat(struct file * file, unsigned int cmd,
unsigned long arg)
{
snd_hwdep_t *hw = file->private_data;
struct snd_hwdep *hw = file->private_data;
void __user *argp = compat_ptr(arg);
switch (cmd) {
case SNDRV_HWDEP_IOCTL_PVERSION: