Prev: [PATCH] staging/wlags49_hs: Fix build error when CONFIG_SYSFS is not set
Next: mmotm 2010-06-11-16-40 uploaded
From: Dan Williams on 11 Jun 2010 20:10 On Tue, Jun 1, 2010 at 5:22 AM, Linus Walleij <linus.walleij(a)stericsson.com> wrote: > Switch to allocating LCLA in memory instead of having a fixed > address. > > Signed-off-by: Jonas Aaberg <jonas.aberg(a)stericsson.com> > Signed-off-by: Linus Walleij <linus.walleij(a)stericsson.com> > --- > �drivers/dma/ste_dma40.c � �| �246 +++++++++++++++++++++++++++----------------- > �drivers/dma/ste_dma40_ll.c | � �5 +- > �drivers/dma/ste_dma40_ll.h | � 12 +- > �3 files changed, 161 insertions(+), 102 deletions(-) > > diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c > index 5579401..ec092fa 100644 > --- a/drivers/dma/ste_dma40.c > +++ b/drivers/dma/ste_dma40.c [..] > @@ -2482,6 +2501,71 @@ static void __init d40_hw_init(struct d40_base *base) > > �} > > +static int __init d40_lcla_allocate(struct d40_base *base) > +{ > + � � � unsigned long *page_list; > + � � � int i, j; > + � � � int ret = 0; > + > + � � � /* > + � � � �* This is somewhat ugly. We need 8192 bytes that are 18 bit aligned, > + � � � �* To full fill this hardware requirement without wasting 256 kb > + � � � �* we allocate pages until we get an aligned one. > + � � � �*/ > + � � � page_list = kmalloc(sizeof(unsigned long) * MAX_LCLA_ALLOC_ATTEMPTS, > + � � � � � � � � � � � � � GFP_KERNEL); > + > + � � � if (!page_list) { > + � � � � � � � ret = -ENOMEM; > + � � � � � � � goto failure; > + � � � } > + > + � � � /* Calculating how many pages that are required */ > + � � � base->lcla_pool.pages = SZ_1K * (base->num_phy_chans + PAGE_SIZE / > + � � � � � � � � � � � � � � � � � � � �SZ_1K - 1) / PAGE_SIZE + 3; > + What? > + � � � for (i = 0; i < MAX_LCLA_ALLOC_ATTEMPTS; i++) { > + � � � � � � � page_list[i] = __get_free_pages(GFP_KERNEL, > + � � � � � � � � � � � � � � � � � � � � � � � base->lcla_pool.pages); > + > + � � � � � � � if ((virt_to_phys((void *)page_list[i]) & > + � � � � � � � � � �(LCLA_ALIGNMENT - 1)) == 0 && page_list[i] != 0) > + � � � � � � � � � � � break; It looks odd to test for page_list[i] being null after determining if this is the desired alignment. -- Dan -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ |