Re: [PATCH 1/4] usbnet: move the CDC parser into USB core

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Oliver Neukum <oneukum@xxxxxxxx> writes:

> The dependencies were impossible to handle preventing
> drivers for CDC devices not which are not network drivers
> from using the common parser.
>
> Signed-off-by: Oliver Neukum <ONeukum@xxxxxxxx>
> ---
>  drivers/net/usb/usbnet.c   | 138 ----------------------------------------
>  drivers/usb/core/message.c | 153 +++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 153 insertions(+), 138 deletions(-)

Yes, we really want to keep the net and usb CDC parsing in the same
place, and making all usb drivers depend on usbnet is of course not an
option.

> +/**
> + * cdc_parse_cdc_header - parse the extra headers present in CDC devices
> + * @hdr: the place to put the results of the parsing
> + * @intf: the interface for which parsing is requested
> + * @buffer: pointer to the extra headers to be parsed
> + * @buflen: length of the extra headers
> + *
> + * This evaluates the extra headers present in CDC devices which
> + * bind the interfaces for data and control and provide details
> + * about the capabilities of the device.
> + *
> + * Return: number of bytes of the buffer parsed or -EINVAL
> + * if the header is contradictory beyond salvage
> + */

The description of Return sounds like a good interface to me.  But, it's
not what's implemented, is it?


> +int cdc_parse_cdc_header(struct usb_cdc_parsed_header *hdr,
..
> +	int cnt = 0;
> +
> +	memset(hdr, 0x00, sizeof(struct usb_cdc_parsed_header));
> +	hdr->phonet_magic_present = false;
> +	while (buflen > 0) {
..
> +		cnt++;
> +next_desc:
> +		buflen -= elength;
> +		buffer += elength;
> +	}
> +	hdr->usb_cdc_union_desc = union_header;
> +	hdr->usb_cdc_header_desc = header;
> +	hdr->usb_cdc_mdlm_detail_desc = detail;
> +	hdr->usb_cdc_mdlm_desc = desc;
> +	hdr->usb_cdc_ether_desc = ether;
> +	return cnt;
> +}

This looks like it just counts the number of CDC descriptors and returns
that count, possibly 0.  It will not -EINVAL or any other negative
number AFAICS.  Unless I'm missing something?


Bjørn
--
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



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux