[PATCH 16/29] target/usb: Remove ifdeffed code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Remove ifdeffed-out code for sg support, it can go back in when sg
support is ready.

Signed-off-by: Andy Grover <agrover@xxxxxxxxxx>
---
 drivers/target/usb-gadget/bot.c |   46 ++++++++++----------------------------
 drivers/target/usb-gadget/uas.c |   32 ++++++++------------------
 2 files changed, 22 insertions(+), 56 deletions(-)

diff --git a/drivers/target/usb-gadget/bot.c b/drivers/target/usb-gadget/bot.c
index cfe968d..9b94de5 100644
--- a/drivers/target/usb-gadget/bot.c
+++ b/drivers/target/usb-gadget/bot.c
@@ -182,9 +182,6 @@ int bot_send_read_response(struct usbg_cmd *cmd)
 {
 	struct f_uas *fu = cmd->fu;
 	struct se_cmd *se_cmd = &cmd->se_cmd;
-#if 0
-	struct usb_gadget *gadget = fuas_to_gadget(fu);
-#endif
 	int ret;
 
 	if (!cmd->data_len) {
@@ -193,24 +190,16 @@ int bot_send_read_response(struct usbg_cmd *cmd)
 		return 0;
 	}
 
-	/* if (!gadget->sg_supported) { */
-		cmd->data_buf = kmalloc(se_cmd->data_length, GFP_ATOMIC);
-		if (!cmd->data_buf)
-			return -ENOMEM;
+	cmd->data_buf = kmalloc(se_cmd->data_length, GFP_ATOMIC);
+	if (!cmd->data_buf)
+		return -ENOMEM;
 
-		sg_copy_to_buffer(se_cmd->t_data_sg,
-				se_cmd->t_data_nents,
-				cmd->data_buf,
-				se_cmd->data_length);
+	sg_copy_to_buffer(se_cmd->t_data_sg,
+			  se_cmd->t_data_nents,
+			  cmd->data_buf,
+			  se_cmd->data_length);
 
-		fu->bot_req_in->buf = cmd->data_buf;
-#if 0
-	} else {
-		fu->bot_req_in->buf = NULL;
-		fu->bot_req_in->num_sgs = se_cmd->t_data_nents;
-		fu->bot_req_in->sg = se_cmd->t_data_sg;
-	}
-#endif
+	fu->bot_req_in->buf = cmd->data_buf;
 
 	fu->bot_req_in->complete = bot_read_compl;
 	fu->bot_req_in->length = se_cmd->data_length;
@@ -225,9 +214,6 @@ int bot_send_write_request(struct usbg_cmd *cmd)
 {
 	struct f_uas *fu = cmd->fu;
 	struct se_cmd *se_cmd = &cmd->se_cmd;
-#if 0
-	struct usb_gadget *gadget = fuas_to_gadget(fu);
-#endif
 	int ret;
 
 	init_completion(&cmd->write_complete);
@@ -238,19 +224,11 @@ 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;
+	cmd->data_buf = kmalloc(se_cmd->data_length, GFP_KERNEL);
+	if (!cmd->data_buf)
+		return -ENOMEM;
 
-		fu->bot_req_out->buf = cmd->data_buf;
-#if 0
-	} 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;
-	}
-#endif
+	fu->bot_req_out->buf = cmd->data_buf;
 
 	fu->bot_req_out->complete = usbg_data_write_cmpl;
 	fu->bot_req_out->length = se_cmd->data_length;
diff --git a/drivers/target/usb-gadget/uas.c b/drivers/target/usb-gadget/uas.c
index 0414733..44fb915 100644
--- a/drivers/target/usb-gadget/uas.c
+++ b/drivers/target/usb-gadget/uas.c
@@ -1,3 +1,4 @@
+
 /*
  * Target based USB-Gadget, UAS protocol handling
  * Author: Sebastian Andrzej Siewior <bigeasy at linutronix dot de>
@@ -57,31 +58,18 @@ static void uasp_status_data_cmpl(struct usb_ep *ep, struct usb_request *req);
 static int uasp_prepare_r_request(struct usbg_cmd *cmd)
 {
 	struct se_cmd *se_cmd = &cmd->se_cmd;
-#if 0
-	struct f_uas *fu = cmd->fu;
-	struct usb_gadget *gadget = fuas_to_gadget(fu);
-#endif
 	struct uas_stream *stream = cmd->stream;
 
-	/* if (!gadget->sg_supported) { */
-		cmd->data_buf = kmalloc(se_cmd->data_length, GFP_ATOMIC);
-		if (!cmd->data_buf)
-			return -ENOMEM;
-
-		sg_copy_to_buffer(se_cmd->t_data_sg,
-				se_cmd->t_data_nents,
-				cmd->data_buf,
-				se_cmd->data_length);
+	cmd->data_buf = kmalloc(se_cmd->data_length, GFP_ATOMIC);
+	if (!cmd->data_buf)
+		return -ENOMEM;
 
-		stream->req_in->buf = cmd->data_buf;
-#if 0
-	} else {
-		stream->req_in->buf = NULL;
-		stream->req_in->num_sgs = se_cmd->t_data_nents;
-		stream->req_in->sg = se_cmd->t_data_sg;
-	}
-#endif
+	sg_copy_to_buffer(se_cmd->t_data_sg,
+			  se_cmd->t_data_nents,
+			  cmd->data_buf,
+			  se_cmd->data_length);
 
+	stream->req_in->buf = cmd->data_buf;
 	stream->req_in->complete = uasp_status_data_cmpl;
 	stream->req_in->length = se_cmd->data_length;
 	stream->req_in->context = cmd;
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe target-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux SCSI]     [Kernel Newbies]     [Linux SCSI Target Infrastructure]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Device Mapper]

  Powered by Linux