Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796456266; b=s9xLFZjdSGkPf8fiFX43Q7JErgQ2JXcGjZivs8fPJAoWW9dTC1VgPOb9SIkOqmxaBisd 6fMkQA0H85OUBkrCwf6x8a2Zjl2vTdjqHxaSPVWsh62e2NPxw87LWo/S8i3WrpQ2Q12d9 bPQbD4PicK1ZmWhB6E7+fRypQtXcfbII08i/xOXPQem/9vqRgVlVCinSs9iiEZgqJfc/p MHoRU4DSpUeSlYNOhU8CrjLhX2VORd49w2kXHGIdlMmTnN/uvnluiFsSYk6MUAlXlQAVB 8fGlMiI2Gd+LUtJqek5LJ7JPCHADv9LKjY6bUR2NZZ1DqBInN126IjW6GXgMQa4kcCA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796456266; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=JY0zMFnOrbtttbKwiViuRSbezlqlC8wPSEcGa77RDuk=; b=4/J2oVqXjQJUqimQ2rJCcotf2LJv93ZLRE/OO/LyY1ZGoU80bDRsr3GwPwGqGzFywtke kKEgekEO4zDkq+jSKLGgMtt/EUc5NsERgz0YkgW/DnPKR60jACwzPVhFpIOA0udQtMtfR UHEGPJxW/R90JahSFHqD69S56XQhI3rFIZ5njDRF/TKV/y6KnpM22vDcI3Yu/9vwL6ElW kOB5gRk3AH16YphLqMXWSVb4CDPhTyUmG/7LYHgOoJ1VgVweMSPZ6hfCGKghQSYwlueNi F4dM05qy1vg97Ew05RbiBcohQgxPr9jnByWuCJLm2pouLY8FoxgvAMMWi60lV65zcoQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=WoZob+M1; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4869B606A322 for ; Sat, 5 Dec 2026 07:37:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=WoZob+M1 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9FFEB1F00936; Sat, 5 Dec 2026 07:37:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796456265; bh=JY0zMFnOrbtttbKwiViuRSbezlqlC8wPSEcGa77RDuk=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=WoZob+M10jem5OOAoOkVNVWQxJ1iaS71I9tcuz5W1i1ZbE7qAvo9V15wXeVy/fDST bogYnn5eRyvqaTluUFaEnVjDIAGzRbXuPqBRKTULC/9sE/JGtcTVTpvl5Dv25B1A2H HVVTcWbAnQYySIghOoJZ7eOsM2n3GcatJhc/UvKvdcVrc9Ddr665RPGhi73hAk8nFL 9SK9EGZknHCFGnNxTEJis7pf90W28rv4vjchDdVJ2D4CflyJZ61VwvRwfl/CQ8DB87 RaA/M67JALQQlf7CpPPKhiL7k2glHzKmnbmYIvS0zBiwLgRopo4S4kXS4douDAa+NC VdXPNUbHM1DTg== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v3 2/2] iio: magnetometer: add Infineon TLE493D-W2B6 driver Reply-To: sashiko-reviews@lists.linux.dev To: "Viral Patel" Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org In-Reply-To: <20261205-tle493d-v3-2-19fc44f81339@gmail.com> References: <20261205-tle493d-v3-0-19fc44f81339@gmail.com> <20261205-tle493d-v3-2-19fc44f81339@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sat, 05 Dec 2026 07:37:45 +0000 X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 4 potential issues to consider: - [High] iio: magnetometer: tle493d_probe() broadcast reset breaks sibling sensors - [Medium] iio: magnetometer: tle493d_reset() lacks I2C bus lock across reset frames - [Medium] iio: magnetometer: tle493d_measure() can read torn data with CA disabled - [Medium] iio: tle493d: missing power-on delay after vdd enable in tle493d_probe() -- commit eb9704b11b9a3ed71756d6e4d39fe59ef234e32f Author: Viral Patel iio: magnetometer: add Infineon TLE493D-W2B6 driver This commit adds an IIO driver for the Infineon TLE493D-W2B6 3-axis Hall effect magnetometer and temperature sensor over I2C, supporting sysfs reads and triggered buffer capture in master-controlled mode. > diff --git a/drivers/iio/magnetometer/tle493d.c b/drivers/iio/magnetomete= r/tle493d.c > new file mode 100644 > index 0000000000000..9982362b57cd2 > --- /dev/null > +++ b/drivers/iio/magnetometer/tle493d.c > @@ -0,0 +1,580 @@ [ ... ] > +static int tle493d_measure(struct tle493d_data *data, u8 *buf) > +{ > + u8 last_frm =3D tle493d_diag_frm(data->regs[TLE493D_REG_DIAG]); > + u8 diag; > + int ret, err; > + > + /* Rewriting Config with the write trigger starts a single conversion */ > + ret =3D tle493d_write(data, TLE493D_REG_CONFIG, > + data->regs[TLE493D_REG_CONFIG], TLE493D_ADDR_TRIG_WRITE); > + if (ret) > + return ret; > + > + /* The result cannot be ready before the conversion time has passed */ > + fsleep(TLE493D_CONV_US); > + > + ret =3D read_poll_timeout(tle493d_read, err, > + err || tle493d_conversion_done(buf, last_frm), > + TLE493D_POLL_US, TLE493D_TIMEOUT_US, false, > + data, buf, TLE493D_DATA_LEN); [Severity: Medium] Can tle493d_measure() return a torn measurement when a conversion finishes mid-read? tle493d_init() sets TLE493D_MOD1_CA, disabling clock stretching, and tle493d_measure() sleeps only the typical conversion time (175 us) before reading registers 0x00 through 0x06 in one transfer. If the conversion completes after byte 0x00 starts clocking out and before Diag (0x06) is read, buf[0..5] can mix old and new bytes while buf[6] already reports completion. Because tle493d_data_parity_ok() only checks a single XOR parity bit, half of torn frames fail with -EIO and the other half silently pass with corrupted readings. A clean read once Diag confirms completion (or sleeping past the worst-case conversion time) would avoid this. [ ... ] > +static void tle493d_reset(struct tle493d_data *data) > +{ > + struct i2c_adapter *adap =3D data->client->adapter; > + static const struct { > + u16 addr; > + char read_write; > + } frames[] =3D { > + { 0x7f, I2C_SMBUS_READ }, > + { 0x7f, I2C_SMBUS_READ }, > + { 0x00, I2C_SMBUS_WRITE }, > + { 0x00, I2C_SMBUS_WRITE }, > + }; > + > + if (!i2c_check_functionality(adap, I2C_FUNC_SMBUS_QUICK)) { > + dev_dbg(&data->client->dev, "adapter cannot send the reset sequence\n"= ); > + return; > + } > + > + /* The reset frames are not acknowledged, so ignore the return values */ > + for (unsigned int i =3D 0; i < ARRAY_SIZE(frames); i++) > + i2c_smbus_xfer(adap, frames[i].addr, 0, frames[i].read_write, 0, > + I2C_SMBUS_QUICK, NULL); > + > + fsleep(TLE493D_RESET_DELAY_US); > +} [Severity: Medium] Should tle493d_reset() hold the I2C segment lock across all four reset frames? i2c_smbus_xfer() acquires and releases I2C_LOCK_SEGMENT on each call, so another driver on the adapter can interleave a transfer between frames and silently break the reset sequence. If the sensor fails to reset and retains a non-zero MOD2.PRD, tle493d_init() computes FP assuming MOD2.PRD is 0 and can write a bad parity bit that drops the sensor off the bus. Locking with i2c_lock_bus(adap, I2C_LOCK_SEGMENT) around four __i2c_smbus_xfer() calls and unlocking with i2c_unlock_bus() would keep the sequence contiguous on the bus. [ ... ] > +static int tle493d_probe(struct i2c_client *client) > +{ [ ... ] > + ret =3D devm_regulator_get_enable(dev, "vdd"); > + if (ret) > + return dev_err_probe(dev, ret, "failed to enable vdd regulator\n"); [Severity: Medium] Does tle493d_probe() need a power-on startup delay after enabling the vdd regulator? devm_regulator_get_enable() only waits for the regulator's own ramp time, not the sensor's internal power-on reset and fuse-loading startup (~250 us). When vdd is cold-enabled, especially on adapters without I2C_FUNC_SMBUS_QUICK where tle493d_reset() returns with no delay, the single non-retried MOD1 write in tle493d_init() can get a NACK and fail probe. > + > + tle493d_reset(data); > + > + ret =3D tle493d_init(data, iicadr); [Severity: High] Will calling tle493d_reset() on every probe break already-probed TLE493D sensors sharing the same I2C bus? The driver supports all four factory address variants in tle493d_i2c_addrs[], but tle493d_reset() sends unaddressed broadcast frames (0x7f and general-call 0x00) that hardware-reset every TLE493D on the bus. When a second sensor probes, it resets any already-initialized sibling back to power-on defaults (PR=3D0, CA=3D0, INT=3D0, non-master mode), disrupting= any in-flight measurement and re-enabling /INT pulses on the shared SCL pin. Because tle493d_measure() only rewrites Config and never restores MOD1, previously probed sibling sensors stay permanently broken while only the last-probed instance remains configured. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261205-tle493d-v3= -0-19fc44f81339@gmail.com?part=3D2