Thread (9 messages) 9 messages, 3 authors, 2025-09-06

Re: [PATCH net-next v4 2/5] dpll: zl3073x: Add low-level flash functions

From: Jakub Kicinski <kuba@kernel.org>
Date: 2025-09-06 02:19:07
Also in: linux-doc, lkml

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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help