Skip to contentSkip to conversation

cleanup dvb-usb/af9005*

PATCH In review Adrian Bunk 2 participants 2 messages Nov 5, 2007 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cleanup dvb-usb/af9005*

This patch contains the following cleanups:
- remove all the module trick code and build af9005-remote always into the af9005 module
- make needlessly global code static
- #if 0 unused functions

One might say that always including af9005-remote into the af9005 module might cause needless bloat, but the fun fact is that altogether the af9005 module becomes *smaller* (dvb-usb-af9005.ko goes down from 41884 to 41244 bytes in the configuration I tested) despite *additionally* containing af9005-remote...

---

 drivers/media/dvb/dvb-usb/Kconfig         |    7 --
 drivers/media/dvb/dvb-usb/Makefile        |    5 -
 drivers/media/dvb/dvb-usb/af9005-remote.c |   31 ++--------
 drivers/media/dvb/dvb-usb/af9005.c        |   63 ++++++++--------------
 drivers/media/dvb/dvb-usb/af9005.h        |    9 ---
 5 files changed, 33 insertions(+), 82 deletions(-)

d7216ff4e314d0ad37ea5f7c4c110bf7865999a5

drivers/media/dvb/dvb-usb/Kconfig +0 -7
index d73934d..e3227ae 100644
@@ -232,10 +232,3 @@ config DVB_USB_AF9005
 	  Say Y here to support the Afatech AF9005 based DVB-T USB1.1 receiver
 	  and the TerraTec Cinergy T USB XE (Rev.1)
 
-config DVB_USB_AF9005_REMOTE
-	tristate "Afatech AF9005 default remote control support"
-	depends on DVB_USB_AF9005
-	help
-	  Say Y here to support the default remote control decoding for the
-	  Afatech AF9005 based receiver.
-
drivers/media/dvb/dvb-usb/Makefile +1 -4
index 73ac0a9..75dc642 100644
@@ -55,10 +55,7 @@ dvb-usb-opera-objs = opera1.o
 obj-$(CONFIG_DVB_USB_OPERA1) += dvb-usb-opera.o
 
 
-dvb-usb-af9005-objs = af9005.o af9005-fe.o
+dvb-usb-af9005-objs = af9005.o af9005-fe.o af9005-remote.o
 obj-$(CONFIG_DVB_USB_AF9005) += dvb-usb-af9005.o
 
-dvb-usb-af9005-remote-objs = af9005-remote.o
-obj-$(CONFIG_DVB_USB_AF9005_REMOTE) += dvb-usb-af9005-remote.o
-
 EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core/ -Idrivers/media/dvb/frontends/
drivers/media/dvb/dvb-usb/af9005-remote.c +7 -24
index ff00c0e..de670ff 100644
@@ -24,14 +24,6 @@
  * see Documentation/dvb/REDME.dvb-usb for more information
  */
 #include "af9005.h"
-/* debug */
-int dvb_usb_af9005_remote_debug;
-module_param_named(debug, dvb_usb_af9005_remote_debug, int, 0644);
-MODULE_PARM_DESC(debug,
-		 "enable (1) or disable (0) debug messages."
-		 DVB_USB_DEBUG_STATUS);
-
-#define deb_decode(args...)   dprintk(dvb_usb_af9005_remote_debug,0x01,args)
 
 struct dvb_usb_rc_key af9005_rc_keys[] = {
 
@@ -99,12 +91,12 @@ int af9005_rc_decode(struct dvb_usb_device *d, u8 * data, int len, u32 * event,
 				if (d->last_event == repeatable_keys[i]) {
 					*state = REMOTE_KEY_REPEAT;
 					*event = d->last_event;
-					deb_decode("repeat key, event %x\n",
+					deb_rem("repeat key, event %x\n",
 						   *event);
 					return 0;
 				}
 			}
-			deb_decode("repeated key ignored (non repeatable)\n");
+			deb_rem("repeated key ignored (non repeatable)\n");
 			return 0;
 		} else if (len >= 33 * 4) {	/*32 bits + start code */
 			result = 0;
@@ -117,9 +109,9 @@ int af9005_rc_decode(struct dvb_usb_device *d, u8 * data, int len, u32 * event,
 				if (mark * 2 > space)
 					result += 1;
 			}
-			deb_decode("key pressed, raw value %x\n", result);
+			deb_rem("key pressed, raw value %x\n", result);
 			if ((result & 0xff000000) != 0xfe000000) {
-				deb_decode
+				deb_rem
 				    ("doesn't start with 0xfe, ignored\n");
 				return 0;
 			}
@@ -127,7 +119,7 @@ int af9005_rc_decode(struct dvb_usb_device *d, u8 * data, int len, u32 * event,
 			dat = (result >> 8) & 0xff;
 			invdat = (~result) & 0xff;
 			if (dat != invdat) {
-				deb_decode("code != inverted code\n");
+				deb_rem("code != inverted code\n");
 				return 0;
 			}
 			for (i = 0; i < af9005_rc_keys_size; i++) {
@@ -135,23 +127,14 @@ int af9005_rc_decode(struct dvb_usb_device *d, u8 * data, int len, u32 * event,
 				    && af9005_rc_keys[i].data == dat) {
 					*event = af9005_rc_keys[i].event;
 					*state = REMOTE_KEY_PRESSED;
-					deb_decode
+					deb_rem
 					    ("key pressed, event %x\n", *event);
 					return 0;
 				}
 			}
-			deb_decode("not found in table\n");
+			deb_rem("not found in table\n");
 		}
 	}
 	return 0;
 }
 
