From patchwork Fri Aug 19 00:12:20 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Rankin X-Patchwork-Id: 265 Return-path: Envelope-to: mchehab@infradead.org Delivery-date: Fri, 19 Aug 2011 00:12:28 +0000 Received: from casper.infradead.org [85.118.1.10] by gaivota with IMAP (fetchmail-6.3.20) for (single-drop); Thu, 18 Aug 2011 17:58:08 -0700 (PDT) Received: from vger.kernel.org ([209.132.180.67]) by casper.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QuChH-00032L-Hh; Fri, 19 Aug 2011 00:12:27 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752016Ab1HSAMZ (ORCPT + 1 other); Thu, 18 Aug 2011 20:12:25 -0400 Received: from nm2-vm0.bt.bullet.mail.ird.yahoo.com ([212.82.108.92]:27062 "HELO nm2-vm0.bt.bullet.mail.ird.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1751685Ab1HSAMY (ORCPT ); Thu, 18 Aug 2011 20:12:24 -0400 Received: from [212.82.108.228] by nm2.bt.bullet.mail.ird.yahoo.com with NNFMP; 19 Aug 2011 00:12:23 -0000 Received: from [212.82.108.225] by tm1.bt.bullet.mail.ird.yahoo.com with NNFMP; 19 Aug 2011 00:12:23 -0000 Received: from [127.0.0.1] by omp1002.bt.mail.ird.yahoo.com with NNFMP; 19 Aug 2011 00:12:23 -0000 X-Yahoo-Newman-Id: 374212.68402.bm@omp1002.bt.mail.ird.yahoo.com Received: (qmail 98437 invoked from network); 19 Aug 2011 00:12:23 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=DKIM-Signature:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject:References:In-Reply-To:Content-Type; b=RnZ5KLYy/c7+AoizJEkUAsgWgcxLimagXZjNuoXdQzpeYgKglZIO+Rx6nOzOCWExl7mCm536qEjnSYN1kW1B1PT3O2c2ogdgqpybxLMtt9DibcNh6JAq/wvwe71gffjOKcdj2+B2zSoZXf5T3IddeJRD7+RPR1/u6DVbTFLtuZ0= ; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1313712743; bh=G/TpXORbBWjKweX5DHZec55kxPlSsHNoG6NoM3qDxcY=; h=X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject:References:In-Reply-To:Content-Type; b=2y38h11NWqAMzKDdRY1dSN5opBKJ0v8zjqGH4N/mwrK8wWpl9oq+tPJVNx8jP7TOfS0JL68TPSX9gO2CzkESNVZAyUv4qF+pdaGRo0BmWVys1IDOjZ4iWe52PBeRIQq8qrl2foOazI6GkIdqV0ruhT3ioF1a6mstKNoMwpLU0XI= X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: BqqbMrwVM1l193GHs0DWscRdrm8OjaQED1rNgrYdD.6GcRe wAkmVQ5Y.J8xwne8nVaqDA0cUJg3.0jy2EfMsMXIy02l_L_W8MkaIrWx4N7g GJMN8aXEAkMmM0fD8V.fJioUmwWEl8kfZlwfWw4sFIsHZ3kTipanivQTDTc7 XW2U.SQ1tK4IgictzCgjY5vxqWKMEI7kA91qHAbxRC8JCWNr9wapNY8y.O6a SCpyDmE57wFT6OeIbr.wxZH0Vm3ur70kn1KVxSD2aBFd4pcBvYezS8q.mcL9 N4XHxPwu30a.vYVRIUg7yuYveaUkp1zrpY1jAXTMTudgNKgxcuBXSsVDWV.8 6dxzDHSufZfhNL04AnbjUfmVFWuXyLcdrXmozlipdJl.QAEvtJ0tY5qcklvW uEIA- X-Yahoo-SMTP: dMK34oyswBBlfKesWTI5ovDjFOUFE6shtILt.ZXnUEjQHhWq Received: from wellhouse.underworld (rankincj@86.183.125.64 with login) by smtp819.mail.ukl.yahoo.com with SMTP; 19 Aug 2011 00:12:22 +0000 GMT Received: from volcano.underworld (volcano.underworld [192.168.0.3]) by wellhouse.underworld (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id p7J0CKWj007930 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 19 Aug 2011 01:12:21 +0100 Message-ID: <4E4DAA64.4050302@yahoo.com> Date: Fri, 19 Aug 2011 01:12:20 +0100 From: Chris Rankin User-Agent: Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20110707 Thunderbird/5.0 MIME-Version: 1.0 To: Devin Heitmueller CC: linux-media@vger.kernel.org, mchehab@redhat.com, Antti Palosaari Subject: Re: [PATCH] Latest version of em28xx / em28xx-dvb patch for PCTV 290e References: <4E4D5157.2080406@yahoo.com> In-Reply-To: Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The final patch removes the unplug/replug deadlock by not holding the device mutex during dvb_init(). However, this mutex has already been locked during device initialisation by em28xx_usb_probe() and is not released again until all extensions have been initialised successfully. The device mutex is not held during either em28xx_register_extension() or em28xx_unregister_extension() any more. More importantly, I don't believe it can safely be held by these functions because they must both - by their nature - acquire the device list mutex before they can iterate through the device list. In other words, while usb_probe() and usb_disconnect() acquire the device mutex followed by the device list mutex, the register/unregister_extension() functions would need to acquire these mutexes in the opposite order. And that sounds like a potential deadlock. On the other hand, the new situation is a definite improvement :-). Signed-off-by: Chris Rankin --- linux-3.0/drivers/media/video/em28xx/em28xx-dvb.c.orig 2011-08-19 00:50:41.000000000 +0100 +++ linux-3.0/drivers/media/video/em28xx/em28xx-dvb.c 2011-08-19 00:51:03.000000000 +0100 @@ -542,7 +542,6 @@ dev->dvb = dvb; dvb->fe[0] = dvb->fe[1] = NULL; - mutex_lock(&dev->lock); em28xx_set_mode(dev, EM28XX_DIGITAL_MODE); /* init frontend */ switch (dev->model) { @@ -711,7 +710,6 @@ em28xx_info("Successfully loaded em28xx-dvb\n"); ret: em28xx_set_mode(dev, EM28XX_SUSPEND); - mutex_unlock(&dev->lock); return result; out_free: