From xiphmont@gmail.com Thu Oct 5 10:33:45 2006 Message-ID: <806dafc20610051033t1f32b17ejeda72c08c51ab346@mail.gmail.com> Date: Thu, 5 Oct 2006 13:33:43 -0400 From: "Christopher \"Monty\" Montgomery" To: linux-usb-devel@lists.sourceforge.com Subject: ehci-hcd: Fix budget_pool allocation for machines with multiple EHCI controllers Cc: xiphmont@gmail.com, , greg@kroah.com, Content-Disposition: inline Alan pointed out that kmem_cache_create is not allowed to create multiple caches of the same name (semantics *look* like dma_alloc_pool, but aren't the same). Thus, ehci_mem_init would fail on ehci controllers past the first one. This patch creates individual budget pool names based on the EHCI controller's bus number. Signed-off-by: Christopher "Monty" Montgomery Signed-off-by: Greg Kroah-Hartman --- --- drivers/usb/host/ehci-mem.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) --- gregkh-2.6.orig/drivers/usb/host/ehci-mem.c +++ gregkh-2.6/drivers/usb/host/ehci-mem.c @@ -292,13 +292,20 @@ static int ehci_mem_init (struct ehci_hc if (ehci->budget == NULL){ goto fail; } - ehci->budget_pool = - kmem_cache_create ("ehci_budget", - sizeof(struct ehci_shadow_budget), - 0,0,NULL,NULL); - if (!ehci->budget_pool) { - goto fail; + + { + char poolname[20]; + + snprintf(poolname,20,"ehci_budget_%d", + ehci_to_hcd(ehci)->self.busnum); + + ehci->budget_pool = + kmem_cache_create (poolname, + sizeof(struct ehci_shadow_budget), + 0,0,NULL,NULL); } + if (!ehci->budget_pool) + goto fail; /* software shadow of hardware table */ ehci->pshadow = kcalloc(ehci->periodic_size, sizeof(void *), flags);