Commit 82e9bae6 authored by Takashi Iwai's avatar Takashi Iwai Committed by Jaroslav Kysela

[ALSA] Remove xxx_t typedefs: Controls

Modules: Control Midlevel

Remove xxx_t typedefs from the core controls.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 512bbd6a
......@@ -24,24 +24,14 @@
#include <sound/asound.h>
typedef struct sndrv_aes_iec958 snd_aes_iec958_t;
typedef struct sndrv_ctl_card_info snd_ctl_card_info_t;
typedef enum sndrv_ctl_elem_type snd_ctl_elem_type_t;
typedef enum sndrv_ctl_elem_iface snd_ctl_elem_iface_t;
typedef struct sndrv_ctl_elem_id snd_ctl_elem_id_t;
typedef struct sndrv_ctl_elem_list snd_ctl_elem_list_t;
typedef struct sndrv_ctl_elem_info snd_ctl_elem_info_t;
typedef struct sndrv_ctl_elem_value snd_ctl_elem_value_t;
typedef enum sndrv_ctl_event_type snd_ctl_event_type_t;
typedef struct sndrv_ctl_event snd_ctl_event_t;
#define snd_kcontrol_chip(kcontrol) ((kcontrol)->private_data)
typedef int (snd_kcontrol_info_t) (snd_kcontrol_t * kcontrol, snd_ctl_elem_info_t * uinfo);
typedef int (snd_kcontrol_get_t) (snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol);
typedef int (snd_kcontrol_put_t) (snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol);
struct snd_kcontrol;
typedef int (snd_kcontrol_info_t) (struct snd_kcontrol * kcontrol, struct snd_ctl_elem_info * uinfo);
typedef int (snd_kcontrol_get_t) (struct snd_kcontrol * kcontrol, struct snd_ctl_elem_value * ucontrol);
typedef int (snd_kcontrol_put_t) (struct snd_kcontrol * kcontrol, struct snd_ctl_elem_value * ucontrol);
typedef struct _snd_kcontrol_new {
struct snd_kcontrol_new {
snd_ctl_elem_iface_t iface; /* interface identifier */
unsigned int device; /* device/client number */
unsigned int subdevice; /* subdevice (substream) number */
......@@ -53,40 +43,40 @@ typedef struct _snd_kcontrol_new {
snd_kcontrol_get_t *get;
snd_kcontrol_put_t *put;
unsigned long private_value;
} snd_kcontrol_new_t;
};
typedef struct _snd_kcontrol_volatile {
snd_ctl_file_t *owner; /* locked */
struct snd_kcontrol_volatile {
struct snd_ctl_file *owner; /* locked */
pid_t owner_pid;
unsigned int access; /* access rights */
} snd_kcontrol_volatile_t;
};
struct _snd_kcontrol {
struct snd_kcontrol {
struct list_head list; /* list of controls */
snd_ctl_elem_id_t id;
struct snd_ctl_elem_id id;
unsigned int count; /* count of same elements */
snd_kcontrol_info_t *info;
snd_kcontrol_get_t *get;
snd_kcontrol_put_t *put;
unsigned long private_value;
void *private_data;
void (*private_free)(snd_kcontrol_t *kcontrol);
snd_kcontrol_volatile_t vd[0]; /* volatile data */
void (*private_free)(struct snd_kcontrol *kcontrol);
struct snd_kcontrol_volatile vd[0]; /* volatile data */
};
#define snd_kcontrol(n) list_entry(n, snd_kcontrol_t, list)
#define snd_kcontrol(n) list_entry(n, struct snd_kcontrol, list)
typedef struct _snd_kctl_event {
struct snd_kctl_event {
struct list_head list; /* list of events */
snd_ctl_elem_id_t id;
struct snd_ctl_elem_id id;
unsigned int mask;
} snd_kctl_event_t;
};
#define snd_kctl_event(n) list_entry(n, snd_kctl_event_t, list)
#define snd_kctl_event(n) list_entry(n, struct snd_kctl_event, list)
struct _snd_ctl_file {
struct snd_ctl_file {
struct list_head list; /* list of all control files */
snd_card_t *card;
struct snd_card *card;
pid_t pid;
int prefer_pcm_subdevice;
int prefer_rawmidi_subdevice;
......@@ -97,25 +87,25 @@ struct _snd_ctl_file {
struct list_head events; /* waiting events for read */
};
#define snd_ctl_file(n) list_entry(n, snd_ctl_file_t, list)
#define snd_ctl_file(n) list_entry(n, struct snd_ctl_file, list)
typedef int (*snd_kctl_ioctl_func_t) (snd_card_t * card,
snd_ctl_file_t * control,
typedef int (*snd_kctl_ioctl_func_t) (struct snd_card * card,
struct snd_ctl_file * control,
unsigned int cmd, unsigned long arg);
void snd_ctl_notify(snd_card_t * card, unsigned int mask, snd_ctl_elem_id_t * id);
void snd_ctl_notify(struct snd_card * card, unsigned int mask, struct snd_ctl_elem_id * id);
snd_kcontrol_t *snd_ctl_new(snd_kcontrol_t * kcontrol, unsigned int access);
snd_kcontrol_t *snd_ctl_new1(const snd_kcontrol_new_t * kcontrolnew, void * private_data);
void snd_ctl_free_one(snd_kcontrol_t * kcontrol);
int snd_ctl_add(snd_card_t * card, snd_kcontrol_t * kcontrol);
int snd_ctl_remove(snd_card_t * card, snd_kcontrol_t * kcontrol);
int snd_ctl_remove_id(snd_card_t * card, snd_ctl_elem_id_t *id);
int snd_ctl_rename_id(snd_card_t * card, snd_ctl_elem_id_t *src_id, snd_ctl_elem_id_t *dst_id);
snd_kcontrol_t *snd_ctl_find_numid(snd_card_t * card, unsigned int numid);
snd_kcontrol_t *snd_ctl_find_id(snd_card_t * card, snd_ctl_elem_id_t *id);
struct snd_kcontrol *snd_ctl_new(struct snd_kcontrol * kcontrol, unsigned int access);
struct snd_kcontrol *snd_ctl_new1(const struct snd_kcontrol_new * kcontrolnew, void * private_data);
void snd_ctl_free_one(struct snd_kcontrol * kcontrol);
int snd_ctl_add(struct snd_card * card, struct snd_kcontrol * kcontrol);
int snd_ctl_remove(struct snd_card * card, struct snd_kcontrol * kcontrol);
int snd_ctl_remove_id(struct snd_card * card, struct snd_ctl_elem_id *id);
int snd_ctl_rename_id(struct snd_card * card, struct snd_ctl_elem_id *src_id, struct snd_ctl_elem_id *dst_id);
struct snd_kcontrol *snd_ctl_find_numid(struct snd_card * card, unsigned int numid);
struct snd_kcontrol *snd_ctl_find_id(struct snd_card * card, struct snd_ctl_elem_id *id);
int snd_ctl_create(snd_card_t *card);
int snd_ctl_create(struct snd_card *card);
int snd_ctl_register_ioctl(snd_kctl_ioctl_func_t fcn);
int snd_ctl_unregister_ioctl(snd_kctl_ioctl_func_t fcn);
......@@ -127,20 +117,20 @@ int snd_ctl_unregister_ioctl_compat(snd_kctl_ioctl_func_t fcn);
#define snd_ctl_unregister_ioctl_compat(fcn)
#endif
int snd_ctl_elem_read(snd_card_t *card, snd_ctl_elem_value_t *control);
int snd_ctl_elem_write(snd_card_t *card, snd_ctl_file_t *file, snd_ctl_elem_value_t *control);
int snd_ctl_elem_read(struct snd_card *card, struct snd_ctl_elem_value *control);
int snd_ctl_elem_write(struct snd_card *card, struct snd_ctl_file *file, struct snd_ctl_elem_value *control);
static inline unsigned int snd_ctl_get_ioffnum(snd_kcontrol_t *kctl, snd_ctl_elem_id_t *id)
static inline unsigned int snd_ctl_get_ioffnum(struct snd_kcontrol *kctl, struct snd_ctl_elem_id *id)
{
return id->numid - kctl->id.numid;
}
static inline unsigned int snd_ctl_get_ioffidx(snd_kcontrol_t *kctl, snd_ctl_elem_id_t *id)
static inline unsigned int snd_ctl_get_ioffidx(struct snd_kcontrol *kctl, struct snd_ctl_elem_id *id)
{
return id->index - kctl->id.index;
}
static inline unsigned int snd_ctl_get_ioff(snd_kcontrol_t *kctl, snd_ctl_elem_id_t *id)
static inline unsigned int snd_ctl_get_ioff(struct snd_kcontrol *kctl, struct snd_ctl_elem_id *id)
{
if (id->numid) {
return snd_ctl_get_ioffnum(kctl, id);
......@@ -149,8 +139,8 @@ static inline unsigned int snd_ctl_get_ioff(snd_kcontrol_t *kctl, snd_ctl_elem_i
}
}
static inline snd_ctl_elem_id_t *snd_ctl_build_ioff(snd_ctl_elem_id_t *dst_id,
snd_kcontrol_t *src_kctl,
static inline struct snd_ctl_elem_id *snd_ctl_build_ioff(struct snd_ctl_elem_id *dst_id,
struct snd_kcontrol *src_kctl,
unsigned int offset)
{
*dst_id = src_kctl->id;
......
This diff is collapsed.
......@@ -22,7 +22,7 @@
#include <linux/compat.h>
struct sndrv_ctl_elem_list32 {
struct snd_ctl_elem_list32 {
u32 offset;
u32 space;
u32 used;
......@@ -31,9 +31,10 @@ struct sndrv_ctl_elem_list32 {
unsigned char reserved[50];
} /* don't set packed attribute here */;
static int snd_ctl_elem_list_compat(snd_card_t *card, struct sndrv_ctl_elem_list32 __user *data32)
static int snd_ctl_elem_list_compat(struct snd_card *card,
struct snd_ctl_elem_list32 __user *data32)
{
struct sndrv_ctl_elem_list __user *data;
struct snd_ctl_elem_list __user *data;
compat_caddr_t ptr;
int err;
......@@ -60,8 +61,8 @@ static int snd_ctl_elem_list_compat(snd_card_t *card, struct sndrv_ctl_elem_list
* it uses union, so the things are not easy..
*/
struct sndrv_ctl_elem_info32 {
struct sndrv_ctl_elem_id id; // the size of struct is same
struct snd_ctl_elem_info32 {
struct snd_ctl_elem_id id; // the size of struct is same
s32 type;
u32 access;
u32 count;
......@@ -87,9 +88,10 @@ struct sndrv_ctl_elem_info32 {
unsigned char reserved[64];
} __attribute__((packed));
static int snd_ctl_elem_info_compat(snd_ctl_file_t *ctl, struct sndrv_ctl_elem_info32 __user *data32)
static int snd_ctl_elem_info_compat(struct snd_ctl_file *ctl,
struct snd_ctl_elem_info32 __user *data32)
{
struct sndrv_ctl_elem_info *data;
struct snd_ctl_elem_info *data;
int err;
data = kzalloc(sizeof(*data), GFP_KERNEL);
......@@ -146,8 +148,8 @@ static int snd_ctl_elem_info_compat(snd_ctl_file_t *ctl, struct sndrv_ctl_elem_i
}
/* read / write */
struct sndrv_ctl_elem_value32 {
struct sndrv_ctl_elem_id id;
struct snd_ctl_elem_value32 {
struct snd_ctl_elem_id id;
unsigned int indirect; /* bit-field causes misalignment */
union {
s32 integer[128];
......@@ -161,10 +163,11 @@ struct sndrv_ctl_elem_value32 {
/* get the value type and count of the control */
static int get_ctl_type(snd_card_t *card, snd_ctl_elem_id_t *id, int *countp)
static int get_ctl_type(struct snd_card *card, struct snd_ctl_elem_id *id,
int *countp)
{
snd_kcontrol_t *kctl;
snd_ctl_elem_info_t info;
struct snd_kcontrol *kctl;
struct snd_ctl_elem_info info;
int err;
down_read(&card->controls_rwsem);
......@@ -193,15 +196,15 @@ static int get_elem_size(int type, int count)
case SNDRV_CTL_ELEM_TYPE_BYTES:
return 512;
case SNDRV_CTL_ELEM_TYPE_IEC958:
return sizeof(struct sndrv_aes_iec958);
return sizeof(struct snd_aes_iec958);
default:
return -1;
}
}
static int copy_ctl_value_from_user(snd_card_t *card,
struct sndrv_ctl_elem_value *data,
struct sndrv_ctl_elem_value32 __user *data32,
static int copy_ctl_value_from_user(struct snd_card *card,
struct snd_ctl_elem_value *data,
struct snd_ctl_elem_value32 __user *data32,
int *typep, int *countp)
{
int i, type, count, size;
......@@ -242,8 +245,8 @@ static int copy_ctl_value_from_user(snd_card_t *card,
}
/* restore the value to 32bit */
static int copy_ctl_value_to_user(struct sndrv_ctl_elem_value32 __user *data32,
struct sndrv_ctl_elem_value *data,
static int copy_ctl_value_to_user(struct snd_ctl_elem_value32 __user *data32,
struct snd_ctl_elem_value *data,
int type, int count)
{
int i, size;
......@@ -265,10 +268,10 @@ static int copy_ctl_value_to_user(struct sndrv_ctl_elem_value32 __user *data32,
return 0;
}
static int snd_ctl_elem_read_user_compat(snd_card_t *card,
struct sndrv_ctl_elem_value32 __user *data32)
static int snd_ctl_elem_read_user_compat(struct snd_card *card,
struct snd_ctl_elem_value32 __user *data32)
{
struct sndrv_ctl_elem_value *data;
struct snd_ctl_elem_value *data;
int err, type, count;
data = kzalloc(sizeof(*data), GFP_KERNEL);
......@@ -285,10 +288,10 @@ static int snd_ctl_elem_read_user_compat(snd_card_t *card,
return err;
}
static int snd_ctl_elem_write_user_compat(snd_ctl_file_t *file,
struct sndrv_ctl_elem_value32 __user *data32)
static int snd_ctl_elem_write_user_compat(struct snd_ctl_file *file,
struct snd_ctl_elem_value32 __user *data32)
{
struct sndrv_ctl_elem_value *data;
struct snd_ctl_elem_value *data;
int err, type, count;
data = kzalloc(sizeof(*data), GFP_KERNEL);
......@@ -306,11 +309,11 @@ static int snd_ctl_elem_write_user_compat(snd_ctl_file_t *file,
}
/* add or replace a user control */
static int snd_ctl_elem_add_compat(snd_ctl_file_t *file,
struct sndrv_ctl_elem_info32 __user *data32,
static int snd_ctl_elem_add_compat(struct snd_ctl_file *file,
struct snd_ctl_elem_info32 __user *data32,
int replace)
{
struct sndrv_ctl_elem_info *data;
struct snd_ctl_elem_info *data;
int err;
data = kzalloc(sizeof(*data), GFP_KERNEL);
......@@ -355,17 +358,17 @@ static int snd_ctl_elem_add_compat(snd_ctl_file_t *file,
}
enum {
SNDRV_CTL_IOCTL_ELEM_LIST32 = _IOWR('U', 0x10, struct sndrv_ctl_elem_list32),
SNDRV_CTL_IOCTL_ELEM_INFO32 = _IOWR('U', 0x11, struct sndrv_ctl_elem_info32),
SNDRV_CTL_IOCTL_ELEM_READ32 = _IOWR('U', 0x12, struct sndrv_ctl_elem_value32),
SNDRV_CTL_IOCTL_ELEM_WRITE32 = _IOWR('U', 0x13, struct sndrv_ctl_elem_value32),
SNDRV_CTL_IOCTL_ELEM_ADD32 = _IOWR('U', 0x17, struct sndrv_ctl_elem_info32),
SNDRV_CTL_IOCTL_ELEM_REPLACE32 = _IOWR('U', 0x18, struct sndrv_ctl_elem_info32),
SNDRV_CTL_IOCTL_ELEM_LIST32 = _IOWR('U', 0x10, struct snd_ctl_elem_list32),
SNDRV_CTL_IOCTL_ELEM_INFO32 = _IOWR('U', 0x11, struct snd_ctl_elem_info32),
SNDRV_CTL_IOCTL_ELEM_READ32 = _IOWR('U', 0x12, struct snd_ctl_elem_value32),
SNDRV_CTL_IOCTL_ELEM_WRITE32 = _IOWR('U', 0x13, struct snd_ctl_elem_value32),
SNDRV_CTL_IOCTL_ELEM_ADD32 = _IOWR('U', 0x17, struct snd_ctl_elem_info32),
SNDRV_CTL_IOCTL_ELEM_REPLACE32 = _IOWR('U', 0x18, struct snd_ctl_elem_info32),
};
static inline long snd_ctl_ioctl_compat(struct file *file, unsigned int cmd, unsigned long arg)
{
snd_ctl_file_t *ctl;
struct snd_ctl_file *ctl;
struct list_head *list;
void __user *argp = compat_ptr(arg);
int err;
......@@ -398,7 +401,7 @@ static inline long snd_ctl_ioctl_compat(struct file *file, unsigned int cmd, uns
down_read(&snd_ioctl_rwsem);
list_for_each(list, &snd_control_compat_ioctls) {
snd_kctl_ioctl_t *p = list_entry(list, snd_kctl_ioctl_t, list);
struct snd_kctl_ioctl *p = list_entry(list, struct snd_kctl_ioctl, list);
if (p->fioctl) {
err = p->fioctl(ctl->card, ctl, cmd, arg);
if (err != -ENOIOCTLCMD) {
......
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