Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[media] dvb-core: move dvb_filter out of the DVB core

The dvb_filter.c can hardly be considered as part of the DVB
core. More than half of the code there is commented out by
av7110 and ttusb_dec.

On the latter, just two small helper functions and a struct
definition is used.

Being part of the core means that it would require an
amount of work to fix issues in it, like bad printk's
on it, and to document it on some future, like other kAPI
headers. It simply not worth the effort for something that
seems to be deprecated, as no new drivers use it.

So, move it out of the core, by moving it to pci/ttpci
directory, where av7110 driver is kept, and copy the two
routines used by ttyusb_dec directly into its code.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>

+59 -7
-1
drivers/media/common/b2c2/flexcop-common.h
··· 14 14 15 15 #include "dmxdev.h" 16 16 #include "dvb_demux.h" 17 - #include "dvb_filter.h" 18 17 #include "dvb_net.h" 19 18 #include "dvb_frontend.h" 20 19
+1 -1
drivers/media/dvb-core/Makefile
··· 4 4 5 5 dvb-net-$(CONFIG_DVB_NET) := dvb_net.o 6 6 7 - dvb-core-objs := dvbdev.o dmxdev.o dvb_demux.o dvb_filter.o \ 7 + dvb-core-objs := dvbdev.o dmxdev.o dvb_demux.o \ 8 8 dvb_ca_en50221.o dvb_frontend.o \ 9 9 $(dvb-net-y) dvb_ringbuffer.o dvb_math.o 10 10
-3
drivers/media/dvb-core/dvb_filter.c drivers/media/pci/ttpci/dvb_filter.c
··· 390 390 391 391 return 0; 392 392 } 393 - EXPORT_SYMBOL(dvb_filter_get_ac3info); 394 393 395 394 396 395 #if 0 ··· 564 565 p2ts->cb=cb; 565 566 p2ts->priv=priv; 566 567 } 567 - EXPORT_SYMBOL(dvb_filter_pes2ts_init); 568 568 569 569 int dvb_filter_pes2ts(struct dvb_filter_pes2ts *p2ts, unsigned char *pes, 570 570 int len, int payload_start) ··· 598 600 memcpy(buf+5+rest, pes, len); 599 601 return p2ts->cb(p2ts->priv, buf); 600 602 } 601 - EXPORT_SYMBOL(dvb_filter_pes2ts);
drivers/media/dvb-core/dvb_filter.h drivers/media/pci/ttpci/dvb_filter.h
+1 -1
drivers/media/pci/ttpci/Makefile
··· 3 3 # and the AV7110 DVB device driver 4 4 # 5 5 6 - dvb-ttpci-objs := av7110_hw.o av7110_v4l.o av7110_av.o av7110_ca.o av7110.o av7110_ipack.o 6 + dvb-ttpci-objs := av7110_hw.o av7110_v4l.o av7110_av.o av7110_ca.o av7110.o av7110_ipack.o dvb_filter.o 7 7 8 8 ifdef CONFIG_DVB_AV7110_IR 9 9 dvb-ttpci-objs += av7110_ir.o
+57 -1
drivers/media/usb/ttusb-dec/ttusb_dec.c
··· 36 36 37 37 #include "dmxdev.h" 38 38 #include "dvb_demux.h" 39 - #include "dvb_filter.h" 40 39 #include "dvb_frontend.h" 41 40 #include "dvb_net.h" 42 41 #include "ttusbdecfe.h" ··· 89 90 TTUSB_DEC_INTERFACE_INITIAL, 90 91 TTUSB_DEC_INTERFACE_IN, 91 92 TTUSB_DEC_INTERFACE_OUT 93 + }; 94 + 95 + typedef int (dvb_filter_pes2ts_cb_t) (void *, unsigned char *); 96 + 97 + struct dvb_filter_pes2ts { 98 + unsigned char buf[188]; 99 + unsigned char cc; 100 + dvb_filter_pes2ts_cb_t *cb; 101 + void *priv; 92 102 }; 93 103 94 104 struct ttusb_dec { ··· 208 200 KEY_M, 209 201 KEY_RADIO 210 202 }; 203 + 204 + static void dvb_filter_pes2ts_init(struct dvb_filter_pes2ts *p2ts, 205 + unsigned short pid, 206 + dvb_filter_pes2ts_cb_t *cb, void *priv) 207 + { 208 + unsigned char *buf=p2ts->buf; 209 + 210 + buf[0]=0x47; 211 + buf[1]=(pid>>8); 212 + buf[2]=pid&0xff; 213 + p2ts->cc=0; 214 + p2ts->cb=cb; 215 + p2ts->priv=priv; 216 + } 217 + 218 + static int dvb_filter_pes2ts(struct dvb_filter_pes2ts *p2ts, 219 + unsigned char *pes, int len, int payload_start) 220 + { 221 + unsigned char *buf=p2ts->buf; 222 + int ret=0, rest; 223 + 224 + //len=6+((pes[4]<<8)|pes[5]); 225 + 226 + if (payload_start) 227 + buf[1]|=0x40; 228 + else 229 + buf[1]&=~0x40; 230 + while (len>=184) { 231 + buf[3]=0x10|((p2ts->cc++)&0x0f); 232 + memcpy(buf+4, pes, 184); 233 + if ((ret=p2ts->cb(p2ts->priv, buf))) 234 + return ret; 235 + len-=184; pes+=184; 236 + buf[1]&=~0x40; 237 + } 238 + if (!len) 239 + return 0; 240 + buf[3]=0x30|((p2ts->cc++)&0x0f); 241 + rest=183-len; 242 + if (rest) { 243 + buf[5]=0x00; 244 + if (rest-1) 245 + memset(buf+6, 0xff, rest-1); 246 + } 247 + buf[4]=rest; 248 + memcpy(buf+5+rest, pes, len); 249 + return p2ts->cb(p2ts->priv, buf); 250 + } 211 251 212 252 static void ttusb_dec_set_model(struct ttusb_dec *dec, 213 253 enum ttusb_dec_model model);