From: Devin Heitmueller Date: Mon, 6 Oct 2008 15:07:48 +0000 (-0300) Subject: V4L/DVB (9114): dib0700: fix bad assignment of dib0700_xc5000_tuner_callback after... X-Git-Tag: v2.6.28-rc1~601^2~54 X-Git-Url: http://www.pilppa.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=79025a9ed9132880d5197611dec6d8533c121ac7;p=linux-2.6-omap-h63xx.git V4L/DVB (9114): dib0700: fix bad assignment of dib0700_xc5000_tuner_callback after return call 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. Signed-off-by: Devin Heitmueller Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/dvb/dvb-usb/dib0700_devices.c b/drivers/media/dvb/dvb-usb/dib0700_devices.c index 9891ca0924a..0cfccc24b19 100644 --- a/drivers/media/dvb/dvb-usb/dib0700_devices.c +++ b/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 */