V4L/DVB (11078): au0828: properly handle non-existent analog inputs
It is not valid to look for dev->board.input == NULL to detect an undefined
analog configuration section, since it is a member of the struct and not a
pointer (hence it will *always* be non-NULL). Do the check based on whether
the first input is actually a valid input type instead.
Thanks to Michael Krufky <mkrufky@linuxtv.org> for providing sample hardware
of various configurations to test with.
Signed-off-by: Devin Heitmueller <dheitmueller@linuxtv.org>
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
diff --git a/drivers/media/video/au0828/au0828-cards.c b/drivers/media/video/au0828/au0828-cards.c
index e10b1b9..0516c06 100644
--- a/drivers/media/video/au0828/au0828-cards.c
+++ b/drivers/media/video/au0828/au0828-cards.c
@@ -195,7 +195,7 @@
break;
}
- if (dev->board.input != NULL) {
+ if (AUVI_INPUT(0).type != AU0828_VMUX_UNDEFINED) {
/* Load the analog demodulator driver (note this would need to
be abstracted out if we ever need to support a different
demod) */
diff --git a/drivers/media/video/au0828/au0828-core.c b/drivers/media/video/au0828/au0828-core.c
index 2b5ade6..5199c8a 100644
--- a/drivers/media/video/au0828/au0828-core.c
+++ b/drivers/media/video/au0828/au0828-core.c
@@ -146,7 +146,7 @@
/* Digital TV */
au0828_dvb_unregister(dev);
- if (dev->board.input != NULL)
+ if (AUVI_INPUT(0).type != AU0828_VMUX_UNDEFINED)
au0828_analog_unregister(dev);
/* I2C */
@@ -205,7 +205,7 @@
au0828_card_setup(dev);
/* Analog TV */
- if (dev->board.input != NULL)
+ if (AUVI_INPUT(0).type != AU0828_VMUX_UNDEFINED)
au0828_analog_register(dev, interface);
/* Digital TV */
diff --git a/drivers/media/video/au0828/au0828.h b/drivers/media/video/au0828/au0828.h
index d2e54c8..590d15e 100644
--- a/drivers/media/video/au0828/au0828.h
+++ b/drivers/media/video/au0828/au0828.h
@@ -66,7 +66,8 @@
#define AU0828_MAX_INPUT 4
enum au0828_itype {
- AU0828_VMUX_COMPOSITE = 1,
+ AU0828_VMUX_UNDEFINED = 0,
+ AU0828_VMUX_COMPOSITE,
AU0828_VMUX_SVIDEO,
AU0828_VMUX_CABLE,
AU0828_VMUX_TELEVISION,