[linux-dvb] [PATCH] Update FE_DISHNETWORK_SEND_LEGACY_CMD for current kernels

Johannes Stezenbach js at linuxtv.org
Sun Mar 27 22:45:56 CEST 2005


On Sun, Mar 27, 2005 at 11:27:49AM -0800, NooneImportant wrote:
> The following patch fixes the current stv0299 code that handles
> FE_DISHNETWORK_SEND_LEGACY_CMD.
> (This code supports the legacy SW21, SW44, and SW64 switches)

Would you mind to do some clean ups?

> +static int debug_dn_switch;

I would suggest "debug_dish_network".

> +#define USEC_DELAY(b,a) (((a).tv_usec < (b).tv_usec) ? \
> +		1000000 - (b).tv_usec + (a).tv_usec : (a).tv_usec - (b).tv_usec)
> +#define ADD_TIME_USECS(a,b) ({(a).tv_usec += (b); \
> +                if((a).tv_usec>=1000000) {(a).tv_usec-=1000000; (a).tv_sec++;}})

Please use static inline functions.

> +static void stv0299_sleep_until(struct timeval waketime)
> +{
> +       struct timeval lasttime;
> +       s32 delta, newdelta;
> +       do_gettimeofday(&lasttime);
> +       delta=USEC_DELAY(lasttime,waketime);
> +       if(delta > 2500) {

Please put a space after if, and between operators:
	delta = USEC_DELAY(lasttime, waketime);
	if (delta > 2500) {

> +         msleep((delta-1500)/1000);
> +         do_gettimeofday(&lasttime);
> +         newdelta=USEC_DELAY(lasttime,waketime);
> +         delta=(newdelta>delta)? 0 : newdelta;
> +       }

Broken indentation. Please use one tab, not 8 spaces and certainly not 2 spaces.

> +        struct stv0299_state* state = (struct stv0299_state*) fe->demodulator_priv;

Unnecessary cast.


Thanks,
Johannes




More information about the linux-dvb mailing list