Since bulk max packet size must always be a power of 2, we can use the 'and' operator instead of modulus. Signed-off-by: Paul Zimmerman <paulz@xxxxxxxxxxxx> --- drivers/usb/gadget/f_mass_storage.c | 2 +- drivers/usb/gadget/file_storage.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c index 52583a2..3bfdeba 100644 --- a/drivers/usb/gadget/f_mass_storage.c +++ b/drivers/usb/gadget/f_mass_storage.c @@ -481,7 +481,7 @@ static void set_bulk_out_req_length(struct fsg_common *common, unsigned int rem; bh->bulk_out_intended_length = length; - rem = length % common->bulk_out_maxpacket; + rem = length & (common->bulk_out_maxpacket - 1); if (rem > 0) length += common->bulk_out_maxpacket - rem; bh->outreq->length = length; diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c index 8aad1e3..9d930a9 100644 --- a/drivers/usb/gadget/file_storage.c +++ b/drivers/usb/gadget/file_storage.c @@ -489,7 +489,7 @@ static void set_bulk_out_req_length(struct fsg_dev *fsg, unsigned int rem; bh->bulk_out_intended_length = length; - rem = length % fsg->bulk_out_maxpacket; + rem = length & (fsg->bulk_out_maxpacket - 1); if (rem > 0) length += fsg->bulk_out_maxpacket - rem; bh->outreq->length = length; -- 1.7.6.233.gd79bc -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html