Re: [PATCH v7] usb/gadget: Add driver for Aspeed SoC virtual hub

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

 



On Tue, 2018-03-27 at 10:30 +0300, Felipe Balbi wrote:
> Hi,
> 
> Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx> writes:
> 
> <snip>
> 
> > +static int ast_vhub_rep_desc(struct ast_vhub_ep *ep,
> > +			     u8 desc_type, u16 len)
> > +{
> > +	const void *desc;
> > +	size_t dsize;
> > +
> > +	EPDBG(ep, "GET_DESCRIPTOR(type:%d)\n", desc_type);
> > +	switch(desc_type) {
> > +	case USB_DT_DEVICE:
> > +		desc = &ast_vhub_dev_desc;
> > +		dsize = USB_DT_DEVICE_SIZE;
> > +		break;
> > +	case USB_DT_CONFIG:
> > +		desc = &ast_vhub_conf_desc;
> > +		dsize = AST_VHUB_CONF_DESC_SIZE;
> > +		break;
> > +	case USB_DT_HUB:
> > +		desc = &ast_vhub_hub_desc;
> > +		dsize = AST_VHUB_HUB_DESC_SIZE;
> > +		break;
> > +	default:
> > +		return std_req_stall;
> > +	}
> > +	if (dsize < len)
> > +		len = dsize;
> > +	/*
> > +	 * This is our limit for hub replies in our current
> > +	 * implementation, keeps things simpler.
> > +	 */
> > +	if (WARN_ON(len >= AST_VHUB_EP0_MAX_PACKET))
> > +		len = AST_VHUB_EP0_MAX_PACKET - 1;
> > +
> > +	/*
> > +	 * Copy first to EP buffer and send from there, so
> > +	 * we can do some in-place patching if needed
> > +	 */
> > +	memcpy(ep->buf, desc, len);
> 
> still fails to compile here the same way.
> 
> $ gcc --version
> gcc (Debian 7.3.0-12) 7.3.0

Hrm, no idea what to do about it short of installing myself a debian on
some machine here. Is that an x86 compiler or a cross compiler ?

It really looks like a compiler bug to me...

> > +
> > +	/* Patch it if forcing USB1 */
> > +	if (desc_type == USB_DT_DEVICE && ep->vhub->force_usb1)
> > +		ast_vhub_patch_dev_desc_usb1(ep->buf);
> > +
> > +	/* Shoot it from the EP buffer */
> > +	return ast_vhub_reply(ep, NULL, len);
> > +}
> > +
> > +/* copied from hdc.c */
> > +static unsigned
> > +ascii2desc(char const *s, u8 *buf, unsigned len)
> 
> seems it would be best to move this helper to usb common, or something
> like that. Copying is not a good idea.

Yeah I can do that, would have to pick a better name though ;-)

> > +static int ast_vhub_rep_string(struct ast_vhub_ep *ep,
> > +			       u8 string_id, u16 lang_id,
> > +			       u16 len)
> 
> spaces for indentation?

An accident, not sure how those snuck in, I'll fix.

Ben.

--
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