Re: [PATCH v9 2/3] mtd: spi-nand: Add support for randomizer

Cheng Ming Lin
2026-04-22T08:15:30Z

Hi Miquel,

Miquel Raynal <miquel.raynal@bootlin.com> 於 2026年4月22日週三 下午4:08寫道：
>
> Hi Cheng Ming,
>
> > +static int spinand_randomizer_init(struct spinand_device *spinand)
> > +{
> > + struct device_node *np = spinand->spimem->spi->dev.of_node;
> > + u32 rand_val;
> > + int ret;
> > +
> > + if (!spinand->set_randomizer)
> > + return 0;
> > +
> > + ret = of_property_read_u32(np, "nand-randomizer", &rand_val);
> > + if (ret)
> > + return 0;
> > +
> > + return spinand->set_randomizer(spinand, rand_val == 1);
>
> You do not need the "== 1" part. rand_val is cast into a boolean, so any
> non zero value will be taken understood as an "enable" and zero will be
> treated as "disable", which is fine.

Got it, thanks for the tip. I will drop the "== 1" part and rely on the
implicit boolean cast in the next version.

Since the rest of the patch looks fine to you, I will wait for the Device
Tree maintainers' feedback on the dt-binding patch (Patch 1/3) before
spinning v10 to avoid spamming the list.

>
> The rest looks fine.
>
> Thanks,
> Miquèl

Thanks,
Cheng Ming Lin