From patchwork Wed May 5 17:05:26 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Ellingsworth X-Patchwork-Id: 97156 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o45HbqH7010329 for ; Wed, 5 May 2010 17:37:53 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756514Ab0EERhV (ORCPT ); Wed, 5 May 2010 13:37:21 -0400 Received: from 99-34-136-231.lightspeed.bcvloh.sbcglobal.net ([99.34.136.231]:48164 "EHLO desource.dyndns.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756437Ab0EERhT (ORCPT ); Wed, 5 May 2010 13:37:19 -0400 Received: from root by desource.dyndns.org with local (Exim 4.71) (envelope-from ) id 1O9i2Q-0005mc-GP; Wed, 05 May 2010 13:05:34 -0400 From: David Ellingsworth To: linux-media@vger.kernel.org Cc: David Ellingsworth Subject: [PATCH/RFC 3/7] dsbr100: only change frequency upon success Date: Wed, 5 May 2010 13:05:26 -0400 Message-Id: <1273079130-21999-4-git-send-email-david@identd.dyndns.org> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1273079130-21999-1-git-send-email-david@identd.dyndns.org> References: <1273079130-21999-1-git-send-email-david@identd.dyndns.org> X-SA-Exim-Connect-IP: X-SA-Exim-Rcpt-To: linux-media@vger.kernel.org, david@identd.dyndns.org X-SA-Exim-Mail-From: root@desource.dyndns.org X-SA-Exim-Scanned: No (on desource.dyndns.org); SAEximRunCond expanded to false Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Wed, 05 May 2010 17:37:53 +0000 (UTC) diff --git a/drivers/media/radio/dsbr100.c b/drivers/media/radio/dsbr100.c index 2f96e13..b62fe40 100644 --- a/drivers/media/radio/dsbr100.c +++ b/drivers/media/radio/dsbr100.c @@ -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");