From nobody Fri Oct 3 14:29:32 2025 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 087EE32BF41 for ; Fri, 29 Aug 2025 16:30:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756485006; cv=none; b=YZIBvf4NO5N0TdC13Ll2r6Mf1HxevvqJJ4WDeIh1IKSEjdpEB7z9Ap7LZ9ssXeZWrnMR7rfrW7Fyp5+LSdvpDseu3HYSq7JlxMh2K+BdP4H1S+sbeqydfGPxMPFP/CHabFsIYIKJM+4BQs8y88lHiPnmgJo5x0+PcC7aPrulRh4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756485006; c=relaxed/simple; bh=eI1aiFNYryO+t5nHeumpPB+dsVNw8uOQsJ0Hivfxi60=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=rhQQrkPeAxRqbKxG+wqvk/sAe3psiDr3cNXMr/qgh+P8ZaPC2t+uIGrcUGSmdH147U3mrA3dJBCDi7zCYDQPYYN/yqCTxt1cCVErC1FLqaAJa8Gfh4HtEDDZGEJbOBDqJmV66HaL02Z8d1JyyTvH1fBOB304eDiBouel5UxiuGE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=D6B66iWh; arc=none smtp.client-ip=185.246.84.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="D6B66iWh" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 93F041A0DC6; Fri, 29 Aug 2025 16:30:02 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id A77D9605F1; Fri, 29 Aug 2025 16:30:01 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 66CC91C228022; Fri, 29 Aug 2025 18:29:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1756485000; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=G5hFWIHn9ebEQkKaq4cychymeANjC1DTgGmjV0wrK34=; b=D6B66iWhhIkneh6Of/grY33WCc1fdZG14R0ITLbqgX8JoY0egDLm4lqQAPPxw2tjCujfMQ NraUFtveckrHI4GoKj2+cXJ4wmAwCsqn12O96aRD5LXMWYRSJ2trizHmDBav5aVXH7FRTO 7/+NHZEjFUgHniZYJ8YqBTu0bfWjj5wWGZwW0zwIho4SfMFsiQlMM0ycnYlWFg16QtrrO3 PocKThLwG6qj1nd99lowsFu4Guwl2MsNIydEz7RUKPrALb2onj/RM/SwWPfg+4x7aN/gcH EsV+Z0GIlsZWs5zvqYcAXFOo6H8QHZqIYKwSaXX0h/6gXHCGwSbyMbdu9/D0Aw== From: Kory Maincent Date: Fri, 29 Aug 2025 18:28:43 +0200 Subject: [PATCH net-next v2 1/4] net: pse-pd: pd692x0: Replace __free macro with explicit kfree calls Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250829-feature_poe_permanent_conf-v2-1-8bb6f073ec23@bootlin.com> References: <20250829-feature_poe_permanent_conf-v2-0-8bb6f073ec23@bootlin.com> In-Reply-To: <20250829-feature_poe_permanent_conf-v2-0-8bb6f073ec23@bootlin.com> To: Oleksij Rempel , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jiri Pirko , Simon Horman , Jonathan Corbet Cc: kernel@pengutronix.de, Dent Project , Thomas Petazzoni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Maxime Chevallier , linux-doc@vger.kernel.org, "Kory Maincent (Dent Project)" X-Mailer: b4 0.15-dev-8cb71 X-Last-TLS-Session-Version: TLSv1.3 From: Kory Maincent (Dent Project) Replace __free(kfree) with explicit kfree() calls to follow the net subsystem policy of avoiding automatic cleanup macros as described in the documentation. Signed-off-by: Kory Maincent --- Changes in v2: - New patch --- drivers/net/pse-pd/pd692x0.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/pse-pd/pd692x0.c b/drivers/net/pse-pd/pd692x0.c index f4e91ba64a666..055e925c853ef 100644 --- a/drivers/net/pse-pd/pd692x0.c +++ b/drivers/net/pse-pd/pd692x0.c @@ -1200,9 +1200,9 @@ static void pd692x0_managers_free_pw_budget(struct pd= 692x0_priv *priv) =20 static int pd692x0_setup_pi_matrix(struct pse_controller_dev *pcdev) { - struct pd692x0_manager *manager __free(kfree) =3D NULL; struct pd692x0_priv *priv =3D to_pd692x0_priv(pcdev); struct pd692x0_matrix port_matrix[PD692X0_MAX_PIS]; + struct pd692x0_manager *manager; int ret, nmanagers; =20 /* Should we flash the port matrix */ @@ -1216,7 +1216,7 @@ static int pd692x0_setup_pi_matrix(struct pse_control= ler_dev *pcdev) =20 ret =3D pd692x0_of_get_managers(priv, manager); if (ret < 0) - return ret; + goto err_free_manager; =20 nmanagers =3D ret; ret =3D pd692x0_register_managers_regulator(priv, manager, nmanagers); @@ -1236,12 +1236,15 @@ static int pd692x0_setup_pi_matrix(struct pse_contr= oller_dev *pcdev) goto err_managers_req_pw; =20 pd692x0_of_put_managers(priv, manager, nmanagers); + kfree(manager); return 0; =20 err_managers_req_pw: pd692x0_managers_free_pw_budget(priv); err_of_managers: pd692x0_of_put_managers(priv, manager, nmanagers); +err_free_manager: + kfree(manager); return ret; } =20 --=20 2.43.0 From nobody Fri Oct 3 14:29:32 2025 Received: from smtpout-04.galae.net (smtpout-04.galae.net [185.171.202.116]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 561473043BD; Fri, 29 Aug 2025 16:30:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.171.202.116 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756485007; cv=none; b=o4+GyqQ9MGQhbWljCbGg26daF3NDDtq5R2qXjW3+ayC7tCZaB7pSWJbNidC418NOsmdyZjOuWQtj6EYC+VkCV2SoYcm4bcKZLnpeI1pBCNb65EzHvBFL6YpuHQOkrk2F/1V8DelfMtZ2ZED6/m7d5KNzcIjid5llnNeMRa8X92Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756485007; c=relaxed/simple; bh=dJwjUPn034iFwJen1qZi+xOnmiXvVUMA6OruI/pptho=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=p3aVBmnAjODfVpyYTBGfovcEjL9ukb39M+BHQ0lCNkw0dRZUJ0Q6ARS06cwkjRLY+HDZjleGeQdabszHewOvjnJ98XYLJTlnHw2IxMrLdCzEsAddGAzQvcZa4+zjNSwNOzZ3RoyhQCuc3c2upuQyYT/bKR4t5xn2FD8YfK0lgmw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=CSem9IXw; arc=none smtp.client-ip=185.171.202.116 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="CSem9IXw" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id 230CDC8F475; Fri, 29 Aug 2025 16:29:49 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id A33BA605F1; Fri, 29 Aug 2025 16:30:03 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id EEB6B1C22DB2E; Fri, 29 Aug 2025 18:30:00 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1756485002; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=MP2NOP/U31hvh9wbH1Enlv9gdxa7zblBpEyR64wWxPQ=; b=CSem9IXwbgmm+qztBlYCkt7lhcyjMfPD7rdPKSicM9PXAhU6/L8dZYYgE9qqrhT4P8JlJU tDwKISnmuOqW5Mi88RgmzaEK/DmrQph8I3Tm5WzLB6mCPDKGFhFapkoL/7a8gQOAFYJU91 cUN2l3Ae77bCNqPr7QnIwn+AgVtDsNst89Ql2/muEOEDdt+iO1bw4HOfDy67FkrawfhkHR ZrYNgaFEsrJ2UdkEaog/L0H77Ea8JpJyQ1wU1svN9JGG2mf7fIk/MqdcIX3fgQXlzIxP/L 0MJeu9e/f6KIE3QhBrN8wHTH5FFBgnHMAmAjyh7Q9O+IiB/QamA9jg4OUm+2gQ== From: Kory Maincent Date: Fri, 29 Aug 2025 18:28:44 +0200 Subject: [PATCH net-next v2 2/4] net: pse-pd: pd692x0: Separate configuration parsing from hardware setup Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250829-feature_poe_permanent_conf-v2-2-8bb6f073ec23@bootlin.com> References: <20250829-feature_poe_permanent_conf-v2-0-8bb6f073ec23@bootlin.com> In-Reply-To: <20250829-feature_poe_permanent_conf-v2-0-8bb6f073ec23@bootlin.com> To: Oleksij Rempel , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jiri Pirko , Simon Horman , Jonathan Corbet Cc: kernel@pengutronix.de, Dent Project , Thomas Petazzoni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Maxime Chevallier , linux-doc@vger.kernel.org, "Kory Maincent (Dent Project)" X-Mailer: b4 0.15-dev-8cb71 X-Last-TLS-Session-Version: TLSv1.3 From: Kory Maincent (Dent Project) Cache the port matrix configuration in driver private data to enable PSE controller reconfiguration. This refactoring separates device tree parsing from hardware configuration application, allowing settings to be reapplied without reparsing the device tree. This prepares for upcoming permanent configuration support where cached settings can be restored after device resets or firmware updates. Signed-off-by: Kory Maincent --- drivers/net/pse-pd/pd692x0.c | 115 ++++++++++++++++++++++++++++-----------= ---- 1 file changed, 76 insertions(+), 39 deletions(-) diff --git a/drivers/net/pse-pd/pd692x0.c b/drivers/net/pse-pd/pd692x0.c index 055e925c853ef..782b1abf94cb1 100644 --- a/drivers/net/pse-pd/pd692x0.c +++ b/drivers/net/pse-pd/pd692x0.c @@ -85,6 +85,11 @@ enum { PD692X0_MSG_CNT }; =20 +struct pd692x0_matrix { + u8 hw_port_a; + u8 hw_port_b; +}; + struct pd692x0_priv { struct i2c_client *client; struct pse_controller_dev pcdev; @@ -101,6 +106,8 @@ struct pd692x0_priv { enum ethtool_c33_pse_admin_state admin_state[PD692X0_MAX_PIS]; struct regulator_dev *manager_reg[PD692X0_MAX_MANAGERS]; int manager_pw_budget[PD692X0_MAX_MANAGERS]; + int nmanagers; + struct pd692x0_matrix *port_matrix; }; =20 /* Template list of communication messages. The non-null bytes defined here @@ -809,11 +816,6 @@ struct pd692x0_manager { int nports; }; =20 -struct pd692x0_matrix { - u8 hw_port_a; - u8 hw_port_b; -}; - static int pd692x0_of_get_ports_manager(struct pd692x0_priv *priv, struct pd692x0_manager *manager, @@ -903,7 +905,8 @@ pd692x0_of_get_managers(struct pd692x0_priv *priv, } =20 of_node_put(managers_node); - return nmanagers; + priv->nmanagers =3D nmanagers; + return 0; =20 out: for (i =3D 0; i < nmanagers; i++) { @@ -963,8 +966,7 @@ pd692x0_register_manager_regulator(struct device *dev, = char *reg_name, =20 static int pd692x0_register_managers_regulator(struct pd692x0_priv *priv, - const struct pd692x0_manager *manager, - int nmanagers) + const struct pd692x0_manager *manager) { struct device *dev =3D &priv->client->dev; size_t reg_name_len; @@ -975,7 +977,7 @@ pd692x0_register_managers_regulator(struct pd692x0_priv= *priv, */ reg_name_len =3D strlen(dev_name(dev)) + 23; =20 - for (i =3D 0; i < nmanagers; i++) { + for (i =3D 0; i < priv->nmanagers; i++) { static const char * const regulators[] =3D { "vaux5", "vaux3p3" }; struct regulator_dev *rdev; char *reg_name; @@ -1008,10 +1010,14 @@ pd692x0_register_managers_regulator(struct pd692x0_= priv *priv, } =20 static int -pd692x0_conf_manager_power_budget(struct pd692x0_priv *priv, int id, int p= w) +pd692x0_conf_manager_power_budget(struct pd692x0_priv *priv, int id) { struct pd692x0_msg msg, buf; - int ret, pw_mW =3D pw / 1000; + int ret, pw_mW; + + pw_mW =3D priv->manager_pw_budget[id] / 1000; + if (!pw_mW) + return 0; =20 msg =3D pd692x0_msg_template_list[PD692X0_MSG_GET_POWER_BANK]; msg.data[0] =3D id; @@ -1032,11 +1038,11 @@ pd692x0_conf_manager_power_budget(struct pd692x0_pr= iv *priv, int id, int pw) } =20 static int -pd692x0_configure_managers(struct pd692x0_priv *priv, int nmanagers) +pd692x0_req_managers_pw_budget(struct pd692x0_priv *priv) { int i, ret; =20 - for (i =3D 0; i < nmanagers; i++) { + for (i =3D 0; i < priv->nmanagers; i++) { struct regulator *supply =3D priv->manager_reg[i]->supply; int pw_budget; =20 @@ -1053,7 +1059,18 @@ pd692x0_configure_managers(struct pd692x0_priv *priv= , int nmanagers) return ret; =20 priv->manager_pw_budget[i] =3D pw_budget; - ret =3D pd692x0_conf_manager_power_budget(priv, i, pw_budget); + } + + return 0; +} + +static int +pd692x0_configure_managers(struct pd692x0_priv *priv) +{ + int i, ret; + + for (i =3D 0; i < priv->nmanagers; i++) { + ret =3D pd692x0_conf_manager_power_budget(priv, i); if (ret < 0) return ret; } @@ -1101,10 +1118,9 @@ pd692x0_set_port_matrix(const struct pse_pi_pairset = *pairset, =20 static int pd692x0_set_ports_matrix(struct pd692x0_priv *priv, - const struct pd692x0_manager *manager, - int nmanagers, - struct pd692x0_matrix port_matrix[PD692X0_MAX_PIS]) + const struct pd692x0_manager *manager) { + struct pd692x0_matrix *port_matrix =3D priv->port_matrix; struct pse_controller_dev *pcdev =3D &priv->pcdev; int i, ret; =20 @@ -1117,7 +1133,7 @@ pd692x0_set_ports_matrix(struct pd692x0_priv *priv, /* Update with values for every PSE PIs */ for (i =3D 0; i < pcdev->nr_lines; i++) { ret =3D pd692x0_set_port_matrix(&pcdev->pi[i].pairset[0], - manager, nmanagers, + manager, priv->nmanagers, &port_matrix[i]); if (ret) { dev_err(&priv->client->dev, @@ -1126,7 +1142,7 @@ pd692x0_set_ports_matrix(struct pd692x0_priv *priv, } =20 ret =3D pd692x0_set_port_matrix(&pcdev->pi[i].pairset[1], - manager, nmanagers, + manager, priv->nmanagers, &port_matrix[i]); if (ret) { dev_err(&priv->client->dev, @@ -1139,9 +1155,9 @@ pd692x0_set_ports_matrix(struct pd692x0_priv *priv, } =20 static int -pd692x0_write_ports_matrix(struct pd692x0_priv *priv, - const struct pd692x0_matrix port_matrix[PD692X0_MAX_PIS]) +pd692x0_write_ports_matrix(struct pd692x0_priv *priv) { + struct pd692x0_matrix *port_matrix =3D priv->port_matrix; struct pd692x0_msg msg, buf; int ret, i; =20 @@ -1166,13 +1182,32 @@ pd692x0_write_ports_matrix(struct pd692x0_priv *pri= v, return 0; } =20 +static int pd692x0_hw_conf_init(struct pd692x0_priv *priv) +{ + int ret; + + /* Is PD692x0 ready to be configured? */ + if (priv->fw_state !=3D PD692X0_FW_OK && + priv->fw_state !=3D PD692X0_FW_COMPLETE) + return 0; + + ret =3D pd692x0_configure_managers(priv); + if (ret) + return ret; + + ret =3D pd692x0_write_ports_matrix(priv); + if (ret) + return ret; + + return 0; +} + static void pd692x0_of_put_managers(struct pd692x0_priv *priv, - struct pd692x0_manager *manager, - int nmanagers) + struct pd692x0_manager *manager) { int i, j; =20 - for (i =3D 0; i < nmanagers; i++) { + for (i =3D 0; i < priv->nmanagers; i++) { for (j =3D 0; j < manager[i].nports; j++) of_node_put(manager[i].port_node[j]); of_node_put(manager[i].node); @@ -1201,48 +1236,50 @@ static void pd692x0_managers_free_pw_budget(struct = pd692x0_priv *priv) static int pd692x0_setup_pi_matrix(struct pse_controller_dev *pcdev) { struct pd692x0_priv *priv =3D to_pd692x0_priv(pcdev); - struct pd692x0_matrix port_matrix[PD692X0_MAX_PIS]; + struct pd692x0_matrix *port_matrix; struct pd692x0_manager *manager; - int ret, nmanagers; - - /* Should we flash the port matrix */ - if (priv->fw_state !=3D PD692X0_FW_OK && - priv->fw_state !=3D PD692X0_FW_COMPLETE) - return 0; + int ret; =20 manager =3D kcalloc(PD692X0_MAX_MANAGERS, sizeof(*manager), GFP_KERNEL); if (!manager) return -ENOMEM; =20 + port_matrix =3D devm_kcalloc(&priv->client->dev, PD692X0_MAX_PIS, + sizeof(*port_matrix), GFP_KERNEL); + if (!port_matrix) { + ret =3D -ENOMEM; + goto err_free_manager; + } + priv->port_matrix =3D port_matrix; + ret =3D pd692x0_of_get_managers(priv, manager); if (ret < 0) goto err_free_manager; =20 - nmanagers =3D ret; - ret =3D pd692x0_register_managers_regulator(priv, manager, nmanagers); + ret =3D pd692x0_register_managers_regulator(priv, manager); if (ret) goto err_of_managers; =20 - ret =3D pd692x0_configure_managers(priv, nmanagers); + ret =3D pd692x0_req_managers_pw_budget(priv); if (ret) goto err_of_managers; =20 - ret =3D pd692x0_set_ports_matrix(priv, manager, nmanagers, port_matrix); + ret =3D pd692x0_set_ports_matrix(priv, manager); if (ret) goto err_managers_req_pw; =20 - ret =3D pd692x0_write_ports_matrix(priv, port_matrix); + ret =3D pd692x0_hw_conf_init(priv); if (ret) goto err_managers_req_pw; =20 - pd692x0_of_put_managers(priv, manager, nmanagers); + pd692x0_of_put_managers(priv, manager); kfree(manager); return 0; =20 err_managers_req_pw: pd692x0_managers_free_pw_budget(priv); err_of_managers: - pd692x0_of_put_managers(priv, manager, nmanagers); + pd692x0_of_put_managers(priv, manager); err_free_manager: kfree(manager); return ret; @@ -1647,7 +1684,7 @@ static enum fw_upload_err pd692x0_fw_poll_complete(st= ruct fw_upload *fwl) return FW_UPLOAD_ERR_FW_INVALID; } =20 - ret =3D pd692x0_setup_pi_matrix(&priv->pcdev); + ret =3D pd692x0_hw_conf_init(priv); if (ret < 0) { dev_err(&client->dev, "Error configuring ports matrix (%pe)\n", ERR_PTR(ret)); --=20 2.43.0 From nobody Fri Oct 3 14:29:32 2025 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 83DB5322DAA; Fri, 29 Aug 2025 16:30:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756485009; cv=none; b=uLvMr7iLoiQgdcCE5Ukn8CqYZpIOLzwlAWDkV7x6+pXNzseL27nmBgl0MC98HYBdZVXPxWzNUNgZAOKVHJJsblNX6BGS9aCnLAHP0GCY1EFfdf8NNy4WL06jZ6Z+XsMueVNhUocOOuFTAmB+oA4UCNd33wLXrrsfk6Z+JSnGqlc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756485009; c=relaxed/simple; bh=1fC6qPHhw0+ReUKx7i0sZJqlysF67p/4YIgETaU4kAA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=jlveDUzHl+lQ1nJOgTHBz/aw/RQBV8WEcrKbQ1xDYet7aFErCA+LDCSYLstK4QE0+18+vrL8UYt3YDYUfs3azN22uAP0YHj+0lP6+l9BLuy9LW/eTBYn8t1BxYlcJESiqrYwTDUgs2pwfnX75OAObIzRYSyomLt/BeX8YadUT9k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=OVtktu26; arc=none smtp.client-ip=185.246.84.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="OVtktu26" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id E51B71A0E43; Fri, 29 Aug 2025 16:30:05 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id BD972605F1; Fri, 29 Aug 2025 16:30:05 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 0AFB71C22DC9A; Fri, 29 Aug 2025 18:30:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1756485004; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=7Z/vVaiwPDqUIpffCxIZ4JsTPL7u+izJHcekcnCQ+bw=; b=OVtktu26HdJEMs3GIss/zzWd1tOEkxZaGce+ith9pHLeaF57Z/QwrGtoSOiKbErgfJEVQb 1XGFxjwGL8g8Yo4uVPnvm3sY9IwmfAIsQEGquRqdhigbVmRTZ5QclgODGo4HakqNQOq8jm 3fdc3pCGN4j/0qThuzZDknUlktHv3CponcoyFkDzS16lDW1XtRlAJ8+pEeNSo6JsGkacwB zirLFyiaxpHVy9+NfR+oSSn/pZ1hzwUZQyvsQexcG9rnuEpRP7Nu2WV8T2fXYP+YFgW9Ms OnAq9LeCBRghil/gML3YTPlh+FmduyM6Ur9BBWG4SoZS6xgKoOAw1Azqg8DIhA== From: Kory Maincent Date: Fri, 29 Aug 2025 18:28:45 +0200 Subject: [PATCH net-next v2 3/4] docs: devlink: Sort table of contents alphabetically Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250829-feature_poe_permanent_conf-v2-3-8bb6f073ec23@bootlin.com> References: <20250829-feature_poe_permanent_conf-v2-0-8bb6f073ec23@bootlin.com> In-Reply-To: <20250829-feature_poe_permanent_conf-v2-0-8bb6f073ec23@bootlin.com> To: Oleksij Rempel , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jiri Pirko , Simon Horman , Jonathan Corbet Cc: kernel@pengutronix.de, Dent Project , Thomas Petazzoni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Maxime Chevallier , linux-doc@vger.kernel.org, "Kory Maincent (Dent Project)" X-Mailer: b4 0.15-dev-8cb71 X-Last-TLS-Session-Version: TLSv1.3 From: Kory Maincent (Dent Project) Sort devlink documentation table of contents alphabetically to improve readability and make it easier to locate specific chapters. Signed-off-by: Kory Maincent --- Changes in v2: - New patch --- Documentation/networking/devlink/index.rst | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Documentation/networking/devlink/index.rst b/Documentation/net= working/devlink/index.rst index 270a65a014111..0c58e5c729d92 100644 --- a/Documentation/networking/devlink/index.rst +++ b/Documentation/networking/devlink/index.rst @@ -56,18 +56,18 @@ general. :maxdepth: 1 =20 devlink-dpipe + devlink-eswitch-attr + devlink-flash devlink-health devlink-info - devlink-flash + devlink-linecard devlink-params devlink-port devlink-region - devlink-resource devlink-reload + devlink-resource devlink-selftests devlink-trap - devlink-linecard - devlink-eswitch-attr =20 Driver-specific documentation ----------------------------- @@ -78,12 +78,14 @@ parameters, info versions, and other features it suppor= ts. .. toctree:: :maxdepth: 1 =20 + am65-nuss-cpsw-switch bnxt etas_es58x hns3 i40e - ionic ice + ionic + iosm ixgbe kvaser_pciefd kvaser_usb @@ -93,11 +95,9 @@ parameters, info versions, and other features it support= s. mv88e6xxx netdevsim nfp - qed - ti-cpsw-switch - am65-nuss-cpsw-switch - prestera - iosm octeontx2 + prestera + qed sfc + ti-cpsw-switch zl3073x --=20 2.43.0 From nobody Fri Oct 3 14:29:32 2025 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 40F6132A3C4; Fri, 29 Aug 2025 16:30:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756485011; cv=none; b=cfJ6UlwwC043YjdXA8RIczXp0M0OwlXFmt9iai+aBUabsY4bCYOxInWn1mX7LnIjxtJ2g7m/C1JMF7jhsTJUDdV/F9SuPOF7ZnL2Jalq4bWKaob7O2uWb1S7UKCqRWiMKrHfz1aLW1GmTpjdQJEaBxUZe3liQcCgp7FdQrkTDVk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756485011; c=relaxed/simple; bh=nDs+Ie14LE/juWFDz3NHG4FNB0iWCY6Xzjh/+R1BulU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=jS1D1WGkDJsZJcEEr02vta3mjW1uy5pMcoDf4DjS/2bavNnVSao1nQYPhRpWiAmeS27zMXi34RWrOA3emmxmATMHNv4IJv88euns8ZjIC8lhx/Cix3p8MSsmaczWl4NBJHl5HVLpQ1KQGM3xPCxa5pP4ddxwIlNDUijWpiEB++U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=Pn9J0RIW; arc=none smtp.client-ip=185.246.84.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="Pn9J0RIW" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id C301C1A0DC6; Fri, 29 Aug 2025 16:30:07 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 9A5E5605F1; Fri, 29 Aug 2025 16:30:07 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 124461C22DC9E; Fri, 29 Aug 2025 18:30:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1756485006; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=rB6OFQqpx/J1t/BrMgB2RTzpqylFswGdLZiejBlZhwI=; b=Pn9J0RIWX8RBICI135bvwWELfwaIqqvT9x9oh8Uxz2F5+1CN7P8SnbzOM8DaMse3xKN//R rqNW9fShs/KmPglnIu1mI3RBawoj8qZo5d+VIMq4Z4LBEqNf4v1tjLNA3kRb6tbw46lymY nksA+tqfPsvtpz4vyUvQ+agvNOIFbuMQYZMIFW70CQHJjZNLq6IR9oBuJ876fbPyOn7DC2 TW9opmEdWhmIJ0+e//1plNmihcOm8mqO8STWf87H81yaRQhv6wmuOBy7ilr9QuUEW3FRJJ 2TojgSo/xTzgTrrxCzngBGPey4Q7egIgRkX1N/rmjorPipAyO0E41OexodpvUw== From: Kory Maincent Date: Fri, 29 Aug 2025 18:28:46 +0200 Subject: [PATCH net-next v2 4/4] net: pse-pd: pd692x0: Add devlink interface for configuration save/reset Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250829-feature_poe_permanent_conf-v2-4-8bb6f073ec23@bootlin.com> References: <20250829-feature_poe_permanent_conf-v2-0-8bb6f073ec23@bootlin.com> In-Reply-To: <20250829-feature_poe_permanent_conf-v2-0-8bb6f073ec23@bootlin.com> To: Oleksij Rempel , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jiri Pirko , Simon Horman , Jonathan Corbet Cc: kernel@pengutronix.de, Dent Project , Thomas Petazzoni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Maxime Chevallier , linux-doc@vger.kernel.org, "Kory Maincent (Dent Project)" X-Mailer: b4 0.15-dev-8cb71 X-Last-TLS-Session-Version: TLSv1.3 From: Kory Maincent (Dent Project) Add devlink param attributes PD692X0_DEVLINK_PARAM_ID_SAVE_CONF and PD692X0_DEVLINK_PARAM_ID_RESET_CONF to enable userspace management of the PSE's permanent configuration stored in non-volatile memory. The save_conf attribute with the '1' value allows saving the current configuration to non-volatile memory. The reset_conf attribute restores factory defaults configurations. Skip hardware configuration initialization on probe when a saved configuration is already present in non-volatile memory (detected via user byte 42). Signed-off-by: Kory Maincent --- Changes in v2: - Move on from sysfs to devlink param for userspace management. --- Documentation/networking/devlink/index.rst | 1 + Documentation/networking/devlink/pd692x0.rst | 32 +++++ drivers/net/pse-pd/pd692x0.c | 205 +++++++++++++++++++++++= +++- 3 files changed, 235 insertions(+), 3 deletions(-) diff --git a/Documentation/networking/devlink/index.rst b/Documentation/net= working/devlink/index.rst index 0c58e5c729d92..6db7d9b45f7aa 100644 --- a/Documentation/networking/devlink/index.rst +++ b/Documentation/networking/devlink/index.rst @@ -96,6 +96,7 @@ parameters, info versions, and other features it supports. netdevsim nfp octeontx2 + pd692x0 prestera qed sfc diff --git a/Documentation/networking/devlink/pd692x0.rst b/Documentation/n= etworking/devlink/pd692x0.rst new file mode 100644 index 0000000000000..3f3edd0ac0361 --- /dev/null +++ b/Documentation/networking/devlink/pd692x0.rst @@ -0,0 +1,32 @@ +.. SPDX-License-Identifier: GPL-2.0 + +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D +PSE PD692x0 devlink support +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D + +This document describes the devlink features implemented by the PSE ``PD69= 2x0`` +device drivers. + +Parameters +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +The ``PD692x0`` drivers implement the following driver-specific parameters. + +.. list-table:: Driver-specific parameters implemented + :widths: 5 5 5 85 + + * - Name + - Type + - Mode + - Description + * - ``save_conf`` + - bool + - runtime + - Save the current configuration to non-volatile memory using ``1`` + attribute value. + * - ``reset_conf`` + - bool + - runtime + - Reset the current and saved configuration using ``1`` attribute + value. + diff --git a/drivers/net/pse-pd/pd692x0.c b/drivers/net/pse-pd/pd692x0.c index 782b1abf94cb1..eb4b911d438b3 100644 --- a/drivers/net/pse-pd/pd692x0.c +++ b/drivers/net/pse-pd/pd692x0.c @@ -14,6 +14,7 @@ #include #include #include +#include =20 #define PD692X0_PSE_NAME "pd692x0_pse" =20 @@ -30,6 +31,8 @@ #define PD692X0_FW_MIN_VER 5 #define PD692X0_FW_PATCH_VER 5 =20 +#define PD692X0_USER_BYTE 42 + enum pd692x0_fw_state { PD692X0_FW_UNKNOWN, PD692X0_FW_OK, @@ -80,6 +83,9 @@ enum { PD692X0_MSG_GET_PORT_PARAM, PD692X0_MSG_GET_POWER_BANK, PD692X0_MSG_SET_POWER_BANK, + PD692X0_MSG_SET_USER_BYTE, + PD692X0_MSG_SAVE_SYS_SETTINGS, + PD692X0_MSG_RESTORE_FACTORY, =20 /* add new message above here */ PD692X0_MSG_CNT @@ -103,11 +109,13 @@ struct pd692x0_priv { bool last_cmd_key; unsigned long last_cmd_key_time; =20 + bool cfg_saved; enum ethtool_c33_pse_admin_state admin_state[PD692X0_MAX_PIS]; struct regulator_dev *manager_reg[PD692X0_MAX_MANAGERS]; int manager_pw_budget[PD692X0_MAX_MANAGERS]; int nmanagers; struct pd692x0_matrix *port_matrix; + struct devlink *dl; }; =20 /* Template list of communication messages. The non-null bytes defined here @@ -193,6 +201,24 @@ static const struct pd692x0_msg pd692x0_msg_template_l= ist[PD692X0_MSG_CNT] =3D { .key =3D PD692X0_KEY_CMD, .sub =3D {0x07, 0x0b, 0x57}, }, + [PD692X0_MSG_SET_USER_BYTE] =3D { + .key =3D PD692X0_KEY_PRG, + .sub =3D {0x41, PD692X0_USER_BYTE}, + .data =3D {0x4e, 0x4e, 0x4e, 0x4e, + 0x4e, 0x4e, 0x4e, 0x4e}, + }, + [PD692X0_MSG_SAVE_SYS_SETTINGS] =3D { + .key =3D PD692X0_KEY_PRG, + .sub =3D {0x06, 0x0f}, + .data =3D {0x4e, 0x4e, 0x4e, 0x4e, + 0x4e, 0x4e, 0x4e, 0x4e}, + }, + [PD692X0_MSG_RESTORE_FACTORY] =3D { + .key =3D PD692X0_KEY_PRG, + .sub =3D {0x2d, 0x4e}, + .data =3D {0x4e, 0x4e, 0x4e, 0x4e, + 0x4e, 0x4e, 0x4e, 0x4e}, + }, }; =20 static u8 pd692x0_build_msg(struct pd692x0_msg *msg, u8 echo) @@ -1268,9 +1294,12 @@ static int pd692x0_setup_pi_matrix(struct pse_contro= ller_dev *pcdev) if (ret) goto err_managers_req_pw; =20 - ret =3D pd692x0_hw_conf_init(priv); - if (ret) - goto err_managers_req_pw; + /* Do not init the conf if it is already saved */ + if (!priv->cfg_saved) { + ret =3D pd692x0_hw_conf_init(priv); + if (ret) + goto err_managers_req_pw; + } =20 pd692x0_of_put_managers(priv, manager); kfree(manager); @@ -1727,14 +1756,148 @@ static const struct fw_upload_ops pd692x0_fw_ops = =3D { .cleanup =3D pd692x0_fw_cleanup, }; =20 +/* Devlink Params APIs */ +enum pd692x0_devlink_param_id { + PD692X0_DEVLINK_PARAM_ID_BASE =3D DEVLINK_PARAM_GENERIC_ID_MAX, + PD692X0_DEVLINK_PARAM_ID_SAVE_CONF, + PD692X0_DEVLINK_PARAM_ID_RESET_CONF, +}; + +struct pd692x0_devlink { + struct pd692x0_priv *priv; +}; + +static int pd692x0_dl_validate(struct devlink *devlink, u32 id, + union devlink_param_value val, + struct netlink_ext_ack *extack) +{ + if (!val.vbool) { + NL_SET_ERR_MSG_FMT(extack, "0 is not a valid value"); + return -EINVAL; + } + + return 0; +} + +static int pd692x0_dl_save_conf_set(struct devlink *devlink, u32 id, + struct devlink_param_gset_ctx *ctx, + struct netlink_ext_ack *extack) +{ + struct pd692x0_devlink *dl =3D devlink_priv(devlink); + struct pd692x0_priv *priv =3D dl->priv; + struct pd692x0_msg msg, buf =3D {0}; + int ret; + + mutex_lock(&priv->pcdev.lock); + ret =3D pd692x0_fw_unavailable(priv); + if (ret) + goto out; + + msg =3D pd692x0_msg_template_list[PD692X0_MSG_SET_USER_BYTE]; + ret =3D pd692x0_sendrecv_msg(priv, &msg, &buf); + if (ret) + goto out; + + msg =3D pd692x0_msg_template_list[PD692X0_MSG_SAVE_SYS_SETTINGS]; + ret =3D pd692x0_send_msg(priv, &msg); + if (ret) { + dev_err(&priv->client->dev, + "Failed to save the configuration (%pe)\n", + ERR_PTR(ret)); + goto out; + } + + msleep(50); /* Sleep 50ms as described in the datasheet */ + + ret =3D i2c_master_recv(priv->client, (u8 *)&buf, sizeof(buf)); + if (ret !=3D sizeof(buf)) { + if (ret >=3D 0) + ret =3D -EIO; + goto out; + } + + ret =3D 0; + +out: + mutex_unlock(&priv->pcdev.lock); + return ret; +} + +static int pd692x0_dl_reset_conf_set(struct devlink *devlink, u32 id, + struct devlink_param_gset_ctx *ctx, + struct netlink_ext_ack *extack) +{ + struct pd692x0_devlink *dl =3D devlink_priv(devlink); + struct pd692x0_priv *priv =3D dl->priv; + struct pd692x0_msg msg, buf =3D {0}; + int ret; + + mutex_lock(&priv->pcdev.lock); + ret =3D pd692x0_fw_unavailable(priv); + if (ret) + goto out; + + msg =3D pd692x0_msg_template_list[PD692X0_MSG_RESTORE_FACTORY]; + ret =3D pd692x0_send_msg(priv, &msg); + if (ret) { + dev_err(&priv->client->dev, + "Failed to reset the configuration (%pe)\n", + ERR_PTR(ret)); + goto out; + } + + msleep(100); /* Sleep 100ms as described in the datasheet */ + + ret =3D i2c_master_recv(priv->client, (u8 *)&buf, sizeof(buf)); + if (ret !=3D sizeof(buf)) { + if (ret >=3D 0) + ret =3D -EIO; + goto out; + } + + ret =3D pd692x0_hw_conf_init(priv); + if (ret) { + dev_err(&priv->client->dev, + "Error configuring ports matrix (%pe)\n", + ERR_PTR(ret)); + } + +out: + mutex_unlock(&priv->pcdev.lock); + return ret; +} + +static int pd692x0_dl_dummy_get(struct devlink *devlink, u32 id, + struct devlink_param_gset_ctx *ctx) +{ + return 0; +} + +static const struct devlink_param pd692x0_dl_params[] =3D { + DEVLINK_PARAM_DRIVER(PD692X0_DEVLINK_PARAM_ID_SAVE_CONF, + "save_conf", DEVLINK_PARAM_TYPE_BOOL, + BIT(DEVLINK_PARAM_CMODE_RUNTIME), + pd692x0_dl_dummy_get, pd692x0_dl_save_conf_set, + pd692x0_dl_validate), + DEVLINK_PARAM_DRIVER(PD692X0_DEVLINK_PARAM_ID_RESET_CONF, + "reset_conf", DEVLINK_PARAM_TYPE_BOOL, + BIT(DEVLINK_PARAM_CMODE_RUNTIME), + pd692x0_dl_dummy_get, pd692x0_dl_reset_conf_set, + pd692x0_dl_validate), +}; + +static const struct devlink_ops pd692x0_dl_ops =3D { }; + static int pd692x0_i2c_probe(struct i2c_client *client) { static const char * const regulators[] =3D { "vdd", "vdda" }; struct pd692x0_msg msg, buf =3D {0}, zero =3D {0}; + struct pd692x0_devlink *pd692x0_dl; struct device *dev =3D &client->dev; struct pd692x0_msg_ver ver; struct pd692x0_priv *priv; struct fw_upload *fwl; + struct devlink *dl; int ret; =20 ret =3D devm_regulator_bulk_get_enable(dev, ARRAY_SIZE(regulators), @@ -1793,6 +1956,9 @@ static int pd692x0_i2c_probe(struct i2c_client *clien= t) } } =20 + if (buf.data[2] =3D=3D PD692X0_USER_BYTE) + priv->cfg_saved =3D true; + priv->np =3D dev->of_node; priv->pcdev.nr_lines =3D PD692X0_MAX_PIS; priv->pcdev.owner =3D THIS_MODULE; @@ -1813,14 +1979,47 @@ static int pd692x0_i2c_probe(struct i2c_client *cli= ent) "failed to register to the Firmware Upload API\n"); priv->fwl =3D fwl; =20 + dl =3D devlink_alloc(&pd692x0_dl_ops, + sizeof(struct pd692x0_devlink), dev); + if (!dl) { + dev_err(dev, "devlink_alloc failed\n"); + ret =3D -ENOMEM; + goto err_unregister_fw; + } + + pd692x0_dl =3D devlink_priv(dl); + pd692x0_dl->priv =3D priv; + priv->dl =3D dl; + + ret =3D devlink_params_register(dl, pd692x0_dl_params, + ARRAY_SIZE(pd692x0_dl_params)); + if (ret) { + dev_err(dev, + "devlink params register failed with error %d", + ret); + goto err_free_dl; + } + + devlink_register(dl); return 0; + +err_free_dl: + devlink_free(dl); +err_unregister_fw: + firmware_upload_unregister(priv->fwl); + + return ret; } =20 static void pd692x0_i2c_remove(struct i2c_client *client) { struct pd692x0_priv *priv =3D i2c_get_clientdata(client); + struct devlink *dl =3D priv->dl; =20 pd692x0_managers_free_pw_budget(priv); + devlink_params_unregister(dl, pd692x0_dl_params, + ARRAY_SIZE(pd692x0_dl_params)); + devlink_unregister(dl); firmware_upload_unregister(priv->fwl); } =20 --=20 2.43.0