Messages in this thread | | | From | Sjur BRENDELAND <> | Date | Tue, 15 Jan 2013 16:13:45 +0100 | Subject | RE: [RFCv2 09/11] remoteproc: Add operation to find resource table in memory |
| |
Hi Ido,
> From: Ido Yariv [mailto:ido@wizery.com] > > +struct resource_table *rproc_elf_get_rsctab_addr(struct rproc *rproc, > > + const struct firmware *fw) > > +{ > > + struct elf32_shdr *shdr; > > + > > + shdr = find_rsc_shdr(&rproc->dev, (struct elf32_hdr *)fw->data); > > + if (!shdr) > > + return NULL; > > Instead of traversing the headers twice, perhaps we could save the > address and size in advance and use it here?
To do that we would have to store the struct elf32_shdr in struct rproc. So this is a trade-off between bloating rproc structure with shdr or spending some more cpu-cycles to scan the elf sections. It shouldn't be that many sections to scan, and as we've just parsed this firmware sections earlier so it might be hot in cache. This shouldn't be very expensive, so I'd prefer to keep this as is.
Are you OK with that?
Regards, Sjur
| |