From patchwork Thu Aug 18 22:28:42 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Rankin X-Patchwork-Id: 263 Return-path: Envelope-to: mchehab@infradead.org Delivery-date: Thu, 18 Aug 2011 22:28:51 +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:57:35 -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 1QuB51-0000wk-GG; Thu, 18 Aug 2011 22:28:51 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755057Ab1HRW2s (ORCPT + 1 other); Thu, 18 Aug 2011 18:28:48 -0400 Received: from nm4-vm0.bt.bullet.mail.ird.yahoo.com ([212.82.108.93]:24759 "HELO nm4-vm0.bt.bullet.mail.ird.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1754435Ab1HRW2s (ORCPT ); Thu, 18 Aug 2011 18:28:48 -0400 Received: from [212.82.108.228] by nm4.bt.bullet.mail.ird.yahoo.com with NNFMP; 18 Aug 2011 22:28:46 -0000 Received: from [212.82.108.226] by tm1.bt.bullet.mail.ird.yahoo.com with NNFMP; 18 Aug 2011 22:28:46 -0000 Received: from [127.0.0.1] by omp1003.bt.mail.ird.yahoo.com with NNFMP; 18 Aug 2011 22:28:46 -0000 X-Yahoo-Newman-Id: 387291.22441.bm@omp1003.bt.mail.ird.yahoo.com Received: (qmail 70569 invoked from network); 18 Aug 2011 22:28:46 -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=maS22oHKhy7LXl1xJe8t+8VSHuo6MZpc1mUNrqtObTpS5TsvV3FX8bZslZ5khQD8Al1nmzML0VOwvGVe4xiLngI1Boz1OpDITjhx64z6uagcf74ue29L8Ume4E72jSSUzeopcEo/MZ/AG/SWSc388oSYdPHc/AsnMzeUXrWpS14= ; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1313706526; bh=pIalR3v/e9CNRRH0Be3Zz7r4E56Gu35l5x3s0RqnL5k=; 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=FUFpQvBlxZn4M8vupwuCoFnkiIcQ0ugyIsETcOTGStqS+xcfV9znLbeVjp8+g6z4Am+cpHJNj1fXtVhQXgkjHRVPdKBNxsAKHrnfzhLxaSMtFPeeGjL9JLVnkV7+6vhaIWWlyxi9zaCWNL/iroJ4EpX6+uBiVkuSM/xSG7QP5gw= X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: ZUVyXkYVM1mYftqiGlAGNgk17FAeUsoFLzZY3NCuiipBS_5 CS.Lkj4kf_37KU8pXXKYXV.3lTfs1nMDMyedXo_C412_8aNasjnOBw5WId0x QFWBm_w5zrT2RnmZhoT9E7VH4PRLh67fZgmPmquosL6llvsc22A5l4QrPXgY FJysPvxVTlfPXD_uD33zam7BT5lps1jIKwZmy2Gw3AodcvsH.a8PJb4GwABK 0q3sg5_6YGzFuyWs7NfL5Oorq6A8JL2NtFO_LvUjPxhypOW0yDvW9z7JBBJv wOH.vrRulwRrESM2BnZR.RZgqdMukqhNhwZ_EdmNyzgDHnQ.13URjd6MqQ25 mC2fwrRhfgKCSCnzglP59L21b7c_P8k4zzdnCICqp2g8KrWFfIt5hyZOGnWV AB9s- X-Yahoo-SMTP: dMK34oyswBBlfKesWTI5ovDjFOUFE6shtILt.ZXnUEjQHhWq Received: from wellhouse.underworld (rankincj@86.183.125.64 with login) by smtp820.mail.ukl.yahoo.com with SMTP; 18 Aug 2011 22:28:45 +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 p7IMSgqA007765 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Thu, 18 Aug 2011 23:28:44 +0100 Message-ID: <4E4D921A.4080605@yahoo.com> Date: Thu, 18 Aug 2011 23:28:42 +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 Next patch: By default, the DVB framework tries to put a frontend to sleep after it has been shut down. This obviously doesn't work for a USB device that has been disconnected, and can result in occasional errors in dmesg about I2C writes failing with error code -19. The patch works by nulling out the function pointers that the DVB framework would otherwise try to call. I have therefore declared the structs in the tda18271 and cxd2820r modules to be "const", so that we know that they are supposed only to be templates. Signed-off-by: Chris Rankin --- linux-3.0/drivers/media/common/tuners/tda18271-fe.c.orig 2011-08-18 16:55:53.000000000 +0100 +++ linux-3.0/drivers/media/common/tuners/tda18271-fe.c 2011-08-18 23:12:55.000000000 +0100 @@ -1230,7 +1230,7 @@ return 0; } -static struct dvb_tuner_ops tda18271_tuner_ops = { +static const struct dvb_tuner_ops tda18271_tuner_ops = { .info = { .name = "NXP TDA18271HD", .frequency_min = 45000000, --- linux-3.0/drivers/media/dvb/frontends/cxd2820r_core.c.orig 2011-08-18 16:56:02.000000000 +0100 +++ linux-3.0/drivers/media/dvb/frontends/cxd2820r_core.c 2011-08-18 23:14:06.000000000 +0100 @@ -778,7 +778,7 @@ } EXPORT_SYMBOL(cxd2820r_get_tuner_i2c_adapter); -static struct dvb_frontend_ops cxd2820r_ops[2]; +static const struct dvb_frontend_ops cxd2820r_ops[2]; struct dvb_frontend *cxd2820r_attach(const struct cxd2820r_config *cfg, struct i2c_adapter *i2c, struct dvb_frontend *fe) @@ -844,7 +844,7 @@ } EXPORT_SYMBOL(cxd2820r_attach); -static struct dvb_frontend_ops cxd2820r_ops[2] = { +static const struct dvb_frontend_ops cxd2820r_ops[2] = { { /* DVB-T/T2 */ .info = { --- linux-3.0/drivers/media/video/em28xx/em28xx-dvb.c.orig 2011-08-17 08:52:30.000000000 +0100 +++ linux-3.0/drivers/media/video/em28xx/em28xx-dvb.c 2011-08-18 23:17:42.000000000 +0100 @@ -720,6 +720,12 @@ goto ret; } +static inline void prevent_sleep(struct dvb_frontend_ops *ops) { + ops->set_voltage = NULL; + ops->sleep = NULL; + ops->tuner_ops.sleep = NULL; +} + static int dvb_fini(struct em28xx *dev) { if (!dev->board.has_dvb) { @@ -728,8 +734,17 @@ } if (dev->dvb) { - unregister_dvb(dev->dvb); - kfree(dev->dvb); + struct em28xx_dvb *dvb = dev->dvb; + + if (dev->state & DEV_DISCONNECTED) { + /* We cannot tell the device to sleep + * once it has been unplugged. */ + prevent_sleep(&dvb->fe[0]->ops); + prevent_sleep(&dvb->fe[1]->ops); + } + + unregister_dvb(dvb); + kfree(dvb); dev->dvb = NULL; }