Skip to contentSkip to conversation

DVB: possible cleanups

RFC PATCH In review Adrian Bunk 3 participants 3 messages Feb 11, 2005 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 DVB: possible cleanups

Before I'm getting flamed to death:
This patch contains possible cleanups. If parts of this patch conflict with pending changes these parts of my patch have to be dropped.

This patch contains the following possible cleanups:
- make needlessly global code static
- remove the following EXPORT_SYMBOL'ed but unused function:
- bt8xx/bt878.c: bt878_find_by_i2c_adap
- remove the following unused global functions:
- dvb-core/dvb_demux.c: dmx_get_demuxes
- dvb-core/dvb_demux.c: dvb_set_crc32
- remove the following unneeded EXPORT_SYMBOL's:
- dvb-core/dvb_demux.c: dvb_dmx_swfilter_packet
- dvb-core/dvb_demux.c: dvbdmx_connect_frontend
- dvb-core/dvb_demux.c: dvbdmx_disconnect_frontend
- dvb-core/dvbdev.c: dvb_class

drivers/media/dvb/b2c2/b2c2-common.c renamed from drivers/media/dvb/b2c2/b2c2-common.c.old +1 -1
@@ -158,7 +158,7 @@
 	return 0;
 }
 
-int samsung_tdtc9251dh0_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params, u8* pllbuf)
+static int samsung_tdtc9251dh0_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params, u8* pllbuf)
 {
 	u32 div;
 	unsigned char bs = 0;
drivers/media/dvb/b2c2/skystar2.c renamed from drivers/media/dvb/b2c2/skystar2.c.old +1 -1
@@ -2356,7 +2356,7 @@
 	return 0;
 }
 
-int samsung_tdtc9251dh0_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params, u8* pllbuf)
+static int samsung_tdtc9251dh0_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params, u8* pllbuf)
 {
 	u32 div;
 	unsigned char bs = 0;
drivers/media/dvb/bt8xx/dst_priv.h renamed from drivers/media/dvb/bt8xx/dst_priv.h.old +0 -1
@@ -34,4 +34,3 @@
 
 int bt878_device_control(struct bt878 *bt, unsigned int cmd, union dst_gpio_packet *mp);
 
-struct bt878 *bt878_find_by_i2c_adap(struct i2c_adapter *adap);
drivers/media/dvb/bt8xx/bt878.c renamed from drivers/media/dvb/bt8xx/bt878.c.old +0 -15
@@ -381,21 +381,6 @@
 
 EXPORT_SYMBOL(bt878_device_control);
 
-struct bt878 *bt878_find_by_i2c_adap(struct i2c_adapter *adapter)
-{
-	unsigned int card_nr;
-	
-	printk("bt878 find by dvb adap: checking \"%s\"\n",adapter->name);
-	for (card_nr = 0; card_nr < bt878_num; card_nr++) {
-		if (bt878[card_nr].adapter == adapter)
-			return &bt878[card_nr];
-	}
-	printk("bt878 find by dvb adap: NOT found \"%s\"\n",adapter->name);
-	return NULL;
-}
-
-EXPORT_SYMBOL(bt878_find_by_i2c_adap);
-
 /***********************/
 /* PCI device handling */
 /***********************/
drivers/media/dvb/dibusb/dvb-dibusb-core.c renamed from drivers/media/dvb/dibusb/dvb-dibusb-core.c.old +1 -1
@@ -446,7 +446,7 @@
 }
 
 /* usb specific object needed to register this driver with the usb subsystem */
