[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250429115933.53a1914c@kernel.org>
Date: Tue, 29 Apr 2025 11:59:33 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Ivan Vecera <ivecera@...hat.com>
Cc: netdev@...r.kernel.org, Vadim Fedorenko <vadim.fedorenko@...ux.dev>,
Arkadiusz Kubalewski <arkadiusz.kubalewski@...el.com>, Jiri Pirko
<jiri@...nulli.us>, Rob Herring <robh@...nel.org>, Krzysztof Kozlowski
<krzk+dt@...nel.org>, Conor Dooley <conor+dt@...nel.org>, Prathosh Satish
<Prathosh.Satish@...rochip.com>, Lee Jones <lee@...nel.org>, Kees Cook
<kees@...nel.org>, Andy Shevchenko <andy@...nel.org>, Andrew Morton
<akpm@...ux-foundation.org>, Michal Schmidt <mschmidt@...hat.com>,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-hardening@...r.kernel.org
Subject: Re: [PATCH net-next v5 4/8] mfd: zl3073x: Add support for devlink
device info
On Fri, 25 Apr 2025 19:09:31 +0200 Ivan Vecera wrote:
> +static int zl3073x_devlink_info_get(struct devlink *devlink,
> + struct devlink_info_req *req,
> + struct netlink_ext_ack *extack)
> +{
> + struct zl3073x_dev *zldev = devlink_priv(devlink);
> + u16 id, revision, fw_ver;
> + char buf[16];
> + u32 cfg_ver;
> + int rc;
> +
> + rc = zl3073x_read_u16(zldev, ZL_REG_ID, &id);
> + if (rc)
> + return rc;
> +
> + snprintf(buf, sizeof(buf), "%X", id);
> + rc = devlink_info_version_fixed_put(req,
> + DEVLINK_INFO_VERSION_GENERIC_ASIC_ID,
> + buf);
> + if (rc)
> + return rc;
> +
> + rc = zl3073x_read_u16(zldev, ZL_REG_REVISION, &revision);
> + if (rc)
> + return rc;
> +
> + snprintf(buf, sizeof(buf), "%X", revision);
> + rc = devlink_info_version_fixed_put(req,
> + DEVLINK_INFO_VERSION_GENERIC_ASIC_REV,
> + buf);
> + if (rc)
> + return rc;
> +
> + rc = zl3073x_read_u16(zldev, ZL_REG_FW_VER, &fw_ver);
> + if (rc)
> + return rc;
> +
> + snprintf(buf, sizeof(buf), "%u", fw_ver);
> + rc = devlink_info_version_fixed_put(req,
> + DEVLINK_INFO_VERSION_GENERIC_FW,
Are you sure FW version is fixed? Fixed is for unchangeable
properties like ASIC revision or serial numbers.
> + buf);
> + if (rc)
> + return rc;
> +
> + rc = zl3073x_read_u32(zldev, ZL_REG_CUSTOM_CONFIG_VER, &cfg_ver);
> + if (rc)
> + return rc;
> +
> + /* No custom config version */
> + if (cfg_ver == U32_MAX)
> + return 0;
> +
> + snprintf(buf, sizeof(buf), "%lu.%lu.%lu.%lu",
> + FIELD_GET(GENMASK(31, 24), cfg_ver),
> + FIELD_GET(GENMASK(23, 16), cfg_ver),
> + FIELD_GET(GENMASK(15, 8), cfg_ver),
> + FIELD_GET(GENMASK(7, 0), cfg_ver));
> +
> + return devlink_info_version_running_put(req, "cfg.custom_ver", buf);
You need to document the custom versions and properties in a driver
specific file under Documentation/networking/device_drivers/
--
pw-bot: cr
Powered by blists - more mailing lists