On Wed, Jul 04, 2012 at 09:18:03AM +0200, Hans de Goede wrote:
> +static void snoop_urb_data(struct urb *urb, unsigned len)
> +{
> + int i, size;
> +
> + if (!usbfs_snoop)
> + return;
> +
> + if (urb->num_sgs == 0) {
> + print_hex_dump(KERN_DEBUG, "data: ", DUMP_PREFIX_NONE, 32, 1,
> + urb->transfer_buffer, len, 1);
> + return;
> + }
> +
> + for (i = 0; i < urb->num_sgs && len; i++) {
> + size = (len > USB_SG_SIZE) ? USB_SG_SIZE : len;
> + print_hex_dump(KERN_DEBUG, "data: ", DUMP_PREFIX_NONE, 32, 1,
> + sg_virt(&urb->sg[i]), size, 1);
> + len -= size;
> + }
> +}
Minor cleanup in the future, can't this be merged with snoop_urb() that
way you don't have to do the logic checking in the places you call this
function instead of snoop_urb()? That would make it a bit simpler for
the "normal" code path, right?
thanks,
greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html