mdm6600: Reduce memory usage
authorBenoit Goby <benoit@android.com>
Fri, 1 Oct 2010 00:20:22 +0000 (17:20 -0700)
committerColin Cross <ccross@android.com>
Thu, 7 Oct 2010 00:03:20 +0000 (17:03 -0700)
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 <benoit@android.com>
drivers/usb/serial/mdm6600.c

index 6ea24e2efb8b15b39c441d934973c74e5cd7079f..8df23d928d20a9a64519997b1fa5ea0b18df89cb 100644 (file)
@@ -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)