Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 737fee1b authored by Chris Rorvick's avatar Chris Rorvick Committed by Greg Kroah-Hartman
Browse files

staging: emxx_udc: Remove nbu2ss_drv_set_dp_info()



This function is an awkward helper for nbu2ss_drv_ep_init().  Most of
its logic is devoted to determining if the current endpoint is ep0,
something the caller can easily do in a single line.  And there is not
a lot going on beyond that.

Move this logic up into nbu2ss_drv_ep_init().  The result is much easier
to understand and the resulting function is still viewable within a
single screen.

Signed-off-by: default avatarChris Rorvick <chris@rorvick.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 36e4d882
Loading
Loading
Loading
Loading
+14 −38
Original line number Diff line number Diff line
@@ -3249,53 +3249,29 @@ static const char *gp_ep_name[NUM_ENDPOINTS] = {
};

/*-------------------------------------------------------------------------*/
static void __init nbu2ss_drv_set_ep_info(
	struct nbu2ss_udc	*udc,
	struct nbu2ss_ep	*ep,
	const char *name)
static void __init nbu2ss_drv_ep_init(struct nbu2ss_udc *udc)
{
	int	i;

	INIT_LIST_HEAD(&udc->gadget.ep_list);
	udc->gadget.ep0 = &udc->ep[0].ep;

	for (i = 0; i < NUM_ENDPOINTS; i++) {
		struct nbu2ss_ep *ep = &udc->ep[i];

		ep->udc = udc;
		ep->desc = NULL;

		ep->ep.driver_data = NULL;
	ep->ep.name = name;
		ep->ep.name = gp_ep_name[i];
		ep->ep.ops = &nbu2ss_ep_ops;

	if (isdigit(name[2])) {

		long	num;
		int	res;
		char	tempbuf[2];

		tempbuf[0] = name[2];
		tempbuf[1] = '\0';
		res = kstrtol(tempbuf, 16, &num);

		if (num == 0)
			ep->ep.maxpacket = EP0_PACKETSIZE;
		else
			ep->ep.maxpacket = EP_PACKETSIZE;

	} else {
		ep->ep.maxpacket = EP_PACKETSIZE;
	}
		ep->ep.maxpacket = (i == 0 ? EP0_PACKETSIZE : EP_PACKETSIZE);

		list_add_tail(&ep->ep.ep_list, &udc->gadget.ep_list);
		INIT_LIST_HEAD(&ep->queue);
	}

/*-------------------------------------------------------------------------*/
static void __init nbu2ss_drv_ep_init(struct nbu2ss_udc *udc)
{
	int	i;

	INIT_LIST_HEAD(&udc->gadget.ep_list);
	udc->gadget.ep0 = &udc->ep[0].ep;


	for (i = 0; i < NUM_ENDPOINTS; i++)
		nbu2ss_drv_set_ep_info(udc, &udc->ep[i], gp_ep_name[i]);

	list_del_init(&udc->ep[0].ep.ep_list);
}