-struct usb_driver dibusb_driver = {
+static struct usb_driver dibusb_driver = {
 	.owner		= THIS_MODULE,
 	.name		= DRIVER_DESC,
 	.probe 		= dibusb_probe,
drivers/media/dvb/dibusb/dvb-dibusb.h renamed from drivers/media/dvb/dibusb/dvb-dibusb.h.old +0 -2
@@ -206,8 +206,6 @@
 int dibusb_remote_init(struct usb_dibusb *dib);
 
 /* dvb-dibusb-fe-i2c.c */
-int dibusb_i2c_msg(struct usb_dibusb *dib, u8 addr, 
-		u8 *wbuf, u16 wlen, u8 *rbuf, u16 rlen);
 int dibusb_fe_init(struct usb_dibusb* dib);
 int dibusb_fe_exit(struct usb_dibusb *dib);
 int dibusb_i2c_init(struct usb_dibusb *dib);
drivers/media/dvb/dibusb/dvb-dibusb-fe-i2c.c renamed from drivers/media/dvb/dibusb/dvb-dibusb-fe-i2c.c.old +2 -2
@@ -14,8 +14,8 @@
 
 #include <linux/usb.h>
 
-int dibusb_i2c_msg(struct usb_dibusb *dib, u8 addr, 
-		u8 *wbuf, u16 wlen, u8 *rbuf, u16 rlen)
+static int dibusb_i2c_msg(struct usb_dibusb *dib, u8 addr, 
+			  u8 *wbuf, u16 wlen, u8 *rbuf, u16 rlen)
 {
 	u8 sndbuf[wlen+4]; /* lead(1) devaddr,direction(1) addr(2) data(wlen) (len(2) (when reading)) */
 	/* write only ? */
drivers/media/dvb/dvb-core/demux.h renamed from drivers/media/dvb/dvb-core/demux.h.old +0 -4
@@ -298,9 +298,5 @@
 
 #define DMX_DIR_ENTRY(list) list_entry(list, struct dmx_demux, reg_list)
 
-int dmx_register_demux (struct dmx_demux* demux); 
-int dmx_unregister_demux (struct dmx_demux* demux); 
-struct list_head* dmx_get_demuxes (void); 
-
 #endif /* #ifndef __DEMUX_H */
 
drivers/media/dvb/dvb-core/dvb_demux.h renamed from drivers/media/dvb/dvb-core/dvb_demux.h.old +0 -4
@@ -138,13 +138,9 @@
 
 int dvb_dmx_init(struct dvb_demux *dvbdemux);
 int dvb_dmx_release(struct dvb_demux *dvbdemux);
-void dvb_dmx_swfilter_packet(struct dvb_demux *dvbdmx, const u8 *buf);
 void dvb_dmx_swfilter_packets(struct dvb_demux *dvbdmx, const u8 *buf, size_t count);
 void dvb_dmx_swfilter(struct dvb_demux *demux, const u8 *buf, size_t count);
 void dvb_dmx_swfilter_204(struct dvb_demux *demux, const u8 *buf, size_t count);
 
-int dvbdmx_connect_frontend(struct dmx_demux *demux, struct dmx_frontend *frontend);
-int dvbdmx_disconnect_frontend(struct dmx_demux *demux);
-
 #endif /* _DVB_DEMUX_H_ */
 
drivers/media/dvb/dvb-core/dvb_demux.c renamed from drivers/media/dvb/dvb-core/dvb_demux.c.old +7 -31
@@ -27,7 +27,7 @@
 #include <linux/module.h>
 #include <linux/poll.h>
 #include <linux/string.h>
-	#include <linux/crc32.h>
+#include <linux/crc32.h>
 #include <asm/uaccess.h>
 
 #include "dvb_demux.h"
@@ -39,17 +39,17 @@
 // #define DVB_DEMUX_SECTION_LOSS_LOG
 
 
-LIST_HEAD(dmx_muxs);
+static LIST_HEAD(dmx_muxs);
 
 
-int dmx_register_demux(struct dmx_demux *demux) 
+static int dmx_register_demux(struct dmx_demux *demux) 
 {
 	demux->users = 0;
 	list_add(&demux->reg_list, &dmx_muxs);
 	return 0;
 }
 
-int dmx_unregister_demux(struct dmx_demux* demux)
+static int dmx_unregister_demux(struct dmx_demux* demux)
 {
 	struct list_head *pos, *n, *head=&dmx_muxs;
 
@@ -66,14 +66,6 @@
 }
 
 
-struct list_head *dmx_get_demuxes(void)
-{
-	if (list_empty(&dmx_muxs))
-		return NULL;
-
-	return &dmx_muxs;
-}
-
 /******************************************************************************
  * static inlined helper functions
  ******************************************************************************/
@@ -105,19 +97,6 @@
 }
 
 
-void dvb_set_crc32(u8 *data, int length)
-{
-	u32 crc;
-
-	crc = crc32_be(~0, data, length);
-
-	data[length]   = (crc >> 24) & 0xff;
-	data[length+1] = (crc >> 16) & 0xff;
-	data[length+2] = (crc >>  8) & 0xff;
-	data[length+3] = (crc)       & 0xff;
-}
-
-
 static u32 dvb_dmx_crc32 (struct dvb_demux_feed *f, const u8 *src, size_t len)
 {
 	return (f->feed.sec.crc_val = crc32_be (f->feed.sec.crc_val, src, len));
@@ -424,7 +403,7 @@
 	((f)->feed.ts.is_filtering) &&					\
 	(((f)->ts_type & (TS_PACKET|TS_PAYLOAD_ONLY)) == TS_PACKET))
 
-void dvb_dmx_swfilter_packet(struct dvb_demux *demux, const u8 *buf)
+static void dvb_dmx_swfilter_packet(struct dvb_demux *demux, const u8 *buf)
 {
 	struct dvb_demux_feed *feed;
 	struct list_head *pos, *head=&demux->feed_list;
@@ -452,7 +431,6 @@
 			feed->cb.ts(buf, 188, NULL, 0, &feed->feed.ts, DMX_OK);
 	}
 }
-EXPORT_SYMBOL(dvb_dmx_swfilter_packet);
 
 void dvb_dmx_swfilter_packets(struct dvb_demux *demux, const u8 *buf, size_t count)
 {
@@ -1176,7 +1154,7 @@
 }
 
 
-int dvbdmx_connect_frontend(struct dmx_demux *demux, struct dmx_frontend *frontend)
+static int dvbdmx_connect_frontend(struct dmx_demux *demux, struct dmx_frontend *frontend)
 {
 	struct dvb_demux *dvbdemux=(struct dvb_demux *) demux;
 
@@ -1190,10 +1168,9 @@
 	up(&dvbdemux->mutex);
 	return 0;
 }
-EXPORT_SYMBOL(dvbdmx_connect_frontend);
 
 
-int dvbdmx_disconnect_frontend(struct dmx_demux *demux)
+static int dvbdmx_disconnect_frontend(struct dmx_demux *demux)
 {
 	struct dvb_demux *dvbdemux=(struct dvb_demux *) demux;
 
@@ -1204,7 +1181,6 @@
 	up(&dvbdemux->mutex);
 	return 0;
 }
-EXPORT_SYMBOL(dvbdmx_disconnect_frontend);
 
 
 static int dvbdmx_get_pes_pids(struct dmx_demux *demux, u16 *pids)
drivers/media/dvb/dvb-core/dvb_net.c renamed from drivers/media/dvb/dvb-core/dvb_net.c.old +2 -2
@@ -217,12 +217,12 @@
 #define ULE_TEST	0
 #define ULE_BRIDGED	1
 
-int ule_test_sndu( struct dvb_net_priv *p )
+static int ule_test_sndu( struct dvb_net_priv *p )
 {
 	return -1;
 }
 
-int ule_bridged_sndu( struct dvb_net_priv *p )
+static int ule_bridged_sndu( struct dvb_net_priv *p )
 {
 	/* BRIDGE SNDU handling sucks in draft-ietf-ipdvb-ule-03.txt.
 	 * This has to be the last extension header, otherwise it won't work.
drivers/media/dvb/dvb-core/dvbdev.c renamed from drivers/media/dvb/dvb-core/dvbdev.c.old +1 -2
@@ -56,8 +56,7 @@
 #define nums2minor(num,type,id)  ((num << 6) | (id << 4) | type)
 #define MAX_DVB_MINORS           (DVB_MAX_IDS*64)
 
-struct class_simple *dvb_class;
-EXPORT_SYMBOL(dvb_class);
+static struct class_simple *dvb_class;
 
 static struct dvb_device* dvbdev_find_device (int minor)
 {
drivers/media/dvb/frontends/tda10021.c renamed from drivers/media/dvb/frontends/tda10021.c.old +1 -1
@@ -65,7 +65,7 @@
 
 #define FIN (XIN >> 4)
 
-int tda10021_inittab_size = 0x40;
+static int tda10021_inittab_size = 0x40;
 static u8 tda10021_inittab[0x40]=
 {
 	0x73, 0x6a, 0x23, 0x0a, 0x02, 0x37, 0x77, 0x1a,
drivers/media/dvb/ttpci/budget-av.c renamed from drivers/media/dvb/ttpci/budget-av.c.old +2 -2
@@ -59,7 +59,7 @@
 	struct dvb_ca_en50221 ca;
 };
 
-int enable_ci = 0;
+static int enable_ci = 0;
 
 
 /****************************************************************************
@@ -662,7 +662,7 @@
 	return request_firmware(fw, name, &budget->dev->pci->dev);
 }
 
-struct tda1004x_config philips_tu1216_config = {
+static struct tda1004x_config philips_tu1216_config = {
 
 	.demod_address = 0x8,
 	.invert = 1,
drivers/media/dvb/ttpci/budget-patch.c renamed from drivers/media/dvb/ttpci/budget-patch.c.old +1 -1
@@ -406,7 +406,7 @@
 	return 0;
 }
 
-struct tda8083_config grundig_29504_451_config = {
+static struct tda8083_config grundig_29504_451_config = {
 	.demod_address = 0x68,
 	.pll_set = grundig_29504_451_pll_set,
 };
#1 lore raw
Quoted 14 lines · Adrian Bunk

Before I'm getting flamed to death:
This patch contains possible cleanups. If parts of this patch conflict with pending changes these parts of my patch have to be dropped.

This patch contains the following possible cleanups:
- make needlessly global code static
- remove the following EXPORT_SYMBOL'ed but unused function:
- bt8xx/bt878.c: bt878_find_by_i2c_adap
- remove the following unused global functions:
- dvb-core/dvb_demux.c: dmx_get_demuxes
- dvb-core/dvb_demux.c: dvb_set_crc32
- remove the following unneeded EXPORT_SYMBOL's:
- dvb-core/dvb_demux.c: dvb_dmx_swfilter_packet

dvb_dmx_swfilter_packet() should remain exported to the public, accessing this directly makes sense for some architectures.

Holger

#2 lore raw
Quoted 16 lines · Holger Waechtler
Quoted 4 lines · Adrian Bunk

Before I'm getting flamed to death:
This patch contains possible cleanups. If parts of this patch conflict with pending changes these parts of my patch have to be dropped.

Quoted 9 lines

This patch contains the following possible cleanups:
- make needlessly global code static
- remove the following EXPORT_SYMBOL'ed but unused function:
- bt8xx/bt878.c: bt878_find_by_i2c_adap
- remove the following unused global functions:
- dvb-core/dvb_demux.c: dmx_get_demuxes
- dvb-core/dvb_demux.c: dvb_set_crc32
- remove the following unneeded EXPORT_SYMBOL's:
- dvb-core/dvb_demux.c: dvb_dmx_swfilter_packet

Quoted 2 lines

dvb_dmx_swfilter_packet() should remain exported to the public, accessing this directly makes sense for some architectures.

Hm, I don't know any out-of-tree driver which is using it. Do you? Besides, it is roughly equivalent to dvb_dmx_swfilter_packets(demux, buf, 1) (the difference is in locking and the test for the MPEG-2 TS sync byte). IMHO the EXPORT_SYMBOL for dvb_dmx_swfilter_packet() can be removed.

To me the patches look good and I'm going to apply them to linuxtv.org CVS.

Thanks,
Johannes

PS: The linuxtv.org server will be down for maintenance over the weekend which includes the linux-dvb-maintainer list. No need to worry.