[PATCH RESEND] mtd: cfi: Support early CFI fixups

Boris Brezillon boris.brezillon at bootlin.com
Mon Apr 30 07:49:36 PDT 2018


On Mon, 30 Apr 2018 09:38:45 -0500 (CDT)
Aaron Sierra <asierra at xes-inc.com> wrote:

> >> --- a/include/linux/mtd/cfi.h
> >> +++ b/include/linux/mtd/cfi.h
> >> @@ -353,6 +353,15 @@ void __xipram cfi_qry_mode_off(uint32_t base, struct
> >> map_info *map,
> >>  
> >>  struct cfi_extquery *cfi_read_pri(struct map_info *map, uint16_t adr, uint16_t
> >>  size,
> >>  			     const char* name);
> >> +
> >> +/* CFI fixup that can occur immediately after reading */  
> > 
> >					   ^ "after reading the ID" ?  
> 
> After reading the CFI structure out of the device, not just the ID. These
> fixups apply to the just-read, byte-swapped, in-memory representation of
> the CFI structure. Is more clarification necessary?

Yep, you should say after reading what. "after reading the CFI
structure out of the device" sounds good.

> 
> >> +struct cfi_early_fixup {
> >> +	uint16_t mfr;
> >> +	uint16_t id;
> >> +	void (*fixup)(struct cfi_private *cfi);
> >> +};
> >> +
> >> +/* CFI fixup that can only occur after MTD device exists */
> >>  struct cfi_fixup {
> >>  	uint16_t mfr;
> >>  	uint16_t id;
> >> @@ -380,6 +389,7 @@ struct cfi_fixup {
> >>  #define CFI_MFR_TOSHIBA		0x0098
> >>  #define CFI_MFR_WINBOND		0x00DA
> >>  
> >> +void cfi_early_fixup(struct cfi_private *cfi, struct cfi_early_fixup *fixups);  
> > 
> > Is cfi_early_fixup() intended to be used outside of cfi_probe.c? If
> > that's not the case, I'd recommend to keep the struct and function def
> > in cfi_probe.c.  
> 
> It is not, but since this is adding a second fixup mechanism for CFI, I
> thought there may be value in defining both of them in close proximity to
> each  other. That way anyone looking for available mechanisms would find
> both instead of only one or the other. Does that value outweigh it only
> being used in one file?

Well, we try to avoid exposing symbols when they're only used from the
file itself. If someone ever needs a similar mechanism in a different
file (cfi_jedec.c for example), we'll consider exposing it in
cfi_util.c/cfi.h, but that's not the case yet, so let's keep it private
to cfi_probe.c for now.



More information about the linux-mtd mailing list