Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ALSA: control: Define SNDRV_CTL_TLV_OP_* constants

Instead of hard-coded magic numbers, define constants for op_flag to
tlv callbacks.

Signed-off-by: Takashi Iwai <tiwai@suse.de>

+9 -4
+6 -1
include/sound/control.h
··· 31 31 typedef int (snd_kcontrol_get_t) (struct snd_kcontrol * kcontrol, struct snd_ctl_elem_value * ucontrol); 32 32 typedef int (snd_kcontrol_put_t) (struct snd_kcontrol * kcontrol, struct snd_ctl_elem_value * ucontrol); 33 33 typedef int (snd_kcontrol_tlv_rw_t)(struct snd_kcontrol *kcontrol, 34 - int op_flag, /* 0=read,1=write,-1=command */ 34 + int op_flag, /* SNDRV_CTL_TLV_OP_XXX */ 35 35 unsigned int size, 36 36 unsigned int __user *tlv); 37 37 38 + enum { 39 + SNDRV_CTL_TLV_OP_READ = 0, 40 + SNDRV_CTL_TLV_OP_WRITE = 1, 41 + SNDRV_CTL_TLV_OP_CMD = -1, 42 + }; 38 43 39 44 struct snd_kcontrol_new { 40 45 snd_ctl_elem_iface_t iface; /* interface identifier */
+3 -3
sound/core/control.c
··· 1406 1406 case SNDRV_CTL_IOCTL_SUBSCRIBE_EVENTS: 1407 1407 return snd_ctl_subscribe_events(ctl, ip); 1408 1408 case SNDRV_CTL_IOCTL_TLV_READ: 1409 - return snd_ctl_tlv_ioctl(ctl, argp, 0); 1409 + return snd_ctl_tlv_ioctl(ctl, argp, SNDRV_CTL_TLV_OP_READ); 1410 1410 case SNDRV_CTL_IOCTL_TLV_WRITE: 1411 - return snd_ctl_tlv_ioctl(ctl, argp, 1); 1411 + return snd_ctl_tlv_ioctl(ctl, argp, SNDRV_CTL_TLV_OP_WRITE); 1412 1412 case SNDRV_CTL_IOCTL_TLV_COMMAND: 1413 - return snd_ctl_tlv_ioctl(ctl, argp, -1); 1413 + return snd_ctl_tlv_ioctl(ctl, argp, SNDRV_CTL_TLV_OP_CMD); 1414 1414 case SNDRV_CTL_IOCTL_POWER: 1415 1415 return -ENOPROTOOPT; 1416 1416 case SNDRV_CTL_IOCTL_POWER_STATE: