From: Chris Rankin <rankincj@yahoo.com>
To: Devin Heitmueller <dheitmueller@kernellabs.com>
Cc: linux-media@vger.kernel.org, mchehab@redhat.com,
Antti Palosaari <crope@iki.fi>
Subject: Re: [PATCH] Latest version of em28xx / em28xx-dvb patch for PCTV 290e
Date: Thu, 18 Aug 2011 23:28:42 +0100 [thread overview]
Message-ID: <4E4D921A.4080605@yahoo.com> (raw)
In-Reply-To: <CAGoCfiw4v-ZsUPmVgOhARwNqjCVK458EV79djD625Sf+8Oghag@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 582 bytes --]
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 <rankincj@yahoo.com>
[-- Attachment #2: EM28xx-disconnect-dont-sleep.diff --]
[-- Type: text/x-patch, Size: 1957 bytes --]
--- 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;
}
next prev parent reply other threads:[~2011-08-18 22:28 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-18 17:52 [PATCH] Latest version of em28xx / em28xx-dvb patch for PCTV 290e Chris Rankin
2011-08-18 18:43 ` Devin Heitmueller
2011-08-18 18:44 ` Devin Heitmueller
2011-08-18 21:34 ` Chris Rankin
2011-08-18 22:11 ` Chris Rankin
2011-08-19 5:53 ` Mauro Carvalho Chehab
2011-08-20 11:08 ` [PATCH 1/6 ] EM28xx - pass correct buffer size to snprintf Chris Rankin
2011-08-20 11:14 ` [PATCH 2/6] Fix memory leak on disconnect or error Chris Rankin
2011-08-20 11:21 ` [PATCH 3/6] EM28xx - use atomic bit operations for devices-in-use mask Chris Rankin
2011-08-20 11:28 ` [PATCH 4/6] EM28xx - clean up resources should init fail Chris Rankin
2011-08-20 11:31 ` [PATCH 5/6] EM28xx - move printk lines outside mutex lock Chris Rankin
2011-08-20 11:37 ` [PATCH 6/6] EM28xx - don't sleep on disconnect Chris Rankin
2011-08-20 12:17 ` Mauro Carvalho Chehab
2011-08-20 13:46 ` Chris Rankin
2011-08-20 14:20 ` Mauro Carvalho Chehab
2011-08-20 19:01 ` Chris Rankin
2011-08-20 11:42 ` [PATCH 1/2] EM28xx - fix race " Chris Rankin
2011-08-20 12:36 ` Sylwester Nawrocki
2011-08-20 11:46 ` [PATCH 2/2] EM28xx - fix deadlock when unplugging and replugging a DVB adapter Chris Rankin
2011-08-20 12:34 ` Mauro Carvalho Chehab
2011-08-20 14:40 ` Chris Rankin
2011-08-20 15:02 ` Mauro Carvalho Chehab
2011-08-20 22:38 ` [PATCH 1/1] " Chris Rankin
2011-08-21 12:32 ` Chris Rankin
2011-09-13 20:04 ` Antti Palosaari
2011-09-13 20:47 ` Chris Rankin
2011-08-18 22:28 ` Chris Rankin [this message]
2011-08-18 23:45 ` [PATCH] Latest version of em28xx / em28xx-dvb patch for PCTV 290e Chris Rankin
2011-08-19 0:12 ` Chris Rankin
2011-08-18 19:56 ` Chris Rankin
2011-08-19 1:01 ` Mauro Carvalho Chehab
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4E4D921A.4080605@yahoo.com \
--to=rankincj@yahoo.com \
--cc=crope@iki.fi \
--cc=dheitmueller@kernellabs.com \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox