Hi Andrzej, Thank you for the patch. On Friday 16 January 2015 15:14:26 Andrzej Pietrasiewicz wrote: > This reverts commit c0b53cb16250 ("usb: gadget: uvc: cleanup > __uvcg_fill_strm()"). I can't find that commit in Linus' master, next/master or Felipe's next branch. If the patch hasn't been applied there's no need to revert it :-) > __uvcg_fill_stream() during its execution uses priv2 as a pointer > to a pointer, because it advances the current position by the amount > of data taken by each processed descriptor and the advanced position > should be visible outside this function, so that the next time it is > called, the current position corresponds to the place where it was > the last time rather than again at the beginning of some block of data. > In other words priv2 is an "out" parameter. > > Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@xxxxxxxxxxx> > --- > drivers/usb/gadget/function/uvc_configfs.c | 39 +++++++++++++------------- > 1 file changed, 20 insertions(+), 19 deletions(-) > > diff --git a/drivers/usb/gadget/function/uvc_configfs.c > b/drivers/usb/gadget/function/uvc_configfs.c index 8a6cd61..cc2a613 100644 > --- a/drivers/usb/gadget/function/uvc_configfs.c > +++ b/drivers/usb/gadget/function/uvc_configfs.c > @@ -2000,27 +2000,28 @@ static int __uvcg_cnt_strm(void *priv1, void *priv2, > void *priv3, int n, return 0; > } > > -static int __uvcg_fill_strm(void *priv1, void *dest, void *priv3, int n, > +static int __uvcg_fill_strm(void *priv1, void *priv2, void *priv3, int n, > enum uvcg_strm_type type) > { > + void **dest = priv2; > struct uvc_descriptor_header ***array = priv3; > size_t sz; > > - **array = dest; > + **array = *dest; > ++*array; > > switch (type) { > case UVCG_HEADER: { > - struct uvc_input_header_descriptor *ihdr = dest; > + struct uvc_input_header_descriptor *ihdr = *dest; > struct uvcg_streaming_header *h = priv1; > struct uvcg_format_ptr *f; > > - memcpy(dest, &h->desc, sizeof(h->desc)); > - dest += sizeof(h->desc); > + memcpy(*dest, &h->desc, sizeof(h->desc)); > + *dest += sizeof(h->desc); > sz = UVCG_STREAMING_CONTROL_SIZE; > list_for_each_entry(f, &h->formats, entry) { > - memcpy(dest, f->fmt->bmaControls, sz); > - dest += sz; > + memcpy(*dest, f->fmt->bmaControls, sz); > + *dest += sz; > } > ihdr->bLength = sizeof(h->desc) + h->num_fmt * sz; > ihdr->bNumFormats = h->num_fmt; > @@ -2030,22 +2031,22 @@ static int __uvcg_fill_strm(void *priv1, void *dest, > void *priv3, int n, struct uvcg_format *fmt = priv1; > > if (fmt->type == UVCG_UNCOMPRESSED) { > - struct uvc_format_uncompressed *unc = dest; > + struct uvc_format_uncompressed *unc = *dest; > struct uvcg_uncompressed *u = > container_of(fmt, struct uvcg_uncompressed, > fmt); > > - memcpy(dest, &u->desc, sizeof(u->desc)); > - dest += sizeof(u->desc); > + memcpy(*dest, &u->desc, sizeof(u->desc)); > + *dest += sizeof(u->desc); > unc->bNumFrameDescriptors = fmt->num_frames; > unc->bFormatIndex = n + 1; > } else if (fmt->type == UVCG_MJPEG) { > - struct uvc_format_mjpeg *mjp = dest; > + struct uvc_format_mjpeg *mjp = *dest; > struct uvcg_mjpeg *m = > container_of(fmt, struct uvcg_mjpeg, fmt); > > - memcpy(dest, &m->desc, sizeof(m->desc)); > - dest += sizeof(m->desc); > + memcpy(*dest, &m->desc, sizeof(m->desc)); > + *dest += sizeof(m->desc); > mjp->bNumFrameDescriptors = fmt->num_frames; > mjp->bFormatIndex = n + 1; > } else { > @@ -2055,15 +2056,15 @@ static int __uvcg_fill_strm(void *priv1, void *dest, > void *priv3, int n, break; > case UVCG_FRAME: { > struct uvcg_frame *frm = priv1; > - struct uvc_descriptor_header *h = dest; > + struct uvc_descriptor_header *h = *dest; > > sz = sizeof(frm->frame); > - memcpy(dest, &frm->frame, sz); > - dest += sz; > + memcpy(*dest, &frm->frame, sz); > + *dest += sz; > sz = frm->frame.b_frame_interval_type * > sizeof(*frm->dw_frame_interval); > - memcpy(dest, frm->dw_frame_interval, sz); > - dest += sz; > + memcpy(*dest, frm->dw_frame_interval, sz); > + *dest += sz; > if (frm->fmt_type == UVCG_UNCOMPRESSED) > h->bLength = UVC_DT_FRAME_UNCOMPRESSED_SIZE( > frm->frame.b_frame_interval_type); > @@ -2126,7 +2127,7 @@ static int uvcg_streaming_class_allow_link(struct > config_item *src, goto unlock; > } > cl_arr = *class_array; > - ret = __uvcg_iter_strm_cls(target_hdr, data, &cl_arr, > + ret = __uvcg_iter_strm_cls(target_hdr, &data, &cl_arr, > __uvcg_fill_strm); > if (ret) { > kfree(*class_array); -- Regards, Laurent Pinchart -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html