greybus: tidy up svc_in_callback() and cport_in_callback()
authorAlex Elder <elder@linaro.org>
Wed, 19 Nov 2014 18:27:14 +0000 (12:27 -0600)
committerGreg Kroah-Hartman <greg@kroah.com>
Wed, 19 Nov 2014 18:41:12 +0000 (10:41 -0800)
The only use of local variable "es1" in in svc_in_callback() and
cport_in_callback() is to get at its hd field.  But we already have
that, so we can get rid of that local variable.

Also, rename the "cport" variable "cport_id" in cport_in_callback()
is to match the convention used elsewhere, and make it the proper
u16 type.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
drivers/staging/greybus/es1-ap-usb.c

index 658506d..7745b81 100644 (file)
@@ -346,7 +346,6 @@ static void ap_disconnect(struct usb_interface *interface)
 static void svc_in_callback(struct urb *urb)
 {
        struct greybus_host_device *hd = urb->context;
-       struct es1_ap_dev *es1 = hd_to_es1(hd);
        struct device *dev = &urb->dev->dev;
        int status = check_urb_status(urb);
        int retval;
@@ -361,7 +360,7 @@ static void svc_in_callback(struct urb *urb)
        /* We have a message, create a new message structure, add it to the
         * list, and wake up our thread that will process the messages.
         */
-       greybus_svc_in(es1->hd, urb->transfer_buffer, urb->actual_length);
+       greybus_svc_in(hd, urb->transfer_buffer, urb->actual_length);
 
 exit:
        /* resubmit the urb to get more messages */
@@ -373,11 +372,10 @@ exit:
 static void cport_in_callback(struct urb *urb)
 {
        struct greybus_host_device *hd = urb->context;
-       struct es1_ap_dev *es1 = hd_to_es1(hd);
        struct device *dev = &urb->dev->dev;
        int status = check_urb_status(urb);
        int retval;
-       u8 cport;
+       u16 cport_id;
        u8 *data;
 
        if (status) {
@@ -398,11 +396,11 @@ static void cport_in_callback(struct urb *urb)
         * the stream is "real" data
         */
        data = urb->transfer_buffer;
-       cport = data[0];
+       cport_id = (u16)data[0];
        data = &data[1];
 
        /* Pass this data to the greybus core */
-       greybus_cport_in(es1->hd, cport, data, urb->actual_length - 1);
+       greybus_cport_in(hd, cport_id, data, urb->actual_length - 1);
 
 exit:
        /* put our urb back in the request pool */