Re: [net-next PATCH v4 03/11] net: pcs: Add subsystem

From
Sean Anderson <sean.anderson@linux.dev>
Date
2025-05-19 17:44:07
Also in
linux-doc, lkml
Reply to
Lei Wei, 2025-05-14
On 5/14/25 12:22, Lei Wei wrote:

On 5/13/2025 12:10 AM, Sean Anderson wrote:
quoted
+/**
+ * pcs_register_full() - register a new PCS
+ * @dev: The device requesting the PCS
+ * @fwnode: The PCS's firmware node; typically @dev.fwnode
+ * @pcs: The PCS to register
+ *
+ * Registers a new PCS which can be attached to a phylink.
+ *
+ * Return: 0 on success, or -errno on error
+ */
+int pcs_register_full(struct device *dev, struct fwnode_handle *fwnode,
+              struct phylink_pcs *pcs)
+{
+    struct pcs_wrapper *wrapper;
+
+    if (!dev || !pcs->ops)
+        return -EINVAL;
+
+    if (!pcs->ops->pcs_an_restart || !pcs->ops->pcs_config ||
+        !pcs->ops->pcs_get_state)
+        return -EINVAL;
+
+    wrapper = kzalloc(sizeof(*wrapper), GFP_KERNEL);
+    if (!wrapper)
+        return -ENOMEM;
How about the case where pcs is removed and then comes back again? Should we find the original wrapper and attach it to pcs again instead of creating a new wrapper?
When the PCS is removed the old wrapper is removed from pcs_wrappers, so
it can no longer be looked up any more. I think trying to save/restore
the wrapper would be much more trouble than it's worth.

--Sean
Thread (32 messages) 32 messages, 9 authors, last reply 2025-05-22
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help