]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/staging/ozwpan/ozusbsvc1.c
Merge tag 'renesas-clocksource-for-v3.12' into next
[karo-tx-linux.git] / drivers / staging / ozwpan / ozusbsvc1.c
index 50d21bf4f927b2b144ee2b65eec01405abd296db..228bffaa69c913e31205582082f4b112e857bb0d 100644 (file)
 #include "ozusbif.h"
 #include "ozhcd.h"
 #include "ozusbsvc.h"
-/*------------------------------------------------------------------------------
- */
+
 #define MAX_ISOC_FIXED_DATA    (253-sizeof(struct oz_isoc_fixed))
-/*------------------------------------------------------------------------------
+
+/*
  * Context: softirq
  */
 static int oz_usb_submit_elt(struct oz_elt_buf *eb, struct oz_elt_info *ei,
@@ -33,6 +33,7 @@ static int oz_usb_submit_elt(struct oz_elt_buf *eb, struct oz_elt_info *ei,
        int ret;
        struct oz_elt *elt = (struct oz_elt *)ei->data;
        struct oz_app_hdr *app_hdr = (struct oz_app_hdr *)(elt+1);
+
        elt->type = OZ_ELT_APP_DATA;
        ei->app_id = OZ_APPID_USB;
        ei->length = elt->length + sizeof(struct oz_elt);
@@ -49,7 +50,8 @@ static int oz_usb_submit_elt(struct oz_elt_buf *eb, struct oz_elt_info *ei,
        spin_unlock_bh(&eb->lock);
        return ret;
 }
-/*------------------------------------------------------------------------------
+
+/*
  * Context: softirq
  */
 int oz_usb_get_desc_req(void *hpd, u8 req_id, u8 req_type, u8 desc_type,
@@ -61,6 +63,7 @@ int oz_usb_get_desc_req(void *hpd, u8 req_id, u8 req_type, u8 desc_type,
        struct oz_get_desc_req *body;
        struct oz_elt_buf *eb = &pd->elt_buff;
        struct oz_elt_info *ei = oz_elt_info_alloc(&pd->elt_buff);
+
        oz_dbg(ON, "    req_type = 0x%x\n", req_type);
        oz_dbg(ON, "    desc_type = 0x%x\n", desc_type);
        oz_dbg(ON, "    index = 0x%x\n", index);
@@ -84,7 +87,8 @@ int oz_usb_get_desc_req(void *hpd, u8 req_id, u8 req_type, u8 desc_type,
        body->index = index;
        return oz_usb_submit_elt(eb, ei, usb_ctx, 0, 0);
 }
-/*------------------------------------------------------------------------------
+
+/*
  * Context: tasklet
  */
 static int oz_usb_set_config_req(void *hpd, u8 req_id, u8 index)
@@ -95,6 +99,7 @@ static int oz_usb_set_config_req(void *hpd, u8 req_id, u8 index)
        struct oz_elt_buf *eb = &pd->elt_buff;
        struct oz_elt_info *ei = oz_elt_info_alloc(&pd->elt_buff);
        struct oz_set_config_req *body;
+
        if (ei == NULL)
                return -1;
        elt = (struct oz_elt *)ei->data;
@@ -105,7 +110,8 @@ static int oz_usb_set_config_req(void *hpd, u8 req_id, u8 index)
        body->index = index;
        return oz_usb_submit_elt(eb, ei, usb_ctx, 0, 0);
 }
-/*------------------------------------------------------------------------------
+
+/*
  * Context: tasklet
  */
 static int oz_usb_set_interface_req(void *hpd, u8 req_id, u8 index, u8 alt)
@@ -116,6 +122,7 @@ static int oz_usb_set_interface_req(void *hpd, u8 req_id, u8 index, u8 alt)
        struct oz_elt_buf *eb = &pd->elt_buff;
        struct oz_elt_info *ei = oz_elt_info_alloc(&pd->elt_buff);
        struct oz_set_interface_req *body;
+
        if (ei == NULL)
                return -1;
        elt = (struct oz_elt *)ei->data;
@@ -127,7 +134,8 @@ static int oz_usb_set_interface_req(void *hpd, u8 req_id, u8 index, u8 alt)
        body->alternative = alt;
        return oz_usb_submit_elt(eb, ei, usb_ctx, 0, 0);
 }
-/*------------------------------------------------------------------------------
+
+/*
  * Context: tasklet
  */
 static int oz_usb_set_clear_feature_req(void *hpd, u8 req_id, u8 type,
@@ -139,6 +147,7 @@ static int oz_usb_set_clear_feature_req(void *hpd, u8 req_id, u8 type,
        struct oz_elt_buf *eb = &pd->elt_buff;
        struct oz_elt_info *ei = oz_elt_info_alloc(&pd->elt_buff);
        struct oz_feature_req *body;
+
        if (ei == NULL)
                return -1;
        elt = (struct oz_elt *)ei->data;
@@ -151,7 +160,8 @@ static int oz_usb_set_clear_feature_req(void *hpd, u8 req_id, u8 type,
        put_unaligned(feature, &body->feature);
        return oz_usb_submit_elt(eb, ei, usb_ctx, 0, 0);
 }
-/*------------------------------------------------------------------------------
+
+/*
  * Context: tasklet
  */
 static int oz_usb_vendor_class_req(void *hpd, u8 req_id, u8 req_type,
@@ -163,6 +173,7 @@ static int oz_usb_vendor_class_req(void *hpd, u8 req_id, u8 req_type,
        struct oz_elt_buf *eb = &pd->elt_buff;
        struct oz_elt_info *ei = oz_elt_info_alloc(&pd->elt_buff);
        struct oz_vendor_class_req *body;
+
        if (ei == NULL)
                return -1;
        elt = (struct oz_elt *)ei->data;
@@ -178,7 +189,8 @@ static int oz_usb_vendor_class_req(void *hpd, u8 req_id, u8 req_type,
                memcpy(body->data, data, data_len);
        return oz_usb_submit_elt(eb, ei, usb_ctx, 0, 0);
 }
-/*------------------------------------------------------------------------------
+
+/*
  * Context: tasklet
  */
 int oz_usb_control_req(void *hpd, u8 req_id, struct usb_ctrlrequest *setup,
@@ -188,6 +200,7 @@ int oz_usb_control_req(void *hpd, u8 req_id, struct usb_ctrlrequest *setup,
        unsigned windex = le16_to_cpu(setup->wIndex);
        unsigned wlength = le16_to_cpu(setup->wLength);
        int rc = 0;
+
        if ((setup->bRequestType & USB_TYPE_MASK) == USB_TYPE_STANDARD) {
                switch (setup->bRequest) {
                case USB_REQ_GET_DESCRIPTOR:
@@ -225,7 +238,8 @@ int oz_usb_control_req(void *hpd, u8 req_id, struct usb_ctrlrequest *setup,
        }
        return rc;
 }
-/*------------------------------------------------------------------------------
+
+/*
  * Context: softirq
  */
 int oz_usb_send_isoc(void *hpd, u8 ep_num, struct urb *urb)
@@ -296,13 +310,15 @@ int oz_usb_send_isoc(void *hpd, u8 ep_num, struct urb *urb)
        }
        return 0;
 }
-/*------------------------------------------------------------------------------
+
+/*
  * Context: softirq-serialized
  */
 static void oz_usb_handle_ep_data(struct oz_usb_ctx *usb_ctx,
        struct oz_usb_hdr *usb_hdr, int len)
 {
        struct oz_data *data_hdr = (struct oz_data *)usb_hdr;
+
        switch (data_hdr->format) {
        case OZ_DATA_F_MULTIPLE_FIXED: {
                        struct oz_multiple_fixed *body =
@@ -338,7 +354,8 @@ static void oz_usb_handle_ep_data(struct oz_usb_ctx *usb_ctx,
        }
 
 }
-/*------------------------------------------------------------------------------
+
+/*
  * This is called when the PD has received a USB element. The type of element
  * is determined and is then passed to an appropriate handler function.
  * Context: softirq-serialized
@@ -410,12 +427,14 @@ void oz_usb_rx(struct oz_pd *pd, struct oz_elt *elt)
 done:
        oz_usb_put(usb_ctx);
 }
-/*------------------------------------------------------------------------------
+
+/*
  * Context: softirq, process
  */
 void oz_usb_farewell(struct oz_pd *pd, u8 ep_num, u8 *data, u8 len)
 {
        struct oz_usb_ctx *usb_ctx;
+
        spin_lock_bh(&pd->app_lock[OZ_APPID_USB-1]);
        usb_ctx = (struct oz_usb_ctx *)pd->app_ctx[OZ_APPID_USB-1];
        if (usb_ctx)