Skip to content

Conversation

@tabrisnet
Copy link
Collaborator

@tabrisnet tabrisnet commented Jan 19, 2026

Description

Rebased tree from frank-w's. Note, not recommended for production use as eth1 & eth2 are missing. eth0's child interfaces are functional.

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Please also note any relevant details for your test configuration.

  • built the kernel, deployed, booted, it minimally works

Checklist:

Please delete options that are not relevant.

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules

Summary by CodeRabbit

  • Chores

    • Edge builds now track the 6.18 kernel line.
  • New Features

    • Added broad board/device-tree support for BananaPi BPI‑R4 (Pro/variants), mt7988/mt7987 platforms and overlays (PCIe, MMC, NAND/UBI, serial, I2C).
    • Added firmware blobs required for several PHYs and boards.
    • Enhanced Ethernet: RSS and LRO support, USXGMII/SerDes paths, passive mux and PCS integrations.
    • Added DSA support for MaxLinear switches and extensive MT7987 clock, pinctrl, PWM and thermal bindings.
  • Bug Fixes

    • Various stability, logging, and build fixes across drivers and tooling.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 19, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

📝 Walkthrough

Walkthrough

Edge kernel configuration for the filogic family is updated to target Linux 6.18 and pushes a filogic-6.18 patch archive containing many kernel patches: DT additions/overlays, new drivers (PCS/USXGMII, rng, mtdrw, clocks, pinctrl, etc.), kernel build script tweaks, and multiple device-tree updates for BPI-R4 / MT7988/MT7987 platforms.

Changes

Cohort / File(s) Summary
Kernel family config
config/sources/families/filogic.conf
In edge block: KERNEL_MAJOR_MINOR updated 6.166.18; KERNELPATCHDIR assignment commented out; KERNELSOURCE/KERNELBRANCH lines adjusted (switched/commented references to different repo/branch).
Patch archive metadata
patch/kernel/archive/filogic-6.18/0000.patching_config.yaml, patch/kernel/archive/filogic-6.18/series.conf, .../series.armbian
New patching config and series files added to describe filogic-6.18 patch set and include the patch series.
DTB/Makefile device-tree patches & overlays
patch/.../patches.armbian/mt7988a-bananapi-bpi-r4-sd.patch, arch/arm64/boot/dts/mediatek/..., arch/arm64/boot/dts/mediatek/Makefile, *.dtso
Many DT/overlay additions and Makefile updates to generate new mt7988/mt7988a BPI‑R4 / BPI‑R4‑Pro DTBs, overlays (mmc/emmc/sd, PCIe, nopcie), new device nodes (sgmiisys/usxgmiisys, usxgmii pcs), and assorted DT changes (gmacs, mmc, ubi, i2c, serial, etc.).
New kernel drivers / subsystems
drivers/net/pcs/*, drivers/net/ethernet/mediatek/*, drivers/net/dsa/*, drivers/net/phy/*, drivers/clk/*, drivers/pinctrl/mediatek/*, drivers/pwm/*, drivers/thermal/*, drivers/net/pcs/pcs-mtk-*, drivers/net/pcs/*
Large feature additions: PCS framework and providers (FW node PCS), MediaTek USXGMII & Lynxi PCS drivers, MTK Ethernet RSS/LRO/SerDes/usxgmii/mux support and related register map changes, DSA/MXL862xx driver updates, new hw drivers (mtk-rng-v2, mtdrw), clock and pinctrl drivers for MT7987, PWM/LVTS/thermal/AS21xxx PHY additions. Many new header macros, structs, Kconfig/Makefile entries and exported symbols.
Userland/utilities & firmware
utils/regs/src/*, utils/firmware/*
Adds a small regs utility (cross-compiled source/binary) and multiple binary firmware blobs for Airoha / Mediatek PHYs.
Build scripts & packaging
build.sh, scripts/package/builddeb
build.sh: run bindeb-pkg in parallel (-j${numproc}); builddeb: extended deb-pkg handling to install kernels/DTBs for BananaPi boards and additional BPI router variants.
Misc fixes / refactors / docs
assorted: drivers/net/phy/*, Documentation/devicetree/bindings/*, drivers/net/dsa/*
Multiple bug fixes, signature/struct expansions (mtk_eth_soc, phylink/PCS integration), DT binding YAML additions/changes, logging improvements, and small correctness fixes across net/phy, DSA, and other subsystems.

Sequence Diagram(s)

sequenceDiagram
  participant Build as Armbian Build
  participant Repo as Kernel Repo (frank-w / frank-w or tabrisnet)
  participant Patch as Patch Archive (filogic-6.18)
  participant DT as DTS/Overlay Handler
  participant Kernel as Kernel Build System
  participant Artifacts as Output (DTBs, images)

  Build->>Repo: fetch kernel source (KERNELSOURCE/KERNELBRANCH)
  Build->>Patch: load 0000.patching_config.yaml and series
  Patch->>Repo: apply patches (series -> individual patch files)
  Patch->>DT: copy dts & overlays per patching config (dts/overlays -> tree)
  DT->>Repo: integrate DTB Makefile changes and new dtbs/dtbo
  Build->>Kernel: invoke build (make -j${numproc}, bindeb-pkg)
  Kernel->>Artifacts: produce kernel images, DTBs, deb packages
Loading

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~120 minutes

Possibly related PRs

Suggested reviewers

  • igorpecovnik

Poem

🐇 I hopped through patches, small and grand,
I stitched new DTBs with careful hand.
6.18 now wears the filogic crown,
drivers, clocks, and overlays sewn down.
Build and boot — the bunny claps and stands.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: updating the filogic kernel family edge branch to kernel version 6.18.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added size/medium PR with more then 50 and less then 250 lines 02 Milestone: First quarter release Needs review Seeking for review Hardware Hardware related like kernel, U-Boot, ... Patches Patches related to kernel, U-Boot, ... size/large PR with 250 lines or more and removed size/medium PR with more then 50 and less then 250 lines labels Jan 19, 2026
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

Note

Due to the large number of review comments, Critical severity comments were prioritized as inline comments.

🤖 Fix all issues with AI agents
In
`@patch/kernel/archive/filogic-6.18/frank-w/0050-net-dsa-mxl862xx-add-ds-mux.patch`:
- Around line 253-271: The of_node_put(mux_np) is being called inside the
for_each_available_child_of_node loop which releases the parent node reference
mid-iteration (use-after-free); move the of_node_put(mux_np) call to immediately
after the loop (outside and after the for_each_available_child_of_node block) so
the parent reference is held for the whole iteration over children (ensure
mux_np is checked for NULL before the loop and always put after the loop
completes, including when ds_add_mux returns an error).

In
`@patch/kernel/archive/filogic-6.18/frank-w/0053-net-phy-as21-try-the-driver-from-mtk-sdk.patch`:
- Around line 1298-1326: Replace C stdint types and missing headers in
as21xxx.h: change all uint8_t to kernel type u8 in struct downshift_cfg, struct
an_mdi_cfg and struct as21xxx_priv; add the appropriate kernel headers at the
top of the file—include <linux/types.h> for u8, <linux/mutex.h> for struct
mutex, and <linux/dcache.h> (or <linux/fs.h> if preferred) for struct dentry—so
the definitions for ipc_lock and debugfs_root are properly declared.

In
`@patch/kernel/archive/filogic-6.18/frank-w/0058-dt-bindings-net-pcs-mediatek-sgmiisys-add-phys-and-r.patch`:
- Around line 37-45: The YAML schema for the resets property is incorrectly
using a nested "items: - items:" structure; update the "resets" entry (symbol:
resets) to describe a phandle-array/flat list instead of nested objects—either
change it to a single items list where each entry has a single description like
"Phandle to reset controller with reset ID" or use the "phandle-array" type if
supported, so each array element maps to a phandle+specifier tuple rather than
an object with nested items.

In
`@patch/kernel/archive/filogic-6.18/frank-w/0078-net-mtk-eth-mux-fix-rcu_lock-in-mux.patch`:
- Around line 69-120: The phylink creation error path jumps to out_unlock
causing an unmatched rtnl_unlock() because rtnl_lock() wasn't taken there;
change the failure branch in the mtk_mux_create_phylink error handling to "goto
reschedule" instead of "goto out_unlock", then remove the out_unlock label and
its rtnl_unlock() so the only rtnl_unlock()/rtnl_lock() pairs remain around the
mtk_open() call; ensure references to mux->data[new_channel]->phylink,
mtk_mux_create_phylink, reschedule, and rtnl_lock/unlock are updated
accordingly.
🟠 Major comments (22)
patch/kernel/archive/filogic-6.18/frank-w/0050-net-dsa-mxl862xx-add-ds-mux.patch-172-179 (1)

172-179: Uninitialized sfp_present_channel if DT property is missing.

of_property_read_u32 return value is not checked. If the sfp-present-channel property is absent, mux->sfp_present_channel remains uninitialized, causing undefined behavior on line 178.

Proposed fix
+	mux->sfp_present_channel = 0; /* default */
 	of_property_read_u32(np, "sfp-present-channel",
 		&mux->sfp_present_channel);
