On Tue, Jun 8, 2010 at 9:57 AM, Anton Vorontsov <cbouatmai...@gmail.com> wrote: > On Tue, Jun 08, 2010 at 08:26:43AM -0600, Grant Likely wrote: > [...] >> + dev = kzalloc(sizeof(*dev) + (sizeof(struct resource) * i), >> GFP_KERNEL); >> if (!dev) >> return NULL; >> - >> dev->dev.of_node = of_node_get(np); >> dev->dev.dma_mask = &dev->archdata.dma_mask; >> dev->dev.parent = parent; >> dev->dev.release = of_release_dev; >> >> + /* Populate the resource table */ >> + if (num_irq || num_reg) { >> + dev->resource = (void*)&dev[1]; > > This is ugly. Why not allocate the memory specifically for > dev->resource? Is this because you plan to get rid of > of_release_dev(), and the generic release_dev() won't > know if it should free the dev->resource? There must > be a better way to handle this.
Allocating in one big block means less potential memory fragmentation, and the kernel can free it all at once. This is a common pattern. > p.s. > > Just wonder what happened to of_gpio stuff? You blocked it > in 2.6.34 for no reason saying "I'll pick it into my OF > tree before the 2.6.35 merge window" and it's 2.6.36 merge > window quite soon. It's in my test-devicetree branch. I'll be posting for 2nd review in the next few days and then adding to my devicetree-next branch probably before the end of the week. g. _______________________________________________ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev