devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Ivan Vecera <ivecera@redhat.com>
Cc: netdev@vger.kernel.org,
	Vadim Fedorenko <vadim.fedorenko@linux.dev>,
	Arkadiusz Kubalewski <arkadiusz.kubalewski@intel.com>,
	Jiri Pirko <jiri@resnulli.us>, Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Prathosh Satish <Prathosh.Satish@microchip.com>,
	Lee Jones <lee@kernel.org>, Kees Cook <kees@kernel.org>,
	Andy Shevchenko <andy@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Michal Schmidt <mschmidt@redhat.com>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-hardening@vger.kernel.org
Subject: Re: [PATCH net-next v5 4/8] mfd: zl3073x: Add support for devlink device info
Date: Tue, 29 Apr 2025 11:59:33 -0700	[thread overview]
Message-ID: <20250429115933.53a1914c@kernel.org> (raw)
In-Reply-To: <20250425170935.740102-5-ivecera@redhat.com>

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

  reply	other threads:[~2025-04-29 18:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-25 17:09 [PATCH net-next v5 0/8] Add Microchip ZL3073x support (part 1) Ivan Vecera
2025-04-25 17:09 ` [PATCH net-next v5 1/8] dt-bindings: dpll: Add DPLL device and pin Ivan Vecera
2025-04-25 17:09 ` [PATCH net-next v5 2/8] dt-bindings: dpll: Add support for Microchip Azurite chip family Ivan Vecera
2025-04-25 17:09 ` [PATCH net-next v5 3/8] mfd: Add Microchip ZL3073x support Ivan Vecera
2025-04-25 17:09 ` [PATCH net-next v5 4/8] mfd: zl3073x: Add support for devlink device info Ivan Vecera
2025-04-29 18:59   ` Jakub Kicinski [this message]
2025-04-30  9:25     ` Ivan Vecera
2025-04-25 17:09 ` [PATCH net-next v5 5/8] mfd: zl3073x: Protect operations requiring multiple register accesses Ivan Vecera
2025-04-25 17:09 ` [PATCH net-next v5 6/8] mfd: zl3073x: Fetch invariants during probe Ivan Vecera
2025-04-25 17:09 ` [PATCH net-next v5 7/8] mfd: zl3073x: Add clock_id field Ivan Vecera
2025-04-25 17:09 ` [PATCH net-next v5 8/8] mfd: zl3073x: Register DPLL sub-device during init Ivan Vecera

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250429115933.53a1914c@kernel.org \
    --to=kuba@kernel.org \
    --cc=Prathosh.Satish@microchip.com \
    --cc=akpm@linux-foundation.org \
    --cc=andy@kernel.org \
    --cc=arkadiusz.kubalewski@intel.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=ivecera@redhat.com \
    --cc=jiri@resnulli.us \
    --cc=kees@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=lee@kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mschmidt@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=vadim.fedorenko@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).