From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S261601AbVEDVba (ORCPT ); Wed, 4 May 2005 17:31:30 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S261665AbVEDVba (ORCPT ); Wed, 4 May 2005 17:31:30 -0400 Received: from penta.pentaserver.com ([216.74.97.66]:48526 "EHLO penta.pentaserver.com") by vger.kernel.org with ESMTP id S261601AbVEDVbY (ORCPT ); Wed, 4 May 2005 17:31:24 -0400 Message-ID: <42793E46.3070007@kromtek.com> Date: Thu, 05 May 2005 01:27:34 +0400 From: Manu Abraham User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Andrew Morton CC: linux-kernel@vger.kernel.org, greg@kroah.com, js@linuxtv.org, kraxel@bytesex.org Subject: [PATCH] Re: [PATCH] Fix dst i2c read/write timeout failure. References: <4279343A.1000707@kromtek.com> <20050504135735.713e99ba.akpm@osdl.org> In-Reply-To: <20050504135735.713e99ba.akpm@osdl.org> Content-Type: multipart/mixed; boundary="------------090107030902090608010000" X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - penta.pentaserver.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [0 0] / [47 12] X-AntiAbuse: Sender Address Domain - kromtek.com X-Source: X-Source-Args: X-Source-Dir: Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org This is a multi-part message in MIME format. --------------090107030902090608010000 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Andrew Morton wrote: > Manu Abraham wrote: > >>User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317) >> > > > uh-oh. > > >>Attached is a patch to bttv which fixes the following problems. > > > Mozilla space-stuffed it. Please resend as an attachment. > > > Oh, i am sorry, resending it .. Attached is a patch to bttv which fixes the following problems. Affected cards and problems: ~~~~~~~~~~~~~~~~~~~~~~~~ o VP-1020 (200103A) Tuning problems, device detection. o VP-1020 (DST-MOT) Errors during tuning, device detection fails in a while. o VP-1030 (DST-CI) Tuning sometimes fails after CI commands. o VP-2031 (DCT-CI) Tuning problems The timeout happens before the actual timeout occured in the MCU on the board, and hence the problems. Changes: (bttv-i2c.diff) ~~~~~~~~~~~~~~~~~~~~~~~~ o Changed the custom wait queue to wait_event_interruptible_timeout() - Suggestion by Johannes Stezenbach. o Fixed the wait queue timeout problem - This fixes the timeout problem on various cards. - This problem was visible as many * Cannot tune to channels, when signal levels are very low. * app_info does not work in some conditions for CI based cards - Smaller values worked good for newer cards, but the older cards suffered, settled down to the worst case values that could happen in any eventuality. Signed-off-by: Manu Abraham --------------090107030902090608010000 Content-Type: text/x-patch; name="bttv-i2c.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="bttv-i2c.diff" --- linux-2.6.12-rc3.orig/drivers/media/video/bttv-i2c.c 2005-05-03 16:04:28.000000000 +0400 +++ linux-2.6.12-rc3/drivers/media/video/bttv-i2c.c 2005-05-05 00:01:00.000000000 +0400 @@ -29,6 +29,7 @@ #include #include #include +#include #include #include "bttvp.h" @@ -130,17 +131,14 @@ static u32 functionality(struct i2c_adap static int bttv_i2c_wait_done(struct bttv *btv) { - DECLARE_WAITQUEUE(wait, current); int rc = 0; - add_wait_queue(&btv->i2c_queue, &wait); - if (0 == btv->i2c_done) - msleep_interruptible(20); - remove_wait_queue(&btv->i2c_queue, &wait); - - if (0 == btv->i2c_done) - /* timeout */ - rc = -EIO; + /* timeout */ + if (wait_event_interruptible_timeout(btv->i2c_queue, + btv->i2c_done, msecs_to_jiffies(85)) == -ERESTARTSYS) + + rc = -EIO; + if (btv->i2c_done & BT848_INT_RACK) rc = 1; btv->i2c_done = 0; --------------090107030902090608010000--