From: Benoit Goby Date: Fri, 1 Oct 2010 00:20:22 +0000 (-0700) Subject: mdm6600: Reduce memory usage X-Git-Tag: firefly_0821_release~9834^2~508 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=b431ff4ebef986b7e7d190715f976cf0eca28cc5;p=firefly-linux-kernel-4.4.55.git mdm6600: Reduce memory usage buffer_sz is multiple of MaxPacketSize because the USB host controller can split the buffer in packets. All buffers received or sent are <2k, so MaxPacketSize * 4 (2k) should be a better buffer size. Change-Id: I1e0e2fd4e9a4e78d33e6b4de57ee420630298de2 Signed-off-by: Benoit Goby --- diff --git a/drivers/usb/serial/mdm6600.c b/drivers/usb/serial/mdm6600.c index 6ea24e2efb8b..8df23d928d20 100644 --- a/drivers/usb/serial/mdm6600.c +++ b/drivers/usb/serial/mdm6600.c @@ -169,9 +169,7 @@ static int mdm6600_attach(struct usb_serial *serial) spin_lock_init(&modem->write.busy_lock); init_usb_anchor(&modem->write.in_flight); init_usb_anchor(&modem->write.delayed); - /* The * 20 calculation is from Motorola's original driver, I do not - * know the reasoning */ - modem->write.buffer_sz = le16_to_cpu(epwrite->wMaxPacketSize) * 20; + modem->write.buffer_sz = le16_to_cpu(epwrite->wMaxPacketSize) * 4; for (i = 0; i < POOL_SZ; i++) { struct urb *u = usb_alloc_urb(0, GFP_KERNEL); if (!u) @@ -193,9 +191,7 @@ static int mdm6600_attach(struct usb_serial *serial) INIT_WORK(&modem->read.work, mdm6600_read_bulk_work); init_usb_anchor(&modem->read.in_flight); init_usb_anchor(&modem->read.pending); - /* The * 2 calculation is from Motorola's original driver, I do not - * know the reasoning */ - modem->read.buffer_sz = le16_to_cpu(epread->wMaxPacketSize) * 2; + modem->read.buffer_sz = le16_to_cpu(epread->wMaxPacketSize) * 4; for (i = 0; i < POOL_SZ; i++) { struct urb *u = usb_alloc_urb(0, GFP_KERNEL); if (!u)