From f470ead894e3d33e70f62d43b8e255beb37f183b Mon Sep 17 00:00:00 2001 From: Fabien Parent Date: Wed, 2 Sep 2015 15:50:38 +0200 Subject: [PATCH] greybus: es{1,2}: remove control endpoint field There is no need to store the endpoint number of the control requests since the default control endpoint is used and the USB standard defines for it a fixed endpoint number of 0. Remove every instance of the field control_endpoint and replace it with a hardcoded 0 value. Signed-off-by: Fabien Parent Reviewed-by: Johan Hovold Signed-off-by: Johan Hovold --- drivers/staging/greybus/es1.c | 9 +-------- drivers/staging/greybus/es2.c | 13 ++----------- 2 files changed, 3 insertions(+), 19 deletions(-) diff --git a/drivers/staging/greybus/es1.c b/drivers/staging/greybus/es1.c index fc4297a8bdb2..f049d655b82e 100644 --- a/drivers/staging/greybus/es1.c +++ b/drivers/staging/greybus/es1.c @@ -59,7 +59,6 @@ static DEFINE_KFIFO(apb1_log_fifo, char, APB1_LOG_SIZE); * @usb_dev: pointer to the USB device we are. * @usb_intf: pointer to the USB interface we are bound to. * @hd: pointer to our greybus_host_device structure - * @control_endpoint: endpoint to send data to SVC * @cport_in_endpoint: bulk in endpoint for CPort data * @cport-out_endpoint: bulk out endpoint for CPort data * @cport_in_urb: array of urbs for the CPort in messages @@ -76,7 +75,6 @@ struct es1_ap_dev { struct usb_interface *usb_intf; struct greybus_host_device *hd; - __u8 control_endpoint; __u8 cport_in_endpoint; __u8 cport_out_endpoint; @@ -420,8 +418,7 @@ static void apb1_log_get(struct es1_ap_dev *es1, char *buf) /* SVC messages go down our control pipe */ do { retval = usb_control_msg(es1->usb_dev, - usb_rcvctrlpipe(es1->usb_dev, - es1->control_endpoint), + usb_rcvctrlpipe(es1->usb_dev, 0), REQUEST_LOG, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, 0x00, 0x00, @@ -577,10 +574,6 @@ static int ap_probe(struct usb_interface *interface, spin_lock_init(&es1->cport_out_urb_lock); usb_set_intfdata(interface, es1); - /* Control endpoint is the pipe to talk to this AP, so save it off */ - endpoint = &udev->ep0.desc; - es1->control_endpoint = endpoint->bEndpointAddress; - /* find all 3 of our endpoints */ iface_desc = interface->cur_altsetting; for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) { diff --git a/drivers/staging/greybus/es2.c b/drivers/staging/greybus/es2.c index 13605b8f873b..d6bd210a6337 100644 --- a/drivers/staging/greybus/es2.c +++ b/drivers/staging/greybus/es2.c @@ -83,7 +83,6 @@ struct es1_cport_out { * @usb_dev: pointer to the USB device we are. * @usb_intf: pointer to the USB interface we are bound to. * @hd: pointer to our greybus_host_device structure - * @control_endpoint: endpoint to send data to SVC * @cport_in: endpoint, urbs and buffer for cport in messages * @cport_out: endpoint for for cport out messages @@ -99,8 +98,6 @@ struct es1_ap_dev { struct usb_interface *usb_intf; struct greybus_host_device *hd; - __u8 control_endpoint; - struct es1_cport_in cport_in[NUM_BULKS]; struct es1_cport_out cport_out[NUM_BULKS]; struct urb *cport_out_urb[NUM_CPORT_OUT_URB]; @@ -169,8 +166,7 @@ int map_cport_to_ep(struct es1_ap_dev *es1, cport_to_ep->endpoint_out = es1->cport_out[bulk_ep_set].endpoint; retval = usb_control_msg(es1->usb_dev, - usb_sndctrlpipe(es1->usb_dev, - es1->control_endpoint), + usb_sndctrlpipe(es1->usb_dev, 0), REQUEST_EP_MAPPING, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, 0x00, 0x00, @@ -518,8 +514,7 @@ static void apb1_log_get(struct es1_ap_dev *es1, char *buf) /* SVC messages go down our control pipe */ do { retval = usb_control_msg(es1->usb_dev, - usb_rcvctrlpipe(es1->usb_dev, - es1->control_endpoint), + usb_rcvctrlpipe(es1->usb_dev, 0), REQUEST_LOG, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, 0x00, 0x00, @@ -714,10 +709,6 @@ static int ap_probe(struct usb_interface *interface, spin_lock_init(&es1->cport_out_urb_lock); usb_set_intfdata(interface, es1); - /* Control endpoint is the pipe to talk to this AP, so save it off */ - endpoint = &udev->ep0.desc; - es1->control_endpoint = endpoint->bEndpointAddress; - es1->cport_to_ep = kcalloc(hd->num_cports, sizeof(*es1->cport_to_ep), GFP_KERNEL); if (!es1->cport_to_ep) { -- 2.20.1