-EXPORT_SYMBOL(af9005_rc_keys);
-EXPORT_SYMBOL(af9005_rc_keys_size);
-EXPORT_SYMBOL(af9005_rc_decode);
-
-MODULE_AUTHOR("Luca Olivetti <[email protected]>");
-MODULE_DESCRIPTION
-    ("Standard remote control decoder for Afatech 9005 DVB-T USB1.1 stick");
-MODULE_VERSION("1.0");
-MODULE_LICENSE("GPL");
drivers/media/dvb/dvb-usb/af9005.c +24 -39

156 lines not on this page · raw message

drivers/media/dvb/dvb-usb/af9005.h +1 -8
index 0bc48a0..f2cd050 100644
@@ -34,8 +34,7 @@ extern int dvb_usb_af9005_debug;
 #define deb_reg(args...)  dprintk(dvb_usb_af9005_debug,0x08,args)
 #define deb_i2c(args...)  dprintk(dvb_usb_af9005_debug,0x10,args)
 #define deb_fw(args...)   dprintk(dvb_usb_af9005_debug,0x20,args)
-
-extern int dvb_usb_af9005_led;
+#define deb_rem(args...)  dprintk(dvb_usb_af9005_debug,0x40,args)
 
 /* firmware */
 #define FW_BULKOUT_SIZE 250
@@ -3464,14 +3463,8 @@ enum {
 extern struct dvb_frontend *af9005_fe_attach(struct dvb_usb_device *d);
 extern int af9005_read_ofdm_register(struct dvb_usb_device *d, u16 reg,
 				     u8 * value);
-extern int af9005_read_ofdm_registers(struct dvb_usb_device *d, u16 reg,
-				      u8 * values, int len);
 extern int af9005_write_ofdm_register(struct dvb_usb_device *d, u16 reg,
 				      u8 value);
-extern int af9005_write_ofdm_registers(struct dvb_usb_device *d, u16 reg,
-				       u8 * values, int len);
-extern int af9005_read_tuner_registers(struct dvb_usb_device *d, u16 reg,
-				       u8 addr, u8 * values, int len);
 extern int af9005_write_tuner_registers(struct dvb_usb_device *d, u16 reg,
 					u8 * values, int len);
 extern int af9005_read_register_bits(struct dvb_usb_device *d, u16 reg,
#1 lore raw

En/na Adrian Bunk ha escrit:

Quoted 2 lines

One might say that always including af9005-remote into the af9005 module might cause needless bloat, but the fun fact is that altogether the af9005 module becomes *smaller* (dvb-usb-af9005.ko goes down from 41884 to 41244 bytes in the configuration I tested) despite *additionally* containing af9005-remote...

The reason wasn't to avoid bloat (though there are sticks without a remote receiver, so they can avoid the useless code) but to allow for an alternative implementation that passes the raw pulses to lirc for decoding:

http://ventoso.org/luca/af9005/README.lirc
http://ventoso.org/luca/af9005/af9005-lirc.c

Bye

Signature · 1 line
Luca