]> rtime.felk.cvut.cz Git - vajnamar/linux-xlnx.git/commitdiff
usb: gadget: f_tcm: remove code duplication
authorRajnikant Bhojani <rajnikant.bhojani@xilinx.com>
Fri, 11 Aug 2017 08:54:11 +0000 (04:54 -0400)
committerMichal Simek <michal.simek@xilinx.com>
Tue, 15 Aug 2017 10:56:57 +0000 (12:56 +0200)
function bot_send_write_request() prepares write request and will call
usbg_prepare_w_request() function which does the same

Signed-off-by: Rajnikant Bhojani <rajnikant.bhojani@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
drivers/usb/gadget/function/f_tcm.c

index 5e24fb19e1768f79f8937848529e99b5ffc523b5..8cf4f07f11993b2d799b1663a589430c9c68a51d 100644 (file)
@@ -245,7 +245,6 @@ static int bot_send_write_request(struct usbg_cmd *cmd)
 {
        struct f_uas *fu = cmd->fu;
        struct se_cmd *se_cmd = &cmd->se_cmd;
-       struct usb_gadget *gadget = fuas_to_gadget(fu);
        int ret;
 
        init_completion(&cmd->write_complete);
@@ -256,22 +255,6 @@ static int bot_send_write_request(struct usbg_cmd *cmd)
                return -EINVAL;
        }
 
-       if (!gadget->sg_supported) {
-               cmd->data_buf = kmalloc(se_cmd->data_length, GFP_KERNEL);
-               if (!cmd->data_buf)
-                       return -ENOMEM;
-
-               fu->bot_req_out->buf = cmd->data_buf;
-       } else {
-               fu->bot_req_out->buf = NULL;
-               fu->bot_req_out->num_sgs = se_cmd->t_data_nents;
-               fu->bot_req_out->sg = se_cmd->t_data_sg;
-       }
-
-       fu->bot_req_out->complete = usbg_data_write_cmpl;
-       fu->bot_req_out->length = se_cmd->data_length;
-       fu->bot_req_out->context = cmd;
-
        ret = usbg_prepare_w_request(cmd, fu->bot_req_out);
        if (ret)
                goto cleanup;