greybus: es{1,2}: remove control endpoint field
authorFabien Parent <fparent@baylibre.com>
Wed, 2 Sep 2015 13:50:38 +0000 (15:50 +0200)
committerJohan Hovold <johan@hovoldconsulting.com>
Wed, 2 Sep 2015 14:28:11 +0000 (16:28 +0200)
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 <fparent@baylibre.com>
Reviewed-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
drivers/staging/greybus/es1.c
drivers/staging/greybus/es2.c

index fc4297a..f049d65 100644 (file)
@@ -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) {
index 13605b8..d6bd210 100644 (file)
@@ -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) {