> For now, let me give a quick explanation of the basics of videobuf. > > --- > (part 2) As you know, the original author of videobuf is Gerd. At the changes I did, I've tried to preserve, as much as possible, the code outside videobuf without changes(*). (*) This is also true for the binary code that videobuf-core + videobuf_dma_sg executes: It is almost the same as the original videobuf, but separated into two separate modules, with distinct functions. a) The first one is about the inherited videobuf_buffer class at each driver. The approach used on videobuf is somehow different from what other parts of the Linux Kernel does. For this to work, the first part of a videobuf_buffer inherited code should do: cx23885_buffer { struct videbuf_buffer; ... } Otherwise, the videobuf code will fail. IMO, it would be better to use container_of as you suggested, but this would mean rewrite more code at the drivers, and do more tests. b) The destructor used to free videobuf_buffer memory is just kfree. So, all memory for the entire class should be allocated with just one kmalloc. The memory model is something like: struct derivated_class { struct cx23885_buffer { struct videobuf_buffer; // cx23885 own data } // dma s/g own data }; So, videobuf_pci_malloc do something like: buf=kmalloc (sizeof(struct derivated_class), GFP_KERNEL); To free a videobuf, you just need to do: free (buf); -- Cheers, Mauro _______________________________________________ linux-dvb mailing list linux-dvb@xxxxxxxxxxx http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb