From patchwork Mon Nov 9 22:09:49 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Klimov X-Patchwork-Id: 2037 Return-path: Envelope-to: mchehab@infradead.org Delivery-date: Mon, 09 Nov 2009 22:09:37 +0000 Received: from bombadil.infradead.org [18.85.46.34] by pedra.chehab.org with IMAP (fetchmail-6.3.6) for (single-drop); Mon, 09 Nov 2009 20:10:21 -0200 (BRST) Received: from vger.kernel.org ([209.132.176.167]) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1N7cQb-0003ca-H4; Mon, 09 Nov 2009 22:09:37 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751201AbZKIWJa (ORCPT + 1 other); Mon, 9 Nov 2009 17:09:30 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751864AbZKIWJa (ORCPT ); Mon, 9 Nov 2009 17:09:30 -0500 Received: from fg-out-1718.google.com ([72.14.220.156]:13636 "EHLO fg-out-1718.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751067AbZKIWJ3 (ORCPT ); Mon, 9 Nov 2009 17:09:29 -0500 Received: by fg-out-1718.google.com with SMTP id d23so936990fga.1 for ; Mon, 09 Nov 2009 14:09:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:x-mailer:mime-version:content-type :content-transfer-encoding; bh=Qe9Dl8tPBDy4TJSkN/sv/xz8OjkJD4qONYPQ/fOT6F8=; b=U1uhBwfORpSVGkJHIBl3fKIUVFLR3LHFKVT94rqeUQoBRmxM6VI82yN2o61EsQxElY yK2EpQNXknrS/ZMqgoHof6GQJYqKvqJ75hyz/R/HUqUrasnVFhkoVw/Z9gbkhdO0S0+w 0gdVW88exn7ou/iRYHsubPYRjTx92hMiwcPf4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:x-mailer:mime-version :content-type:content-transfer-encoding; b=vc0P+xCv+MuQO/tQ65afWu9inOuZWybgVPukxCWJcpLiikMRzAhpb0NpxxYkmyOQdI HAprLQRaV9Zm3dcI+p8kYvU1Tf1evVMRV7++/PWeC8hq9OChULWowOHC9EDHRIze126c Y60pKfOegE92dmgQ4mS0FbYWDwJx5RdtCi2AA= Received: by 10.103.126.27 with SMTP id d27mr3330869mun.56.1257804574032; Mon, 09 Nov 2009 14:09:34 -0800 (PST) Received: from tuz.localhost (radio.mipt.ru [194.85.80.56]) by mx.google.com with ESMTPS id y2sm359744mug.49.2009.11.09.14.09.31 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 09 Nov 2009 14:09:32 -0800 (PST) Date: Tue, 10 Nov 2009 01:09:49 +0300 From: Alexey Klimov To: linux-media@vger.kernel.org Cc: oliver@neukum.org, dougsland@gmail.com Subject: [patch] radio-mr800 - autosuspend for radio-mr800 driver Message-Id: <20091110010949.494ee080.klimov.linux@gmail.com> X-Mailer: Sylpheed 2.7.1 (GTK+ 2.18.3; x86_64-pc-linux-gnu) Mime-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Oliver Neukum Patch adds autosuspend support for mr800 radio driver. Priority: normal Signed-off-by: Oliver Neukum Acked-by: Alexey Klimov diff -r 19c0469c02c3 linux/drivers/media/radio/radio-mr800.c --- a/linux/drivers/media/radio/radio-mr800.c Sat Nov 07 15:51:01 2009 -0200 +++ b/linux/drivers/media/radio/radio-mr800.c Tue Nov 10 00:38:19 2009 +0300 @@ -133,6 +133,7 @@ struct amradio_device { /* reference to USB and video device */ struct usb_device *usbdev; + struct usb_interface *intf; struct video_device videodev; struct v4l2_device v4l2_dev; @@ -166,7 +167,7 @@ .reset_resume = usb_amradio_resume, #endif .id_table = usb_amradio_device_table, - .supports_autosuspend = 0, + .supports_autosuspend = 1, }; /* switch on/off the radio. Send 8 bytes to device */ @@ -509,9 +510,15 @@ } file->private_data = radio; + retval = usb_autopm_get_interface(radio->intf); + if (retval) + goto unlock; - if (unlikely(!radio->initialized)) + if (unlikely(!radio->initialized)) { retval = usb_amradio_init(radio); + if (retval) + usb_autopm_put_interface(radio->intf); + } unlock: mutex_unlock(&radio->lock); @@ -528,6 +535,8 @@ if (!radio->usbdev) retval = -EIO; + else + usb_autopm_put_interface(radio->intf); mutex_unlock(&radio->lock); return retval; @@ -669,6 +678,7 @@ radio->videodev.release = usb_amradio_video_device_release; radio->usbdev = interface_to_usbdev(intf); + radio->intf = intf; radio->curfreq = 95.16 * FREQ_MUL; mutex_init(&radio->lock);