public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Ralph Siemsen <ralph.siemsen@linaro.org>
To: Marek Vasut <marek.vasut@mailbox.org>
Cc: u-boot@lists.denx.de, "Simon Glass" <sjg@chromium.org>,
	"Andre Przywara" <andre.przywara@arm.com>,
	"Heiko Thiery" <heiko.thiery@gmail.com>,
	"Heinrich Schuchardt" <xypron.glpk@gmx.de>,
	"Jérôme Carretero" <cJ-uboot@zougloub.eu>,
	"Marc Kleine-Budde" <mkl@pengutronix.de>,
	"Massimo Pegorer" <massimo.pegorer@vimar.com>,
	"Max Krummenacher" <max.krummenacher@toradex.com>,
	"Pali Rohár" <pali@kernel.org>,
	"Philippe Reynes" <philippe.reynes@softathome.com>,
	"Samuel Holland" <samuel@sholland.org>,
	"Sean Anderson" <seanga2@gmail.com>,
	"Steven Lawrance" <steven.lawrance@softathome.com>,
	"Sughosh Ganu" <sughosh.ganu@linaro.org>,
	"Weijie Gao" <weijie.gao@mediatek.com>
Subject: Re: [PATCH v4 09/10] tools: spkgimage: add Renesas SPKG format
Date: Mon, 17 Apr 2023 16:17:12 -0400	[thread overview]
Message-ID: <20230417201712.GG642444@maple.netwinder.org> (raw)
In-Reply-To: <f4818e45-1a60-c1b0-2539-4f081f30a245@mailbox.org>

On Mon, Apr 17, 2023 at 07:23:46PM +0200, Marek Vasut wrote:
>On 3/8/23 21:26, Ralph Siemsen wrote:
>>+			spkgimage.o \
>
>Maybe just call the file renesas_spkgimage.o so its clear which 
>SoC/vendor this file is associtated with.

Okay, will do.

>>+static struct spkg_file out_buf;
>>+
>>+static uint32_t padding;
>
>Is this padding here and the padding in struct config_file below 
>different padding ? Can we get rid of these static global variables ?

I will give it a try.

