diff options
author | Michael Krufky <mkrufky@linuxtv.org> | 2008-10-06 11:07:48 -0400 |
---|---|---|
committer | Michael Krufky <mkrufky@linuxtv.org> | 2008-10-06 11:07:48 -0400 |
commit | 59bd3f15af822cf71839e0cfc59f5979b6e2e6c7 (patch) | |
tree | aefdb6668f1c81590e7faa1a1aa707916b57a757 /linux/drivers/media/dvb | |
parent | 80ec884df95bd4087156ae970f290da3971cd1bc (diff) | |
download | mediapointer-dvb-s2-59bd3f15af822cf71839e0cfc59f5979b6e2e6c7.tar.gz mediapointer-dvb-s2-59bd3f15af822cf71839e0cfc59f5979b6e2e6c7.tar.bz2 |
dib0700: fix bad assignment of dib0700_xc5000_tuner_callback after return call
From: Devin Heitmueller <devin.heitmueller@gmail.com>
Put callback definition before function return and cleanup callback:
Fix a bug where the xc5000 callback was being set *after* the
return call (essentially resulting in dead code).
Also cleanup the callback function to detect unknown commands.
Priority: normal
Signed-off-by: Devin Heitmueller <devin.heitmueller@gmail.com>
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Diffstat (limited to 'linux/drivers/media/dvb')
-rw-r--r-- | linux/drivers/media/dvb/dvb-usb/dib0700_devices.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/linux/drivers/media/dvb/dvb-usb/dib0700_devices.c b/linux/drivers/media/dvb/dvb-usb/dib0700_devices.c index 9891ca092..0cfccc24b 100644 --- a/linux/drivers/media/dvb/dvb-usb/dib0700_devices.c +++ b/linux/drivers/media/dvb/dvb-usb/dib0700_devices.c @@ -1181,11 +1181,16 @@ static int dib0700_xc5000_tuner_callback(void *priv, int component, { struct dvb_usb_adapter *adap = priv; - /* Reset the tuner */ - dib0700_set_gpio(adap->dev, GPIO1, GPIO_OUT, 0); - msleep(330); /* from Windows USB trace */ - dib0700_set_gpio(adap->dev, GPIO1, GPIO_OUT, 1); - msleep(330); /* from Windows USB trace */ + if (command == XC5000_TUNER_RESET) { + /* Reset the tuner */ + dib0700_set_gpio(adap->dev, GPIO1, GPIO_OUT, 0); + msleep(330); /* from Windows USB trace */ + dib0700_set_gpio(adap->dev, GPIO1, GPIO_OUT, 1); + msleep(330); /* from Windows USB trace */ + } else { + err("xc5000: unknown tuner callback command: %d\n", command); + return -EINVAL; + } return 0; } @@ -1197,12 +1202,12 @@ static struct xc5000_config s5h1411_xc5000_tunerconfig = { static int xc5000_tuner_attach(struct dvb_usb_adapter *adap) { + /* FIXME: generalize & move to common area */ + adap->fe->callback = dib0700_xc5000_tuner_callback; + return dvb_attach(xc5000_attach, adap->fe, &adap->dev->i2c_adap, &s5h1411_xc5000_tunerconfig) == NULL ? -ENODEV : 0; - - /* FIXME: generalize & move to common area */ - adap->fe->callback = dib0700_xc5000_tuner_callback; } /* DVB-USB and USB stuff follows */ |