Oliver Endriss wrote: > - With your code the demux becomes unusable if the memory allocation > failes for some reason. This should be avoided. It is better have a > working demux with a smaller buffer than to have an defunct demux. > > - If there is not enough memory for both buffers, your machine has a problem > anyway, and you should not increase buffer size. > > .... > I'm sorry, spin_lock_irqsave/spin_unlock_irqrestore was a typo. > We have to use spin_[un]lock_irq because buffer writing _might_ occur > in interrupt context. So the '_irq' is very important! > Ok. I've changed the second patch to 1) allocate the new buffer before releasing the old one 2) use spin_[un]lock_irq 3) On top of that, I have rearranged the code of DMX_SET_BUFFER_SIZE for the demux so that it does the same as the dvr (i.e. allocate the new buffer before releasing the old one). I think it is a good idea that 2 very similar functions are implemented in the same way. (if you don't agree, or if you think a 3rd separate patch for this point is a better idea, let me know.) PS: Both patches 1/3 and 2/3 are against a clean v4l-dvb tree. I do not know how to generate incremental patch for 2/3. Let me know what you think about that. Andrea