From b431ff4ebef986b7e7d190715f976cf0eca28cc5 Mon Sep 17 00:00:00 2001 From: Benoit Goby Date: Thu, 30 Sep 2010 17:20:22 -0700 Subject: [PATCH] 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 --- drivers/usb/serial/mdm6600.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) 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) -- 2.34.1