patch/kernel/archive/filogic-6.18/frank-w/0050-net-dsa-mxl862xx-add-ds-mux.patch-52-70 (1)

52-70: Race condition: state updates after lock release.

mux->channel and mux->initialized are updated (lines 69-70) after rtnl_unlock(). If another thread or reschedule reads these fields before they're written, it may see stale values. Move the state updates inside the critical section.

Proposed fix
 	gpiod_set_value_cansleep(mux->chan_sel_gpio, new_channel);
 
+	mux->channel = new_channel;
+	mux->initialized = true;
+
 	rtnl_unlock();
 
-	mux->channel = new_channel;
-	mux->initialized = true;
-
 reschedule:
patch/kernel/archive/filogic-6.18/frank-w/0050-net-dsa-mxl862xx-add-ds-mux.patch-181-188 (1)

181-188: Incomplete cleanup on channel add failure.

If ds_add_mux_channel fails for the second child, the first channel's mux->data[0] (including its phylink) is leaked. The error path should destroy any already-added channels.

Proposed fix
 	for_each_child_of_node(np, child) {
 		err = ds_add_mux_channel(mux, child);
 		if (err) {
 			dev_err(priv->dev, "failed to add ds_mux\n");
 			of_node_put(child);
-			goto err_put_chan_sel;
+			goto err_release_channels;
 		}
 	}
 
 	INIT_DELAYED_WORK(&mux->sfp_monitor_work, sfp_monitor_work_func);
 	mod_delayed_work(system_wq, &mux->sfp_monitor_work, msecs_to_jiffies(3000));
 
 	return 0;
 
+err_release_channels:
+	for (int i = 0; i < 2; i++) {
+		if (mux->data[i]) {
+			if (mux->data[i]->phylink)
+				phylink_destroy(mux->data[i]->phylink);
+			kfree(mux->data[i]);
+		}
+	}
 err_put_chan_sel:
patch/kernel/archive/filogic-6.18/frank-w/0092-net-pcs-mtk_lynxi-add-mt7987-support.patch-22-27 (1)

22-27: Resource leak: of_parse_phandle() reference not released.

of_parse_phandle() returns a reference-counted device_node* that must be released with of_node_put(). This code never releases the reference, creating a resource leak.

Additionally, there's a kernel coding style violation: if one branch of an if-else has braces, both should.

Use of_property_present() instead, which returns a bool without requiring reference management:

Proposed fix
-	if (of_parse_phandle(np->parent, "resets", 0)) {
+	if (of_property_present(np->parent, "resets")) {
 		mpcs->rstc = of_reset_control_get_shared(np->parent, NULL);
 		if (IS_ERR(mpcs->rstc))
 			return PTR_ERR(mpcs->rstc);
-	} else
+	} else {
 		mpcs->rstc = NULL;
+	}
patch/kernel/archive/filogic-6.18/frank-w/0059-dt-bindings-net-pcs-add-bindings-for-MediaTek-USXGMI.patch-45-69 (1)

45-69: Add #pcs-cells to the USXGMII PCS binding.

additionalProperties: false plus the DTS adding #pcs-cells = <0> will fail schema validation unless the binding explicitly allows it.

✅ Proposed fix
 properties:
   $nodename:
     pattern: "^pcs@[0-9a-f]+$"

   compatible:
     const: mediatek,mt7988-usxgmiisys

+  "#pcs-cells":
+    const: 0
+
   reg:
     maxItems: 1
patch/kernel/archive/filogic-6.18/frank-w/0006-kbuild-deb-pkg-add-kernels-for-bpi-boards-to-deb-pac.patch-20-41 (1)

20-41: Set source_image_path/installed_image_path for bpi‑r64 and bpi‑r2pro

These branches fall back to ./$board.itb, causing the final cp "${source_image_path}" to fail since kernel .itb files are not generated for these boards. For bpi‑r2pro you already copy Image.gz to extlinux, so the paths must match that; for bpi‑r64 you have the same uImage structure as bpi‑r2 but forgot to set the paths.

🛠️ Proposed fix
 		bpi-r64)
 			mkdir -p "${pdir}/boot/bananapi/$board/linux/dtb"
 			DTBFILE=arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dtb
 			cp ${srctree}/uImage_nodt "${pdir}/boot/bananapi/$board/linux/uImage-${KERNELRELEASE}_nodt"
+			source_image_path="${srctree}/uImage"
+			installed_image_path="boot/bananapi/$board/linux/uImage-${KERNELRELEASE}"
 			;;
 		bpi-r2pro)
 			DTBFILE=arch/arm64/boot/dts/rockchip/rk3568-bpi-r2-pro.dtb
 			mkdir -p ${pdir}/boot/extlinux/
-			cp arch/arm64/boot/Image.gz "${pdir}/boot/extlinux/Image-${KERNELRELEASE}.gz"
+			source_image_path="${srctree}/arch/arm64/boot/Image.gz"
+			installed_image_path="boot/extlinux/Image-${KERNELRELEASE}.gz"

For bpi‑r3/bpi‑r4, verify that ./$board.itb is actually generated as a kernel artifact during the build; if those boards only use U-Boot .itb, set explicit paths there as well.

patch/kernel/archive/filogic-6.18/frank-w/0053-net-phy-as21-try-the-driver-from-mtk-sdk.patch-342-436 (1)