>
>>+static int check_range(const char *name, int val, int min, int max)
>>+{
>>+	if (val < min) {
>>+		fprintf(stderr, "Warning: param '%s' adjusted to min %d\n",
>>+			name, min);
>>+		val = min;
>>+	}
>>+
>>+	if (val > max) {
>>+		fprintf(stderr, "Warning: param '%s' adjusted to max %d\n",
>>+			name, max);
>>+		val = max;
>>+	}
>
>There is a macro clamp() which implements range limiting .

Thanks for pointing that out. However I think there is value in the 
diagnostic print when the value is clamped. Ideally it should help the 
user to fix their invoking script/binman/etc.

Of course, I could call clamp() and check if the value differs, but that 
seems just as complex as the check_range().

>>+	while (fgets(line, sizeof(line), fcfg)) {
>>+		line_num += 1;
>>+
>>+		/* Skip blank lines and comments */
>>+		if (line[0] == '\n' || line[0] == '#')
>>+			continue;
>>+
>>+		/* Strip the trailing newline */
>>+		len = strlen(line);
>>+		if (line[len - 1] == '\n')
>>+			line[--len] = 0;
>
>Use len - 1 here too to avoid confusion ?

Old habit. I always try to update the length in sync with modifying the 
string. If done as a separate line/statement, it is more likely to be 
lost during subsequent modifications.

In this case I do not need "len" at all, so I could just do:

		line[strcspn(line, "\n")] = 0;

Ralph

  reply	other threads:[~2023-04-17 20:17 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-08 20:26 [PATCH v4 00/10] Renesas RZ/N1 SoC initial support Ralph Siemsen
2023-03-08 20:26 ` [PATCH v4 01/10] ARM: armv7: add non-SPL enable for Cortex SMPEN Ralph Siemsen
2023-04-17 17:04   ` Marek Vasut
2023-04-17 18:26     ` Ralph Siemsen
2023-04-17 20:21       ` Marek Vasut
2023-04-18 14:32         ` Ralph Siemsen
2023-04-18 19:35           ` Marek Vasut
2023-03-08 20:26 ` [PATCH v4 02/10] clk: renesas: prepare for non-RCAR clock drivers Ralph Siemsen
2023-04-17 17:02   ` Marek Vasut
2023-04-17 18:22     ` Ralph Siemsen
2023-04-17 20:33       ` Marek Vasut
2023-04-17 20:48         ` Ralph Siemsen
2023-04-17 22:24           ` Marek Vasut
2023-03-08 20:26 ` [PATCH v4 03/10] clk: renesas: add R906G032 driver Ralph Siemsen
2023-04-17 17:07   ` Marek Vasut
2023-04-17 18:29     ` Ralph Siemsen
2023-03-08 20:26 ` [PATCH v4 04/10] pinctrl: " Ralph Siemsen
2023-04-17 17:09   ` Marek Vasut
2023-03-08 20:26 ` [PATCH v4 05/10] ram: cadence: add driver for Cadence EDAC Ralph Siemsen
2023-04-17 17:32   ` Marek Vasut
2023-04-17 20:33     ` Ralph Siemsen
2023-03-08 20:26 ` [PATCH v4 06/10] dts: basic devicetree for Renesas RZ/N1 SoC Ralph Siemsen
2023-04-17 17:12   ` Marek Vasut
2023-04-17 18:33     ` Ralph Siemsen
2023-04-17 20:22       ` Marek Vasut
2023-03-08 20:26 ` [PATCH v4 07/10] ARM: rzn1: basic support " Ralph Siemsen
2023-04-17 17:15   ` Marek Vasut
2023-04-17 18:57     ` Ralph Siemsen
2023-04-17 20:30       ` Marek Vasut
2023-04-17 20:44         ` Ralph Siemsen
2023-04-17 22:23           ` Marek Vasut
2023-03-08 20:26 ` [PATCH v4 08/10] board: schneider: add RZN1 board support Ralph Siemsen
2023-04-17 17:18   ` Marek Vasut
2023-04-17 19:45     ` Ralph Siemsen
2023-04-17 20:27       ` Marek Vasut
2023-03-08 20:26 ` [PATCH v4 09/10] tools: spkgimage: add Renesas SPKG format Ralph Siemsen
2023-04-17 17:23   ` Marek Vasut
2023-04-17 20:17     ` Ralph Siemsen [this message]
2023-04-17 20:28       ` Marek Vasut
2023-03-08 20:26 ` [PATCH v4 10/10] doc: renesas: add Renesas board docs Ralph Siemsen
2023-04-17 17:28   ` Marek Vasut
2023-04-17 20:29     ` Ralph Siemsen
2023-04-17 20:34       ` Marek Vasut
2023-04-17 20:50         ` Ralph Siemsen

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=20230417201712.GG642444@maple.netwinder.org \
    --to=ralph.siemsen@linaro.org \
    --cc=andre.przywara@arm.com \
    --cc=cJ-uboot@zougloub.eu \
    --cc=heiko.thiery@gmail.com \
    --cc=marek.vasut@mailbox.org \
    --cc=massimo.pegorer@vimar.com \
    --cc=max.krummenacher@toradex.com \
    --cc=mkl@pengutronix.de \
    --cc=pali@kernel.org \
    --cc=philippe.reynes@softathome.com \
    --cc=samuel@sholland.org \
    --cc=seanga2@gmail.com \
    --cc=sjg@chromium.org \
    --cc=steven.lawrance@softathome.com \
    --cc=sughosh.ganu@linaro.org \
    --cc=u-boot@lists.denx.de \
    --cc=weijie.gao@mediatek.com \
    --cc=xypron.glpk@gmx.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox