[PATCH] Re: [linux-dvb] Sending diseqc commands on DST frontend

Philip Prindeville philipp_subx at redfish-solutions.com
Wed Nov 2 08:15:28 CET 2005


Manu Abraham wrote:

> Hello,
>
> Someone with a Twinhan card having diseqc equipment test this patch ?
> One needs to apply the cleanup patch and then the diseqc patch.
>
> Note:
> In the patch,
>
> +    if (cmd->msg_len == 0 || cmd->msg_len > 5)
>          return -EINVAL;
>
> please do change
>
> cmd->msg_len > 5 to cmd->msg_len > 6


Hmmm...  Won't matter, because of:

...

+	} else if ((cmd->msg_len == 5) && (state->dst_hw_cap & DST_TYPE_HAS_DISEQC5)) {
+		memcpy(&paket[2], cmd->msg, cmd->msg_len);
+	}

You never check for msg_len == 6 and DST_TYPE_HAS_DISEQC6 ...  What's more, we
need to add:

       } else
             return -EINVAL;

as well...  Which means that we can remove:

	if (cmd->msg_len == 0 || cmd->msg_len > 5)
 		return -EINVAL;

to begin with.


BTW:  What's the fix for seeing messages about:

Nov  1 23:22:10 tuner kernel: bt878: no version for "struct_module" 
found: kernel tainted.


I'm trying to build and test a patched copy of dst... (so I rebuilt
everything in the dvb/bt8xx/ directory).

-Philip


