From patchwork Mon Apr 20 22:07:44 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dean Anderson X-Patchwork-Id: 19064 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 n3KM84Kd022054 for ; Mon, 20 Apr 2009 22:08:05 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757604AbZDTWHw (ORCPT ); Mon, 20 Apr 2009 18:07:52 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1757284AbZDTWHw (ORCPT ); Mon, 20 Apr 2009 18:07:52 -0400 Received: from mail11e.verio-web.com ([204.202.242.84]:34125 "HELO mail11e.verio-web.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1757674AbZDTWHv (ORCPT ); Mon, 20 Apr 2009 18:07:51 -0400 Received: from mx01.stngva01.us.mxservers.net (204.202.242.3) by mail11e.verio-web.com (RS ver 1.0.95vs) with SMTP id 4-0300435269 for ; Mon, 20 Apr 2009 18:07:49 -0400 (EDT) Received: from unknown [161.58.148.76] (EHLO mmm1118.verio-web.com) by va1-mx01.stngva01.us.mxservers.net (mxl_mta-3.1.0-05) with ESMTP id 532fce94.2582293408.1449544.00-012.va1-mx01.stngva01.us.mxservers.net (envelope-from ); Mon, 20 Apr 2009 18:07:49 -0400 (EDT) Received: (qmail 15871 invoked from network); 20 Apr 2009 22:07:47 -0000 Received: from unknown (HELO ?10.140.5.9?) (66.15.212.169) by with SMTP; 20 Apr 2009 22:07:47 -0000 Date: Mon, 20 Apr 2009 15:07:44 -0700 (PDT) From: "Dean A." Subject: patch: s2255drv: fix race condition on set mode To: linux-media@vger.kernel.org, mchehab@infradead.org, video4linux-list@redhat.com Message-ID: MIME-Version: 1.0 Content-Disposition: INLINE X-Spam: [F=0.2000000000; S=0.200(2009020301); MH=0.500(2009042037)] X-MAIL-FROM: X-SOURCE-IP: [161.58.148.76] X-SF-Loop: 1 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Dean Anderson set_modeready flag must be set before command sent to USB in s2255_write_config. Signed-off-by: Dean Anderson --- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- v4l-dvb-74b7f650670a/linux/drivers/media/video/s2255drv.c.orig 2009-04-20 14:33:04.000000000 -0700 +++ v4l-dvb-74b7f650670a/linux/drivers/media/video/s2255drv.c 2009-04-20 14:58:22.000000000 -0700 @@ -1238,6 +1238,7 @@ static int s2255_set_mode(struct s2255_d buffer[1] = (u32) chn_rev; buffer[2] = CMD_SET_MODE; memcpy(&buffer[3], &dev->mode[chn], sizeof(struct s2255_mode)); + dev->setmode_ready[chn] = 0; res = s2255_write_config(dev->udev, (unsigned char *)buffer, 512); if (debug) dump_verify_mode(dev, mode); @@ -1246,7 +1247,6 @@ static int s2255_set_mode(struct s2255_d /* wait at least 3 frames before continuing */ if (mode->restart) { - dev->setmode_ready[chn] = 0; wait_event_timeout(dev->wait_setmode[chn], (dev->setmode_ready[chn] != 0), msecs_to_jiffies(S2255_SETMODE_TIMEOUT));