if (cmd == SOUND_MIXER_INFO) { mixer_info info; strlcpy(info.id, "tv card", sizeof(info.id)); strlcpy(info.name, client->name, sizeof(info.name)); info.modify_counter = 42 /* FIXME */; if (copy_to_user(argp, &info, sizeof(info))) return -EFAULT; return 0; } if (cmd == SOUND_OLD_MIXER_INFO) { _old_mixer_info info; strlcpy(info.id, "tv card", sizeof(info.id)); strlcpy(info.name, client->name, sizeof(info.name)); if (copy_to_user(argp, &info, sizeof(info))) return -EFAULT; return 0; } if (cmd == OSS_GETVERSION) return put_user(SOUND_VERSION, p); 
if (cmd == SOUND_MIXER_INFO) { mixer_info info; strlcpy(info.id, "tv card", sizeof(info.id)); strlcpy(info.name, client->name, sizeof(info.name)); info.modify_counter = 42 /* FIXME */; if (copy_to_user(argp, &info, sizeof(info))) return -EFAULT; return 0; } if (cmd == SOUND_OLD_MIXER_INFO) { _old_mixer_info info; strlcpy(info.id, "tv card", sizeof(info.id)); strlcpy(info.name, client->name, sizeof(info.name)); if (copy_to_user(argp, &info, sizeof(info))) return -EFAULT; return 0; } if (cmd == OSS_GETVERSION) return put_user(SOUND_VERSION, p); 
static int tvmixer_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg){	struct video_audio va;	int left,right,ret,val = 0;        struct TVMIXER *mix = file->private_data;	struct i2c_client *client = mix->dev;	void __user *argp = (void __user *)arg;	int __user *p = argp;	if (NULL == client)		return -ENODEV;        if (cmd == SOUND_MIXER_INFO) {                mixer_info info;                strlcpy(info.id, "tv card", sizeof(info.id));                strlcpy(info.name, client->name, sizeof(info.name));                info.modify_counter = 42 /* FIXME */;                if (copy_to_user(argp, &info, sizeof(info)))                        return -EFAULT;                return 0;        }        if (cmd == SOUND_OLD_MIXER_INFO) {                _old_mixer_info info;                strlcpy(info.id, "tv card", sizeof(info.id));                strlcpy(info.name, client->name, sizeof(info.name));                if (copy_to_user(argp, &info, sizeof(info)))                        return -EFAULT;                return 0;        }        if (cmd == OSS_GETVERSION)                return put_user(SOUND_VERSION, p);	if (_SIOC_DIR(cmd) & _SIOC_WRITE)		if (get_user(val, p))			return -EFAULT;	/* read state */	memset(&va,0,sizeof(va));	client->driver->command(client,VIDIOCGAUDIO,&va);	switch (cmd) {	case MIXER_READ(SOUND_MIXER_RECMASK):	case MIXER_READ(SOUND_MIXER_CAPS):	case MIXER_READ(SOUND_MIXER_RECSRC):	case MIXER_WRITE(SOUND_MIXER_RECSRC):		ret = 0;		break;	case MIXER_READ(SOUND_MIXER_STEREODEVS):		ret = SOUND_MASK_VOLUME;		break;	case MIXER_READ(SOUND_MIXER_DEVMASK):		ret = SOUND_MASK_VOLUME;		if (va.flags & VIDEO_AUDIO_BASS)			ret |= SOUND_MASK_BASS;		if (va.flags & VIDEO_AUDIO_TREBLE)			ret |= SOUND_MASK_TREBLE;		break;	case MIXER_WRITE(SOUND_MIXER_VOLUME):		left  = mix_to_v4l(val);		right = mix_to_v4l(val >> 8);		va.volume  = max(left,right);		va.balance = (32768*min(left,right)) / (va.volume ? va.volume : 1);		va.balance = (left<right) ? (65535-va.balance) : va.balance;		if (va.volume)			va.flags &= ~VIDEO_AUDIO_MUTE;		client->driver->command(client,VIDIOCSAUDIO,&va);		client->driver->command(client,VIDIOCGAUDIO,&va);		/* fall throuth */	case MIXER_READ(SOUND_MIXER_VOLUME):		left  = (min(65536 - va.balance,32768) *			 va.volume) / 32768;		right = (min(va.balance,(u16)32768) *			 va.volume) / 32768;		ret = v4l_to_mix2(left,right);		break;	case MIXER_WRITE(SOUND_MIXER_BASS):		va.bass = mix_to_v4l(val);		client->driver->command(client,VIDIOCSAUDIO,&va);		client->driver->command(client,VIDIOCGAUDIO,&va);		/* fall throuth  */	case MIXER_READ(SOUND_MIXER_BASS):		ret = v4l_to_mix(va.bass);		break;	case MIXER_WRITE(SOUND_MIXER_TREBLE):		va.treble = mix_to_v4l(val);		client->driver->command(client,VIDIOCSAUDIO,&va);		client->driver->command(client,VIDIOCGAUDIO,&va);		/* fall throuth */	case MIXER_READ(SOUND_MIXER_TREBLE):		ret = v4l_to_mix(va.treble);		break;	default:		return -EINVAL;	}	if (put_user(ret, p))		return -EFAULT;	return 0;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/4ac97914c6c35f6bf132071c718e034d0846b9f5/tvmixer.c/clean/drivers/media/video/tvmixer.c