All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: ahmadexp@gmail.com
Cc: Jakub Kicinski <kuba@kernel.org>,
	netdev@vger.kernel.org, lee@kernel.org, pavel@kernel.org,
	robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org,
	andi.shyti@kernel.org, peda@lysator.liu.se, trannamatk@gmail.com,
	vadim.fedorenko@linux.dev, richardcochran@gmail.com,
	andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
	pabeni@redhat.com, kees@kernel.org, gustavoars@kernel.org,
	linux-leds@vger.kernel.org, devicetree@vger.kernel.org,
	linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-hardening@vger.kernel.org
Subject: Re: [PATCH net-next v5 7/7] ptp: ocp: Add Time Card V9 I2C peripheral topology
Date: Tue, 18 Aug 2026 09:57:24 -0700	[thread overview]
Message-ID: <20260818165724.4008556-1-kuba@kernel.org> (raw)
In-Reply-To: <1b0ad989c6290a400bd642f9fb2d26d965bc02c8.1786747084.git.ahmadexp@gmail.com>

This is an AI-generated review of your patch. The human sending this
email has considered the AI review valid, or at least plausible.
---
ptp: ocp: Add Time Card V9 I2C peripheral topology

This adds a new I2C profile describing the Time Card V9 board: a BME280
pressure sensor, a BNO055 IMU, and an IS32FL3207 LED controller at 0x37
with six RGB groups. A new helper, ptp_ocp_board_id_matches(), selects
the profile when the fixed-width board ID equals TIMECARD-V9 with 0x00 or
0xff padding.

> diff --git a/drivers/ptp/ptp_ocp.c b/drivers/ptp/ptp_ocp.c
> index 5ae50ad83bdac..5100278f164d3 100644
> --- a/drivers/ptp/ptp_ocp.c
> +++ b/drivers/ptp/ptp_ocp.c
> @@ -643,6 +643,73 @@ static const struct ptp_ocp_i2c_profile ptp_ocp_r4006_profile = {
>  	.led_max_microamp = 8150,
>  };
>  
> +static const struct ptp_ocp_i2c_device ptp_ocp_v9_sensors[] = {
> +	{ "pressure@76", "bosch,bme280", "bme280", 1, 0x76 },
> +	{ "imu@29", "bosch,bno055", "bno055", 1, 0x29 },
> +};

[Severity: Low]
This isn't a bug, but the generated software node for pressure@76 does not
describe the supplies that the BME280 binding marks as required.

ptp_ocp_i2c_init_nodes() emits only two properties per sensor:

	if (sensor->compatible)
		topology->sensor_props[i][prop++] =
			PROPERTY_ENTRY_STRING("compatible",
					      sensor->compatible);
	topology->sensor_props[i][prop] =
		PROPERTY_ENTRY_U32("reg", sensor->address);

Documentation/devicetree/bindings/iio/pressure/bmp085.yaml lists
vddd-supply and vdda-supply in its required list, and bmp280_common_probe()
calls devm_regulator_bulk_get() for both.

To be clear, this does not break probing on the hosts this card plugs into:
devm_regulator_bulk_get() uses NORMAL_GET, and _regulator_get() substitutes
dummy_regulator_rdev whenever have_full_constraints() is true, which is the
case on ACPI systems because acpi_early_init() calls
regulator_has_full_constraints(). The visible effect is two dev_warn()
lines of the form "supply vddd not found, using dummy regulator", plus the
description mismatch against the binding. The preceding patch in this
series relies on the same behaviour for the R4006 invensense,icp10100 node.

Is relying on the dummy regulator here intentional, and would it be worth
saying so in the commit message?

[ ... ]

> @@ -2243,6 +2310,22 @@ ptp_ocp_i2c_supported(struct ptp_ocp *bp)
>  		bp->pdev->device == PCI_DEVICE_ID_CELESTICA_TIMECARD);
>  }
>  
> +static bool
> +ptp_ocp_board_id_matches(const u8 *board_id, const char *id)
> +{
> +	size_t len = strlen(id);
> +	unsigned int i;
> +
> +	if (len > OCP_BOARD_ID_LEN || memcmp(board_id, id, len))
> +		return false;
> +
> +	for (i = len; i < OCP_BOARD_ID_LEN; i++)
> +		if (board_id[i] != 0 && board_id[i] != 0xff)
> +			return false;
> +
> +	return true;
> +}