>
> Thanks,
> Manu
>
>------------------------------------------------------------------------
>
>diff -Naurp bt8xx.orig/dst.c bt8xx/dst.c
>--- bt8xx.orig/dst.c	2005-10-19 15:58:23.000000000 +0400
>+++ bt8xx/dst.c	2005-10-24 15:50:24.000000000 +0400
>@@ -42,28 +42,6 @@ MODULE_PARM_DESC(dst_addons, "CA daughte
> #define ATTEMPT_TUNE		2
> #define HAS_POWER		4
> 
>-#define DST_ERROR		0
>-#define DST_NOTICE		1
>-#define DST_INFO		2
>-#define DST_DEBUG		3
>-
>-#define dprintk(x, y, z, format, arg...) do {						\
>-	if (z) {									\
>-		if	((x > DST_ERROR) && (x > y))					\
>-			printk(KERN_ERR "%s: " format "\n", __FUNCTION__ , ##arg);	\
>-		else if	((x > DST_NOTICE) && (x > y))					\
>-			printk(KERN_NOTICE "%s: " format "\n", __FUNCTION__ , ##arg);	\
>-		else if ((x > DST_INFO) && (x > y))					\
>-			printk(KERN_INFO "%s: " format "\n", __FUNCTION__ , ##arg);	\
>-		else if ((x > DST_DEBUG) && (x > y))					\
>-			printk(KERN_DEBUG "%s: " format "\n", __FUNCTION__ , ##arg);	\
>-	} else {									\
>-		if (x > y)								\
>-			printk(format, ##arg);						\
>-	}										\
>-} while(0)
>-
>-
> static void dst_packsize(struct dst_state *state, int psize)
> {
> 	union dst_gpio_packet bits;
>@@ -72,7 +50,8 @@ static void dst_packsize(struct dst_stat
> 	bt878_device_control(state->bt, DST_IG_TS, &bits);
> }
> 
>-int dst_gpio_outb(struct dst_state *state, u32 mask, u32 enbb, u32 outhigh, int delay)
>+int dst_gpio_outb(struct dst_state *state, u32 mask,
>+		u32 enbb, u32 outhigh, int delay)
> {
> 	union dst_gpio_packet enb;
> 	union dst_gpio_packet bits;
>@@ -81,9 +60,13 @@ int dst_gpio_outb(struct dst_state *stat
> 	enb.enb.mask = mask;
> 	enb.enb.enable = enbb;
> 
>-	dprintk(verbose, DST_INFO, 1, "mask=[%04x], enbb=[%04x], outhigh=[%04x]", mask, enbb, outhigh);
>+	print(verbose, DST_INFO, 1, "mask=[%04x], enbb=[%04x], outhigh=[%04x]",
>+		mask, enbb, outhigh);
>+
> 	if ((err = bt878_device_control(state->bt, DST_IG_ENABLE, &enb)) < 0) {
>-		dprintk(verbose, DST_INFO, 1, "dst_gpio_enb error (err == %i, mask == %02x, enb == %02x)", err, mask, enbb);
>+		print(verbose, DST_INFO, 1, "err=%i, mask=%02x, enb=%02x",
>+			err, mask, enbb);
>+
> 		return -EREMOTEIO;
> 	}
> 	udelay(1000);
>@@ -95,7 +78,9 @@ int dst_gpio_outb(struct dst_state *stat
> 	bits.outp.mask = enbb;
> 	bits.outp.highvals = outhigh;
> 	if ((err = bt878_device_control(state->bt, DST_IG_WRITE, &bits)) < 0) {
>-		dprintk(verbose, DST_INFO, 1, "dst_gpio_outb error (err == %i, enbb == %02x, outhigh == %02x)", err, enbb, outhigh);
>+		print(verbose, DST_INFO, 1, "err=%i, enbb=%02x, outhigh=%02x",
>+			err, enbb, outhigh);
>+
> 		return -EREMOTEIO;
> 	}
> 
>@@ -109,8 +94,10 @@ int dst_gpio_inb(struct dst_state *state
> 	int err;
> 
> 	*result = 0;
>-	if ((err = bt878_device_control(state->bt, DST_IG_READ, &rd_packet)) < 0) {
>-		dprintk(verbose, DST_ERROR, 1, "dst_gpio_inb error (err == %i)\n", err);
>+	if ((err = bt878_device_control(state->bt, DST_IG_READ,
>+		&rd_packet)) < 0) {
>+
>+		print(verbose, DST_ERROR, 1, "err==%i", err);
> 		return -EREMOTEIO;
> 	}
> 	*result = (u8) rd_packet.rd.value;
>@@ -121,14 +108,16 @@ EXPORT_SYMBOL(dst_gpio_inb);
> 
> int rdc_reset_state(struct dst_state *state)
> {
>-	dprintk(verbose, DST_INFO, 1, "Resetting state machine");
>+	print(verbose, DST_INFO, 1, "Resetting state machine");
> 	if (dst_gpio_outb(state, RDC_8820_INT, RDC_8820_INT, 0, NO_DELAY) < 0) {
>-		dprintk(verbose, DST_ERROR, 1, "dst_gpio_outb ERROR !");
>+		print(verbose, DST_ERROR, 1, "dst_gpio_outb ERROR !");
> 		return -1;
> 	}
> 	msleep(10);
>-	if (dst_gpio_outb(state, RDC_8820_INT, RDC_8820_INT, RDC_8820_INT, NO_DELAY) < 0) {
>-		dprintk(verbose, DST_ERROR, 1, "dst_gpio_outb ERROR !");
>+	if (dst_gpio_outb(state, RDC_8820_INT, RDC_8820_INT,
>+		RDC_8820_INT, NO_DELAY) < 0) {
>+
>+		print(verbose, DST_ERROR, 1, "dst_gpio_outb ERROR !");
> 		msleep(10);
> 		return -1;
> 	}
>@@ -139,14 +128,18 @@ EXPORT_SYMBOL(rdc_reset_state);
> 
> int rdc_8820_reset(struct dst_state *state)
> {
>-	dprintk(verbose, DST_DEBUG, 1, "Resetting DST");
>-	if (dst_gpio_outb(state, RDC_8820_RESET, RDC_8820_RESET, 0, NO_DELAY) < 0) {
>-		dprintk(verbose, DST_ERROR, 1, "dst_gpio_outb ERROR !");
>+	print(verbose, DST_DEBUG, 1, "Resetting DST");
>+	if (dst_gpio_outb(state, RDC_8820_RESET, RDC_8820_RESET,
>+		0, NO_DELAY) < 0) {
>+
>+		print(verbose, DST_ERROR, 1, "dst_gpio_outb ERROR !");
> 		return -1;
> 	}
> 	udelay(1000);
>-	if (dst_gpio_outb(state, RDC_8820_RESET, RDC_8820_RESET, RDC_8820_RESET, DELAY) < 0) {
>-		dprintk(verbose, DST_ERROR, 1, "dst_gpio_outb ERROR !");
>+	if (dst_gpio_outb(state, RDC_8820_RESET, RDC_8820_RESET,
>+		RDC_8820_RESET, DELAY) < 0) {
>+
>+		print(verbose, DST_ERROR, 1, "dst_gpio_outb ERROR !");
> 		return -1;
> 	}
> 
>@@ -157,7 +150,7 @@ EXPORT_SYMBOL(rdc_8820_reset);
> int dst_pio_enable(struct dst_state *state)
> {
> 	if (dst_gpio_outb(state, ~0, RDC_8820_PIO_0_ENABLE, 0, NO_DELAY) < 0) {
>-		dprintk(verbose, DST_ERROR, 1, "dst_gpio_outb ERROR !");
>+		print(verbose, DST_ERROR, 1, "dst_gpio_outb ERROR !");
> 		return -1;
> 	}
> 	udelay(1000);
>@@ -168,8 +161,10 @@ EXPORT_SYMBOL(dst_pio_enable);
> 
> int dst_pio_disable(struct dst_state *state)
> {
>-	if (dst_gpio_outb(state, ~0, RDC_8820_PIO_0_DISABLE, RDC_8820_PIO_0_DISABLE, NO_DELAY) < 0) {
>-		dprintk(verbose, DST_ERROR, 1, "dst_gpio_outb ERROR !");
>+	if (dst_gpio_outb(state, ~0, RDC_8820_PIO_0_DISABLE,
>+		RDC_8820_PIO_0_DISABLE, NO_DELAY) < 0) {
>+
>+		print(verbose, DST_ERROR, 1, "dst_gpio_outb ERROR !");
> 		return -1;
> 	}
> 	if (state->type_flags & DST_TYPE_HAS_FW_1)
>@@ -186,16 +181,16 @@ int dst_wait_dst_ready(struct dst_state 
> 
> 	for (i = 0; i < 200; i++) {
> 		if (dst_gpio_inb(state, &reply) < 0) {
>-			dprintk(verbose, DST_ERROR, 1, "dst_gpio_inb ERROR !");
>+			print(verbose, DST_ERROR, 1, "dst_gpio_inb ERROR !");
> 			return -1;
> 		}
> 		if ((reply & RDC_8820_PIO_0_ENABLE) == 0) {
>-			dprintk(verbose, DST_INFO, 1, "dst wait ready after %d", i);
>+			print(verbose, DST_INFO, 1, "Ready after %d", i);
> 			return 1;
> 		}
> 		msleep(10);
> 	}
>-	dprintk(verbose, DST_NOTICE, 1, "dst wait NOT ready after %d", i);
>+	print(verbose, DST_NOTICE, 1, "NOT ready after %d", i);
> 
> 	return 0;
> }
>@@ -203,7 +198,7 @@ EXPORT_SYMBOL(dst_wait_dst_ready);
> 
> int dst_error_recovery(struct dst_state *state)
> {
>-	dprintk(verbose, DST_NOTICE, 1, "Trying to return from previous errors.");
>+	print(verbose, DST_NOTICE, 1, "Trying to return from previous errors.");
> 	dst_pio_disable(state);
> 	msleep(10);
> 	dst_pio_enable(state);
>@@ -215,7 +210,7 @@ EXPORT_SYMBOL(dst_error_recovery);
> 
> int dst_error_bailout(struct dst_state *state)
> {
>-	dprintk(verbose, DST_INFO, 1, "Trying to bailout from previous error.");
>+	print(verbose, DST_INFO, 1, "Trying to bailout from previous error.");
> 	rdc_8820_reset(state);
> 	dst_pio_disable(state);
> 	msleep(10);
>@@ -226,13 +221,13 @@ EXPORT_SYMBOL(dst_error_bailout);
> 
> int dst_comm_init(struct dst_state *state)
> {
>-	dprintk(verbose, DST_INFO, 1, "Initializing DST.");
>+	print(verbose, DST_INFO, 1, "Initializing DST.");
> 	if ((dst_pio_enable(state)) < 0) {
>-		dprintk(verbose, DST_ERROR, 1, "PIO Enable Failed");
>+		print(verbose, DST_ERROR, 1, "PIO Enable Failed");
> 		return -1;
> 	}
> 	if ((rdc_reset_state(state)) < 0) {
>-		dprintk(verbose, DST_ERROR, 1, "RDC 8820 State RESET Failed.");
>+		print(verbose, DST_ERROR, 1, "RDC 8820 State RESET Failed.");
> 		return -1;
> 	}
> 	if (state->type_flags & DST_TYPE_HAS_FW_1)
>@@ -256,21 +251,23 @@ int write_dst(struct dst_state *state, u
> 	int err;
> 	u8 cnt, i;
> 
>-	dprintk(verbose, DST_NOTICE, 0, "writing [ ");
>+	print(verbose, DST_NOTICE, 0, "writing [ ");
> 	for (i = 0; i < len; i++)
>-		dprintk(verbose, DST_NOTICE, 0, "%02x ", data[i]);
>-	dprintk(verbose, DST_NOTICE, 0, "]\n");
>+		print(verbose, DST_NOTICE, 0, "%02x ", data[i]);
>+	print(verbose, DST_NOTICE, 0, "]\n");
> 
> 	for (cnt = 0; cnt < 2; cnt++) {
> 		if ((err = i2c_transfer(state->i2c, &msg, 1)) < 0) {
>-			dprintk(verbose, DST_INFO, 1, "_write_dst error (err == %i, len == 0x%02x, b0 == 0x%02x)", err, len, data[0]);
>+			print(verbose, DST_INFO, 1, "err=%i, len=%02x, b0=%02x",
>+				err, len, data[0]);
>+
> 			dst_error_recovery(state);
> 			continue;
> 		} else
> 			break;
> 	}
> 	if (cnt >= 2) {
>-		dprintk(verbose, DST_INFO, 1, "RDC 8820 RESET");
>+		print(verbose, DST_INFO, 1, "RDC 8820 RESET");
> 		dst_error_bailout(state);
> 
> 		return -1;
>@@ -294,23 +291,25 @@ int read_dst(struct dst_state *state, u8
> 
> 	for (cnt = 0; cnt < 2; cnt++) {
> 		if ((err = i2c_transfer(state->i2c, &msg, 1)) < 0) {
>-			dprintk(verbose, DST_INFO, 1, "read_dst error (err == %i, len == 0x%02x, b0 == 0x%02x)", err, len, ret[0]);
>+			print(verbose, DST_INFO, 1, "err=%i, len=%02x, b0=%02x",
>+				err, len, ret[0]);
>+
> 			dst_error_recovery(state);
> 			continue;
> 		} else
> 			break;
> 	}
> 	if (cnt >= 2) {
>-		dprintk(verbose, DST_INFO, 1, "RDC 8820 RESET");
>+		print(verbose, DST_INFO, 1, "RDC 8820 RESET");
> 		dst_error_bailout(state);
> 
> 		return -1;
> 	}
>-	dprintk(verbose, DST_DEBUG, 1, "reply is 0x%x", ret[0]);
>+	print(verbose, DST_DEBUG, 1, "reply is 0x%x", ret[0]);
> 	for (err = 1; err < len; err++)
>-		dprintk(verbose, DST_DEBUG, 0, " 0x%x", ret[err]);
>+		print(verbose, DST_DEBUG, 0, " 0x%x", ret[err]);
> 	if (err > 1)
>-		dprintk(verbose, DST_DEBUG, 0, "\n");
>+		print(verbose, DST_DEBUG, 0, "\n");
> 
> 	return 0;
> }
>@@ -320,11 +319,11 @@ static int dst_set_polarization(struct d
> {
> 	switch (state->voltage) {
> 	case SEC_VOLTAGE_13:	/*	Vertical	*/
>-		dprintk(verbose, DST_INFO, 1, "Polarization=[Vertical]");
>+		print(verbose, DST_INFO, 1, "Polarization=[Vertical]");
> 		state->tx_tuna[8] &= ~0x40;
> 		break;
> 	case SEC_VOLTAGE_18:	/*	Horizontal	*/
>-		dprintk(verbose, DST_INFO, 1, "Polarization=[Horizontal]");
>+		print(verbose, DST_INFO, 1, "Polarization=[Horizontal]");
> 		state->tx_tuna[8] |= 0x40;
> 		break;
> 	case SEC_VOLTAGE_OFF:
>@@ -337,7 +336,7 @@ static int dst_set_polarization(struct d
> static int dst_set_freq(struct dst_state *state, u32 freq)
> {
> 	state->frequency = freq;
>-	dprintk(verbose, DST_INFO, 1, "set Frequency %u", freq);
>+	print(verbose, DST_INFO, 1, "set Frequency %u", freq);
> 
> 	if (state->dst_type == DST_TYPE_IS_SAT) {
> 		freq = freq / 1000;
>@@ -408,7 +407,8 @@ static int dst_set_bandwidth(struct dst_
> 	return 0;
> }
> 
>-static int dst_set_inversion(struct dst_state *state, fe_spectral_inversion_t inversion)
>+static int dst_set_inversion(struct dst_state *state,
>+			fe_spectral_inversion_t inversion)
> {
> 	state->inversion = inversion;
> 	switch (inversion) {
>@@ -445,14 +445,14 @@ static int dst_set_symbolrate(struct dst
> 	if (state->dst_type == DST_TYPE_IS_TERR) {
> 		return 0;
> 	}
>-	dprintk(verbose, DST_INFO, 1, "set symrate %u", srate);
>+	print(verbose, DST_INFO, 1, "set symrate %u", srate);
> 	srate /= 1000;
> 	if (state->type_flags & DST_TYPE_HAS_SYMDIV) {
> 		sval = srate;
> 		sval <<= 20;
> 		do_div(sval, 88000);
> 		symcalc = (u32) sval;
>-		dprintk(verbose, DST_INFO, 1, "set symcalc %u", symcalc);
>+		print(verbose, DST_INFO, 1, "set symcalc %u", symcalc);
> 		state->tx_tuna[5] = (u8) (symcalc >> 12);
> 		state->tx_tuna[6] = (u8) (symcalc >> 4);
> 		state->tx_tuna[7] = (u8) (symcalc << 4);
>@@ -470,7 +470,8 @@ static int dst_set_symbolrate(struct dst
> }
> 
> 
>-static int dst_set_modulation(struct dst_state *state, fe_modulation_t modulation)
>+static int dst_set_modulation(struct dst_state *state,
>+			fe_modulation_t modulation)
> {
> 	if (state->dst_type != DST_TYPE_IS_CABLE)
> 		return 0;
>@@ -525,20 +526,31 @@ EXPORT_SYMBOL(dst_check_sum);
> 
> static void dst_type_flags_print(u32 type_flags)
> {
>-	dprintk(verbose, DST_ERROR, 0, "DST type flags :");
>+	print(verbose, DST_ERROR, 0, "DST type flags :");
> 	if (type_flags & DST_TYPE_HAS_NEWTUNE)
>-		dprintk(verbose, DST_ERROR, 0, " 0x%x newtuner", DST_TYPE_HAS_NEWTUNE);
>+		print(verbose, DST_ERROR, 0, " 0x%x newtuner",
>+			DST_TYPE_HAS_NEWTUNE);
>+
> 	if (type_flags & DST_TYPE_HAS_TS204)
>-		dprintk(verbose, DST_ERROR, 0, " 0x%x ts204", DST_TYPE_HAS_TS204);
>+		print(verbose, DST_ERROR, 0, " 0x%x ts204",
>+			DST_TYPE_HAS_TS204);
>+
> 	if (type_flags & DST_TYPE_HAS_SYMDIV)
>-		dprintk(verbose, DST_ERROR, 0, " 0x%x symdiv", DST_TYPE_HAS_SYMDIV);
>+		print(verbose, DST_ERROR, 0, " 0x%x symdiv",
>+			DST_TYPE_HAS_SYMDIV);
>+
> 	if (type_flags & DST_TYPE_HAS_FW_1)
>-		dprintk(verbose, DST_ERROR, 0, " 0x%x firmware version = 1", DST_TYPE_HAS_FW_1);
>+		print(verbose, DST_ERROR, 0, " 0x%x firmware version = 1",
>+			DST_TYPE_HAS_FW_1);
>+
> 	if (type_flags & DST_TYPE_HAS_FW_2)
>-		dprintk(verbose, DST_ERROR, 0, " 0x%x firmware version = 2", DST_TYPE_HAS_FW_2);
>+		print(verbose, DST_ERROR, 0, " 0x%x firmware version = 2",
>+			DST_TYPE_HAS_FW_2);
>+
> 	if (type_flags & DST_TYPE_HAS_FW_3)
>-		dprintk(verbose, DST_ERROR, 0, " 0x%x firmware version = 3", DST_TYPE_HAS_FW_3);
>-	dprintk(verbose, DST_ERROR, 0, "\n");
>+		print(verbose, DST_ERROR, 0, " 0x%x firmware version = 3",
>+			DST_TYPE_HAS_FW_3);
>+	print(verbose, DST_ERROR, 0, "\n");
> }
> 
> 
>@@ -559,10 +571,10 @@ static int dst_type_print(u8 type)
> 		break;
> 
> 	default:
>-		dprintk(verbose, DST_INFO, 1, "invalid dst type %d", type);
>+		print(verbose, DST_INFO, 1, "invalid dst type %d", type);
> 		return -EINVAL;
> 	}
>-	dprintk(verbose, DST_INFO, 1, "DST type: %s", otype);
>+	print(verbose, DST_INFO, 1, "DST type: %s", otype);
> 
> 	return 0;
> }
>@@ -607,7 +619,9 @@ struct dst_types dst_tlist[] = {
> 		.device_id = "200103A",
> 		.offset = 0,
> 		.dst_type =  DST_TYPE_IS_SAT,
>-		.type_flags = DST_TYPE_HAS_SYMDIV | DST_TYPE_HAS_FW_1 | DST_TYPE_HAS_OBS_REGS,
>+		.type_flags = DST_TYPE_HAS_SYMDIV | DST_TYPE_HAS_FW_1 |
>+			      DST_TYPE_HAS_OBS_REGS,
>+
> 		.dst_feature = 0
> 	},	/*	obsolete	*/
> 
>@@ -623,7 +637,8 @@ struct dst_types dst_tlist[] = {
> 		.device_id = "DST-030",
> 		.offset =  0,
> 		.dst_type = DST_TYPE_IS_SAT,
>-		.type_flags = DST_TYPE_HAS_TS204 | DST_TYPE_HAS_NEWTUNE | DST_TYPE_HAS_FW_1,
>+		.type_flags = DST_TYPE_HAS_TS204 | DST_TYPE_HAS_NEWTUNE
>+						 | DST_TYPE_HAS_FW_1,
> 		.dst_feature = 0
> 	},	/*	obsolete	*/
> 
>@@ -631,9 +646,12 @@ struct dst_types dst_tlist[] = {
> 		.device_id = "DST-03T",
> 		.offset = 0,
> 		.dst_type = DST_TYPE_IS_SAT,
>-		.type_flags = DST_TYPE_HAS_SYMDIV | DST_TYPE_HAS_TS204 | DST_TYPE_HAS_FW_2,
>-		.dst_feature = DST_TYPE_HAS_DISEQC3 | DST_TYPE_HAS_DISEQC4 | DST_TYPE_HAS_DISEQC5
>-							 | DST_TYPE_HAS_MAC | DST_TYPE_HAS_MOTO
>+		.type_flags = DST_TYPE_HAS_SYMDIV | DST_TYPE_HAS_TS204
>+						  | DST_TYPE_HAS_FW_2,
>+
>+		.dst_feature = DST_TYPE_HAS_DISEQC3 | DST_TYPE_HAS_DISEQC4 |
>+			       DST_TYPE_HAS_DISEQC5 | DST_TYPE_HAS_MAC	   |
>+			       DST_TYPE_HAS_MOTO
> 	 },
> 
> 	{
>@@ -648,7 +666,9 @@ struct dst_types dst_tlist[] = {
> 		.device_id = "DST-CI",
> 		.offset = 1,
> 		.dst_type = DST_TYPE_IS_SAT,
>-		.type_flags = DST_TYPE_HAS_TS204 | DST_TYPE_HAS_NEWTUNE | DST_TYPE_HAS_FW_1,
>+		.type_flags = DST_TYPE_HAS_TS204 | DST_TYPE_HAS_NEWTUNE |
>+			      DST_TYPE_HAS_FW_1,
>+
> 		.dst_feature = DST_TYPE_HAS_CA
> 	},	/*	An OEM board	*/
> 
>@@ -656,9 +676,12 @@ struct dst_types dst_tlist[] = {
> 		.device_id = "DSTMCI",
> 		.offset = 1,
> 		.dst_type = DST_TYPE_IS_SAT,
>-		.type_flags = DST_TYPE_HAS_NEWTUNE | DST_TYPE_HAS_FW_2 | DST_TYPE_HAS_FW_BUILD | DST_TYPE_HAS_INC_COUNT,
>-		.dst_feature = DST_TYPE_HAS_CA | DST_TYPE_HAS_DISEQC3 | DST_TYPE_HAS_DISEQC4
>-							| DST_TYPE_HAS_MOTO | DST_TYPE_HAS_MAC
>+		.type_flags = DST_TYPE_HAS_NEWTUNE  | DST_TYPE_HAS_FW_2 |
>+			      DST_TYPE_HAS_FW_BUILD | DST_TYPE_HAS_INC_COUNT,
>+
>+		.dst_feature = DST_TYPE_HAS_CA		| DST_TYPE_HAS_DISEQC3 |
>+			       DST_TYPE_HAS_DISEQC4     | DST_TYPE_HAS_MOTO    |
>+			       DST_TYPE_HAS_MAC
> 	},
> 
> 	{
>@@ -673,8 +696,9 @@ struct dst_types dst_tlist[] = {
> 		.device_id = "DCT-CI",
> 		.offset = 1,
> 		.dst_type = DST_TYPE_IS_CABLE,
>-		.type_flags = DST_TYPE_HAS_TS204 | DST_TYPE_HAS_NEWTUNE | DST_TYPE_HAS_FW_1
>-							| DST_TYPE_HAS_FW_2,
>+		.type_flags = DST_TYPE_HAS_TS204 | DST_TYPE_HAS_NEWTUNE |
>+			      DST_TYPE_HAS_FW_1	 | DST_TYPE_HAS_FW_2,
>+
> 		.dst_feature = DST_TYPE_HAS_CA
> 	},
> 
>@@ -682,7 +706,9 @@ struct dst_types dst_tlist[] = {
> 		.device_id = "DCTNEW",
> 		.offset = 1,
> 		.dst_type = DST_TYPE_IS_CABLE,
>-		.type_flags = DST_TYPE_HAS_NEWTUNE | DST_TYPE_HAS_FW_3 | DST_TYPE_HAS_FW_BUILD,
>+		.type_flags = DST_TYPE_HAS_NEWTUNE | DST_TYPE_HAS_FW_3 |
>+			      DST_TYPE_HAS_FW_BUILD,
>+
> 		.dst_feature = 0
> 	},
> 
>@@ -690,7 +716,9 @@ struct dst_types dst_tlist[] = {
> 		.device_id = "DTT-CI",
> 		.offset = 1,
> 		.dst_type = DST_TYPE_IS_TERR,
>-		.type_flags = DST_TYPE_HAS_TS204 | DST_TYPE_HAS_NEWTUNE | DST_TYPE_HAS_FW_2 | DST_TYPE_HAS_MULTI_FE,
>+		.type_flags = DST_TYPE_HAS_TS204 | DST_TYPE_HAS_NEWTUNE |
>+			      DST_TYPE_HAS_FW_2 | DST_TYPE_HAS_MULTI_FE,
>+
> 		.dst_feature = DST_TYPE_HAS_CA
> 	},
> 
>@@ -735,12 +763,13 @@ static int dst_get_mac(struct dst_state 
> 	u8 get_mac[] = { 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
> 	get_mac[7] = dst_check_sum(get_mac, 7);
> 	if (dst_command(state, get_mac, 8) < 0) {
>-		dprintk(verbose, DST_INFO, 1, "Unsupported Command");
>+		print(verbose, DST_INFO, 1, "Unsupported Command");
> 		return -1;
> 	}
> 	memset(&state->mac_address, '\0', 8);
> 	memcpy(&state->mac_address, &state->rxbuffer, 6);
>-	dprintk(verbose, DST_ERROR, 1, "MAC Address=[%02x:%02x:%02x:%02x:%02x:%02x]",
>+	print(verbose, DST_ERROR, 1, "%s=[%02x:%02x:%02x:%02x:%02x:%02x]",
>+		"MAC Address",
> 		state->mac_address[0], state->mac_address[1], state->mac_address[2],
> 		state->mac_address[4], state->mac_address[5], state->mac_address[6]);
> 
>@@ -752,12 +781,13 @@ static int dst_fw_ver(struct dst_state *
> 	u8 get_ver[] = { 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
> 	get_ver[7] = dst_check_sum(get_ver, 7);
> 	if (dst_command(state, get_ver, 8) < 0) {
>-		dprintk(verbose, DST_INFO, 1, "Unsupported Command");
>+		print(verbose, DST_INFO, 1, "Unsupported Command");
> 		return -1;
> 	}
> 	memset(&state->fw_version, '\0', 8);
> 	memcpy(&state->fw_version, &state->rxbuffer, 8);
>-	dprintk(verbose, DST_ERROR, 1, "Firmware Ver = %x.%x Build = %02x, on %x:%x, %x-%x-20%02x",
>+	print(verbose, DST_ERROR, 1, "%s=%x.%x Build=%02x, on %x:%x, %x-%x-20%02x",
>+		"Firmware Version",
> 		state->fw_version[0] >> 4, state->fw_version[0] & 0x0f,
> 		state->fw_version[1],
> 		state->fw_version[5], state->fw_version[6],
>@@ -771,12 +801,12 @@ static int dst_card_type(struct dst_stat
> 	u8 get_type[] = { 0x00, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
> 	get_type[7] = dst_check_sum(get_type, 7);
> 	if (dst_command(state, get_type, 8) < 0) {
>-		dprintk(verbose, DST_INFO, 1, "Unsupported Command");
>+		print(verbose, DST_INFO, 1, "Unsupported Command");
> 		return -1;
> 	}
> 	memset(&state->card_info, '\0', 8);
> 	memcpy(&state->card_info, &state->rxbuffer, 8);
>-	dprintk(verbose, DST_ERROR, 1, "Device Model=[%s]", &state->card_info[0]);
>+	print(verbose, DST_ERROR, 1, "Device Model=[%s]", &state->card_info[0]);
> 
> 	return 0;
> }
>@@ -786,12 +816,12 @@ static int dst_get_vendor(struct dst_sta
> 	u8 get_vendor[] = { 0x00, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
> 	get_vendor[7] = dst_check_sum(get_vendor, 7);
> 	if (dst_command(state, get_vendor, 8) < 0) {
>-		dprintk(verbose, DST_INFO, 1, "Unsupported Command");
>+		print(verbose, DST_INFO, 1, "Unsupported Command");
> 		return -1;
> 	}
> 	memset(&state->vendor, '\0', 8);
> 	memcpy(&state->vendor, &state->rxbuffer, 8);
>-	dprintk(verbose, DST_ERROR, 1, "Vendor=[%s]", &state->vendor[0]);
>+	print(verbose, DST_ERROR, 1, "Vendor=[%s]", &state->vendor[0]);
> 
> 	return 0;
> }
>@@ -805,12 +835,12 @@ static int dst_get_tuner_info(struct dst
> 	get_tuner_2[7] = dst_check_sum(get_tuner_2, 7);
> 	if (state->type_flags & DST_TYPE_HAS_MULTI_FE) {
> 		if (dst_command(state, get_tuner_2, 8) < 0) {
>-			dprintk(verbose, DST_INFO, 1, "Unsupported Command");
>+			print(verbose, DST_INFO, 1, "Unsupported Command");
> 			return -1;
> 		}
> 	} else {
> 		if (dst_command(state, get_tuner_1, 8) < 0) {
>-			dprintk(verbose, DST_INFO, 1, "Unsupported Command");
>+			print(verbose, DST_INFO, 1, "Unsupported Command");
> 			return -1;
> 		}
> 	}
>@@ -821,25 +851,27 @@ static int dst_get_tuner_info(struct dst
> 			if (state->type_flags & DST_TYPE_HAS_TS204)
> 				state->type_flags &= ~DST_TYPE_HAS_TS204;
> 			state->type_flags |= DST_TYPE_HAS_NEWTUNE;
>-			dprintk(verbose, DST_INFO, 1, "DST type has TS=188");
>+			print(verbose, DST_INFO, 1, "DST type has TS=188");
> 		} else {
> 			if (state->type_flags & DST_TYPE_HAS_NEWTUNE)
> 				state->type_flags &= ~DST_TYPE_HAS_NEWTUNE;
> 			state->type_flags |= DST_TYPE_HAS_TS204;
>-			dprintk(verbose, DST_INFO, 1, "DST type has TS=204");
>+			print(verbose, DST_INFO, 1, "DST type has TS=204");
> 		}
> 	} else {
> 		if (state->board_info[0] == 0xbc) {
> 			if (state->type_flags & DST_TYPE_HAS_TS204)
> 				state->type_flags &= ~DST_TYPE_HAS_TS204;
> 			state->type_flags |= DST_TYPE_HAS_NEWTUNE;
>-			dprintk(verbose, DST_INFO, 1, "DST type has TS=188, Daughterboard=[%d]", state->board_info[1]);
>+			print(verbose, DST_INFO, 1, "%s Daughterboard=[%d]",
>+				"DST type has TS=188",state->board_info[1]);
> 
> 		} else if (state->board_info[0] == 0xcc) {
> 			if (state->type_flags & DST_TYPE_HAS_NEWTUNE)
> 				state->type_flags &= ~DST_TYPE_HAS_NEWTUNE;
> 			state->type_flags |= DST_TYPE_HAS_TS204;
>-			dprintk(verbose, DST_INFO, 1, "DST type has TS=204 Daughterboard=[%d]", state->board_info[1]);
>+			print(verbose, DST_INFO, 1, "%s Daughterboard=[%d]",
>+				"DST type has TS=204",state->board_info[1]);
> 		}
> 	}
> 
>@@ -866,7 +898,8 @@ static int dst_get_device_id(struct dst_
> 	if (read_dst(state, &reply, GET_ACK))
> 		return -1;		/*	Read failure		*/
> 	if (reply != ACK) {
>-		dprintk(verbose, DST_INFO, 1, "Write not Acknowledged! [Reply=0x%02x]", reply);
>+		print(verbose, DST_INFO, 1, "%s [Reply=0x%02x]",
>+			"Write not Acknowledged!", reply);
> 		return -1;		/*	Unack'd write		*/
> 	}
> 	if (!dst_wait_dst_ready(state, DEVICE_INIT))
>@@ -876,27 +909,36 @@ static int dst_get_device_id(struct dst_
> 
> 	dst_pio_disable(state);
> 	if (state->rxbuffer[7] != dst_check_sum(state->rxbuffer, 7)) {
>-		dprintk(verbose, DST_INFO, 1, "Checksum failure!");
>+		print(verbose, DST_INFO, 1, "Checksum failure!");
> 		return -1;		/*	Checksum failure	*/
> 	}
> 	state->rxbuffer[7] = '\0';
> 
>-	for (i = 0, p_dst_type = dst_tlist; i < ARRAY_SIZE(dst_tlist); i++, p_dst_type++) {
>-		if (!strncmp (&state->rxbuffer[p_dst_type->offset], p_dst_type->device_id, strlen (p_dst_type->device_id))) {
>+	for (i = 0, p_dst_type = dst_tlist; i < ARRAY_SIZE(dst_tlist);
>+		i++, p_dst_type++) {
>+
>+		if (!strncmp (&state->rxbuffer[p_dst_type->offset],
>+			p_dst_type->device_id, strlen (p_dst_type->device_id))) {
>+
> 			use_type_flags = p_dst_type->type_flags;
> 			use_dst_type = p_dst_type->dst_type;
> 
> 			/*	Card capabilities	*/
> 			state->dst_hw_cap = p_dst_type->dst_feature;
>-			dprintk(verbose, DST_ERROR, 1, "Recognise [%s]\n", p_dst_type->device_id);
>+			print(verbose, DST_ERROR, 1, "Recognise [%s]\n",
>+				p_dst_type->device_id);
> 
> 			break;
> 		}
> 	}
> 
> 	if (i >= sizeof (dst_tlist) / sizeof (dst_tlist [0])) {
>-		dprintk(verbose, DST_ERROR, 1, "Unable to recognize %s or %s", &state->rxbuffer[0], &state->rxbuffer[1]);
>-		dprintk(verbose, DST_ERROR, 1, "please email linux-dvb at linuxtv.org with this type in");
>+		print(verbose, DST_ERROR, 1, "Unable to recognize %s or %s",
>+			&state->rxbuffer[0], &state->rxbuffer[1]);
>+
>+		print(verbose, DST_ERROR, 1, "email linux-dvb at linuxtv.org %s",
>+			"with this type in");
>+
> 		use_dst_type = DST_TYPE_IS_SAT;
> 		use_type_flags = DST_TYPE_HAS_SYMDIV;
> 	}
>@@ -912,7 +954,9 @@ static int dst_probe(struct dst_state *s
> {
> 	sema_init(&state->dst_mutex, 1);
> 	if ((rdc_8820_reset(state)) < 0) {
>-		dprintk(verbose, DST_ERROR, 1, "RDC 8820 RESET Failed.");
>+		print(verbose, DST_ERROR, 1,
>+			"RDC 8820 RESET Failed.");
>+
> 		return -1;
> 	}
> 	if (dst_addons & DST_TYPE_HAS_CA)
>@@ -921,36 +965,48 @@ static int dst_probe(struct dst_state *s
> 		msleep(100);
> 
> 	if ((dst_comm_init(state)) < 0) {
>-		dprintk(verbose, DST_ERROR, 1, "DST Initialization Failed.");
>+		print(verbose, DST_ERROR, 1,
>+			"DST Initialization Failed.");
>+
> 		return -1;
> 	}
> 	msleep(100);
> 	if (dst_get_device_id(state) < 0) {
>-		dprintk(verbose, DST_ERROR, 1, "unknown device.");
>+		print(verbose, DST_ERROR, 1,
>+			"unknown device.");
> 		return -1;
> 	}
> 	if (dst_get_mac(state) < 0) {
>-		dprintk(verbose, DST_INFO, 1, "MAC: Unsupported command");
>+		print(verbose, DST_INFO, 1,
>+			"MAC: Unsupported command");
> 		return 0;
> 	}
>-	if ((state->type_flags & DST_TYPE_HAS_MULTI_FE) || (state->type_flags & DST_TYPE_HAS_FW_BUILD)) {
>+	if ((state->type_flags & DST_TYPE_HAS_MULTI_FE) ||
>+		(state->type_flags & DST_TYPE_HAS_FW_BUILD)) {
>+
> 		if (dst_get_tuner_info(state) < 0)
>-			dprintk(verbose, DST_INFO, 1, "Tuner: Unsupported command");
>+			print(verbose, DST_INFO, 1,
>+				"Tuner: Unsupported command");
> 	}
> 	if (state->type_flags & DST_TYPE_HAS_TS204) {
> 		dst_packsize(state, 204);
> 	}
> 	if (state->type_flags & DST_TYPE_HAS_FW_BUILD) {
> 		if (dst_fw_ver(state) < 0) {
>-			dprintk(verbose, DST_INFO, 1, "FW: Unsupported command");
>+			print(verbose, DST_INFO, 1,
>+				"F/W: Unsupported command");
> 			return 0;
> 		}
> 		if (dst_card_type(state) < 0) {
>-			dprintk(verbose, DST_INFO, 1, "Card: Unsupported command");
>+			print(verbose, DST_INFO, 1,
>+				"Card: Unsupported command");
>+
> 			return 0;
> 		}
> 		if (dst_get_vendor(state) < 0) {
>-			dprintk(verbose, DST_INFO, 1, "Vendor: Unsupported command");
>+			print(verbose, DST_INFO, 1,
>+				"Vendor: Unsupported command");
>+
> 			return 0;
> 		}
> 	}
>@@ -964,33 +1020,36 @@ int dst_command(struct dst_state *state,
> 
> 	down(&state->dst_mutex);
> 	if ((dst_comm_init(state)) < 0) {
>-		dprintk(verbose, DST_NOTICE, 1, "DST Communication Initialization Failed.");
>+		print(verbose, DST_NOTICE, 1,
>+			"DST Communication Initialization Failed.");
> 		goto error;
> 	}
> 	if (write_dst(state, data, len)) {
>-		dprintk(verbose, DST_INFO, 1, "Tring to recover.. ");
>+		print(verbose, DST_INFO, 1, "Tring to recover.. ");
> 		if ((dst_error_recovery(state)) < 0) {
>-			dprintk(verbose, DST_ERROR, 1, "Recovery Failed.");
>+			print(verbose, DST_ERROR, 1, "Recovery Failed.");
> 			goto error;
> 		}
> 		goto error;
> 	}
> 	if ((dst_pio_disable(state)) < 0) {
>-		dprintk(verbose, DST_ERROR, 1, "PIO Disable Failed.");
>+		print(verbose, DST_ERROR, 1, "PIO Disable Failed.");
> 		goto error;
> 	}
> 	if (state->type_flags & DST_TYPE_HAS_FW_1)
> 		udelay(3000);
> 	if (read_dst(state, &reply, GET_ACK)) {
>-		dprintk(verbose, DST_DEBUG, 1, "Trying to recover.. ");
>+		print(verbose, DST_DEBUG, 1, "Trying to recover.. ");
> 		if ((dst_error_recovery(state)) < 0) {
>-			dprintk(verbose, DST_INFO, 1, "Recovery Failed.");
>+			print(verbose, DST_INFO, 1, "Recovery Failed.");
> 			goto error;
> 		}
> 		goto error;
> 	}
> 	if (reply != ACK) {
>-		dprintk(verbose, DST_INFO, 1, "write not acknowledged 0x%02x ", reply);
>+		print(verbose, DST_INFO, 1, "%s 0x%02x ",
>+			"write not acknowledged", reply);
>+
> 		goto error;
> 	}
> 	if (len >= 2 && data[0] == 0 && (data[1] == 1 || data[1] == 3))
>@@ -1002,15 +1061,15 @@ int dst_command(struct dst_state *state,
> 	if (!dst_wait_dst_ready(state, NO_DELAY))
> 		goto error;
> 	if (read_dst(state, state->rxbuffer, FIXED_COMM)) {
>-		dprintk(verbose, DST_DEBUG, 1, "Trying to recover.. ");
>+		print(verbose, DST_DEBUG, 1, "Trying to recover.. ");
> 		if ((dst_error_recovery(state)) < 0) {
>-			dprintk(verbose, DST_INFO, 1, "Recovery failed.");
>+			print(verbose, DST_INFO, 1, "Recovery failed.");
> 			goto error;
> 		}
> 		goto error;
> 	}
> 	if (state->rxbuffer[7] != dst_check_sum(state->rxbuffer, 7)) {
>-		dprintk(verbose, DST_INFO, 1, "checksum failure");
>+		print(verbose, DST_INFO, 1, "checksum failure");
> 		goto error;
> 	}
> 	up(&state->dst_mutex);
>@@ -1027,13 +1086,17 @@ static int dst_get_signal(struct dst_sta
> {
> 	int retval;
> 	u8 get_signal[] = { 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfb };
>-	//dprintk("%s: Getting Signal strength and other parameters\n", __FUNCTION__);
>+	//print("%s: Getting Signal strength and other parameters\n", __FUNCTION__);
> 	if ((state->diseq_flags & ATTEMPT_TUNE) == 0) {
>-		state->decode_lock = state->decode_strength = state->decode_snr = 0;
>+		state->decode_lock = state->decode_strength = 0;
>+		state->decode_snr = 0;
>+
> 		return 0;
> 	}
> 	if (0 == (state->diseq_flags & HAS_LOCK)) {
>-		state->decode_lock = state->decode_strength = state->decode_snr = 0;
>+		state->decode_lock = state->decode_strength = 0;
>+		state->decode_snr = 0;
>+
> 		return 0;
> 	}
> 	if (time_after_eq(jiffies, state->cur_jiff + (HZ / 5))) {
>@@ -1044,7 +1107,9 @@ static int dst_get_signal(struct dst_sta
> 			state->decode_lock = ((state->rxbuffer[6] & 0x10) == 0) ? 1 : 0;
> 			state->decode_strength = state->rxbuffer[5] << 8;
> 			state->decode_snr = state->rxbuffer[2] << 8 | state->rxbuffer[3];
>-		} else if ((state->dst_type == DST_TYPE_IS_TERR) || (state->dst_type == DST_TYPE_IS_CABLE)) {
>+		} else if ((state->dst_type == DST_TYPE_IS_TERR) ||
>+			(state->dst_type == DST_TYPE_IS_CABLE)) {
>+
> 			state->decode_lock = (state->rxbuffer[1]) ? 1 : 0;
> 			state->decode_strength = state->rxbuffer[4] << 8;
> 			state->decode_snr = state->rxbuffer[3] << 8;
>@@ -1084,26 +1149,28 @@ static int dst_get_tuna(struct dst_state
> 	else
> 		retval = read_dst(state, &state->rx_tuna[2], FIXED_COMM);
> 	if (retval < 0) {
>-		dprintk(verbose, DST_DEBUG, 1, "read not successful");
>+		print(verbose, DST_DEBUG, 1, "read not successful");
> 		return retval;
> 	}
> 	if (state->type_flags & DST_TYPE_HAS_NEWTUNE) {
> 		if (state->rx_tuna[9] != dst_check_sum(&state->rx_tuna[0], 9)) {
>-			dprintk(verbose, DST_INFO, 1, "checksum failure ? ");
>+			print(verbose, DST_INFO, 1, "checksum failure ? ");
> 			return -EIO;
> 		}
> 	} else {
> 		if (state->rx_tuna[9] != dst_check_sum(&state->rx_tuna[2], 7)) {
>-			dprintk(verbose, DST_INFO, 1, "checksum failure? ");
>+			print(verbose, DST_INFO, 1, "checksum failure? ");
> 			return -EIO;
> 		}
> 	}
> 	if (state->rx_tuna[2] == 0 && state->rx_tuna[3] == 0)
> 		return 0;
> 	if (state->dst_type == DST_TYPE_IS_SAT) {
>-		state->decode_freq = ((state->rx_tuna[2] & 0x7f) << 8) + state->rx_tuna[3];
>+		state->decode_freq = ((state->rx_tuna[2] & 0x7f) << 8)
>+			+ state->rx_tuna[3];
> 	} else {
>-		state->decode_freq = ((state->rx_tuna[2] & 0x7f) << 16) + (state->rx_tuna[3] << 8) + state->rx_tuna[4];
>+		state->decode_freq = ((state->rx_tuna[2] & 0x7f) << 16)
>+			+ (state->rx_tuna[3] << 8) + state->rx_tuna[4];
> 	}
> 	state->decode_freq = state->decode_freq * 1000;
> 	state->decode_lock = 1;
>@@ -1120,7 +1187,7 @@ static int dst_write_tuna(struct dvb_fro
> 	int retval;
> 	u8 reply;
> 
>-	dprintk(verbose, DST_INFO, 1, "type_flags 0x%x ", state->type_flags);
>+	print(verbose, DST_INFO, 1, "type_flags 0x%x ", state->type_flags);
> 	state->decode_freq = 0;
> 	state->decode_lock = state->decode_strength = state->decode_snr = 0;
> 	if (state->dst_type == DST_TYPE_IS_SAT) {
>@@ -1130,7 +1197,8 @@ static int dst_write_tuna(struct dvb_fro
> 	state->diseq_flags &= ~(HAS_LOCK | ATTEMPT_TUNE);
> 	down(&state->dst_mutex);
> 	if ((dst_comm_init(state)) < 0) {
>-		dprintk(verbose, DST_DEBUG, 1, "DST Communication initialization failed.");
>+		print(verbose, DST_DEBUG, 1, "DST Communication %s",
>+			"initialization failed.");
> 		goto error;
> 	}
> 	if (state->type_flags & DST_TYPE_HAS_NEWTUNE) {
>@@ -1142,19 +1210,21 @@ static int dst_write_tuna(struct dvb_fro
> 	}
> 	if (retval < 0) {
> 		dst_pio_disable(state);
>-		dprintk(verbose, DST_DEBUG, 1, "write not successful");
>+		print(verbose, DST_DEBUG, 1, "write not successful");
> 		goto werr;
> 	}
> 	if ((dst_pio_disable(state)) < 0) {
>-		dprintk(verbose, DST_DEBUG, 1, "DST PIO disable failed !");
>+		print(verbose, DST_DEBUG, 1, "DST PIO disable failed !");
> 		goto error;
> 	}
> 	if ((read_dst(state, &reply, GET_ACK) < 0)) {
>-		dprintk(verbose, DST_DEBUG, 1, "read verify not successful.");
>+		print(verbose, DST_DEBUG, 1, "read verify not successful.");
> 		goto error;
> 	}
> 	if (reply != ACK) {
>-		dprintk(verbose, DST_DEBUG, 1, "write not acknowledged 0x%02x ", reply);
>+		print(verbose, DST_DEBUG, 1, "%s 0x%02x ",
>+			"write not acknowledged", reply);
>+
> 		goto error;
> 	}
> 	state->diseq_flags |= ATTEMPT_TUNE;
>@@ -1182,7 +1252,8 @@ error:
>  * Diseqc 4    0x00, 0x08, 0x04, 0xe0, 0x10, 0x38, 0xfc, 0xe0
>  */
> 
>-static int dst_set_diseqc(struct dvb_frontend *fe, struct dvb_diseqc_master_cmd *cmd)
>+static int dst_set_diseqc(struct dvb_frontend *fe,
>+			struct dvb_diseqc_master_cmd *cmd)
> {
> 	struct dst_state *state = fe->demodulator_priv;
> 	u8 paket[8] = { 0x00, 0x08, 0x04, 0xe0, 0x10, 0x38, 0xf0, 0xec };
>@@ -1283,12 +1354,23 @@ static int dst_init(struct dvb_frontend 
> {
> 	struct dst_state *state = fe->demodulator_priv;
> 
>-	static u8 sat_tuna_188[] = { 0x09, 0x00, 0x03, 0xb6, 0x01, 0x00, 0x73, 0x21, 0x00, 0x00 };
>-	static u8 sat_tuna_204[] = { 0x00, 0x00, 0x03, 0xb6, 0x01, 0x55, 0xbd, 0x50, 0x00, 0x00 };
>-	static u8 ter_tuna_188[] = { 0x09, 0x00, 0x03, 0xb6, 0x01, 0x07, 0x00, 0x00, 0x00, 0x00 };
>-	static u8 ter_tuna_204[] = { 0x00, 0x00, 0x03, 0xb6, 0x01, 0x07, 0x00, 0x00, 0x00, 0x00 };
>-	static u8 cab_tuna_204[] = { 0x00, 0x00, 0x03, 0xb6, 0x01, 0x07, 0x00, 0x00, 0x00, 0x00 };
>-	static u8 cab_tuna_188[] = { 0x09, 0x00, 0x03, 0xb6, 0x01, 0x07, 0x00, 0x00, 0x00, 0x00 };
>+	static u8 sat_tuna_188[] = { 0x09, 0x00, 0x03, 0xb6, 0x01,
>+					0x00, 0x73, 0x21, 0x00, 0x00 };
>+
>+	static u8 sat_tuna_204[] = { 0x00, 0x00, 0x03, 0xb6, 0x01,
>+					0x55, 0xbd, 0x50, 0x00, 0x00 };
>+
>+	static u8 ter_tuna_188[] = { 0x09, 0x00, 0x03, 0xb6, 0x01,
>+					0x07, 0x00, 0x00, 0x00, 0x00 };
>+
>+	static u8 ter_tuna_204[] = { 0x00, 0x00, 0x03, 0xb6, 0x01,
>+					0x07, 0x00, 0x00, 0x00, 0x00 };
>+
>+	static u8 cab_tuna_204[] = { 0x00, 0x00, 0x03, 0xb6, 0x01,
>+					0x07, 0x00, 0x00, 0x00, 0x00 };
>+
>+	static u8 cab_tuna_188[] = { 0x09, 0x00, 0x03, 0xb6, 0x01,
>+					0x07, 0x00, 0x00, 0x00, 0x00 };
> 
> 	state->inversion = INVERSION_OFF;
> 	state->voltage = SEC_VOLTAGE_13;
>@@ -1298,11 +1380,16 @@ static int dst_init(struct dvb_frontend 
> 	state->bandwidth = BANDWIDTH_7_MHZ;
> 	state->cur_jiff = jiffies;
> 	if (state->dst_type == DST_TYPE_IS_SAT)
>-		memcpy(state->tx_tuna, ((state->type_flags & DST_TYPE_HAS_NEWTUNE) ? sat_tuna_188 : sat_tuna_204), sizeof (sat_tuna_204));
>+		memcpy(state->tx_tuna, ((state->type_flags & DST_TYPE_HAS_NEWTUNE)
>+			? sat_tuna_188 : sat_tuna_204), sizeof (sat_tuna_204));
>+
> 	else if (state->dst_type == DST_TYPE_IS_TERR)
>-		memcpy(state->tx_tuna, ((state->type_flags & DST_TYPE_HAS_NEWTUNE) ? ter_tuna_188 : ter_tuna_204), sizeof (ter_tuna_204));
>+		memcpy(state->tx_tuna, ((state->type_flags & DST_TYPE_HAS_NEWTUNE)
>+			? ter_tuna_188 : ter_tuna_204), sizeof (ter_tuna_204));
>+
> 	else if (state->dst_type == DST_TYPE_IS_CABLE)
>-		memcpy(state->tx_tuna, ((state->type_flags & DST_TYPE_HAS_NEWTUNE) ? cab_tuna_188 : cab_tuna_204), sizeof (cab_tuna_204));
>+		memcpy(state->tx_tuna, ((state->type_flags & DST_TYPE_HAS_NEWTUNE)
>+			? cab_tuna_188 : cab_tuna_204), sizeof (cab_tuna_204));
> 
> 	return 0;
> }
>@@ -1315,7 +1402,8 @@ static int dst_read_status(struct dvb_fr
> 	if (state->diseq_flags & HAS_LOCK) {
> 		dst_get_signal(state);
> 		if (state->decode_lock)
>-			*status |= FE_HAS_LOCK | FE_HAS_SIGNAL | FE_HAS_CARRIER | FE_HAS_SYNC | FE_HAS_VITERBI;
>+			*status |= FE_HAS_LOCK | FE_HAS_SIGNAL | FE_HAS_CARRIER
>+				| FE_HAS_SYNC  | FE_HAS_VITERBI;
> 	}
> 
> 	return 0;
>@@ -1341,12 +1429,13 @@ static int dst_read_snr(struct dvb_front
> 	return 0;
> }
> 
>-static int dst_set_frontend(struct dvb_frontend *fe, struct dvb_frontend_parameters *p)
>+static int dst_set_frontend(struct dvb_frontend *fe,
>+			struct dvb_frontend_parameters *p)
> {
> 	struct dst_state *state = fe->demodulator_priv;
> 
> 	dst_set_freq(state, p->frequency);
>-	dprintk(verbose, DST_DEBUG, 1, "Set Frequency=[%d]", p->frequency);
>+	print(verbose, DST_DEBUG, 1, "Set Frequency=[%d]", p->frequency);
> 
> 	if (state->dst_type == DST_TYPE_IS_SAT) {
> 		if (state->type_flags & DST_TYPE_HAS_OBS_REGS)
>@@ -1354,7 +1443,8 @@ static int dst_set_frontend(struct dvb_f
> 		dst_set_fec(state, p->u.qpsk.fec_inner);
> 		dst_set_symbolrate(state, p->u.qpsk.symbol_rate);
> 		dst_set_polarization(state);
>-		dprintk(verbose, DST_DEBUG, 1, "Set Symbolrate=[%d]", p->u.qpsk.symbol_rate);
>+		print(verbose, DST_DEBUG, 1, "Set Symbolrate=[%d]",
>+			p->u.qpsk.symbol_rate);
> 
> 	} else if (state->dst_type == DST_TYPE_IS_TERR)
> 		dst_set_bandwidth(state, p->u.ofdm.bandwidth);
>@@ -1368,7 +1458,8 @@ static int dst_set_frontend(struct dvb_f
> 	return 0;
> }
> 
>-static int dst_get_frontend(struct dvb_frontend *fe, struct dvb_frontend_parameters *p)
>+static int dst_get_frontend(struct dvb_frontend *fe,
>+			struct dvb_frontend_parameters *p)
> {
> 	struct dst_state *state = fe->demodulator_priv;
> 
>@@ -1399,7 +1490,8 @@ static struct dvb_frontend_ops dst_dvbt_
> static struct dvb_frontend_ops dst_dvbs_ops;
> static struct dvb_frontend_ops dst_dvbc_ops;
> 
>-struct dst_state *dst_attach(struct dst_state *state, struct dvb_adapter *dvb_adapter)
>+struct dst_state *dst_attach(struct dst_state *state,
>+			struct dvb_adapter *dvb_adapter)
> {
> 	/* check if the ASIC is there */
> 	if (dst_probe(state) < 0) {
>@@ -1411,27 +1503,32 @@ struct dst_state *dst_attach(struct dst_
> 	/* determine settings based on type */
> 	switch (state->dst_type) {
> 	case DST_TYPE_IS_TERR:
>-		memcpy(&state->ops, &dst_dvbt_ops, sizeof(struct dvb_frontend_ops));
>+		memcpy(&state->ops, &dst_dvbt_ops,
>+			sizeof(struct dvb_frontend_ops));
> 		break;
> 	case DST_TYPE_IS_CABLE:
>-		memcpy(&state->ops, &dst_dvbc_ops, sizeof(struct dvb_frontend_ops));
>+		memcpy(&state->ops, &dst_dvbc_ops,
>+			sizeof(struct dvb_frontend_ops));
> 		break;
> 	case DST_TYPE_IS_SAT:
>-		memcpy(&state->ops, &dst_dvbs_ops, sizeof(struct dvb_frontend_ops));
>+		memcpy(&state->ops, &dst_dvbs_ops,
>+			sizeof(struct dvb_frontend_ops));
> 		break;
> 	default:
>-		dprintk(verbose, DST_ERROR, 1, "unknown DST type. please report to the LinuxTV.org DVB mailinglist.");
>+		print(verbose, DST_ERROR, 1, "unknown DST type. %s",
>+			"please report to the LinuxTV.org DVB mailinglist.");
>+
> 		if (state)
> 			kfree(state);
> 
> 		return NULL;
> 	}
> 
>-	/* create dvb_frontend */
>+	/*	create dvb_frontend		*/
> 	state->frontend.ops = &state->ops;
> 	state->frontend.demodulator_priv = state;
> 
>-	return state;				/*	Manu (DST is a card not a frontend)	*/
>+	return state;	/*	(DST is not a frontend)	*/
> }
> 
> EXPORT_SYMBOL(dst_attach);
>@@ -1444,7 +1541,9 @@ static struct dvb_frontend_ops dst_dvbt_
> 		.frequency_min = 137000000,
> 		.frequency_max = 858000000,
> 		.frequency_stepsize = 166667,
>-		.caps = FE_CAN_FEC_AUTO | FE_CAN_QAM_AUTO | FE_CAN_TRANSMISSION_MODE_AUTO | FE_CAN_GUARD_INTERVAL_AUTO
>+		.caps = FE_CAN_FEC_AUTO | FE_CAN_QAM_AUTO |
>+			FE_CAN_TRANSMISSION_MODE_AUTO	  |
>+			FE_CAN_GUARD_INTERVAL_AUTO
> 	},
> 
> 	.release = dst_release,
>diff -Naurp bt8xx.orig/dst_ca.c bt8xx/dst_ca.c
>--- bt8xx.orig/dst_ca.c	2005-10-18 23:06:11.000000000 +0400
>+++ bt8xx/dst_ca.c	2005-10-24 15:50:42.000000000 +0400
>@@ -28,27 +28,6 @@
> #include "dst_ca.h"
> #include "dst_common.h"
> 
>-#define DST_CA_ERROR		0
>-#define DST_CA_NOTICE		1
>-#define DST_CA_INFO		2
>-#define DST_CA_DEBUG		3
>-
>-#define dprintk(x, y, z, format, arg...) do {						\
>-	if (z) {									\
>-		if	((x > DST_CA_ERROR) && (x > y))					\
>-			printk(KERN_ERR "%s: " format "\n", __FUNCTION__ , ##arg);	\
>-		else if	((x > DST_CA_NOTICE) && (x > y))				\
>-			printk(KERN_NOTICE "%s: " format "\n", __FUNCTION__ , ##arg);	\
>-		else if ((x > DST_CA_INFO) && (x > y))					\
>-			printk(KERN_INFO "%s: " format "\n", __FUNCTION__ , ##arg);	\
>-		else if ((x > DST_CA_DEBUG) && (x > y))					\
>-			printk(KERN_DEBUG "%s: " format "\n", __FUNCTION__ , ##arg);	\
>-	} else {									\
>-		if (x > y)								\
>-			printk(format, ## arg);						\
>-	}										\
>-} while(0)
>-
> 
> static unsigned int verbose = 5;
> module_param(verbose, int, 0644);
>@@ -71,13 +50,16 @@ static int ca_set_pid(void)
> 
> static void put_checksum(u8 *check_string, int length)
> {
>-	dprintk(verbose, DST_CA_DEBUG, 1, " Computing string checksum.");
>-	dprintk(verbose, DST_CA_DEBUG, 1, "  -> string length : 0x%02x", length);
>+	print(verbose, DST_DEBUG, 1, " Computing string checksum.");
>+	print(verbose, DST_DEBUG, 1, "  -> string length : 0x%02x", length);
> 	check_string[length] = dst_check_sum (check_string, length);
>-	dprintk(verbose, DST_CA_DEBUG, 1, "  -> checksum      : 0x%02x", check_string[length]);
>+	print(verbose, DST_DEBUG, 1, "  -> checksum      : 0x%02x",
>+		check_string[length]);
>+
> }
> 
>-static int dst_ci_command(struct dst_state* state, u8 * data, u8 *ca_string, u8 len, int read)
>+static int dst_ci_command(struct dst_state* state, u8 * data, u8 *ca_string,
>+			u8 len, int read)
> {
> 	u8 reply;
> 
>@@ -86,26 +68,28 @@ static int dst_ci_command(struct dst_sta
> 	msleep(65);
> 
> 	if (write_dst(state, data, len)) {
>-		dprintk(verbose, DST_CA_INFO, 1, " Write not successful, trying to recover");
>+		print(verbose, DST_INFO, 1, " Write failed, trying to recover");
> 		dst_error_recovery(state);
> 		goto error;
> 	}
> 	if ((dst_pio_disable(state)) < 0) {
>-		dprintk(verbose, DST_CA_ERROR, 1, " DST PIO disable failed.");
>+		print(verbose, DST_ERROR, 1, " DST PIO disable failed.");
> 		goto error;
> 	}
> 	if (read_dst(state, &reply, GET_ACK) < 0) {
>-		dprintk(verbose, DST_CA_INFO, 1, " Read not successful, trying to recover");
>+		print(verbose, DST_INFO, 1, " Read failed, trying to recover");
> 		dst_error_recovery(state);
> 		goto error;
> 	}
> 	if (read) {
> 		if (! dst_wait_dst_ready(state, LONG_DELAY)) {
>-			dprintk(verbose, DST_CA_NOTICE, 1, " 8820 not ready");
>+			print(verbose, DST_NOTICE, 1, " 8820 not ready");
> 			goto error;
> 		}
> 		if (read_dst(state, ca_string, 128) < 0) {	/*	Try to make this dynamic	*/
>-			dprintk(verbose, DST_CA_INFO, 1, " Read not successful, trying to recover");
>+			print(verbose, DST_INFO, 1,
>+				" Read failed, trying to recover");
>+
> 			dst_error_recovery(state);
> 			goto error;
> 		}
>@@ -119,13 +103,14 @@ error:
> }
> 
> 
>-static int dst_put_ci(struct dst_state *state, u8 *data, int len, u8 *ca_string, int read)
>+static int dst_put_ci(struct dst_state *state, u8 *data, int len,
>+		u8 *ca_string, int read)
> {
> 	u8 dst_ca_comm_err = 0;
> 
> 	while (dst_ca_comm_err < RETRIES) {
> 		dst_comm_init(state);
>-		dprintk(verbose, DST_CA_NOTICE, 1, " Put Command");
>+		print(verbose, DST_NOTICE, 1, " Put Command");
> 		if (dst_ci_command(state, data, ca_string, len, read)) {	// If error
> 			dst_error_recovery(state);
> 			dst_ca_comm_err++; // work required here.
>@@ -143,40 +128,56 @@ static int ca_get_app_info(struct dst_st
> 	static u8 command[8] = {0x07, 0x40, 0x01, 0x00, 0x01, 0x00, 0x00, 0xff};
> 
> 	put_checksum(&command[0], command[0]);
>-	if ((dst_put_ci(state, command, sizeof(command), state->messages, GET_REPLY)) < 0) {
>-		dprintk(verbose, DST_CA_ERROR, 1, " -->dst_put_ci FAILED !");
>+	if ((dst_put_ci(state, command, sizeof(command),
>+		state->messages, GET_REPLY)) < 0) {
>+
>+		print(verbose, DST_ERROR, 1, " -->dst_put_ci FAILED !");
> 		return -1;
> 	}
>-	dprintk(verbose, DST_CA_INFO, 1, " -->dst_put_ci SUCCESS !");
>-	dprintk(verbose, DST_CA_INFO, 1, " ================================ CI Module Application Info ======================================");
>-	dprintk(verbose, DST_CA_INFO, 1, " Application Type=[%d], Application Vendor=[%d], Vendor Code=[%d]\n%s: Application info=[%s]",
>-		state->messages[7], (state->messages[8] << 8) | state->messages[9],
>-		(state->messages[10] << 8) | state->messages[11], __FUNCTION__, (char *)(&state->messages[12]));
>-	dprintk(verbose, DST_CA_INFO, 1, " ==================================================================================================");
>+	print(verbose, DST_INFO, 1, " -->dst_put_ci SUCCESS !");
>+	print(verbose, DST_INFO, 1, "=%s %s %s=",
>+		"================================",
>+		"   CI Module Application Info   ",
>+		"================================");
>+
>+	print(verbose, DST_INFO, 1, " %s=[%d], %s=[%d], %s=[%d]\n%s: %s=[%s] ",
>+		"Application Type", state->messages[7],
>+		"Application Vendor", (state->messages[8] << 8) | state->messages[9],
>+		"Vendor Code", (state->messages[10] << 8) | state->messages[11],
>+		__func__,
>+		"Application info", (char *)(&state->messages[12]));
>+
>+	print(verbose, DST_INFO, 1, "=%s%s%s=",
>+		"================================",
>+		"================================",
>+		"================================");
> 
> 	return 0;
> }
> 
>-static int ca_get_slot_caps(struct dst_state *state, struct ca_caps *p_ca_caps, void __user *arg)
>+static int ca_get_slot_caps(struct dst_state *state,
>+			struct ca_caps *p_ca_caps, void __user *arg)
> {
> 	int i;
> 	u8 slot_cap[256];
>-	static u8 slot_command[8] = {0x07, 0x40, 0x02, 0x00, 0x02, 0x00, 0x00, 0xff};
>+	static u8 slot_cmd[8] = {0x07, 0x40, 0x02, 0x00, 0x02, 0x00, 0x00, 0xff};
>+
>+	put_checksum(&slot_cmd[0], slot_cmd[0]);
>+	if ((dst_put_ci(state, slot_cmd, sizeof (slot_cmd),
>+		slot_cap, GET_REPLY)) < 0) {
> 
>-	put_checksum(&slot_command[0], slot_command[0]);
>-	if ((dst_put_ci(state, slot_command, sizeof (slot_command), slot_cap, GET_REPLY)) < 0) {
>-		dprintk(verbose, DST_CA_ERROR, 1, " -->dst_put_ci FAILED !");
>+		print(verbose, DST_ERROR, 1, " -->dst_put_ci FAILED !");
> 		return -1;
> 	}
>-	dprintk(verbose, DST_CA_NOTICE, 1, " -->dst_put_ci SUCCESS !");
>+	print(verbose, DST_NOTICE, 1, " -->dst_put_ci SUCCESS !");
> 
> 	/*	Will implement the rest soon		*/
> 
>-	dprintk(verbose, DST_CA_INFO, 1, " Slot cap = [%d]", slot_cap[7]);
>-	dprintk(verbose, DST_CA_INFO, 0, "===================================\n");
>+	print(verbose, DST_INFO, 1, " Slot cap = [%d]", slot_cap[7]);
>+	print(verbose, DST_INFO, 0, "===================================\n");
> 	for (i = 0; i < 8; i++)
>-		dprintk(verbose, DST_CA_INFO, 0, " %d", slot_cap[i]);
>-	dprintk(verbose, DST_CA_INFO, 0, "\n");
>+		print(verbose, DST_INFO, 0, " %d", slot_cap[i]);
>+	print(verbose, DST_INFO, 0, "\n");
> 
> 	p_ca_caps->slot_num = 1;
> 	p_ca_caps->slot_type = 1;
>@@ -190,33 +191,38 @@ static int ca_get_slot_caps(struct dst_s
> }
> 
> /*	Need some more work	*/
>-static int ca_get_slot_descr(struct dst_state *state, struct ca_msg *p_ca_message, void __user *arg)
>+static int ca_get_slot_descr(struct dst_state *state,
>+			struct ca_msg *p_ca_message, void __user *arg)
> {
> 	return -EOPNOTSUPP;
> }
> 
> 
>-static int ca_get_slot_info(struct dst_state *state, struct ca_slot_info *p_ca_slot_info, void __user *arg)
>+static int ca_get_slot_info(struct dst_state *state,
>+			struct ca_slot_info *p_ca_slot_info, void __user *arg)
> {
> 	int i;
>-	static u8 slot_command[8] = {0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff};
>+	static u8 slot_command[8] = { 0x00, 0x05, 0x00, 0x00,
>+				0x00, 0x00, 0x00, 0xff };
> 
> 	u8 *slot_info = state->messages;
> 
> 	put_checksum(&slot_command[0], 7);
>-	if ((dst_put_ci(state, slot_command, sizeof (slot_command), slot_info, GET_REPLY)) < 0) {
>-		dprintk(verbose, DST_CA_ERROR, 1, " -->dst_put_ci FAILED !");
>+	if ((dst_put_ci(state, slot_command, sizeof (slot_command),
>+		slot_info, GET_REPLY)) < 0) {
>+
>+		print(verbose, DST_ERROR, 1, " -->dst_put_ci FAILED !");
> 		return -1;
> 	}
>-	dprintk(verbose, DST_CA_INFO, 1, " -->dst_put_ci SUCCESS !");
>+	print(verbose, DST_INFO, 1, " -->dst_put_ci SUCCESS !");
> 
> 	/*	Will implement the rest soon		*/
> 
>-	dprintk(verbose, DST_CA_INFO, 1, " Slot info = [%d]", slot_info[3]);
>-	dprintk(verbose, DST_CA_INFO, 0, "===================================\n");
>+	print(verbose, DST_INFO, 1, " Slot info = [%d]", slot_info[3]);
>+	print(verbose, DST_INFO, 0, "===================================\n");
> 	for (i = 0; i < 8; i++)
>-		dprintk(verbose, DST_CA_INFO, 0, " %d", slot_info[i]);
>-	dprintk(verbose, DST_CA_INFO, 0, "\n");
>+		print(verbose, DST_INFO, 0, " %d", slot_info[i]);
>+	print(verbose, DST_INFO, 0, "\n");
> 
> 	if (slot_info[4] & 0x80) {
> 		p_ca_slot_info->flags = CA_CI_MODULE_PRESENT;
>@@ -236,7 +242,8 @@ static int ca_get_slot_info(struct dst_s
> }
> 
> 
>-static int ca_get_message(struct dst_state *state, struct ca_msg *p_ca_message, void __user *arg)
>+static int ca_get_message(struct dst_state *state,
>+			struct ca_msg *p_ca_message, void __user *arg)
> {
> 	u8 i = 0;
> 	u32 command = 0;
>@@ -245,19 +252,24 @@ static int ca_get_message(struct dst_sta
> 		return -EFAULT;
> 
> 	if (p_ca_message->msg) {
>-		dprintk(verbose, DST_CA_NOTICE, 1, " Message = [%02x %02x %02x]", p_ca_message->msg[0], p_ca_message->msg[1], p_ca_message->msg[2]);
>+		print(verbose, DST_NOTICE, 1, " Message = [%02x %02x %02x]",
>+			p_ca_message->msg[0],
>+			p_ca_message->msg[1],
>+			p_ca_message->msg[2]);
> 
> 		for (i = 0; i < 3; i++) {
> 			command = command | p_ca_message->msg[i];
> 			if (i < 2)
> 				command = command << 8;
> 		}
>-		dprintk(verbose, DST_CA_NOTICE, 1, " Command=[0x%x]", command);
>+		print(verbose, DST_NOTICE, 1, " Command=[0x%x]", command);
> 
> 		switch (command) {
> 		case CA_APP_INFO:
> 			memcpy(p_ca_message->msg, state->messages, 128);
>-			if (copy_to_user(arg, p_ca_message, sizeof (struct ca_msg)) )
>+			if (copy_to_user(arg, p_ca_message,
>+				sizeof (struct ca_msg)))
>+
> 				return -EFAULT;
> 			break;
> 		}
>@@ -266,14 +278,18 @@ static int ca_get_message(struct dst_sta
> 	return 0;
> }
> 
>-static int handle_dst_tag(struct dst_state *state, struct ca_msg *p_ca_message, struct ca_msg *hw_buffer, u32 length)
>+static int handle_dst_tag(struct dst_state *state,
>+			struct ca_msg *p_ca_message,
>+			struct ca_msg *hw_buffer, u32 length)
> {
> 	if (state->dst_hw_cap & DST_TYPE_HAS_SESSION) {
> 		hw_buffer->msg[2] = p_ca_message->msg[1];	/*	MSB	*/
> 		hw_buffer->msg[3] = p_ca_message->msg[2];	/*	LSB	*/
> 	} else {
> 		if (length > 247) {
>-			dprintk(verbose, DST_CA_ERROR, 1, " Message too long ! *** Bailing Out *** !");
>+			print(verbose, DST_ERROR, 1,
>+				" Message too long ! *** Bailing Out *** !");
>+
> 			return -1;
> 		}
> 		hw_buffer->msg[0] = (length & 0xff) + 7;
>@@ -285,8 +301,8 @@ static int handle_dst_tag(struct dst_sta
> 		hw_buffer->msg[6] = 0x00;
> 
> 		/*
>-		 *	Need to compute length for EN50221 section 8.3.2, for the time being
>-		 *	assuming 8.3.2 is not applicable
>+		 *	Need to compute length for EN50221 section 8.3.2,
>+		 *	for the time being assuming 8.3.2 is not applicable
> 		 */
> 		memcpy(&hw_buffer->msg[7], &p_ca_message->msg[4], length);
> 	}
>@@ -294,15 +310,18 @@ static int handle_dst_tag(struct dst_sta
> 	return 0;
> }
> 
>-static int write_to_8820(struct dst_state *state, struct ca_msg *hw_buffer, u8 length, u8 reply)
>+static int write_to_8820(struct dst_state *state,
>+			struct ca_msg *hw_buffer, u8 length, u8 reply)
> {
>-	if ((dst_put_ci(state, hw_buffer->msg, length, hw_buffer->msg, reply)) < 0) {
>-		dprintk(verbose, DST_CA_ERROR, 1, " DST-CI Command failed.");
>-		dprintk(verbose, DST_CA_NOTICE, 1, " Resetting DST.");
>+	if ((dst_put_ci(state, hw_buffer->msg, length,
>+		hw_buffer->msg, reply)) < 0) {
>+
>+		print(verbose, DST_ERROR, 1, " DST-CI Command failed.");
>+		print(verbose, DST_NOTICE, 1, " Resetting DST.");
> 		rdc_reset_state(state);
> 		return -1;
> 	}
>-	dprintk(verbose, DST_CA_NOTICE, 1, " DST-CI Command succes.");
>+	print(verbose, DST_NOTICE, 1, " DST-CI Command succes.");
> 
> 	return 0;
> }
>@@ -313,16 +332,16 @@ static u32 asn_1_decode(u8 *asn_1_array)
> 	u32 length = 0;
> 
> 	length_field = asn_1_array[0];
>-	dprintk(verbose, DST_CA_DEBUG, 1, " Length field=[%02x]", length_field);
>+	print(verbose, DST_DEBUG, 1, " Length field=[%02x]", length_field);
> 	if (length_field < 0x80) {
> 		length = length_field & 0x7f;
>-		dprintk(verbose, DST_CA_DEBUG, 1, " Length=[%02x]\n", length);
>+		print(verbose, DST_DEBUG, 1, " Length=[%02x]\n", length);
> 	} else {
> 		word_count = length_field & 0x7f;
> 		for (count = 0; count < word_count; count++) {
> 			length = length  << 8;
> 			length += asn_1_array[count + 1];
>-			dprintk(verbose, DST_CA_DEBUG, 1, " Length=[%04x]", length);
>+			print(verbose, DST_DEBUG, 1, " Length=[%04x]", length);
> 		}
> 	}
> 	return length;
>@@ -332,21 +351,22 @@ static int debug_string(u8 *msg, u32 len
> {
> 	u32 i;
> 
>-	dprintk(verbose, DST_CA_DEBUG, 0, " String=[ ");
>+	print(verbose, DST_DEBUG, 0, " String=[ ");
> 	for (i = offset; i < length; i++)
>-		dprintk(verbose, DST_CA_DEBUG, 0, "%02x ", msg[i]);
>-	dprintk(verbose, DST_CA_DEBUG, 0, "]\n");
>+		print(verbose, DST_DEBUG, 0, "%02x ", msg[i]);
>+	print(verbose, DST_DEBUG, 0, "]\n");
> 
> 	return 0;
> }
> 
>-static int ca_set_pmt(struct dst_state *state, struct ca_msg *p_ca_message, struct ca_msg *hw_buffer, u8 reply, u8 query)
>+static int ca_set_pmt(struct dst_state *state, struct ca_msg *p_ca_message,
>+		struct ca_msg *hw_buffer, u8 reply, u8 query)
> {
> 	u32 length = 0;
> 	u8 tag_length = 8;
> 
> 	length = asn_1_decode(&p_ca_message->msg[3]);
>-	dprintk(verbose, DST_CA_DEBUG, 1, " CA Message length=[%d]", length);
>+	print(verbose, DST_DEBUG, 1, " CA Message length=[%d]", length);
> 	debug_string(&p_ca_message->msg[4], length, 0); /*	length is excluding tag & length	*/
> 
> 	memset(hw_buffer->msg, '\0', length);
>@@ -361,7 +381,8 @@ static int ca_set_pmt(struct dst_state *
> 
> 
> /*	Board supports CA PMT reply ?		*/
>-static int dst_check_ca_pmt(struct dst_state *state, struct ca_msg *p_ca_message, struct ca_msg *hw_buffer)
>+static int dst_check_ca_pmt(struct dst_state *state, struct ca_msg *p_ca_message,
>+			struct ca_msg *hw_buffer)
> {
> 	int ca_pmt_reply_test = 0;
> 
>@@ -370,29 +391,34 @@ static int dst_check_ca_pmt(struct dst_s
> 
> 	/*	CA PMT Reply capable		*/
> 	if (ca_pmt_reply_test) {
>-		if ((ca_set_pmt(state, p_ca_message, hw_buffer, 1, GET_REPLY)) < 0) {
>-			dprintk(verbose, DST_CA_ERROR, 1, " ca_set_pmt.. failed !");
>+		if ((ca_set_pmt(state, p_ca_message, hw_buffer,
>+			1, GET_REPLY)) < 0) {
>+
>+			print(verbose, DST_ERROR, 1, " ca_set_pmt.. failed !");
> 			return -1;
> 		}
> 
> 	/*	Process CA PMT Reply		*/
> 	/*	will implement soon		*/
>-		dprintk(verbose, DST_CA_ERROR, 1, " Not there yet");
>+		print(verbose, DST_ERROR, 1, " Not there yet");
> 	}
> 	/*	CA PMT Reply not capable	*/
> 	if (!ca_pmt_reply_test) {
>-		if ((ca_set_pmt(state, p_ca_message, hw_buffer, 0, NO_REPLY)) < 0) {
>-			dprintk(verbose, DST_CA_ERROR, 1, " ca_set_pmt.. failed !");
>+		if ((ca_set_pmt(state, p_ca_message, hw_buffer,
>+			0, NO_REPLY)) < 0) {
>+
>+			print(verbose, DST_ERROR, 1, " ca_set_pmt.. failed !");
> 			return -1;
> 		}
>-		dprintk(verbose, DST_CA_NOTICE, 1, " ca_set_pmt.. success !");
>+		print(verbose, DST_NOTICE, 1, " ca_set_pmt.. success !");
> 	/*	put a dummy message		*/
> 
> 	}
> 	return 0;
> }
> 
>-static int ca_send_message(struct dst_state *state, struct ca_msg *p_ca_message, void __user *arg)
>+static int ca_send_message(struct dst_state *state, struct ca_msg *p_ca_message,
>+			void __user *arg)
> {
> 	int i = 0;
> 	unsigned int ca_message_header_len;
>@@ -401,11 +427,13 @@ static int ca_send_message(struct dst_st
> 	struct ca_msg *hw_buffer;
> 	int result = 0;
> 
>-	if ((hw_buffer = (struct ca_msg *) kmalloc(sizeof (struct ca_msg), GFP_KERNEL)) == NULL) {
>-		dprintk(verbose, DST_CA_ERROR, 1, " Memory allocation failure");
>+	if ((hw_buffer = (struct ca_msg *) kmalloc(sizeof (struct ca_msg),
>+		GFP_KERNEL)) == NULL) {
>+
>+		print(verbose, DST_ERROR, 1, " Memory allocation failure");
> 		return -ENOMEM;
> 	}
>-	dprintk(verbose, DST_CA_DEBUG, 1, " ");
>+	print(verbose, DST_DEBUG, 1, " ");
> 
> 	if (copy_from_user(p_ca_message, (void *)arg, sizeof (struct ca_msg))) {
> 		result = -EFAULT;
>@@ -423,37 +451,47 @@ static int ca_send_message(struct dst_st
> 			if (i < 2)
> 				command = command << 8;
> 		}
>-		dprintk(verbose, DST_CA_DEBUG, 1, " Command=[0x%x]\n", command);
>+		print(verbose, DST_DEBUG, 1, " Command=[0x%x]\n", command);
> 
> 		switch (command) {
> 		case CA_PMT:
>-			dprintk(verbose, DST_CA_DEBUG, 1, "Command = SEND_CA_PMT");
>-			if ((ca_set_pmt(state, p_ca_message, hw_buffer, 0, 0)) < 0) {	// code simplification started
>-				dprintk(verbose, DST_CA_ERROR, 1, " -->CA_PMT Failed !");
>-				result = -1;
>+			print(verbose, DST_DEBUG, 1, "Command = SEND_CA_PMT");
>+			if ((ca_set_pmt(state, p_ca_message,
>+				hw_buffer, 0, 0)) < 0) {
>+
>+				print(verbose, DST_ERROR, 1,
>+					" -->CA_PMT Failed !");
>+				result = -EIO;
> 				goto free_mem_and_exit;
> 			}
>-			dprintk(verbose, DST_CA_INFO, 1, " -->CA_PMT Success !");
>+			print(verbose, DST_INFO, 1, " -->CA_PMT Success !");
> 			break;
> 		case CA_PMT_REPLY:
>-			dprintk(verbose, DST_CA_INFO, 1, "Command = CA_PMT_REPLY");
>+			print(verbose, DST_INFO, 1, "Command = CA_PMT_REPLY");
> 			/*      Have to handle the 2 basic types of cards here  */
>-			if ((dst_check_ca_pmt(state, p_ca_message, hw_buffer)) < 0) {
>-				dprintk(verbose, DST_CA_ERROR, 1, " -->CA_PMT_REPLY Failed !");
>-				result = -1;
>+			if ((dst_check_ca_pmt(state, p_ca_message,
>+				hw_buffer)) < 0) {
>+
>+				print(verbose, DST_ERROR, 1,
>+					" -->CA_PMT_REPLY Failed !");
>+				result = -EIO;
> 				goto free_mem_and_exit;
> 			}
>-			dprintk(verbose, DST_CA_INFO, 1, " -->CA_PMT_REPLY Success !");
>+			print(verbose, DST_INFO, 1,
>+				" -->CA_PMT_REPLY Success !");
> 			break;
> 		case CA_APP_INFO_ENQUIRY:		// only for debugging
>-			dprintk(verbose, DST_CA_INFO, 1, " Getting Cam Application information");
>+			print(verbose, DST_INFO, 1,
>+				" Getting Cam Application information");
> 
> 			if ((ca_get_app_info(state)) < 0) {
>-				dprintk(verbose, DST_CA_ERROR, 1, " -->CA_APP_INFO_ENQUIRY Failed !");
>-				result = -1;
>+				print(verbose, DST_ERROR, 1,
>+					" -->CA_APP_INFO_ENQUIRY Failed !");
>+				result = -EIO;
> 				goto free_mem_and_exit;
> 			}
>-			dprintk(verbose, DST_CA_INFO, 1, " -->CA_APP_INFO_ENQUIRY Success !");
>+			print(verbose, DST_INFO, 1,
>+				" -->CA_APP_INFO_ENQUIRY Success !");
> 			break;
> 		}
> 	}
>@@ -463,7 +501,8 @@ free_mem_and_exit:
> 	return result;
> }
> 
>-static int dst_ca_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long ioctl_arg)
>+static int dst_ca_ioctl(struct inode *inode, struct file *file,
>+		unsigned int cmd, unsigned long ioctl_arg)
> {
> 	struct dvb_device* dvbdev = (struct dvb_device*) file->private_data;
> 	struct dst_state* state = (struct dst_state*) dvbdev->priv;
>@@ -473,86 +512,98 @@ static int dst_ca_ioctl(struct inode *in
> 	void __user *arg = (void __user *)ioctl_arg;
> 	int result = 0;
> 
>-	if ((p_ca_message = (struct ca_msg *) kmalloc(sizeof (struct ca_msg), GFP_KERNEL)) == NULL) {
>-		dprintk(verbose, DST_CA_ERROR, 1, " Memory allocation failure");
>+	if ((p_ca_message = kmalloc(sizeof (struct ca_msg),
>+		GFP_KERNEL)) == NULL) {
>+
>+		print(verbose, DST_ERROR, 1, " Memory allocation failure");
> 		return -ENOMEM;
> 	}
>-	if ((p_ca_slot_info = (struct ca_slot_info *) kmalloc(sizeof (struct ca_slot_info), GFP_KERNEL)) == NULL) {
>-		dprintk(verbose, DST_CA_ERROR, 1, " Memory allocation failure");
>+	if ((p_ca_slot_info = kmalloc(sizeof (struct ca_slot_info),
>+		GFP_KERNEL)) == NULL) {
>+
>+		print(verbose, DST_ERROR, 1, " Memory allocation failure");
> 		return -ENOMEM;
> 	}
>-	if ((p_ca_caps = (struct ca_caps *) kmalloc(sizeof (struct ca_caps), GFP_KERNEL)) == NULL) {
>-		dprintk(verbose, DST_CA_ERROR, 1, " Memory allocation failure");
>+	if ((p_ca_caps = kmalloc(sizeof (struct ca_caps),
>+		GFP_KERNEL)) == NULL) {
>+
>+		print(verbose, DST_ERROR, 1, " Memory allocation failure");
> 		return -ENOMEM;
> 	}
> 	/*	We have now only the standard ioctl's, the driver is upposed to handle internals.	*/
> 	switch (cmd) {
> 	case CA_SEND_MSG:
>-		dprintk(verbose, DST_CA_INFO, 1, " Sending message");
>+		print(verbose, DST_INFO, 1, " Sending message");
> 		if ((ca_send_message(state, p_ca_message, arg)) < 0) {
>-			dprintk(verbose, DST_CA_ERROR, 1, " -->CA_SEND_MSG Failed !");
>-			result = -1;
>+			print(verbose, DST_ERROR, 1, " -->CA_SEND_MSG Failed !");
>+			result = -EIO;
> 			goto free_mem_and_exit;
> 		}
> 		break;
> 	case CA_GET_MSG:
>-		dprintk(verbose, DST_CA_INFO, 1, " Getting message");
>+		print(verbose, DST_INFO, 1, " Getting message");
> 		if ((ca_get_message(state, p_ca_message, arg)) < 0) {
>-			dprintk(verbose, DST_CA_ERROR, 1, " -->CA_GET_MSG Failed !");
>-			result = -1;
>+			print(verbose, DST_ERROR, 1, " -->CA_GET_MSG Failed !");
>+			result = -EIO;
> 			goto free_mem_and_exit;
> 		}
>-		dprintk(verbose, DST_CA_INFO, 1, " -->CA_GET_MSG Success !");
>+		print(verbose, DST_INFO, 1, " -->CA_GET_MSG Success !");
> 		break;
> 	case CA_RESET:
>-		dprintk(verbose, DST_CA_ERROR, 1, " Resetting DST");
>+		print(verbose, DST_ERROR, 1, " Resetting DST");
> 		dst_error_bailout(state);
> 		msleep(4000);
> 		break;
> 	case CA_GET_SLOT_INFO:
>-		dprintk(verbose, DST_CA_INFO, 1, " Getting Slot info");
>+		print(verbose, DST_INFO, 1, " Getting Slot info");
> 		if ((ca_get_slot_info(state, p_ca_slot_info, arg)) < 0) {
>-			dprintk(verbose, DST_CA_ERROR, 1, " -->CA_GET_SLOT_INFO Failed !");
>-			result = -1;
>+			print(verbose, DST_ERROR, 1,
>+				" -->CA_GET_SLOT_INFO Failed !");
>+
>+			result = -EIO;
> 			goto free_mem_and_exit;
> 		}
>-		dprintk(verbose, DST_CA_INFO, 1, " -->CA_GET_SLOT_INFO Success !");
>+		print(verbose, DST_INFO, 1, " -->CA_GET_SLOT_INFO Success !");
> 		break;
> 	case CA_GET_CAP:
>-		dprintk(verbose, DST_CA_INFO, 1, " Getting Slot capabilities");
>+		print(verbose, DST_INFO, 1, " Getting Slot capabilities");
> 		if ((ca_get_slot_caps(state, p_ca_caps, arg)) < 0) {
>-			dprintk(verbose, DST_CA_ERROR, 1, " -->CA_GET_CAP Failed !");
>-			result = -1;
>+			print(verbose, DST_ERROR, 1, " -->CA_GET_CAP Failed !");
>+			result = -EIO;
> 			goto free_mem_and_exit;
> 		}
>-		dprintk(verbose, DST_CA_INFO, 1, " -->CA_GET_CAP Success !");
>+		print(verbose, DST_INFO, 1, " -->CA_GET_CAP Success !");
> 		break;
> 	case CA_GET_DESCR_INFO:
>-		dprintk(verbose, DST_CA_INFO, 1, " Getting descrambler description");
>+		print(verbose, DST_INFO, 1, " Getting descrambler description");
> 		if ((ca_get_slot_descr(state, p_ca_message, arg)) < 0) {
>-			dprintk(verbose, DST_CA_ERROR, 1, " -->CA_GET_DESCR_INFO Failed !");
>-			result = -1;
>+			print(verbose, DST_ERROR, 1,
>+				" -->CA_GET_DESCR_INFO Failed !");
>+
>+			result = -EIO;
> 			goto free_mem_and_exit;
> 		}
>-		dprintk(verbose, DST_CA_INFO, 1, " -->CA_GET_DESCR_INFO Success !");
>+		print(verbose, DST_INFO, 1, " -->CA_GET_DESCR_INFO Success !");
> 		break;
> 	case CA_SET_DESCR:
>-		dprintk(verbose, DST_CA_INFO, 1, " Setting descrambler");
>+		print(verbose, DST_INFO, 1, " Setting descrambler");
> 		if ((ca_set_slot_descr()) < 0) {
>-			dprintk(verbose, DST_CA_ERROR, 1, " -->CA_SET_DESCR Failed !");
>-			result = -1;
>+			print(verbose, DST_ERROR, 1,
>+				" -->CA_SET_DESCR Failed !");
>+
>+			result = -EIO;
> 			goto free_mem_and_exit;
> 		}
>-		dprintk(verbose, DST_CA_INFO, 1, " -->CA_SET_DESCR Success !");
>+		print(verbose, DST_INFO, 1, " -->CA_SET_DESCR Success !");
> 		break;
> 	case CA_SET_PID:
>-		dprintk(verbose, DST_CA_INFO, 1, " Setting PID");
>+		print(verbose, DST_INFO, 1, " Setting PID");
> 		if ((ca_set_pid()) < 0) {
>-			dprintk(verbose, DST_CA_ERROR, 1, " -->CA_SET_PID Failed !");
>+			print(verbose, DST_ERROR, 1, " -->CA_SET_PID Failed !");
> 			result = -1;
> 			goto free_mem_and_exit;
> 		}
>-		dprintk(verbose, DST_CA_INFO, 1, " -->CA_SET_PID Success !");
>+		print(verbose, DST_INFO, 1, " -->CA_SET_PID Success !");
> 	default:
> 		result = -EOPNOTSUPP;
> 	};
>@@ -566,7 +617,7 @@ static int dst_ca_ioctl(struct inode *in
> 
> static int dst_ca_open(struct inode *inode, struct file *file)
> {
>-	dprintk(verbose, DST_CA_DEBUG, 1, " Device opened [%p] ", file);
>+	print(verbose, DST_DEBUG, 1, " Device opened [%p] ", file);
> 	try_module_get(THIS_MODULE);
> 
> 	return 0;
>@@ -574,24 +625,26 @@ static int dst_ca_open(struct inode *ino
> 
> static int dst_ca_release(struct inode *inode, struct file *file)
> {
>-	dprintk(verbose, DST_CA_DEBUG, 1, " Device closed.");
>+	print(verbose, DST_DEBUG, 1, " Device closed.");
> 	module_put(THIS_MODULE);
> 
> 	return 0;
> }
> 
>-static int dst_ca_read(struct file *file, char __user *buffer, size_t length, loff_t *offset)
>+static int dst_ca_read(struct file *file, char __user *buffer,
>+		size_t length, loff_t *offset)
> {
> 	int bytes_read = 0;
> 
>-	dprintk(verbose, DST_CA_DEBUG, 1, " Device read.");
>+	print(verbose, DST_DEBUG, 1, " Device read.");
> 
> 	return bytes_read;
> }
> 
>-static int dst_ca_write(struct file *file, const char __user *buffer, size_t length, loff_t *offset)
>+static int dst_ca_write(struct file *file, const char __user *buffer,
>+		size_t length, loff_t *offset)
> {
>-	dprintk(verbose, DST_CA_DEBUG, 1, " Device write.");
>+	print(verbose, DST_DEBUG, 1, " Device write.");
> 
> 	return 0;
> }
>@@ -616,8 +669,10 @@ static struct dvb_device dvbdev_ca = {
> int dst_ca_attach(struct dst_state *dst, struct dvb_adapter *dvb_adapter)
> {
> 	struct dvb_device *dvbdev;
>-	dprintk(verbose, DST_CA_ERROR, 1, "registering DST-CA device");
>-	dvb_register_device(dvb_adapter, &dvbdev, &dvbdev_ca, dst, DVB_DEVICE_CA);
>+	print(verbose, DST_ERROR, 1, "registering DST-CA device");
>+	dvb_register_device(dvb_adapter, &dvbdev,
>+		&dvbdev_ca, dst, DVB_DEVICE_CA);
>+
> 	return 0;
> }
> 
>diff -Naurp bt8xx.orig/dst_common.h bt8xx/dst_common.h
>--- bt8xx.orig/dst_common.h	2005-10-18 23:13:09.000000000 +0400
>+++ bt8xx/dst_common.h	2005-10-24 15:50:34.000000000 +0400
>@@ -77,6 +77,28 @@
> 
> #define ACK			0xff
> 
>+#define DST_ERROR		0
>+#define DST_NOTICE		1
>+#define DST_INFO		2
>+#define DST_DEBUG		3
>+
>+#define print(x, y, z, fmt, arg...) do {				\
>+	if (z) {							\
>+		if	((x > DST_ERROR) && (x > y))			\
>+			vprint("%s: " fmt "\n", __func__ , ##arg);	\
>+		else if	((x > DST_NOTICE) && (x > y))			\
>+			vprint("%s: " fmt "\n",__func__ , ##arg);	\
>+		else if ((x > DST_INFO) && (x > y))			\
>+			vprint("%s: " fmt "\n", __func__ , ##arg);	\
>+		else if ((x > DST_DEBUG) && (x > y))			\
>+			vprint("%s: " fmt "\n", __func__ , ##arg);	\
>+	} else {							\
>+		if (x > y)						\
>+			printk(fmt, ##arg);				\
>+	}								\
>+} while(0)
>+
>+
> struct dst_state {
> 
> 	struct i2c_adapter* i2c;
>@@ -151,11 +173,26 @@ int dst_comm_init(struct dst_state* stat
> int write_dst(struct dst_state *state, u8 * data, u8 len);
> int read_dst(struct dst_state *state, u8 * ret, u8 len);
> u8 dst_check_sum(u8 * buf, u32 len);
>-struct dst_state* dst_attach(struct dst_state* state, struct dvb_adapter *dvb_adapter);
>-int dst_ca_attach(struct dst_state *state, struct dvb_adapter *dvb_adapter);
>-int dst_gpio_outb(struct dst_state* state, u32 mask, u32 enbb, u32 outhigh, int delay);
>+struct dst_state* dst_attach(struct dst_state* state,
>+				struct dvb_adapter *dvb_adapter);
>+
>+int dst_ca_attach(struct dst_state *state,
>+				struct dvb_adapter *dvb_adapter);
>+
>+int dst_gpio_outb(struct dst_state* state, u32 mask, u32 enbb,
>+					   u32 outhigh, int delay);
> 
> int dst_command(struct dst_state* state, u8 * data, u8 len);
> 
> 
>+static inline void vprint(__u8 *fmt, ...)
>+{
>+	va_list args;
>+
>+	va_start(args, fmt);
>+	vprintk(fmt, args);
>+	va_end(args);
>+}
>+
>+
> #endif // DST_COMMON_H
>diff -Naurp bt8xx.orig/dst_priv.h bt8xx/dst_priv.h
>--- bt8xx.orig/dst_priv.h	2005-04-04 22:08:16.000000000 +0400
>+++ bt8xx/dst_priv.h	2005-10-24 15:51:15.000000000 +0400
>@@ -32,4 +32,5 @@ union dst_gpio_packet {
> 
> struct bt878;
> 
>-int bt878_device_control(struct bt878 *bt, unsigned int cmd, union dst_gpio_packet *mp);
>+int bt878_device_control(struct bt878 *bt, unsigned int cmd,
>+			union dst_gpio_packet *mp);
>diff -Naurp bt8xx.orig/dvb-bt8xx.c bt8xx/dvb-bt8xx.c
>--- bt8xx.orig/dvb-bt8xx.c	2005-10-01 21:01:45.000000000 +0400
>+++ bt8xx/dvb-bt8xx.c	2005-10-24 15:51:25.000000000 +0400
>@@ -559,9 +559,9 @@ static int tdvs_tua6034_pll_set(struct d
> 	dprintk("%s: tuner at 0x%02x bytes: 0x%02x 0x%02x 0x%02x 0x%02x\n",
> 		__FUNCTION__, msg.addr, buf[0],buf[1],buf[2],buf[3]);
> 	if ((err = i2c_transfer(card->i2c_adapter, &msg, 1)) != 1) {
>-	        printk(KERN_WARNING "dvb-bt8xx: %s error "
>-		        "(addr %02x <- %02x, err = %i)\n",
>-		        __FUNCTION__, buf[0], buf[1], err);
>+		printk(KERN_WARNING "dvb-bt8xx: %s error "
>+			"(addr %02x <- %02x, err = %i)\n",
>+			__FUNCTION__, buf[0], buf[1], err);
> 		if (err < 0)
> 			return err;
> 		else
>
>  
>
>------------------------------------------------------------------------
>
>--- dst.c.orig	2005-10-24 15:50:24.000000000 +0400
>+++ dst.c	2005-10-24 15:47:37.000000000 +0400
>@@ -630,7 +630,7 @@ struct dst_types dst_tlist[] = {
> 		.offset = 0,
> 		.dst_type =  DST_TYPE_IS_SAT,
> 		.type_flags = DST_TYPE_HAS_SYMDIV | DST_TYPE_HAS_FW_1,
>-		.dst_feature = 0
>+		.dst_feature = DST_TYPE_HAS_DISEQC3
> 	},	/*	obsolete	*/
> 
> 	{
>@@ -639,7 +639,8 @@ struct dst_types dst_tlist[] = {
> 		.dst_type = DST_TYPE_IS_SAT,
> 		.type_flags = DST_TYPE_HAS_TS204 | DST_TYPE_HAS_NEWTUNE
> 						 | DST_TYPE_HAS_FW_1,
>-		.dst_feature = 0
>+
>+		.dst_feature = DST_TYPE_HAS_DISEQC3 | DST_TYPE_HAS_DISEQC4
> 	},	/*	obsolete	*/
> 
> 	{
>@@ -659,7 +660,8 @@ struct dst_types dst_tlist[] = {
> 		.offset =  0,
> 		.dst_type = DST_TYPE_IS_SAT,
> 		.type_flags = DST_TYPE_HAS_SYMDIV | DST_TYPE_HAS_FW_1,
>-		.dst_feature = 0
>+		.dst_feature = DST_TYPE_HAS_DISEQC3 | DST_TYPE_HAS_DISEQC4 |
>+			       DST_TYPE_HAS_DISEQC5
> 	},	/*	obsolete	*/
> 
> 	{
>@@ -669,7 +671,8 @@ struct dst_types dst_tlist[] = {
> 		.type_flags = DST_TYPE_HAS_TS204 | DST_TYPE_HAS_NEWTUNE |
> 			      DST_TYPE_HAS_FW_1,
> 
>-		.dst_feature = DST_TYPE_HAS_CA
>+		.dst_feature = DST_TYPE_HAS_CA		| DST_TYPE_HAS_DISEQC3 |
>+			       DST_TYPE_HAS_DISEQC4	| DST_TYPE_HAS_DISEQC5
> 	},	/*	An OEM board	*/
> 
> 	{
>@@ -680,7 +683,7 @@ struct dst_types dst_tlist[] = {
> 			      DST_TYPE_HAS_FW_BUILD | DST_TYPE_HAS_INC_COUNT,
> 
> 		.dst_feature = DST_TYPE_HAS_CA		| DST_TYPE_HAS_DISEQC3 |
>-			       DST_TYPE_HAS_DISEQC4     | DST_TYPE_HAS_MOTO    |
>+			       DST_TYPE_HAS_DISEQC4     | DST_TYPE_HAS_DISEQC5 |
> 			       DST_TYPE_HAS_MAC
> 	},
> 
>@@ -1260,9 +1263,20 @@ static int dst_set_diseqc(struct dvb_fro
> 
> 	if (state->dst_type != DST_TYPE_IS_SAT)
> 		return 0;
>-	if (cmd->msg_len == 0 || cmd->msg_len > 4)
>+//	if (cmd->msg_len == 0 || cmd->msg_len > 4)
>+//		return -EINVAL;
>+	if (cmd->msg_len == 0 || cmd->msg_len > 5)
> 		return -EINVAL;
>-	memcpy(&paket[3], cmd->msg, cmd->msg_len);
>+	if ((cmd->msg_len == 3) && (state->dst_hw_cap & DST_TYPE_HAS_DISEQC3)) {
>+		memcpy(&paket[3], cmd->msg, cmd->msg_len);
>+		paket[2] = 0x03;
>+	} else if ((cmd->msg_len == 4) && (state->dst_hw_cap & DST_TYPE_HAS_DISEQC4)) {
>+		memcpy(&paket[3], cmd->msg, cmd->msg_len);
>+		paket[2] = 0x04;
>+	} else if ((cmd->msg_len == 5) && (state->dst_hw_cap & DST_TYPE_HAS_DISEQC5)) {
>+		memcpy(&paket[2], cmd->msg, cmd->msg_len);
>+	}
>+
> 	paket[7] = dst_check_sum(&paket[0], 7);
> 	dst_command(state, paket, 8);
> 	return 0;
>
>  
>




More information about the linux-dvb mailing list