[PATCH v2 5/6] mtd: partitions: pass around 'mtd_partitions' wrapper struct

Brian Norris computersforpeace at gmail.com
Fri Dec 4 20:18:35 PST 2015


Hi Boris,

On Fri, Dec 04, 2015 at 05:45:11PM -0800, Brian Norris wrote:
> On Sat, Dec 05, 2015 at 01:30:49AM +0100, Boris Brezillon wrote:
> > How about defining a new function to encourage mtd drivers to pass an
> > mtd_partitions structure instead of the parts + nr_parts arguments.

...

> > Hm, you updated the ->parse_fn() prototype to take a const mtd_partition **
> > in patch 2, and it seemed pretty easy.
> > How about updating it again to take an mtd_partitions pointer here?

OK, so I've hacked around at these two suggestions, and I'm not very
happy with the results so far. I mentioned some of my objection to the
first above already, and when I tried to do some kind of compromise, it
doesn't end up much cleaner IMO.

For the second suggestion, I don't really like the circular dependency,
where we have struct mtd_part_parser include pointers to struct
mtd_partitions which includes pointers to mtd_part_parser. This is
partly because of the re-use of the parts of the same struct as both an
input and an output, depending on the context. I don't think that's very
clean.

So, if there are good ways to extend some version of your suggestions,
perhaps they can be tackled after this patch set?

Brian



More information about the linux-mtd mailing list