]> Git Repo - linux.git/blobdiff - drivers/usb/core/buffer.c
dm persistent data: eliminate unnecessary return values
[linux.git] / drivers / usb / core / buffer.c
index 684ef70dc09d2c798dbde35bcad87b4e241cef73..89f2e7765093955b9bc37b1efcf5013d69f64482 100644 (file)
  */
 
 /* FIXME tune these based on pool statistics ... */
-static const size_t    pool_max[HCD_BUFFER_POOLS] = {
-       /* platforms without dma-friendly caches might need to
-        * prevent cacheline sharing...
-        */
-       32,
-       128,
-       512,
-       PAGE_SIZE / 2
-       /* bigger --> allocate pages */
+static size_t pool_max[HCD_BUFFER_POOLS] = {
+       32, 128, 512, 2048,
 };
 
+void __init usb_init_pool_max(void)
+{
+       /*
+        * The pool_max values must never be smaller than
+        * ARCH_KMALLOC_MINALIGN.
+        */
+       if (ARCH_KMALLOC_MINALIGN <= 32)
+               ;                       /* Original value is okay */
+       else if (ARCH_KMALLOC_MINALIGN <= 64)
+               pool_max[0] = 64;
+       else if (ARCH_KMALLOC_MINALIGN <= 128)
+               pool_max[0] = 0;        /* Don't use this pool */
+       else
+               BUILD_BUG();            /* We don't allow this */
+}
 
 /* SETUP primitives */
 
@@ -62,7 +70,7 @@ int hcd_buffer_create(struct usb_hcd *hcd)
                size = pool_max[i];
                if (!size)
                        continue;
-               snprintf(name, sizeof name, "buffer-%d", size);
+               snprintf(name, sizeof(name), "buffer-%d", size);
                hcd->pool[i] = dma_pool_create(name, hcd->self.controller,
                                size, size, 0);
                if (!hcd->pool[i]) {
@@ -87,6 +95,7 @@ void hcd_buffer_destroy(struct usb_hcd *hcd)
 
        for (i = 0; i < HCD_BUFFER_POOLS; i++) {
                struct dma_pool *pool = hcd->pool[i];
+
                if (pool) {
                        dma_pool_destroy(pool);
                        hcd->pool[i] = NULL;
This page took 0.036586 seconds and 4 git commands to generate.