Skip to contentSkip to conversation

dvb-usb: split out common parts of dibusb

PATCH New Arnd Bergmann 1 participant 2 messages Jul 19, 2016 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 dvb-usb: split out common parts of dibusb

Tha ARM randconfig builds came up with another rare build failure for the dib3000mc driver, when dvb-usb-dibusb-mb is built-in and dib3000mc is a loadable module:

ERROR: "dibusb_dib3000mc_frontend_attach" [drivers/media/usb/dvb-usb/dvb-usb-nova-t-usb2.ko] undefined!
ERROR: "dibusb_dib3000mc_tuner_attach" [drivers/media/usb/dvb-usb/dvb-usb-nova-t-usb2.ko] undefined!

Apparently this used to be a valid configuration (build-time, not run-time), but broke as part of a cleanup.

I tried reverting the cleanup, but saw that the code was still wrong then. This tries to fix the code properly, by moving the problematic functions into a new file that now is built as a loadable module or built-in, whichever is correct for a particular configuration. It fixes the regression as well as the runtime problem that already existed.

The new module dependency chain is now:

dvb-usb-{dibusb_mc,a800,dib0700,umt-010,gp8psk} dvb-usb-dibusb-mb

         |                        |                   |          |
   dvb-usb-dibusb-mc-common       |        ___________|          |
         |               |        |        |                     |
   dib3000mc (frontend)  |        |        |         dib3000mb (frontend)
                         |        |        |
                         |        |        |

dvb-usb-dibusb-common

I have also checked the two other files that were changed in the original cleanup, and found them to be correct in either version, so I do not touch that part.

As this is a rather obscure bug, there is no need for backports.

Fixes 028c70ff42783 ("[media] dvb-usb/dvb-usb-v2: use IS_ENABLED")

---
I think I sent this before, but couldn't find a reference to it any more. It is certainly still needed. I'm now sending an alternative simpler patch as well, please pick one of the two

 drivers/media/usb/dvb-usb/Kconfig            |  20 +++-
 drivers/media/usb/dvb-usb/Makefile           |  11 +-
 drivers/media/usb/dvb-usb/dibusb-common.c    | 158 -------------------------
 drivers/media/usb/dvb-usb/dibusb-mc-common.c | 168 +++++++++++++++++++++++++++
 4 files changed, 190 insertions(+), 167 deletions(-)
 create mode 100644 drivers/media/usb/dvb-usb/dibusb-mc-common.c
drivers/media/usb/dvb-usb/Kconfig +15 -5
index f03b0b70c901..8c911119faa6 100644
@@ -20,10 +20,20 @@ config DVB_USB_DEBUG
 	  Say Y if you want to enable debugging. See modinfo dvb-usb (and the
 	  appropriate drivers) for debug levels.
 
+config DVB_USB_DIB3000MC
+	tristate
+	depends on DVB_USB
+	select DVB_DIB3000MC
+	help
+	  This is a module with helper functions for accessing the
+	  DIB3000MC from USB DVB devices. It must be a separate module
+	  in case DVB_USB is built-in and DVB_DIB3000MC is a module,
+	  and gets selected automatically when needed.
+
 config DVB_USB_A800
 	tristate "AVerMedia AverTV DVB-T USB 2.0 (A800)"
 	depends on DVB_USB
-	select DVB_DIB3000MC
+	select DVB_USB_DIB3000MC
 	select DVB_PLL if MEDIA_SUBDRV_AUTOSELECT
 	select MEDIA_TUNER_MT2060 if MEDIA_SUBDRV_AUTOSELECT
 	help
@@ -54,7 +64,7 @@ config DVB_USB_DIBUSB_MB_FAULTY
 config DVB_USB_DIBUSB_MC
 	tristate "DiBcom USB DVB-T devices (based on the DiB3000M-C/P) (see help for device list)"
 	depends on DVB_USB
-	select DVB_DIB3000MC
+	select DVB_USB_DIB3000MC
 	select MEDIA_TUNER_MT2060 if MEDIA_SUBDRV_AUTOSELECT
 	help
 	  Support for USB2.0 DVB-T receivers based on reference designs made by
@@ -72,7 +82,7 @@ config DVB_USB_DIB0700
 	select DVB_DIB7000P if MEDIA_SUBDRV_AUTOSELECT
 	select DVB_DIB7000M if MEDIA_SUBDRV_AUTOSELECT
 	select DVB_DIB8000 if MEDIA_SUBDRV_AUTOSELECT
-	select DVB_DIB3000MC if MEDIA_SUBDRV_AUTOSELECT
+	select DVB_USB_DIB3000MC if MEDIA_SUBDRV_AUTOSELECT
 	select DVB_S5H1411 if MEDIA_SUBDRV_AUTOSELECT
 	select DVB_LGDT3305 if MEDIA_SUBDRV_AUTOSELECT
 	select DVB_TUNER_DIB0070 if MEDIA_SUBDRV_AUTOSELECT
@@ -99,7 +109,7 @@ config DVB_USB_UMT_010
 	tristate "HanfTek UMT-010 DVB-T USB2.0 support"
 	depends on DVB_USB
 	select DVB_PLL if MEDIA_SUBDRV_AUTOSELECT
