From: Felipe Balbi <balbi@kernel.org>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>,
linux-usb@vger.kernel.org
Cc: Greg KH <greg@kroah.com>, Joel Stanley <joel@jms.id.au>,
Andrew Jeffery <andrew@aj.id.au>
Subject: [v7] usb/gadget: Add driver for Aspeed SoC virtual hub
Date: Tue, 27 Mar 2018 10:30:36 +0300 [thread overview]
Message-ID: <87sh8mm0v7.fsf@linux.intel.com> (raw)
Hi,
Benjamin Herrenschmidt <benh@kernel.crashing.org> 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
> +
> + /* 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.
> +static int ast_vhub_rep_string(struct ast_vhub_ep *ep,
> + u8 string_id, u16 lang_id,
> + u16 len)
spaces for indentation?
next reply other threads:[~2018-03-27 7:30 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-27 7:30 Felipe Balbi [this message]
-- strict thread matches above, loose matches on Subject: below --
2018-03-28 23:10 [v7] usb/gadget: Add driver for Aspeed SoC virtual hub Benjamin Herrenschmidt
2018-03-28 22:26 Benjamin Herrenschmidt
2018-03-28 22:19 Benjamin Herrenschmidt
2018-03-27 7:57 Benjamin Herrenschmidt
2018-03-26 0:32 Benjamin Herrenschmidt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87sh8mm0v7.fsf@linux.intel.com \
--to=balbi@kernel.org \
--cc=andrew@aj.id.au \
--cc=benh@kernel.crashing.org \
--cc=greg@kroah.com \
--cc=joel@jms.id.au \
--cc=linux-usb@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.