342-436: IPC receive can wrap errors + IPC transaction is no longer serialized.

aeon_ipc_rcv_msg stores negative reads into an unsigned size, which then returns a huge positive value. Also, ipc_lock now covers send and receive separately, so another thread can interleave a command between them. That can corrupt IPC responses.

🐛 Proposed fix for error wrapping
-static int aeon_ipc_rcv_msg(struct phy_device *phydev,
-			    u16 ret_sts, u16 *data)
+static int aeon_ipc_rcv_msg(struct phy_device *phydev,
+			    u16 ret_sts, u16 *data)
 {
 	struct as21xxx_priv *priv = phydev->priv;
-	unsigned int size;
+	int size;
 	int ret;
 	int i;
@@
-		if (ret < 0) {
-			size = ret;
-			goto out;
-		}
+		if (ret < 0) {
+			size = ret;
+			goto out;
+		}
 		data[i] = ret;
 	}
 out:
 	mutex_unlock(&priv->ipc_lock);
 	return size;
 }

Please also ensure callers serialize the entire IPC transaction (send + receive) with ipc_lock or move the lock to a wrapper that spans both steps to prevent interleaving.

patch/kernel/archive/filogic-6.18/frank-w/0053-net-phy-as21-try-the-driver-from-mtk-sdk.patch-290-333 (1)

290-333: Fix IPC polling error handling and signedness.

val is unsigned int, but you compare it to < 0 and use negative error codes. That check never triggers, and polling failures are logged but not returned.