-	select DVB_DIB3000MC
+	select DVB_USB_DIB3000MC
 	select MEDIA_TUNER_MT2060 if MEDIA_SUBDRV_AUTOSELECT
 	select DVB_MT352 if MEDIA_SUBDRV_AUTOSELECT
 	help
@@ -192,7 +202,7 @@ config DVB_USB_GP8PSK
 config DVB_USB_NOVA_T_USB2
 	tristate "Hauppauge WinTV-NOVA-T usb2 DVB-T USB2.0 support"
 	depends on DVB_USB
-	select DVB_DIB3000MC
+	select DVB_USB_DIB3000MC
 	select DVB_PLL if MEDIA_SUBDRV_AUTOSELECT
 	select MEDIA_TUNER_MT2060 if MEDIA_SUBDRV_AUTOSELECT
 	help
drivers/media/usb/dvb-usb/Makefile +7 -4
index acdd1efd4e74..2a7b5a963acf 100644
@@ -16,20 +16,23 @@ obj-$(CONFIG_DVB_USB_DTT200U) += dvb-usb-dtt200u.o
 
 dvb-usb-dibusb-common-objs := dibusb-common.o
 
+dvb-usb-dibusb-mc-common-objs := dibusb-mc-common.o
+obj-$(CONFIG_DVB_USB_DIB3000MC)	+= dvb-usb-dibusb-common.o dvb-usb-dibusb-mc-common.o
+
 dvb-usb-a800-objs := a800.o
-obj-$(CONFIG_DVB_USB_A800) += dvb-usb-dibusb-common.o dvb-usb-a800.o
+obj-$(CONFIG_DVB_USB_A800) += dvb-usb-a800.o
 
 dvb-usb-dibusb-mb-objs := dibusb-mb.o
 obj-$(CONFIG_DVB_USB_DIBUSB_MB) += dvb-usb-dibusb-common.o dvb-usb-dibusb-mb.o
 
 dvb-usb-dibusb-mc-objs := dibusb-mc.o
-obj-$(CONFIG_DVB_USB_DIBUSB_MC) += dvb-usb-dibusb-common.o dvb-usb-dibusb-mc.o
+obj-$(CONFIG_DVB_USB_DIBUSB_MC) += dvb-usb-dibusb-mc.o
 
 dvb-usb-nova-t-usb2-objs := nova-t-usb2.o
-obj-$(CONFIG_DVB_USB_NOVA_T_USB2) += dvb-usb-dibusb-common.o dvb-usb-nova-t-usb2.o
+obj-$(CONFIG_DVB_USB_NOVA_T_USB2) += dvb-usb-nova-t-usb2.o
 
 dvb-usb-umt-010-objs := umt-010.o
-obj-$(CONFIG_DVB_USB_UMT_010) += dvb-usb-dibusb-common.o dvb-usb-umt-010.o
+obj-$(CONFIG_DVB_USB_UMT_010) += dvb-usb-umt-010.o
 
 dvb-usb-m920x-objs := m920x.o
 obj-$(CONFIG_DVB_USB_M920X) += dvb-usb-m920x.o
drivers/media/usb/dvb-usb/dibusb-common.c +0 -158

164 lines not on this page · raw message

drivers/media/usb/dvb-usb/dibusb-mc-common.c new file +168 -0

168 lines not on this page · raw message

Signature · 1 line
2.9.0
#1 lore raw

PATCH 2/2 dvb-usb: avoid link error with dib3000m{b,c|

Tha ARM randconfig builds came up with another rare build failure for the dib3000mc driver, when dvb-usb-dibusb-mb is built-in and dib3000mc is a loadable module:

ERROR: "dibusb_dib3000mc_frontend_attach" [drivers/media/usb/dvb-usb/dvb-usb-nova-t-usb2.ko] undefined!
ERROR: "dibusb_dib3000mc_tuner_attach" [drivers/media/usb/dvb-usb/dvb-usb-nova-t-usb2.ko] undefined!

Apparently this used to be a valid configuration (build-time, not run-time), but broke as part of a cleanup.

I tried reverting the cleanup, but saw that the code was still wrong then. This version adds a dependency for dib3000mb, to ensure that dib3000mb does not force the dibusb_dib3000mc_frontend_attach function to be built-in when dib3000mc is a loadable module.

I have also checked the two other files that were changed in the original cleanup, and found them to be correct in either version, so I do not touch that part.

As this is a rather obscure bug, there is no need for backports.

Fixes 028c70ff42783 ("[media] dvb-usb/dvb-usb-v2: use IS_ENABLED")

---
This is one of two different ways to avoid the link error, please pick one of them. Adding a dependency is simpler but slighly more limiting.

---
 drivers/media/usb/dvb-usb/Kconfig | 1 +
 1 file changed, 1 insertion(+)
drivers/media/usb/dvb-usb/Kconfig +1 -0
index 8c911119faa6..959fa09dfd92 100644
@@ -44,6 +44,7 @@ config DVB_USB_DIBUSB_MB
 	depends on DVB_USB
 	select DVB_PLL if MEDIA_SUBDRV_AUTOSELECT
 	select DVB_DIB3000MB
+	depends on DVB_DIB3000MC || !DVB_DIB3000MC
 	select MEDIA_TUNER_MT2060 if MEDIA_SUBDRV_AUTOSELECT
 	help
 	  Support for USB 1.1 and 2.0 DVB-T receivers based on reference designs made by
Signature · 1 line
2.9.0