@@ -259,11 +259,12 @@ usb_control_msg_failed:
}
/* set a frequency, freq is defined by v4l's TUNER_LOW, i.e. 1/16th kHz */
-static int dsbr100_setfreq(struct dsbr100_device *radio)
+static int dsbr100_setfreq(struct dsbr100_device *radio, int freq)
{
int retval;
int request;
- int freq = (radio->curfreq / 16 * 80) / 1000 + 856;
+
+ freq = (freq / 16 * 80) / 1000 + 856;
BUG_ON(!mutex_is_locked(&radio->lock));
@@ -302,6 +303,7 @@ static int dsbr100_setfreq(struct dsbr100_device *radio)
}
radio->stereo = !((radio->transfer_buffer)[0] & 0x01);
+ radio->curfreq = freq;
return (radio->transfer_buffer)[0];
usb_control_msg_failed:
@@ -408,11 +410,8 @@ static int vidioc_s_frequency(struct file *file, void *priv,
struct v4l2_frequency *f)
{
struct dsbr100_device *radio = video_drvdata(file);
- int retval;
-
- radio->curfreq = f->frequency;
+ int retval = dsbr100_setfreq(radio, f->frequency);
- retval = dsbr100_setfreq(radio);
if (retval < 0)
dev_warn(&radio->usbdev->dev, "Set frequency failed\n");