All of lore.kernel.org
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Cheng Ming Lin <linchengming884@gmail.com>
Cc: richard@nod.at,  vigneshr@ti.com,  robh@kernel.org,
	 krzk+dt@kernel.org, conor+dt@kernel.org,
	 linux-mtd@lists.infradead.org, devicetree@vger.kernel.org,
	 linux-kernel@vger.kernel.org, alvinzhou@mxic.com.tw,
	 Cheng Ming Lin <chengminglin@mxic.com.tw>
Subject: Re: [PATCH v9 2/3] mtd: spi-nand: Add support for randomizer
Date: Wed, 22 Apr 2026 10:08:10 +0200	[thread overview]
Message-ID: <87a4uv5set.fsf@bootlin.com> (raw)
In-Reply-To: <20260422070203.698716-3-linchengming884@gmail.com> (Cheng Ming Lin's message of "Wed, 22 Apr 2026 15:02:02 +0800")

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.

The rest looks fine.

Thanks,
Miquèl

WARNING: multiple messages have this Message-ID (diff)
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Cheng Ming Lin <linchengming884@gmail.com>
Cc: richard@nod.at,  vigneshr@ti.com,  robh@kernel.org,
	 krzk+dt@kernel.org, conor+dt@kernel.org,
	 linux-mtd@lists.infradead.org, devicetree@vger.kernel.org,
	 linux-kernel@vger.kernel.org, alvinzhou@mxic.com.tw,
	 Cheng Ming Lin <chengminglin@mxic.com.tw>
Subject: Re: [PATCH v9 2/3] mtd: spi-nand: Add support for randomizer
Date: Wed, 22 Apr 2026 10:08:10 +0200	[thread overview]
Message-ID: <87a4uv5set.fsf@bootlin.com> (raw)
In-Reply-To: <20260422070203.698716-3-linchengming884@gmail.com> (Cheng Ming Lin's message of "Wed, 22 Apr 2026 15:02:02 +0800")

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.

The rest looks fine.

Thanks,
Miquèl

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

  reply	other threads:[~2026-04-22  8:08 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-22  7:02 [PATCH v9 0/3] mtd: spi-nand: Add support for randomizer feature Cheng Ming Lin
2026-04-22  7:02 ` Cheng Ming Lin
2026-04-22  7:02 ` [PATCH v9 1/3] dt-bindings: mtd: nand: Add nand-randomizer property Cheng Ming Lin
2026-04-22  7:02   ` Cheng Ming Lin
2026-04-22  7:02 ` [PATCH v9 2/3] mtd: spi-nand: Add support for randomizer Cheng Ming Lin
2026-04-22  7:02   ` Cheng Ming Lin
2026-04-22  8:08   ` Miquel Raynal [this message]
2026-04-22  8:08     ` Miquel Raynal
2026-04-22  8:14     ` Cheng Ming Lin
2026-04-22  8:14       ` Cheng Ming Lin
2026-04-22  7:02 ` [PATCH v9 3/3] mtd: spi-nand: macronix: Enable randomizer support Cheng Ming Lin
2026-04-22  7:02   ` Cheng Ming Lin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a4uv5set.fsf@bootlin.com \
    --to=miquel.raynal@bootlin.com \
    --cc=alvinzhou@mxic.com.tw \
    --cc=chengminglin@mxic.com.tw \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linchengming884@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=richard@nod.at \
    --cc=robh@kernel.org \
    --cc=vigneshr@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.