Am Sonntag, den 07.10.2007, 14:03 -0700 schrieb Trent Piepho: > On Sun, 7 Oct 2007, Mauro Carvalho Chehab wrote: > > I took a look at cx23885 code. It seems that there's a serious error on > > the way you're using cx23885_buffer there: > > > > cx23885-dvb.c: return cx23885_buf_prepare(q, port, (struct > > cx23885_buffer*)vb, field); > > cx23885-dvb.c: cx23885_buf_queue(port, (struct cx23885_buffer*)vb); > > cx23885-dvb.c: cx23885_free_buffer(q, (struct cx23885_buffer*)vb); > > > > It seems that you are forcing videobuf_buffer to be cx23885_buffer. This > > is not right! > > > > This is what is defined on cx23885.h: > > > > struct cx23885_buffer { > > /* common v4l buffer stuff -- must be first */ > > struct videobuf_buffer vb; > > I'm not sure that it is competely wrong. Say one has a cx23885_buffer that > contains a videobuf_buffer. Now suppose you have a pointer to the > videobuf_buffer, and you want to get a pointer to the cx23885_buffer that > contains it. What you should write is: > > struct videobuf_buffer *vb = ...; > struct cx23885_buffer *buf = container_of(vb, struct cx23885_buffer, vb); > > But since vb is the first field of the cx23885_buffer struct, the container_of > will turn into just '(struct cx23885_buffer *)(vb)' > > This code in videobuf-dma-sg.c looks odd to me: > > /* Allocated area consists on 3 parts: > struct video_buffer > struct <driver>_buffer (cx88_buffer, saa7134_buf, ...) > struct videobuf_pci_sg_memory > > static void *__videobuf_alloc(size_t size) > { > struct videbuf_pci_sg_memory *mem; > struct videobuf_buffer *vb; > > vb = kzalloc(size+sizeof(*mem),GFP_KERNEL); > > mem = vb->priv = ((char *)vb)+size; > > What is 'size', is that the size of the driver buffer? Shouldn't you be > allocating size + sizeof(*vb) + sizeof(*mem)? > > Is there documentation for videobuf anywhere? It doesn't look like any of > the videobuf functions have descriptions of that they do or what the > parameters are. As far as I know, there is no further documentation, except the little what is on the list. It is work done by Gerd, and we almost always had fun. Hermann _______________________________________________ linux-dvb mailing list linux-dvb@xxxxxxxxxxx http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb