[RFC PATCH v2] mtd: nand: vf610_nfc: make use of ->exec_op()

Miquel Raynal miquel.raynal at bootlin.com
Thu Feb 8 10:23:47 PST 2018


> > +}
> >  
> > -	switch (command) {
> > -	case NAND_CMD_SEQIN:
> > -		/* Use valid column/page from preread... */
> > -		vf610_nfc_addr_cycle(nfc, column, page);
> > -		nfc->buf_offset = 0;
> > +static int vf610_nfc_exec_op(struct nand_chip *chip,
> > +			     const struct nand_operation *op,
> > +			     bool check_only)  
> 
> The soul of ->exec_op() is here :) However this implementation looks
> very specific to the kind of tasks you are used to do with one specific
> chip. What if someone wants to support a new command that implies
> several command/address/data cycles interleaved? Maybe one solution
> would be to rework a bit by using a case statement in a for loop. If
> the indentation level is too high, you may use helpers to do small
> tasks like sending a command or addresse cycle. What do you think?

Actually, instead of writing your own implementation, maybe you should
just write the helpers I mentioned above and fill a parser patterns
array to give to the NAND core's parser, simplifying again the
implementation.


Miquèl

-- 
Miquel Raynal, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
http://bootlin.com



More information about the linux-mtd mailing list