[Severity: Low]
This isn't a bug introduced by this patch, but the new helper documents
that 0xff padding really does appear in bp->board_id, which makes an
existing formatting inconsistency reachable.

ptp_ocp_devlink_info_get() formats the same field for userspace:

	snprintf(buf, sizeof(buf), "%.*s", OCP_BOARD_ID_LEN,
		 (const char *)bp->board_id);
	err = devlink_info_version_fixed_put(req, board_id_key, buf);

The "%.*s" conversion stops early only on a NUL byte, so for exactly the
boards targeted here, "TIMECARD-V9" followed by erased-flash 0xff bytes,
devlink publishes a DEVLINK_INFO_VERSION_GENERIC_BOARD_ID string with raw
0xff bytes appended. The write is bounded by OCP_BOARD_ID_LEN over a
u8[13] array, so this is presentational only, but the two consumers of the
field now disagree: one trims 0x00 and 0xff padding, the other forwards it
verbatim.

Would it make sense to trim the padding in a shared helper, or in the
devlink path, so both call sites agree on the encoding of board_id?

  parent reply	other threads:[~2026-08-18 16:57 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-14 23:10 [PATCH net-next v5 0/7] ptp: ocp: Add R4006 and V9 I2C peripheral support Ahmad Byagowi
2026-08-14 23:10 ` [PATCH net-next v5 1/7] dt-bindings: leds: Add IS32FL3207 controller Ahmad Byagowi
2026-08-15 23:11   ` sashiko-bot
2026-08-17  6:41   ` Krzysztof Kozlowski
2026-08-17 18:06     ` Ahmad Byagowi
2026-08-18 16:57   ` Jakub Kicinski
2026-08-14 23:10 ` [PATCH net-next v5 2/7] leds: is32fl3207: Add controller driver Ahmad Byagowi
2026-08-15 23:11   ` sashiko-bot
2026-08-18 16:57   ` Jakub Kicinski
2026-08-14 23:10 ` [PATCH net-next v5 3/7] i2c: mux: Propagate software nodes to channel adapters Ahmad Byagowi
2026-08-15 23:11   ` sashiko-bot
2026-08-18 16:57   ` Jakub Kicinski
2026-08-14 23:10 ` [PATCH net-next v5 4/7] ptp: ocp: Track EEPROM fields independently Ahmad Byagowi
2026-08-15 23:11   ` sashiko-bot
2026-08-18 16:57   ` Jakub Kicinski
2026-08-14 23:10 ` [PATCH net-next v5 5/7] ptp: ocp: Add profile-driven I2C topology support Ahmad Byagowi
2026-08-15 23:11   ` sashiko-bot
2026-08-18 16:57   ` Jakub Kicinski
2026-08-14 23:10 ` [PATCH net-next v5 6/7] ptp: ocp: Add R4006 I2C peripheral topology Ahmad Byagowi
2026-08-15 23:11   ` sashiko-bot
2026-08-18 16:57   ` Jakub Kicinski
2026-08-14 23:10 ` [PATCH net-next v5 7/7] ptp: ocp: Add Time Card V9 " Ahmad Byagowi
2026-08-15 23:11   ` sashiko-bot
2026-08-18 16:57   ` Jakub Kicinski [this message]
2026-08-18 16:56 ` [PATCH net-next v5 0/7] ptp: ocp: Add R4006 and V9 I2C peripheral support Jakub Kicinski
2026-08-18 18:12   ` Ahmad Byagowi

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=20260818165724.4008556-1-kuba@kernel.org \
    --to=kuba@kernel.org \
    --cc=ahmadexp@gmail.com \
    --cc=andi.shyti@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=conor+dt@kernel.org \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=edumazet@google.com \
    --cc=gustavoars@kernel.org \
    --cc=kees@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=lee@kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pavel@kernel.org \
    --cc=peda@lysator.liu.se \
    --cc=richardcochran@gmail.com \
    --cc=robh@kernel.org \
    --cc=trannamatk@gmail.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.