[PATCH 07/12] usbgadget: fastboot: Use function to find file_list entry by name

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

 



We have file_list_entry_by_name() now, so use it rather than open
coding it.

Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
---
 drivers/usb/gadget/f_fastboot.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index 598637619d..0f2c02ee47 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -679,18 +679,15 @@ static void cb_flash(struct usb_ep *ep, struct usb_request *req, const char *cmd
 
 	fastboot_tx_print(f_fb, "INFOCopying file to %s...", cmd);
 
-	file_list_for_each_entry(f_fb->files, fentry) {
-		if (!strcmp(cmd, fentry->name)) {
-			filename = fentry->filename;
-			break;
-		}
-	}
+	fentry = file_list_entry_by_name(f_fb->files, cmd);
 
-	if (!filename) {
+	if (!fentry) {
 		fastboot_tx_print(f_fb, "FAILNo such partition: %s", cmd);
 		return;
 	}
 
+	filename = fentry->filename;
+
 	if (filetype == filetype_ubi) {
 		int fd;
 		struct mtd_info_user meminfo;
-- 
2.11.0


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux