[linux-dvb] [Patch] Added Nova-S-Plus and Nova-SE2 DVB-S support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Dec 01, 2005, Steve Toth wrote:
> @@ -501,12 +503,11 @@ static int cx24123_pll_writereg(struct d
>  	cx24123_writereg(state, 0x22, (data >> 16) & 0xff);
>  	while ( ( cx24123_readreg(state, 0x20) & 0x40 ) == 0 )
>  	{
> -		/* Safety - No reason why the write should not complete, and we never get here, avoid hang */
>  		if (timeout++ >= 4) {
> -			printk("%s:  demodulator is no longer responding, aborting.\n",__FUNCTION__);
> +			printk("%s:  demodulator is not responding, possibly hung, aborting.\n", __FUNCTION__);
>  			return -EREMOTEIO;
>  		}
> -		msleep(500);
> +		msleep(10);
>  	}

I know this nit-picking in this case, but code tends to get copied
and reussed so it pays off to do the trivial cases correctly.
An msleep(10) could sleep very long if the machine is busy,
thus one should write timeout code like this:

	unsigned long timeout = jiffies + msecs_to_jiffies(40);
	cx24123_writereg(state, 0x22, (data >> 16) & 0xff);
	while ((cx24123_readreg(state, 0x20) & 0x40) == 0) {
		if (time_after(jiffies, timeout)) {
			printk("%s:  demodulator is not responding, possibly hung, aborting.\n", __FUNCTION__);
			return -EREMOTEIO;
		}
		msleep(10);
	}

Johannes


[Index of Archives]     [Linux Media]     [Video 4 Linux]     [Asterisk]     [Samba]     [Xorg]     [Xfree86]     [Linux USB]

  Powered by Linux