linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Ivan Vecera <ivecera@redhat.com>
Cc: netdev@vger.kernel.org, Jiri Pirko <jiri@resnulli.us>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
	Jonathan Corbet <corbet@lwn.net>,
	Prathosh Satish <Prathosh.Satish@microchip.com>,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
	Michal Schmidt <mschmidt@redhat.com>,
	Petr Oros <poros@redhat.com>,
	Przemek Kitszel <przemyslaw.kitszel@intel.com>
Subject: Re: [PATCH net-next v4 2/5] dpll: zl3073x: Add low-level flash functions
Date: Fri, 5 Sep 2025 19:19:05 -0700	[thread overview]
Message-ID: <20250905191905.05476586@kernel.org> (raw)
In-Reply-To: <20250903100900.8470-3-ivecera@redhat.com>

On Wed,  3 Sep 2025 12:08:57 +0200 Ivan Vecera wrote:
> +/**
> + * zl3073x_flash_download_block - Download image block to device memory
> + * @zldev: zl3073x device structure
> + * @image: image to be downloaded
> + * @start: start position (in 32-bit words)
> + * @size: size to download (in 32-bit words)
> + * @extack: netlink extack pointer to report errors
> + *
> + * Returns 0 in case of success or negative value otherwise.
> + */
> +static int
> +zl3073x_flash_download(struct zl3073x_dev *zldev, const char *component,
> +		       u32 addr, const void *data, size_t size,
> +		       struct netlink_ext_ack *extack)

function name doesn't match kdoc, and "Returns" -> "Return:"

No idea why the kernel-doc script doesn't catch this..

> +		rc = zl3073x_write_hwreg(zldev, addr, *(const u32 *)ptr);

you're sure data is 4B aligned? Otherwise get_unaligned()

> +		if (time_after(jiffies, timeout)) {

time_after_jiffies() ?

> +			if (signal_pending(current)) {
> +				ZL_FLASH_ERR_MSG(extack,
> +						 "Flashing interrupted");
> +				return -EINTR;
> +			}

Is the flash dual-banked? Normally random signals interrupting flashing
is recipe for bricked parts.

A little odd to use "timeout" for periodic check. check_time?

> +	/* Return if no error occurred */
> +	if (!count)
> +		return 0;

Did I already accus^W ask you if AI helped you write this ? :D
This level of commenting makes me think of code generators :)

+	/* Enable host control */
+	rc = zl3073x_flash_host_ctrl_enable(zldev);
+	if (rc) {
+		ZL_FLASH_ERR_MSG(extack, "cannot enable host control");
+		goto error;
+	}
+
+	zl3073x_devlink_flash_notify(zldev, "Flash mode enabled", "utility",
+				     0, 0);
+
+	return 0;
+
+error:
+	rc = zl3073x_flash_mode_leave(zldev, extack);
+	if (rc)
+		ZL_FLASH_ERR_MSG(extack,
+				 "failed to switch back to normal mode");
+
+	return rc;

Should we be overriding rc here if there was an error on entering
but we cleanly left? If so that _is_ worth commenting on..
-- 
pw-bot: cr

  reply	other threads:[~2025-09-06  2:19 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-03 10:08 [PATCH net-next v4 0/5] dpll: zl3073x: Add support for devlink flash Ivan Vecera
2025-09-03 10:08 ` [PATCH net-next v4 1/5] dpll: zl3073x: Add functions to access hardware registers Ivan Vecera
2025-09-03 10:08 ` [PATCH net-next v4 2/5] dpll: zl3073x: Add low-level flash functions Ivan Vecera
2025-09-06  2:19   ` Jakub Kicinski [this message]
2025-09-06  6:57     ` Ivan Vecera
2025-09-03 10:08 ` [PATCH net-next v4 3/5] dpll: zl3073x: Add firmware loading functionality Ivan Vecera
2025-09-03 10:08 ` [PATCH net-next v4 4/5] dpll: zl3073x: Refactor DPLL initialization Ivan Vecera
2025-09-03 10:09 ` [PATCH net-next v4 5/5] dpll: zl3073x: Implement devlink flash callback Ivan Vecera
2025-09-05 13:07 ` [PATCH net-next v4 0/5] dpll: zl3073x: Add support for devlink flash Przemek Kitszel

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=20250905191905.05476586@kernel.org \
    --to=kuba@kernel.org \
    --cc=Prathosh.Satish@microchip.com \
    --cc=corbet@lwn.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=ivecera@redhat.com \
    --cc=jiri@resnulli.us \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mschmidt@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=poros@redhat.com \
    --cc=przemyslaw.kitszel@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).