Browse Source

Jeff modifications on utp buffer

Jeff Kudrick patch for fsl_updater.c file. Free utp buffer
Alejandro Sierra 11 years ago
parent
commit
4c6a11e42e
1 changed files with 12 additions and 3 deletions
  1. 12 3
      drivers/usb/gadget/fsl_updater.c

+ 12 - 3
drivers/usb/gadget/fsl_updater.c

@@ -428,7 +428,7 @@ static int utp_handle_message(struct fsg_common *common,
 		utp_do_write(common, uud2r->data.data, common->data_size);
 		/* don't know what will be written */
 		utp_interpret_message(uud2r);
-		free(uud2r);
+		utp_user_data_free(uud2r);
 		/*
 		 * Return PASS or FAIL according to uuc's status
 		 * Please open it if need to check uuc's status
@@ -461,7 +461,16 @@ static int utp_handle_message(struct fsg_common *common,
 		}
 #endif
 		/* workaround, normally would SS_PASS */
-		UTP_SS_BUSY(common, UTP_CTX(fsg)->counter);
+		if (common->data_size == 65536)
+		{
+			pr_debug("%s: Sending UTP_SS_BUSY\n", __func__);
+			UTP_SS_BUSY(common, UTP_CTX(fsg)->counter);
+		}
+		else
+		{
+			pr_debug("%s: Sending UTP_SS_PASS\n", __func__);
+			UTP_SS_PASS(common);
+		}
 		break;
 	}
 
@@ -525,7 +534,7 @@ int utp_pipe_sd(u8 *data, size_t bufsize)
 	unsigned int blkcnt;
 	char argbuf[100];
 
-	blkcnt = bufsize / pinfo.blksz;
+	blkcnt = (bufsize / pinfo.blksz) + (((bufsize % pinfo.blksz) != 0) ? 1 : 0);
 	pr_debug("blkcnt: %x, index: %lx, bufsize: %zx\n", blkcnt, pinfo.index, bufsize);
 
 	sprintf(argbuf, "mmc write %x %lx %x", data, pinfo.index, blkcnt);