diff options
Diffstat (limited to 'drivers/media/common/saa7146_i2c.c')
-rw-r--r-- | drivers/media/common/saa7146_i2c.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/drivers/media/common/saa7146_i2c.c b/drivers/media/common/saa7146_i2c.c index 5297a365c928..8c85efc26527 100644 --- a/drivers/media/common/saa7146_i2c.c +++ b/drivers/media/common/saa7146_i2c.c | |||
@@ -189,13 +189,21 @@ static int saa7146_i2c_writeout(struct saa7146_dev *dev, u32* dword, int short_d | |||
189 | saa7146_write(dev, I2C_TRANSFER, *dword); | 189 | saa7146_write(dev, I2C_TRANSFER, *dword); |
190 | 190 | ||
191 | dev->i2c_op = 1; | 191 | dev->i2c_op = 1; |
192 | SAA7146_ISR_CLEAR(dev, MASK_16|MASK_17); | ||
192 | SAA7146_IER_ENABLE(dev, MASK_16|MASK_17); | 193 | SAA7146_IER_ENABLE(dev, MASK_16|MASK_17); |
193 | saa7146_write(dev, MC2, (MASK_00 | MASK_16)); | 194 | saa7146_write(dev, MC2, (MASK_00 | MASK_16)); |
194 | 195 | ||
195 | wait_event_interruptible(dev->i2c_wq, dev->i2c_op == 0); | 196 | timeout = HZ/100 + 1; /* 10ms */ |
196 | if (signal_pending (current)) { | 197 | timeout = wait_event_interruptible_timeout(dev->i2c_wq, dev->i2c_op == 0, timeout); |
197 | /* a signal arrived */ | 198 | if (timeout == -ERESTARTSYS || dev->i2c_op) { |
198 | return -ERESTARTSYS; | 199 | SAA7146_IER_DISABLE(dev, MASK_16|MASK_17); |
200 | SAA7146_ISR_CLEAR(dev, MASK_16|MASK_17); | ||
201 | if (timeout == -ERESTARTSYS) | ||
202 | /* a signal arrived */ | ||
203 | return -ERESTARTSYS; | ||
204 | |||
205 | printk(KERN_WARNING "saa7146_i2c_writeout: timed out waiting for end of xfer\n"); | ||
206 | return -EIO; | ||
199 | } | 207 | } |
200 | status = saa7146_read(dev, I2C_STATUS); | 208 | status = saa7146_read(dev, I2C_STATUS); |
201 | } else { | 209 | } else { |