🐛 Proposed fix
-	unsigned int val;
+	int val;
@@
-	ret = read_poll_timeout(aeon_cl45_read, val,
+	ret = read_poll_timeout(aeon_cl45_read, val,
 				(FIELD_GET(AEON_IPC_STS_PARITY, val) == curr_parity &&
 				(val & AEON_IPC_STS_STATUS) != AEON_IPC_STS_STATUS_RCVD &&
 				(val & AEON_IPC_STS_STATUS) != AEON_IPC_STS_STATUS_PROCESS &&
 				(val & AEON_IPC_STS_STATUS) != AEON_IPC_STS_STATUS_BUSY) ||
 				(val < 0),
 				10000, 2000000, false,
 				phydev, MDIO_MMD_VEND1, VEND1_IPC_STS);
-	if (val < 0)
-		ret = val;
-
-	if (ret)
-		phydev_err(phydev, "%s fail to polling status failed: %d\n", __func__, ret);
+	if (ret)
+		return ret;
+	if (val < 0)
+		return val;
 	*ret_sts = val;
patch/kernel/archive/filogic-6.18/frank-w/0053-net-phy-as21-try-the-driver-from-mtk-sdk.patch-450-476 (1)

450-476: Ensure firmware version string is bounded and NUL‑terminated.

Line 475 logs ret_data as a string without ensuring termination. That can read past the buffer and leak memory.

🐛 Proposed fix
-	u16 ret_data[8], data[1];
-	u16 ret_sts;
+	u16 ret_data[8], data[1];
+	u16 ret_sts;
+	char fw_version[AEON_IPC_DATA_MAX + 1];
@@
-	ret = aeon_ipc_rcv_msg(phydev, ret_sts, ret_data);
+	ret = aeon_ipc_rcv_msg(phydev, ret_sts, ret_data);
 	if (ret < 0)
 		return ret;
-
-	phydev_info(phydev, "Firmware Version: %s\n", (char *)ret_data);
+	memcpy(fw_version, ret_data, min_t(int, ret, AEON_IPC_DATA_MAX));
+	fw_version[min_t(int, ret, AEON_IPC_DATA_MAX)] = '\0';
+	phydev_info(phydev, "Firmware Version: %s\n", fw_version);
patch/kernel/archive/filogic-6.18/frank-w/0053-net-phy-as21-try-the-driver-from-mtk-sdk.patch-170-228 (1)

170-228: Propagate failures from aeon_set_default_value.

Line 186/192 set ret on error, but Line 227 always returns 0, silently masking failures. This hides allocation/overflow problems and can leave the device in a partial state.

🐛 Proposed fix
 	remaining = byte_count - pos;
 	if (remaining > 0) {
-		if (wdata_count + 2 <= MAX_WDATA_SIZE) {
+		if (wdata_count + 2 <= MAX_WDATA_SIZE) {
 			// Here we just need padded_bytes once, otherwise we need to read from mem
 			memcpy(padded_bytes, &bytebuf[pos], remaining);
 			wdata[wdata_count++] = le16_to_cpu(*(unsigned short *)&padded_bytes[0]);
 			wdata[wdata_count++] = le16_to_cpu(*(unsigned short *)&padded_bytes[2]);
+		} else {
+			pr_err("wdata array overflow\n");
+			ret = -ENOSPC;
+			goto cleanup;
 		}
 	}
@@
 cleanup:
 	kfree(wdata);
-	return 0;
+	return ret;
patch/kernel/archive/filogic-6.18/frank-w/0035-net-pcs-pcs-mtk-lynxi-add-platform-driver-for-MT7988.patch-173-210 (1)

173-210: Add error handling and rollback to mtk_pcs_lynxi_enable().

The function ignores return values from clk_prepare_enable() and phy_power_on(), both of which can fail with negative errno codes in the kernel API. Failures are silently masked, potentially leaving the PCS partially enabled. Proper error propagation and rollback are needed.

🛠️ Suggested fix with error propagation and rollback
 static int mtk_pcs_lynxi_enable(struct phylink_pcs *pcs)
 {
 	struct mtk_pcs_lynxi *mpcs = pcs_to_mtk_pcs_lynxi(pcs);
+	int ret;

 	if (mpcs->sgmii_tx && mpcs->sgmii_rx) {
-		clk_prepare_enable(mpcs->sgmii_rx);
-		clk_prepare_enable(mpcs->sgmii_tx);
+		ret = clk_prepare_enable(mpcs->sgmii_rx);
+		if (ret)
+			return ret;
+		ret = clk_prepare_enable(mpcs->sgmii_tx);
+		if (ret) {
+			clk_disable_unprepare(mpcs->sgmii_rx);
+			return ret;
+		}
 	}

-	if (mpcs->xfi_tphy)
-		phy_power_on(mpcs->xfi_tphy);
+	if (mpcs->xfi_tphy) {
+		ret = phy_power_on(mpcs->xfi_tphy);
+		if (ret) {
+			if (mpcs->sgmii_tx && mpcs->sgmii_rx) {
+				clk_disable_unprepare(mpcs->sgmii_tx);
+				clk_disable_unprepare(mpcs->sgmii_rx);
+			}
+			return ret;
+		}
+	}

 	return 0;
 }
patch/kernel/archive/filogic-6.18/frank-w/0042-net-dsa-add-tag-formats-for-MaxLinear-switches.patch-213-225 (1)

213-225: Fix magic-tag validation logic (&&||).

The current check only rejects packets when both bytes are wrong. It should reject when either byte mismatches.

🐛 Proposed fix
-	if ((mxl862_tag[0] != 0x88) && (mxl862_tag[1] != 0xc3)) {
+	if ((mxl862_tag[0] != 0x88) || (mxl862_tag[1] != 0xc3)) {
patch/kernel/archive/filogic-6.18/frank-w/0046-net-dsa-mxl862xx-Support-serdes1-as-a-lan-port.patch-755-771 (1)

755-771: Port translation error handling returns valid port number.

Both mxl862_dsa_port_to_tag_port() and mxl862_tag_port_to_dsa_port() return 0 on error, which could be confused with a valid port. In the RX path, this could cause packets to be attributed to the wrong interface. Consider returning a negative value or using a clearly invalid sentinel:

 static int mxl862_dsa_port_to_tag_port(const int in_dsa_port)
 {
 	if (in_dsa_port < 15)
 		return in_dsa_port + 1;

 	dev_err_ratelimited(NULL, "%s Wrong in_dsa_port value: %d\n", __FILE__, in_dsa_port);
-	return 0;
+	return -EINVAL;
 }

 static int mxl862_tag_port_to_dsa_port(const int in_hw_port)
 {
 	if (in_hw_port >= 1 && in_hw_port <= 15)
 		return in_hw_port - 1;

 	dev_err_ratelimited(NULL, "%s Wrong in_hw_port value: %d\n", __FILE__, in_hw_port);
-	return 0;
+	return -EINVAL;
 }

The callers would then need to check for negative return values. Alternatively, if the error case truly should never happen in production, a WARN_ON_ONCE might be more appropriate to catch bugs during development.

patch/kernel/archive/filogic-6.18/frank-w/0033-net-phylink-support-late-PCS-provider-attach.patch-46-52 (1)

46-52: Missing notifier unregistration risks UAF on phylink teardown.

Each phylink instance registers fwnode_pcs_nb but there’s no corresponding unregister on destroy, leaving a dangling notifier entry that can call into freed memory on later provider-add events. Please add an unregister API and invoke it in phylink_destroy (and any failure paths after registration).

🛠️ Suggested fix
diff --git a/drivers/net/pcs/pcs.c b/drivers/net/pcs/pcs.c
@@
 int register_fwnode_pcs_notifier(struct notifier_block *nb)
 {
 	return blocking_notifier_chain_register(&fwnode_pcs_notify_list, nb);
 }
 EXPORT_SYMBOL_GPL(register_fwnode_pcs_notifier);
+
+int unregister_fwnode_pcs_notifier(struct notifier_block *nb)
+{
+	return blocking_notifier_chain_unregister(&fwnode_pcs_notify_list, nb);
+}
+EXPORT_SYMBOL_GPL(unregister_fwnode_pcs_notifier);
diff --git a/include/linux/pcs/pcs.h b/include/linux/pcs/pcs.h
@@
 int register_fwnode_pcs_notifier(struct notifier_block *nb);
+int unregister_fwnode_pcs_notifier(struct notifier_block *nb);
@@
 static int register_fwnode_pcs_notifier(struct notifier_block *nb)
 {
 	return -EOPNOTSUPP;
 }
+static int unregister_fwnode_pcs_notifier(struct notifier_block *nb)
+{
+	return -EOPNOTSUPP;
+}
diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
@@
 void phylink_destroy(struct phylink *pl)
 {
+	if (!phy_interface_empty(pl->config->pcs_interfaces))
+		unregister_fwnode_pcs_notifier(&pl->fwnode_pcs_nb);
 	...
 }

Also applies to: 173-176

patch/kernel/archive/filogic-6.18/frank-w/0033-net-phylink-support-late-PCS-provider-attach.patch-71-92 (1)

71-92: Release fwnode references while scanning PCS handles.

Each loop iteration acquires a pcsspec.fwnode reference but never releases it when the handle doesn’t match, leaking refs. Add fwnode_handle_put() before continuing/breaking.

🛠️ Suggested fix
 while (true) {
 	ret = fwnode_parse_pcsspec(fwnode, i, NULL, &pcsspec);
 	if (ret)
 		break;
 
 	if (pcsspec.fwnode == pcs_fwnode)
-		break;
+		goto out_put;
 
+out_put:
+	fwnode_handle_put(pcsspec.fwnode);
 	i++;
 }
 
 return fwnode_pcs_get(fwnode, i);
patch/kernel/archive/filogic-6.18/frank-w/0031-net-phylink-add-phylink_release_pcs-to-externally-re.patch-46-92 (1)

46-92: Fix lifecycle issue: phylink_release_pcs() cannot be called after phylink_stop().

When phylink_stop() sets pcs->phylink = NULL for all PCS in the list without removing them, a subsequent call to phylink_release_pcs() performs an early return since pl = pcs->phylink is now NULL. The list_del(&pcs->list) never executes, leaving the stale PCS entry in pl->pcs_list. On the next phylink_start(), the PCS is re-attached via the list iteration, violating the release operation's contract.

Either ensure phylink_release_pcs() is always called before phylink_stop(), or track the PCS-phylink association independently of the pcs->phylink pointer so list removal is always possible.

patch/kernel/archive/filogic-6.18/frank-w/0036-net-pcs-add-driver-for-MediaTek-USXGMII-PCS.patch-396-403 (1)

396-403: Propagate PHY power‑on failures.

phy_power_on() returns an int (0 on success, negative errno on failure), but the return value is ignored, allowing silent failures. The mtk_usxgmii_pcs_enable() function signature supports returning errors; propagate them to phylink.

Suggested fix
 static int mtk_usxgmii_pcs_enable(struct phylink_pcs *pcs)
 {
 	struct mtk_usxgmii_pcs *mpcs = pcs_to_mtk_usxgmii_pcs(pcs);
+	int ret;
 
-	phy_power_on(mpcs->xfi_tphy);
+	ret = phy_power_on(mpcs->xfi_tphy);
+	if (ret)
+		return ret;
 
 	return 0;
 }
patch/kernel/archive/filogic-6.18/frank-w/0001-add-mtd-rw-driver.patch-505-582 (1)

505-582: Fix unlocked bitmask shifts for partitions ≥ 32.

Line 554 and Line 579 use 1 << i with i up to 63. This is undefined for 32-bit shifts and will mis-track unlocked partitions beyond 31. Use BIT_ULL(i) or 1ULL << i.

🛠️ Suggested fix
@@
-			unlocked |= (1 << i);
+			unlocked |= (1ULL << i);
@@
-		if (unlocked & (1 << i)) {
+		if (unlocked & (1ULL << i)) {
patch/kernel/archive/filogic-6.18/frank-w/0002-add-regs-command-from-mtk-sdk-and-add-crosscompile-s.patch-300-387 (1)

300-387: Harden regs CLI validation and munmap size.

Line 366 onward reads argv[4] without ensuring argc >= 5, so regs r <addr> <startbit> (argc=4) will read past argv. Also, Line 386 unmaps only MAP_SIZE despite mapping 2 * MAP_SIZE at Line 328.

🛠️ Suggested fix
@@
-		case 'r':
-			if (argc == 3)
+		case 'r':
+			if (argc == 3)
 				reg_read_bits((uint32_t *)virt_addr,
 					      (uint32_t *)map_base,
 					      (uint32_t *)(offset & ~MAP_MASK),
 					      0, 32);
-			else {
+			else if (argc >= 5) {
 				startbit = strtoul(argv[3], 0, 10);
 				if (startbit > 32)
 					PRINT_ERROR;
 				datalen = strtoul(argv[4], 0, 10);
 				if (datalen > 32)
 					PRINT_ERROR;
 				reg_read_bits((uint32_t *)virt_addr,
 					      (uint32_t *)map_base,
 					      (uint32_t *)(offset & ~MAP_MASK),
 					      startbit, datalen);
+			} else {
+				usage();
 			}
 			goto out;
@@
-out:
-	if(munmap(map_base, MAP_SIZE) == -1)
+out:
+	if(munmap(map_base, 2 * MAP_SIZE) == -1)
 		PRINT_ERROR;
patch/kernel/archive/filogic-6.18/frank-w/0001-add-mtd-rw-driver.patch-33-42 (1)

33-42: Gate mtdrw build on CONFIG_MTD_RW (currently unconditional).

Lines 41-42 add mtdrw/ unconditionally and the subdir Makefile uses obj-m with only CONFIG_MTD gating. This builds the module even when CONFIG_MTD_RW=n, which breaks Kconfig intent.

🛠️ Suggested fix (align build with Kconfig)
diff --git a/drivers/mtd/Makefile b/drivers/mtd/Makefile
@@
-obj-y				+= mtdrw/
+obj-$(CONFIG_MTD_RW)		+= mtdrw/

diff --git a/drivers/mtd/mtdrw/Makefile b/drivers/mtd/mtdrw/Makefile
@@
-ifdef CONFIG_MTD
-obj-m += mtd-rw.o
-endif
+obj-$(CONFIG_MTD_RW) += mtd-rw.o
patch/kernel/archive/filogic-6.18/frank-w/0077-net-ethernet-mtk_eth_soc-support-ethernet-passive-mu.patch-252-270 (1)

252-270: Move of_node_put(mux_np) out of the child loop.
It's called inside the loop (line 268), releasing the parent node reference on each iteration while still iterating over its children. Each of_get_child_by_name() call acquires one reference that must be released exactly once. Put it after the loop completes.

Proposed fix
 		for_each_available_child_of_node(mux_np, child) {
 			if (err)
 				dev_err(&pdev->dev, "failed to add mux\n");
-
-			of_node_put(mux_np);
-		};
+		}
+		of_node_put(mux_np);
 	}
patch/kernel/archive/filogic-6.18/frank-w/0077-net-ethernet-mtk_eth_soc-support-ethernet-passive-mu.patch-161-234 (1)

161-234: Validate sfp-present-channel bounds and clean up partial channel allocations on error.

The sfp_present_channel value is used as an index into mux->data[2] (a 2-element array) at line 48 of the patch (mux->data[new_channel]), but there is no validation to ensure it's in the valid range [0, 1]. An invalid value causes out-of-bounds access.

Additionally, if mtk_add_mux_channel() fails after allocating one or more channels, the previously allocated mtk_mux_data structures and their embedded phylink objects leak, as the error path skips the per-channel cleanup that mtk_release_mux() provides elsewhere in the patch.

🐛 Proposed fix
-	struct mtk_mux *mux;
-	unsigned int id;
-	int err;
+	struct mtk_mux *mux;
+	unsigned int id;
+	int err, i;
@@
-	mux = kmalloc(sizeof(struct mtk_mux), GFP_KERNEL);
+	mux = kzalloc(sizeof(*mux), GFP_KERNEL);
@@
-	of_property_read_u32(np, "sfp-present-channel",
-		&mux->sfp_present_channel);
+	err = of_property_read_u32(np, "sfp-present-channel",
+		&mux->sfp_present_channel);
+	if (err || mux->sfp_present_channel > 1) {
+		dev_err(eth->dev, "invalid sfp-present-channel\n");
+		err = -EINVAL;
+		goto err_put_chan_sel;
+	}
@@
 		if (err) {
 			dev_err(eth->dev, "failed to add mtk_mux\n");
 			of_node_put(child);
-			goto err_put_chan_sel;
+			goto err_free_channels;
 		}
 	}
@@
+err_free_channels:
+	for (i = 0; i < 2; i++) {
+		if (mux->data[i]) {
+			if (mux->data[i]->phylink)
+				phylink_destroy(mux->data[i]->phylink);
+			kfree(mux->data[i]);
+		}
+	}
 err_put_chan_sel:
 	gpiod_put(mux->chan_sel_gpio);
🟡 Minor comments (9)
patch/kernel/archive/filogic-6.18/frank-w/0094-net-pcs-mtk_lynxi-make-xfi-tphy-optional.patch-23-28 (1)

23-28: Missing of_node_put() for phandle reference.

of_parse_phandle() returns a node with an incremented reference count. The returned pointer should be released with of_node_put() to avoid a reference leak.

Suggested fix
-	if (of_parse_phandle(dev->of_node, "phys", 0)) {
+	struct device_node *phy_np = of_parse_phandle(dev->of_node, "phys", 0);
+	if (phy_np) {
+		of_node_put(phy_np);
 		mpcs->xfi_tphy = devm_of_phy_get(mpcs->dev, dev->of_node, NULL);
 		if (IS_ERR(mpcs->xfi_tphy))
 			return PTR_ERR(mpcs->xfi_tphy);
-	} else
+	} else {
 		mpcs->xfi_tphy = NULL;
+	}
patch/kernel/archive/filogic-6.18/frank-w/0050-net-dsa-mxl862xx-add-ds-mux.patch-141-144 (1)

141-144: Unsigned comparison always false.

id is declared as unsigned int on line 133, so the check id < 0 on line 142 is always false. Either change id to int (as done in ds_add_mux_channel) or remove the negative check.

Proposed fix
-	unsigned int id;
+	int id;
 	int err;
 
 	if (!_id) {
patch/kernel/archive/filogic-6.18/frank-w/0082-dt-bindings-pinctrl-add-binding-for-MT7987-SoC.patch-148-152 (1)

148-152: Function name mismatch between enum and conditional.

The function enum at line 151 uses eth, but the conditional at lines 181-184 checks for const: ethernet. The documentation table (lines 103-145) also uses "ethernet". This inconsistency means:

  1. The example using function = "eth" will pass enum validation
  2. But the conditional enforcing allowed groups for mdc_mdio won't trigger since it checks for ethernet

Either change the enum to include ethernet instead of eth, or update the conditional and documentation to use eth.

Suggested fix
         properties:
           function:
             description:
               A string containing the name of the function to mux to the group.
-            enum: [eth, flash, i2c, i2s, led, pcie, pcm, pwm, jtag, spi, uart, usb, wdt]
+            enum: [ethernet, flash, i2c, i2s, led, pcie, pcm, pwm, jtag, spi, uart, usb, wdt]

And update the example at line 410:

         mdio0_pins: mdio0-pins {
           mux {
-            function = "eth";
+            function = "ethernet";
             groups = "mdc_mdio";
           };
patch/kernel/archive/filogic-6.18/frank-w/0017-arm64-dts-mediatek-mt7988-Add-devicetree-for-BananaP.patch-100-105 (1)

100-105: Model string missing "Pro" designation.

The model property says "Bananapi BPI-R4" but this is the BPI-R4 Pro variant (4E). The compatible strings correctly include bananapi,bpi-r4-pro-4e, but the model string should match to avoid confusion with the standard BPI-R4.

The same issue exists in the 8x variant at lines 122-127.

📝 Suggested fix

For mt7988a-bananapi-bpi-r4-pro-4e.dts:

 / {
-	model = "Bananapi BPI-R4";
+	model = "Bananapi BPI-R4 Pro 4E";
 	compatible = "bananapi,bpi-r4-pro-4e",

For mt7988a-bananapi-bpi-r4-pro-8x.dts:

 / {
-	model = "Bananapi BPI-R4";
+	model = "Bananapi BPI-R4 Pro 8X";
 	compatible = "bananapi,bpi-r4-pro-8x",
patch/kernel/archive/filogic-6.18/frank-w/0053-net-phy-as21-try-the-driver-from-mtk-sdk.patch-1066-1075 (1)

1066-1075: Don’t swallow PHY ID read errors.

If aeon_read_pid() fails, returning 0 treats it as “not a match” and hides real MDIO errors.

🐛 Proposed fix
 	/* AEONSEMI get pid. */
 	phydev->phy_id = aeon_read_pid(phydev);
+	if ((int)phydev->phy_id < 0)
+		return (int)phydev->phy_id;
 	if (phydev->phy_id != PHY_ID_AS21XXX)
 		return 0;
patch/kernel/archive/filogic-6.18/frank-w/0046-net-dsa-mxl862xx-Support-serdes1-as-a-lan-port.patch-403-417 (1)

403-417: Potential use of uninitialized cpu_port variable.

If the device tree has no port marked as CPU port, cpu_port will be used uninitialized in the dev_info() on line 416. While there's a validation check later in probe (lines 662-666), this dev_info executes first. Consider initializing cpu_port to an invalid sentinel value:

 static int mxl862xx_setup(struct dsa_switch *ds)
 {
 	struct mxl862xx_priv *priv = ds->priv;
-	unsigned int cpu_port, j;
+	unsigned int cpu_port = UINT_MAX, j;
 	int ret;
 	u8 i;

This way, if no CPU port is found, the log will show an obviously invalid value rather than garbage.

patch/kernel/archive/filogic-6.18/frank-w/0032-net-pcs-implement-Firmware-node-support-for-PCS-driv.patch-238-262 (1)

238-262: Propagate parse errors instead of masking as -ENOENT.

fwnode_phylink_pcs_count() treats any error from fwnode_property_get_reference_args() as end-of-list, which can silently hide malformed pcs-handle data. Consider propagating non--ENOENT errors.

🛠️ Suggested fix
 while (true) {
 	ret = fwnode_property_get_reference_args(fwnode, "pcs-handle",
 						 "#pcs-cells",
 						 -1, index, &out_args);
-	/* We expect to reach an -ENOENT error while counting */
-	if (ret)
-		break;
+	if (ret == -ENOENT)
+		break;
+	if (ret)
+		return ret;
 
 	fwnode_handle_put(out_args.fwnode);
 	index++;
 }
patch/kernel/archive/filogic-6.18/frank-w/0025-net-ethernet-mtk_eth_soc-Add-RSS-support.patch-388-455 (1)

388-455: Confirm PDMA IRQ naming is complete for MTK_PDMA_INT SoCs.

The driver now requires named IRQs pdma0..pdma3 for SoCs with the MTK_PDMA_INT capability (MT7985, MT7986, MT7987, MT7988). Patch 0106 (MT7987) includes these names, but MT7988 DTS patches (0016, 0017) do not add them to the base ethernet node. Probe will fail unless the MT7988 ethernet node in the kernel's base mt7988a.dtsi already defines these interrupt names; confirm this is the case or add them to patch 0017.

patch/kernel/archive/filogic-6.18/frank-w/0077-net-ethernet-mtk_eth_soc-support-ethernet-passive-mu.patch-35-72 (1)

35-72: Handle GPIO read errors before using the value.
gpiod_get_value_cansleep() returns the GPIO logical value (0 or 1) on success, or a negative errno on failure. The current code doesn't check for errors, so a negative return would be treated as truthy in the ternary operator on line 48, potentially triggering an unintended channel switch.

Proposed fix
 	sfp_present = gpiod_get_value_cansleep(mux->mod_def0_gpio);
+	if (sfp_present < 0)
+		goto reschedule;
 	new_channel = sfp_present ? mux->sfp_present_channel : !mux->sfp_present_channel;
🧹 Nitpick comments (21)
patch/kernel/archive/filogic-6.18/frank-w/0052-dbg-net-dsa-mxl862xx-extend-information-on-write-err.patch (1)

15-20: Enhanced error logging improves debuggability.

The additional diagnostic fields (hardware port, serial port ID, speed, and return code) are useful for troubleshooting interface setup failures.

Minor style note: kernel coding style typically uses spaces after commas in function arguments. This is a nitpick for an edge-branch patch.

Optional: Add spaces for style consistency
-		dev_err(dp->ds->dev, "failed to set intf on port %d (hw:%d,ser_port_id:%d) to %d (ret:%d)\n", dp->index,hw_port,ser_intf.port_id,ser_intf.speed,ret);
+		dev_err(dp->ds->dev,
+			"failed to set intf on port %d (hw:%d, ser_port_id:%d) to %d (ret:%d)\n",
+			dp->index, hw_port, ser_intf.port_id, ser_intf.speed, ret);
patch/kernel/archive/filogic-6.18/frank-w/0054-net-phy-as21x-disable-the-dcp_ra-call.patch (1)

18-40: Consider using #if 0 or preprocessor guards instead of mixed comment styles.

The patch uses /* */ block comments for the function definition (lines 18-28) and // single-line comments for the call site (lines 38-39). For temporarily disabling code in kernel sources, #if 0 ... #endif`` is the conventional approach—it's easier to grep for, toggle, and avoids nested comment issues.

That said, for an edge branch with experimental code, this is a minor style concern.

💡 Alternative using preprocessor guards
-/*static int aeon_dpc_ra_enable(struct phy_device *phydev)
+#if 0 /* DCP RA disabled - see patch 0054 */
+static int aeon_dpc_ra_enable(struct phy_device *phydev)
 {
 	u16 data[2];
 	u16 ret_sts;
@@ -709,7 +709,7 @@ static int aeon_dpc_ra_enable(struct phy_device *phydev)
 
 	return aeon_ipc_send_msg(phydev, IPC_CMD_CFG_PARAM, data,
 				 sizeof(data), &ret_sts);
-}*/
+}
+#endif

And for the call site:

-	//if (phydev->interface == PHY_INTERFACE_MODE_USXGMII)
-	//	ret = aeon_dpc_ra_enable(phydev);
+#if 0 /* DCP RA disabled */
+	if (phydev->interface == PHY_INTERFACE_MODE_USXGMII)
+		ret = aeon_dpc_ra_enable(phydev);
+#endif
patch/kernel/archive/filogic-6.18/frank-w/0008-hwrng-add-driver-for-MediaTek-TRNG-SMC.patch (1)

27-42: Minor typo in Kconfig help text.

Line 38 in the patch: "choose M here. the module" — the sentence-initial "the" should be capitalized to "The".

📝 Suggested fix
-	  To compile this driver as a module, choose M here. the
+	  To compile this driver as a module, choose M here. The
 	  module will be called mtk-rng-v2.
patch/kernel/archive/filogic-6.18/frank-w/0014-build.sh-Build-DEB-packages-in-parallel.patch (1)

18-19: Guard numproc before using -j to avoid unbounded parallelism.

If numproc is unset/empty, make -j runs unlimited jobs and can overwhelm build hosts. Please confirm numproc is always initialized before this call, or add a local default and quote it. Line 19 is the only place that assumes numproc is set.

♻️ Suggested hardening
- LOCALVERSION="${gitbranch}" board="$baseboard" KDEB_COMPRESS=gzip make -j${numproc} bindeb-pkg
+ : "${numproc:=$(nproc)}"
+ LOCALVERSION="${gitbranch}" board="$baseboard" KDEB_COMPRESS=gzip make -j"${numproc}" bindeb-pkg
patch/kernel/archive/filogic-6.18/frank-w/0038-net-ethernet-mtk_eth_soc-add-more-DMA-monitor-for-MT.patch (1)

123-123: Macro parameter i should be parenthesized.

The macro MTK_GDM_RX_FC_OFFSET(eth, i) uses i without parentheses. If a caller passes an expression like idx + 1, the multiplication binds tighter than addition, causing incorrect evaluation.

Suggested fix
-#define MTK_GDM_RX_FC_OFFSET(eth, i)	(i * (mtk_is_netsys_v3_or_greater(eth) ? MTK_STAT_OFFSET_V3 : MTK_STAT_OFFSET) + MTK_GDM_RX_FC)
+#define MTK_GDM_RX_FC_OFFSET(eth, i)	((i) * (mtk_is_netsys_v3_or_greater(eth) ? MTK_STAT_OFFSET_V3 : MTK_STAT_OFFSET) + MTK_GDM_RX_FC)
patch/kernel/archive/filogic-6.18/frank-w/0095-net-pcs-mtk-lynxi-add-phya-tx-rx-clock-path.patch (1)

57-69: Consider documenting the TRX buffer threshold magic numbers.

The values 0x3112 (default) and 0x2111 (PHYA clock) are hardware-specific constants from the MediaTek SDK. Adding a brief comment explaining their purpose or defining named constants would improve maintainability.

Example documentation
-	unsigned int rgc3, sgm_mode, bmcr = 0, trxbuf_thr = 0x3112;
+	unsigned int rgc3, sgm_mode, bmcr = 0;
+	/* TRX buffer threshold: default 0x3112, PHYA clock path 0x2111 */
+	unsigned int trxbuf_thr = 0x3112;
patch/kernel/archive/filogic-6.18/frank-w/0012-firmware-add-firmware-for-mt7987-BPI-R4Lite-phy.patch (1)

6-11: Firmware blobs are redistributable under MediaTek license; consider documenting source for reference.

The MT7987 firmware files (i2p5ge-phy-pmb.bin and i2p5ge-phy-DSPBitTb.bin) are included in upstream linux-firmware under the redistributable LICENCE.mediatek and are sourced from MediaTek's OpenWrt feed. No licensing compliance issue exists. For audit clarity, optionally reference the upstream source or firmware version in the patch header or PR notes.

patch/kernel/archive/filogic-6.18/frank-w/0096-net-ethernet-mtk_eth_soc-add-mt7987-support.patch (2)

109-116: Consider using a dedicated capability bit instead of direct caps comparison.

The check eth->soc->caps != MT7988_CAPS works but is fragile—it implicitly excludes MT7988 by comparing the entire capability bitmask. If additional netsys_v3 SoCs are added in the future, this logic may need revisiting.

A cleaner approach would be to introduce a dedicated capability bit (e.g., MTK_QTX_SCH_V3) to explicitly indicate which rate register layout to use. However, given this is an edge kernel patch from an upstream vendor tree, the current approach is acceptable.


244-246: Commented-out RSS configuration.

The //rss_num = 4 line appears to be development leftover. Note that MT7987_CAPS already includes MTK_RSS, so RSS capability is enabled. Consider either removing this commented line or uncommenting it if RSS is intended to be active with 4 queues.

patch/kernel/archive/filogic-6.18/frank-w/0083-pinctrl-add-pinctrl-driver-for-mt7987-from-sdk.patch (1)

66-73: Remove duplicate PIN_FIELD_BASE definition.
It’s defined twice identically; this is redundant and can trigger -Wmacro-redefined in some toolchains.

♻️ Proposed cleanup
-#define PIN_FIELD_BASE(_s_pin, _e_pin, _i_base, _s_addr, _x_addrs, _s_bit,     \
-		       _x_bits)                                                \
-	PIN_FIELD_CALC(_s_pin, _e_pin, _i_base, _s_addr, _x_addrs, _s_bit,     \
-		       _x_bits, 32, 0)
-#define PIN_FIELD_BASE(_s_pin, _e_pin, _i_base, _s_addr, _x_addrs, _s_bit,     \
-		       _x_bits)                                                \
-	PIN_FIELD_CALC(_s_pin, _e_pin, _i_base, _s_addr, _x_addrs, _s_bit,     \
-		       _x_bits, 32, 0)
+#define PIN_FIELD_BASE(_s_pin, _e_pin, _i_base, _s_addr, _x_addrs, _s_bit,     \
+		       _x_bits)                                                \
+	PIN_FIELD_CALC(_s_pin, _e_pin, _i_base, _s_addr, _x_addrs, _s_bit,     \
+		       _x_bits, 32, 0)
patch/kernel/archive/filogic-6.18/frank-w/0018-arm64-dts-mediatek-mt7988a-bpi-r4-pro-Add-PCIe-overl.patch (1)

48-48: Unused include in cn15 overlay.

The dt-bindings/gpio/gpio.h header is included but no GPIO macros (like GPIO_ACTIVE_HIGH/LOW) are used in this overlay file. The same applies to cn18.dtso at line 74. This is harmless but could be cleaned up.

♻️ Suggested cleanup
-#include <dt-bindings/gpio/gpio.h>
-
 / {
 	compatible = "bananapi,bpi-r4-pro", "mediatek,mt7988a";
 };
patch/kernel/archive/filogic-6.18/frank-w/0017-arm64-dts-mediatek-mt7988-Add-devicetree-for-BananaP.patch (1)

321-326: Duplicate fan properties.

The &fan reference re-specifies pinctrl-0, pinctrl-names, and pwms that are already defined in the original fan: pwm-fan node (lines 166-174). This duplication is unnecessary since the values are identical.

♻️ Suggested simplification
 &fan {
-	pinctrl-0 = <&pwm0_pins>;
-	pinctrl-names = "default";
-	pwms = <&pwm 0 50000>;
 	status = "okay";
 };
patch/kernel/archive/filogic-6.18/frank-w/0071-arm64-dts-r4pro-add-mxl-switch.patch (1)

145-161: Minor formatting: missing space after reg=.

The switchphy nodes have reg= <x> instead of the standard reg = <x> formatting with a space before the equals sign.

♻️ Suggested formatting fix
-			switchphy0:switchphy@0 {
-				reg= <0>;
+			switchphy0: switchphy@0 {
+				reg = <0>;
 			};

-			switchphy1:switchphy@1 {
-				reg= <1>;
+			switchphy1: switchphy@1 {
+				reg = <1>;
 			};

(Apply similar fixes for switchphy2-4)

patch/kernel/archive/filogic-6.18/frank-w/0070-arm64-dts-r4pro-add-gmac-1-2-and-phys.patch (1)

33-33: Leftover debug comment.

The comment //change 5 appears to be a development note that should be removed or clarified before merging.

♻️ Suggested fix
-		reset-gpios = <&pio 83 GPIO_ACTIVE_LOW>; //change 5
+		reset-gpios = <&pio 83 GPIO_ACTIVE_LOW>;
patch/kernel/archive/filogic-6.18/frank-w/0035-net-pcs-pcs-mtk-lynxi-add-platform-driver-for-MT7988.patch (1)

302-307: Prefer devm-managed reset control acquisition.

of_reset_control_get_shared() isn’t devm‑managed and there’s no corresponding reset_control_put() on remove/error paths. Consider devm_reset_control_get_shared() (or _optional_shared if reset is optional).

♻️ Suggested refactor
-	mpcs->rstc = of_reset_control_get_shared(np->parent, NULL);
+	mpcs->rstc = devm_reset_control_get_shared(dev, NULL);
 	if (IS_ERR(mpcs->rstc))
 		return PTR_ERR(mpcs->rstc);
patch/kernel/archive/filogic-6.18/frank-w/0046-net-dsa-mxl862xx-Support-serdes1-as-a-lan-port.patch (3)

124-140: Tag protocol parsing function is functional, minor style nits.

The cast on line 128 is unnecessary—dsa_to_port() already returns struct dsa_port *. Also, of_property_read_string() could be cleaner than of_get_property() for string retrieval. These are optional refinements:

-	struct dsa_port *dp = (struct dsa_port *)dsa_to_port(ds, port);
-	const char *user_protocol = NULL;
+	struct dsa_port *dp = dsa_to_port(ds, port);
+	const char *user_protocol;

-	if (dp != NULL)
-		user_protocol = of_get_property(dp->dn, "dsa-tag-protocol", NULL);
-	if (user_protocol != NULL) {
+	if (dp && !of_property_read_string(dp->dn, "dsa-tag-protocol", &user_protocol)) {

227-242: Safety check added for block_id, minor style issue.

The added && block_id check on line 231 prevents attempting to deactivate VLAN filter entries when the block is not allocated (block_id = 0). This is a good defensive fix.

Minor style: line 239 is missing spaces around the minus operator.

-			block_info->final_filters_idx = block_info->filters_max-1;
+			block_info->final_filters_idx = block_info->filters_max - 1;

591-615: Mirror state preservation fix is important.

Lines 595-596 now properly preserve the existing mirror enable states before calling the API. This fixes a likely bug where only the changed mirror direction was set, potentially disabling the other direction unintentionally.

The brace placement on lines 604-612 doesn't follow kernel coding style (opening brace should be on the same line as for):

-	for (i = 0; i < max_ports; i++)
-	{
+	for (i = 0; i < max_ports; i++) {
 		if (dsa_is_unused_port(ds, i))
 			continue;
patch/kernel/archive/filogic-6.18/frank-w/0028-net-ethernet-mtk_eth_soc-add-paths-and-SerDes-modes-.patch (1)

122-145: Validate mac_id before defaulting to GMAC3 paths.

The ternary fallback routes any unexpected mac_id to GMAC3, which can silently misconfigure the mux. A small switch with a default -EINVAL makes failures explicit.

♻️ Suggested defensive update
 int mtk_gmac_usxgmii_path_setup(struct mtk_eth *eth, int mac_id)
 {
 	u64 path;
 
-	path = (mac_id == MTK_GMAC1_ID) ?  MTK_ETH_PATH_GMAC1_USXGMII :
-	       (mac_id == MTK_GMAC2_ID) ?  MTK_ETH_PATH_GMAC2_USXGMII :
-					   MTK_ETH_PATH_GMAC3_USXGMII;
+	switch (mac_id) {
+	case MTK_GMAC1_ID:
+		path = MTK_ETH_PATH_GMAC1_USXGMII;
+		break;
+	case MTK_GMAC2_ID:
+		path = MTK_ETH_PATH_GMAC2_USXGMII;
+		break;
+	case MTK_GMAC3_ID:
+		path = MTK_ETH_PATH_GMAC3_USXGMII;
+		break;
+	default:
+		return -EINVAL;
+	}
 
 	/* Setup proper MUXes along the path */
 	return mtk_eth_mux_setup(eth, path);
 }
 
 int mtk_gmac_sgmii_path_setup(struct mtk_eth *eth, int mac_id)
 {
 	u64 path;
 
-	path = (mac_id == MTK_GMAC1_ID) ? MTK_ETH_PATH_GMAC1_SGMII :
-	       (mac_id == MTK_GMAC2_ID) ? MTK_ETH_PATH_GMAC2_SGMII :
-					  MTK_ETH_PATH_GMAC3_SGMII;
+	switch (mac_id) {
+	case MTK_GMAC1_ID:
+		path = MTK_ETH_PATH_GMAC1_SGMII;
+		break;
+	case MTK_GMAC2_ID:
+		path = MTK_ETH_PATH_GMAC2_SGMII;
+		break;
+	case MTK_GMAC3_ID:
+		path = MTK_ETH_PATH_GMAC3_SGMII;
+		break;
+	default:
+		return -EINVAL;
+	}
 
 	/* Setup proper MUXes along the path */
 	return mtk_eth_mux_setup(eth, path);
 }
patch/kernel/archive/filogic-6.18/frank-w/0078-net-mtk-eth-mux-fix-rcu_lock-in-mux.patch (2)

135-149: Remove the commented-out phylink_create block.
If creation is intentionally deferred, keep only the live path to avoid dead code noise.

♻️ Cleanup suggestion
-	/*phylink = phylink_create(&mux->mac->phylink_config,
-				 of_fwnode_handle(np),
-				 phy_mode, &mtk_phylink_ops);
-	if (IS_ERR(phylink)) {
-		dev_err(eth->dev, "failed to create phylink structure\n");
-		err = PTR_ERR(phylink);
-		goto err_free_data;
-	}*/
@@
-	data->phylink = NULL;//phylink;
+	data->phylink = NULL;

157-171: Align mux->channel init with the comment’s intent.
The comment says the initial value should be invalid to force a first switch, but it’s set to 0 (valid). Either set an out‑of‑range sentinel or drop the comment.

@tabrisnet tabrisnet marked this pull request as draft January 19, 2026 22:34
@tabrisnet tabrisnet force-pushed the tabrisnet_bpir4-6.18 branch from 4b0bc30 to 0c4f5a0 Compare January 19, 2026 23:20
@tabrisnet tabrisnet force-pushed the tabrisnet_bpir4-6.18 branch from 0c4f5a0 to 07f5014 Compare January 21, 2026 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

02 Milestone: First quarter release Hardware Hardware related like kernel, U-Boot, ... Needs review Seeking for review Patches Patches related to kernel, U-Boot, ... size/large PR with 250 lines or more

Development

Successfully merging this pull request may close these issues.

1 participant