X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=drivers%2Fusb%2Fgadget%2Ff_mass_storage.c;h=abe9391d3d66bf9f2b2e3f36757c5c8e3c95a215;hb=009902a871dcb1ad60e746280372f47d90f65353;hp=4fae5cd3b1ad561674994b8e5c8265c4d5b69664;hpb=75504e9592745021006cb8905b5ff5a51d9d1cb3;p=u-boot diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c index 4fae5cd3b1..abe9391d3d 100644 --- a/drivers/usb/gadget/f_mass_storage.c +++ b/drivers/usb/gadget/f_mass_storage.c @@ -255,6 +255,7 @@ #include #include #include +#include /*------------------------------------------------------------------------*/ @@ -670,7 +671,7 @@ static int sleep_thread(struct fsg_common *common) if (common->thread_wakeup_needed) break; - if (++i == 50000) { + if (++i == 20000) { busy_indicator(); i = 0; k++; @@ -688,7 +689,7 @@ static int sleep_thread(struct fsg_common *common) k = 0; } - usb_gadget_handle_interrupts(); + usb_gadget_handle_interrupts(0); } common->thread_wakeup_needed = 0; return rc; @@ -972,7 +973,7 @@ static int do_write(struct fsg_common *common) /* If an error occurred, report it and its position */ if (nwritten < amount) { - printf("nwritten:%d amount:%d\n", nwritten, + printf("nwritten:%zd amount:%u\n", nwritten, amount); curlun->sense_data = SS_WRITE_ERROR; curlun->info_valid = 1; @@ -1109,6 +1110,7 @@ static int do_inquiry(struct fsg_common *common, struct fsg_buffhd *bh) memset(buf, 0, 8); buf[0] = TYPE_DISK; + buf[1] = curlun->removable ? 0x80 : 0; buf[2] = 2; /* ANSI SCSI level 2 */ buf[3] = 2; /* SCSI-2 INQUIRY data format */ buf[4] = 31; /* Additional length */ @@ -2461,12 +2463,12 @@ static struct fsg_common *fsg_common_init(struct fsg_common *common, /* Allocate? */ if (!common) { - common = calloc(sizeof *common, 1); + common = calloc(sizeof(*common), 1); if (!common) return ERR_PTR(-ENOMEM); common->free_storage_on_release = 1; } else { - memset(common, 0, sizeof common); + memset(common, 0, sizeof(*common)); common->free_storage_on_release = 0; } @@ -2778,3 +2780,5 @@ int fsg_init(struct ums *ums_dev) return 0; } + +DECLARE_GADGET_BIND_CALLBACK(usb_dnl_ums, fsg_add);