Skip to content

Commit

Permalink
Rename vmater slave to follower
Browse files Browse the repository at this point in the history
Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
tiwai committed Aug 7, 2020
1 parent 1512f2c commit 3d940de
Show file tree
Hide file tree
Showing 2 changed files with 146 additions and 139 deletions.
45 changes: 26 additions & 19 deletions include/sound/control.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,21 +109,21 @@ int snd_ctl_enum_info(struct snd_ctl_elem_info *info, unsigned int channels,
*/
struct snd_kcontrol *snd_ctl_make_virtual_master(char *name,
const unsigned int *tlv);
int _snd_ctl_add_slave(struct snd_kcontrol *master, struct snd_kcontrol *slave,
int _snd_ctl_add_follower(struct snd_kcontrol *master, struct snd_kcontrol *follower,
unsigned int flags);
/* optional flags for slave */
#define SND_CTL_SLAVE_NEED_UPDATE (1 << 0)
/* optional flags for follower */
#define SND_CTL_FOLLOWER_NEED_UPDATE (1 << 0)

/**
* snd_ctl_add_slave - Add a virtual slave control
* snd_ctl_add_follower - Add a virtual follower control
* @master: vmaster element
* @slave: slave element to add
* @follower: follower element to add
*
* Add a virtual slave control to the given master element created via
* Add a virtual follower control to the given master element created via
* snd_ctl_create_virtual_master() beforehand.
* Returns zero if successful or a negative error code.
*
* All slaves must be the same type (returning the same information
* All followers must be the same type (returning the same information
* via info callback). The function doesn't check it, so it's your
* responsibility.
*
Expand All @@ -133,18 +133,18 @@ int _snd_ctl_add_slave(struct snd_kcontrol *master, struct snd_kcontrol *slave,
* master can only attenuate the volume without gain
*/
static inline int
snd_ctl_add_slave(struct snd_kcontrol *master, struct snd_kcontrol *slave)
snd_ctl_add_follower(struct snd_kcontrol *master, struct snd_kcontrol *follower)
{
return _snd_ctl_add_slave(master, slave, 0);
return _snd_ctl_add_follower(master, follower, 0);
}

/**
* snd_ctl_add_slave_uncached - Add a virtual slave control
* snd_ctl_add_follower_uncached - Add a virtual follower control
* @master: vmaster element
* @slave: slave element to add
* @follower: follower element to add
*
* Add a virtual slave control to the given master.
* Unlike snd_ctl_add_slave(), the element added via this function
* Add a virtual follower control to the given master.
* Unlike snd_ctl_add_follower(), the element added via this function
* is supposed to have volatile values, and get callback is called
* at each time quried from the master.
*
Expand All @@ -153,23 +153,30 @@ snd_ctl_add_slave(struct snd_kcontrol *master, struct snd_kcontrol *slave)
* this function should be used to keep the value always up-to-date.
*/
static inline int
snd_ctl_add_slave_uncached(struct snd_kcontrol *master,
struct snd_kcontrol *slave)
snd_ctl_add_follower_uncached(struct snd_kcontrol *master,
struct snd_kcontrol *follower)
{
return _snd_ctl_add_slave(master, slave, SND_CTL_SLAVE_NEED_UPDATE);
return _snd_ctl_add_follower(master, follower, SND_CTL_FOLLOWER_NEED_UPDATE);
}

int snd_ctl_add_vmaster_hook(struct snd_kcontrol *kctl,
void (*hook)(void *, int),
void *private_data);
void snd_ctl_sync_vmaster(struct snd_kcontrol *kctl, bool hook_only);
#define snd_ctl_sync_vmaster_hook(kctl) snd_ctl_sync_vmaster(kctl, true)
int snd_ctl_apply_vmaster_slaves(struct snd_kcontrol *kctl,
int (*func)(struct snd_kcontrol *vslave,
struct snd_kcontrol *slave,
int snd_ctl_apply_vmaster_followers(struct snd_kcontrol *kctl,
int (*func)(struct snd_kcontrol *vfollower,
struct snd_kcontrol *follower,
void *arg),
void *arg);

/* hack for old codes */
#define _snd_ctl_add_slave _snd_ctl_add_follower
#define SND_CTL_SLAVE_NEED_UPDATE SND_CTL_FOLLOWER_NEED_UPDATE
#define snd_ctl_add_slave snd_ctl_add_follower
#define snd_ctl_add_slave_uncached snd_ctl_add_follower_uncached
#define snd_ctl_apply_vmaster_slaves snd_ctl_apply_vmaster_followers

/*
* Helper functions for jack-detection controls
*/
Expand Down
Loading

0 comments on commit 3d940de

Please sign in to comment.