Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b4be2048 authored by Alexey Klimov's avatar Alexey Klimov Committed by Mauro Carvalho Chehab
Browse files

V4L/DVB (9152): radio-zoltrix: Add checking for frequency



This patch adds printk messages, adds checking if frequency is set,
adds return -EINVAL in right places in zoltrix-radio.

Signed-off-by: default avatarAlexey Klimov <klimov.linux@gmail.com>
Signed-off-by: default avatarDouglas Schilling Landgraf <dougsland@linuxtv.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 90b698dd
Loading
Loading
Loading
Loading
+13 −4
Original line number Original line Diff line number Diff line
@@ -123,8 +123,11 @@ static int zol_setfreq(struct zol_device *dev, unsigned long freq)
	unsigned int stereo = dev->stereo;
	unsigned int stereo = dev->stereo;
	int i;
	int i;


	if (freq == 0)
	if (freq == 0) {
		return 1;
		printk(KERN_WARNING "zoltrix: received zero freq. Failed to set.\n");
		return -EINVAL;
	}

	m = (freq / 160 - 8800) * 2;
	m = (freq / 160 - 8800) * 2;
	f = (unsigned long long) m + 0x4d1c;
	f = (unsigned long long) m + 0x4d1c;


@@ -279,7 +282,10 @@ static int vidioc_s_frequency(struct file *file, void *priv,
	struct zol_device *zol = video_drvdata(file);
	struct zol_device *zol = video_drvdata(file);


	zol->curfreq = f->frequency;
	zol->curfreq = f->frequency;
	zol_setfreq(zol, zol->curfreq);
	if (zol_setfreq(zol, zol->curfreq) != 0) {
		printk(KERN_WARNING "zoltrix: Set frequency failed.\n");
		return -EINVAL;
	}
	return 0;
	return 0;
}
}


@@ -343,7 +349,10 @@ static int vidioc_s_ctrl(struct file *file, void *priv,
		return 0;
		return 0;
	}
	}
	zol->stereo = 1;
	zol->stereo = 1;
	zol_setfreq(zol, zol->curfreq);
	if (zol_setfreq(zol, zol->curfreq) != 0) {
		printk(KERN_WARNING "zoltrix: Set frequency failed.\n");
		return -EINVAL;
	}
#if 0
#if 0
/* FIXME: Implement stereo/mono switch on V4L2 */
/* FIXME: Implement stereo/mono switch on V4L2 */
			if (v->mode & VIDEO_SOUND_STEREO) {
			if (v->mode & VIDEO_SOUND_STEREO) {