RE: [PATCH 5/6] mtd: spi-nor: add generic flash driver

From: Biju Das
Date: Fri Oct 28 2022 - 14:00:37 EST


Hi All,

Any update on [1]?. As per [2], we need to use generic flash driver as our flash chip
supports sfdp. Anything to be improved on [1]?? Please let us know.

[1] https://lore.kernel.org/lkml/20220810220654.1297699-1-michael@xxxxxxxx/T/#m3ce890b65360f9fbe17b813d692f848b5c6d78e7
[2] https://patchwork.kernel.org/project/linux-renesas-soc/patch/20220715105716.2415068-3-biju.das.jz@xxxxxxxxxxxxxx/

Cheers,
Biju

> Subject: RE: [PATCH 5/6] mtd: spi-nor: add generic flash driver
>
> Hi Michael Walle,
>
> > Subject: Re: [PATCH 5/6] mtd: spi-nor: add generic flash driver
> >
> > Hi,
> >
> > >> +
> > >> + /* Fallback to a generic flash described only by its SFDP
> data. */
> > >> + if (!info) {
> > >> + ret = spi_nor_check_sfdp_signature(nor);
> > >> + if (!ret)
> > >> + info = &spi_nor_generic_flash;
> > >> + }
> > >
> > > May be this can be combined as
> > >
> > > if (!info && (!spi_nor_check_sfdp_signature(nor)))
> > > info = &spi_nor_generic_flash;
> >
> > While this is the behavior, I don't like (1) calling functions in
> the
> > condition and (2) rely on the && and || semantics, i.e.
> > to just call the second part if the first is true/false.
>
> OK fine. I recently got a review comment from mainline for optimizing
> the number of lines. That is the reason for suggestion.
>
> Cheers,
> biju