From patchwork Wed May 27 17:51:08 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Klimov X-Patchwork-Id: 1717 Return-path: Envelope-to: mchehab@infradead.org Delivery-date: Wed, 27 May 2009 17:54:05 +0000 Received: from bombadil.infradead.org [18.85.46.34] by pedra.chehab.org with IMAP (fetchmail-6.3.6) for (single-drop); Wed, 27 May 2009 14:57:13 -0300 (BRT) Received: from vger.kernel.org ([209.132.176.167]) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1M9NKG-0003Tu-O0; Wed, 27 May 2009 17:54:05 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932577AbZE0RvK (ORCPT + 1 other); Wed, 27 May 2009 13:51:10 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S932553AbZE0RvK (ORCPT ); Wed, 27 May 2009 13:51:10 -0400 Received: from yx-out-2324.google.com ([74.125.44.30]:24304 "EHLO yx-out-2324.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932580AbZE0RvI (ORCPT ); Wed, 27 May 2009 13:51:08 -0400 Received: by yx-out-2324.google.com with SMTP id 3so2704090yxj.1 for ; Wed, 27 May 2009 10:51:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=HbmS2k1XuECxblv6hCvLB9YpzOtyaibUgZ2XeW+X51I=; b=lgMJ1qTYXFrhYPFKsfiADL2iDlFjw8zmM1156UmJQ1OuYXiCfHMqIvHdgsZrwuIXxx DbFjsp5rt3llOiSJRKRegGKYZmZqVQDlkf1GiBAEaJncES4xGKCLH5QFd3uHlf9/vCus tm+aBIef4ojyj6jzz0vCpTsU5I9+JJgkrGpbk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=DcT8lKlLVJcvpCRGerg/nG2COXQNR2J9dNBwr+OIVyh54MppF8cZ8oNqBtaK9GQd1T kSDUp/oj7S7u1HFEP3mex4yQ38g4Vw50Le3Y+SCZqIkYfvALaXqrk+jcBZDMkkM+Rp5C XEN9GI1byk2d2W86IZf8ZgtBP3XzrgJIDqGyI= MIME-Version: 1.0 Received: by 10.100.14.2 with SMTP id 2mr473170ann.68.1243446668719; Wed, 27 May 2009 10:51:08 -0700 (PDT) Date: Wed, 27 May 2009 21:51:08 +0400 Message-ID: <208cbae30905271051jfe3294bye415b5b4cd0ce14b@mail.gmail.com> Subject: Probably strange bug with usb radio-mr800 From: Alexey Klimov To: Linux Media , linux-usb@vger.kernel.org Cc: Douglas Schilling Landgraf , Alexey Klimov Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Hello, Doing some improvements in media/radio/radio-mr800.c i see very strange situation. I made simple patch that removed usb_amradio_open function. There is no need in this function (no need to start/set frequency radio in open procedure, and also removed lock/unlock_kernel() calls). Here is this patch: Then i test it. I have two machines: pentium-m and athlon 64 X2 dual core. Kernel is 2.6.30-rc7 on both machines. After patch such tools like fmtools, gnomeradio, kradio works fine with radio. But mplayer didn't. On 64bit machine mplayer didn't start radio. I ask usbmon to help me and here is messages from usbmon: cat /sys/kernel/debug/usbmon/2u ffff880022e380c0 1662784522 S Io:2:003:2 -115:64 8 = 0055aa00 ab010000 (this message stops radio) ffff880022e380c0 1662799160 C Io:2:003:2 0:64 8 > ffff880022e380c0 1662799273 S Io:2:003:2 -115:64 8 = 0055aa00 ae000000 (this ask radio to have stereo signal) ffff880022e380c0 1662831161 C Io:2:003:2 0:64 8 > ffff880022e380c0 1662831439 S Io:2:003:2 -115:64 8 = 0055aa03 a4000008 (this and next message set frequency) ffff880022e380c0 1662863161 C Io:2:003:2 0:64 8 > ffff880022e380c0 1662863233 S Io:2:003:2 -115:64 8 = 1dd00100 00000000 ffff880022e380c0 1662895155 C Io:2:003:2 0:64 8 > ffff880022e380c0 1662895190 S Io:2:003:2 -115:64 8 = 0055aa00 ab000000 (this message starts radio) ffff880022e380c0 1662927156 C Io:2:003:2 0:64 8 > Well, there is no sound from usb device after that. On 32bit machine mplayer starts radio fine and works ok. Usbmon shows me the same messages: tux ~ # cat /sys/kernel/debug/usbmon/0u f6530900 2647820070 S Io:2:002:2 -115:64 8 = 0055aa00 ab010000 f6530900 2647859740 C Io:2:002:2 0:64 8 > f6530900 2647859825 S Io:2:002:2 -115:64 8 = 0055aa00 ae000000 f6530900 2647923747 C Io:2:002:2 0:64 8 > f6530900 2647923942 S Io:2:002:2 -115:64 8 = 0055aa03 a4000008 f6530900 2647987749 C Io:2:002:2 0:64 8 > f6530900 2647987766 S Io:2:002:2 -115:64 8 = 1dcf0100 00000000 f6530900 2648051747 C Io:2:002:2 0:64 8 > f6530900 2648051775 S Io:2:002:2 -115:64 8 = 0055aa00 ab000000 f6530900 2648115753 C Io:2:002:2 0:64 8 > So, the same messages to device works fine with radio on 32bit machine and nothing on 64bit machine. Good thing is if i add one more start message radio works on 64bit machine also. Is this usb subsystem bug? Should i make some workaround to deal with this and add comments about mplayer? diff -r a344b328a34b linux/drivers/media/radio/radio-mr800.c --- a/linux/drivers/media/radio/radio-mr800.c Wed May 27 21:21:36 2009 +0400 +++ b/linux/drivers/media/radio/radio-mr800.c Wed May 27 21:25:41 2009 +0400 @@ -119,7 +119,6 @@ static int usb_amradio_probe(struct usb_interface *intf, const struct usb_device_id *id); static void usb_amradio_disconnect(struct usb_interface *intf); -static int usb_amradio_open(struct file *file); static int usb_amradio_close(struct file *file); static int usb_amradio_suspend(struct usb_interface *intf, pm_message_t message); @@ -533,40 +532,6 @@ return 0; } -/* open device - amradio_start() and amradio_setfreq() */ -static int usb_amradio_open(struct file *file) -{ - struct amradio_device *radio = video_get_drvdata(video_devdata(file)); - int retval; - - lock_kernel(); - - radio->users = 1; - radio->muted = 1; - - retval = amradio_set_mute(radio, AMRADIO_START); - if (retval < 0) { - amradio_dev_warn(&radio->videodev->dev, - "radio did not start up properly\n"); - radio->users = 0; - unlock_kernel(); - return -EIO; - } - - retval = amradio_set_stereo(radio, WANT_STEREO); - if (retval < 0) - 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"); - - unlock_kernel(); - return 0; -} - /*close device */ static int usb_amradio_close(struct file *file) { @@ -623,7 +588,6 @@ /* File system interface */ static const struct v4l2_file_operations usb_amradio_fops = { .owner = THIS_MODULE, - .open = usb_amradio_open, .release = usb_amradio_close, .ioctl = video_ioctl2, };