From patchwork Sun Sep 13 03:23:01 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Ellingsworth X-Patchwork-Id: 47123 X-Patchwork-Delegate: dougsland@redhat.com Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n8D3Mqe2004988 for ; Sun, 13 Sep 2009 03:23:13 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754869AbZIMDXJ (ORCPT ); Sat, 12 Sep 2009 23:23:09 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754838AbZIMDXJ (ORCPT ); Sat, 12 Sep 2009 23:23:09 -0400 Received: from qw-out-2122.google.com ([74.125.92.27]:45517 "EHLO qw-out-2122.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754824AbZIMDXI (ORCPT ); Sat, 12 Sep 2009 23:23:08 -0400 Received: by qw-out-2122.google.com with SMTP id 9so721299qwb.37 for ; Sat, 12 Sep 2009 20:23:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:message-id:date:from :reply-to:user-agent:mime-version:to:subject:content-type; bh=3P5mlfmyHQ+ZpABZcRTzb2pYkk00rjnS5cApQOKs9hQ=; b=SlaNMJuqC7oCnnzKZsjNp926uCOv8Kd6jJINfwMaqnargqnzXDteuo9LKsvJk88lnJ UM+ImwgM7ow3v1jJTCUIFtrnrNl1igkNusugC3qLmYz5ETM5PK3Jl/or8QkUI2WGji7m 7xKb750XO1sU8KlAGoebv8CzdjV7W/bZPRSf8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:date:from:reply-to:user-agent:mime-version:to :subject:content-type; b=FmQtXdxP/XssMiQXqwMjpjvjjk8oB/VolYNiOep4/CIovWAJODzqCdDCxnDmGfys9k 3RPj3CDM2QsgeIb3n6bqEbUPdoSn5+iY6WPDYTCsiohJBm5sSUymWaz1UWO6vtWZEem1 3k1WCv//og42rLceihV4axbTL7dUrdA8leDs8= Received: by 10.224.59.168 with SMTP id l40mr4155264qah.90.1252812191516; Sat, 12 Sep 2009 20:23:11 -0700 (PDT) Received: from ?192.168.10.110? (cpe-71-72-62-249.neo.res.rr.com [71.72.62.249]) by mx.google.com with ESMTPS id 6sm3198567qwd.43.2009.09.12.20.23.09 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 12 Sep 2009 20:23:10 -0700 (PDT) Message-ID: <4AAC6595.5090401@gmail.com> Date: Sat, 12 Sep 2009 23:23:01 -0400 From: David Ellingsworth Reply-To: david@identd.dyndns.org User-Agent: Mozilla-Thunderbird 2.0.0.22 (X11/20090701) MIME-Version: 1.0 To: linux-media@vger.kernel.org, klimov.linux@gmail.com Subject: [RFC/RFT 12/14] radio-mr800: preserve radio state during suspend/resume Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From 8c441616f67011244cb15bc1a3dda6fd8706ecd2 Mon Sep 17 00:00:00 2001 From: David Ellingsworth Date: Sat, 12 Sep 2009 16:04:44 -0400 Subject: [PATCH 08/14] mr800: fix potential use after free Signed-off-by: David Ellingsworth --- drivers/media/radio/radio-mr800.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) /* vidioc_querycap - query device capabilities */ From c8c27c663db7294c660a3bac659742c915ce91a9 Mon Sep 17 00:00:00 2001 From: David Ellingsworth Date: Sat, 12 Sep 2009 22:01:49 -0400 Subject: [PATCH 12/14] mr800: preserve radio state during suspend/resume Signed-off-by: David Ellingsworth --- drivers/media/radio/radio-mr800.c | 33 ++++++++++++++++++++++++++++----- 1 files changed, 28 insertions(+), 5 deletions(-) diff --git a/drivers/media/radio/radio-mr800.c b/drivers/media/radio/radio-mr800.c index 8fc413d..ed734bb 100644 --- a/drivers/media/radio/radio-mr800.c +++ b/drivers/media/radio/radio-mr800.c @@ -573,9 +573,12 @@ static int usb_amradio_suspend(struct usb_interface *intf, pm_message_t message) mutex_lock(&radio->lock); - retval = amradio_set_mute(radio, AMRADIO_STOP); - if (retval < 0) - dev_warn(&intf->dev, "amradio_stop failed\n"); + if (!radio->muted && radio->initialized) { + retval = amradio_set_mute(radio, AMRADIO_STOP); + if (retval < 0) + dev_warn(&intf->dev, "amradio_stop failed\n"); + radio->muted = 0; + } dev_info(&intf->dev, "going into suspend..\n"); @@ -591,10 +594,30 @@ static int usb_amradio_resume(struct usb_interface *intf) mutex_lock(&radio->lock); - retval = amradio_set_mute(radio, AMRADIO_START); + if (unlikely(!radio->initialized)) + goto unlock; + + if (radio->stereo) + retval = amradio_set_stereo(radio, WANT_STEREO); + else + retval = amradio_set_stereo(radio, WANT_MONO); + if (retval < 0) - dev_warn(&intf->dev, "amradio_start failed\n"); + amradio_dev_warn(&radio->videodev.dev, "set stereo failed\n"); + retval = amradio_setfreq(radio, radio->curfreq); + if (retval < 0) + amradio_dev_warn(&radio->videodev.dev, + "set frequency failed\n"); + + if (!radio->muted) { + retval = amradio_set_mute(radio, AMRADIO_START); + if (retval < 0) + dev_warn(&radio->videodev.dev, + "amradio_start failed\n"); + } + +unlock: dev_info(&intf->dev, "coming out of suspend..\n"); mutex_unlock(&radio->lock); -- 1.6.3.3