Johannes Stezenbach wrote: > Steffen Motzer wrote: > >>These patches fix the following bugs: >> >>bttv-i2c.c: >>After upgrading from 2.6.9 to 2.6.11.7, bttv failed to write to the ASIC >>via the i2c bus. After a couple of times bttv_i2c_wait_done was called >>the RACK flag was indicating a failed i2c operation. > > > A number of bttv patches whent into 2.6.12-rc2. Does you stuff still > apply there? > > > >>*** bttv-i2c.c.orig 2005-04-23 00:42:40.000000000 +0200 >>--- bttv-i2c.c 2005-04-23 02:09:43.000000000 +0200 >>*************** bttv_i2c_wait_done(struct bttv *btv) >>*** 135,143 **** > > > Please send unified diffs only! > > >> DECLARE_WAITQUEUE(wait, current); >> int rc = 0; >> >> add_wait_queue(&btv->i2c_queue, &wait); >>! if (0 == btv->i2c_done) >>! msleep_interruptible(20); >> remove_wait_queue(&btv->i2c_queue, &wait); >> >> if (0 == btv->i2c_done) >>--- 135,148 ---- >> DECLARE_WAITQUEUE(wait, current); >> int rc = 0; >> >>+ unsigned long timeout = msecs_to_jiffies(20); >>+ >> add_wait_queue(&btv->i2c_queue, &wait); >>! >>! while (0 == btv->i2c_done && timeout) { >>! set_current_state(TASK_INTERRUPTIBLE); >>! timeout = schedule_timeout(timeout); >>! } >> remove_wait_queue(&btv->i2c_queue, &wait); >> >> if (0 == btv->i2c_done) > > > This code looks strange (before and after your change). > Why isn't this a simple > > wait_event_interruptible_timeout(&btv->i2c_queue, btv->i2c_done, > msecs_to_jiffies(20)); > > ? I tried it out, but when you suggested that, i found another problem that i had been going after .. Attached is my patch.. to what you suggested.. With this the tuning speed seems to be better, and i am kind of seeing lesser cases of the driver getting into error recovery .. Maybe Gerd can comment on this, as i am not too comforatble in this area .. The reason why i have 6, is that it is higher than the worst case timeout.. With larger values at least for the dst/dst_ca drivers, It feels kind of "sluggish" to move around .. I don't know how exactly to explain that, but higher values causes more chances of i2c errors and slower tuning .. Manu -------------- next part -------------- A non-text attachment was scrubbed... Name: waitqueue-bttv-i2c.diff Type: text/x-patch Size: 542 bytes Desc: not available Url : http://www.linuxtv.org/pipermail/linux-dvb/attachments/20050423/e5f6cfbf/waitqueue-bttv-i2c.bin