From nobody Sat Jun 13 17:01:59 2026 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 578713F9F59 for ; Wed, 6 May 2026 09:59:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778061559; cv=none; b=aHPlb1GrWfGcXziizAJIi6osHHQgDW6c79DPz8WTJMnMIe/uEQNnu4TCo/0EGVu8IZdcXalXoKoyWlDuot9GHvmDQ31UTE97zqWp/qbV2FlsaW51QhcATywhbCwpkN75Gh50Em4o6gBL1/QhHAtBvXGcq4HP/zVjJPHhtOf/uxM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778061559; c=relaxed/simple; bh=ODYbs/4qFS8mGunySbbl9t5b3pslPtDBAWJ2j3ndbtw=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=R3v5uaNCyIzTqkLZHORCt+ruNEGYeDnbi5F2tL4NnCncvyX49m0/7nQKyWwTKjz4B8TMvjX2jZKkEebd2HrBS5Qot/X9DbJDHgYbbpuz7cSiALCVaoPc9hOhk7EUIDS9FFR2KI42Mqr8yMlcf3TXVa1t/fdKUsohEQrYhusTgiU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=agvVv6fR; arc=none smtp.client-ip=209.85.128.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="agvVv6fR" Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-488af9fdaa7so32402665e9.1 for ; Wed, 06 May 2026 02:59:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1778061548; x=1778666348; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=iS5WTyUEworChY9dzMjKKDtiYrkTGtQXOk8l279bHxU=; b=agvVv6fRQkNStPRIYXYpTkQJnHF9uiYRF0XOhmsFZmhqEAKYM7nB/r30qcn/4Q58A7 r/LZks7IfBZfsRfrGadBvG/RWbWiVDECbumNC0+eFe9OG/uIlbJuxe1KRydvv9kmjoqH Q6K66gnVasn6jCwDF2DEUYfNV2VMsyeTReRsl5zEhgxZduR1p6V/ga3ucU/XjpaDnhFJ qCgQTOAL/mIWdWNOC8gg4mlDmTBNDIhm7BaPjFDtIsKEadTnMTcvfC1f8gwY05b5+RZk 0tGLLiorhnoZijULDXdRBlpCNn+l0LP8kqZM2d4YYZL8pahEC482K36r/iDaBEYPFyIh hWMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778061548; x=1778666348; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=iS5WTyUEworChY9dzMjKKDtiYrkTGtQXOk8l279bHxU=; b=W+Y6d9AM+RvsbLCgKYSmnSvF6fSqZCBC0A/FQreym61b9UkIs33xlpihet2h109Ajd KzruLLuqSspfKd3d/BQWBsSbW4/8LRZL1EvKYw83QbfJzbxEtxNjOY92vr8y87v7NcQm JIupP7hxIPoXVDVyqnulP3vOtKYMMTTwc85YRerth8VdIngunOXnTtTFnz0koE5MfUz9 Q7OuSGTQtDR4SOPlLXKt12bYVEfFS3WYhuYLcN5RjmhTqFPo78obbTvrVRgcpCL6fpV0 cnxC2UMtyYG7+igJKiyuAfM8Vdnmjt0NwUQLLOK2NkGb6mixdE+0KDzHmkT+VaVThSJ1 V6Dg== X-Forwarded-Encrypted: i=1; AFNElJ8FAVDPIH2r+TnIs5X7OBuThKb2yqz+0QrnOEqmuc1PxmOo2hRzRRmyZgWaK29eUzrGXdWa7rklVHf4aYA=@vger.kernel.org X-Gm-Message-State: AOJu0YytjzyNi2bVPklxq3pn5sFBfL1RvIcLMwNqnWL5Z6sE2mNv/tUP lrM0IyFC5G8s5xkjTEo7fT0CzEiI6doTUzwmmHkjJAolJ777FAwsB0Bs X-Gm-Gg: AeBDiev6uxjN7QB8ohX2Ca+kLIZbpBLEO/YQPuBJabg65Fb2PURIt+4WNgwv7uugHhM Rg15HeEQUg2fGnQFuBUaWkK+vQI7okAVOCa1JUXgJqGp6GFJemcNm6c7T9FiIq2mZAeKeYl1MXp ZBZwnncFa43bBet1/eHl4RJfSskEGqf819bK358mRVW7paFFpPS2RiX+t8o96iBaU7ooknyltDp XN9E8k/qRPeKAovDKrSQ0m4wpf+sd9Q6DNAfX1teU7Y84DHtm5HBgc8qs6y7g3+BuoAzfG38B+x T64P3z5g/C9cbO1PR8k6yT9Qxb8BmT+mHCqPVVHzEcFBGuoI28Yhby7VgkuK2Q/BmdcMHFT9/l+ uLQq/Z8kMnY8K+TviS9MZewi2kELXpnXzDNisfBjaufoM5yTfNeGDSsTEOIntKtfi4RlhBGl6LJ HnMj/KKjjcfnaJajBVu+1ckYYhKJxK7Nie+2yxSmgEba9mcdU3 X-Received: by 2002:a05:600c:8485:b0:48d:364:e236 with SMTP id 5b1f17b1804b1-48e51f30493mr50016315e9.18.1778061547531; Wed, 06 May 2026 02:59:07 -0700 (PDT) Received: from localhost.localdomain ([196.235.155.85]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48e538c4ae1sm33933415e9.12.2026.05.06.02.59.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 May 2026 02:59:07 -0700 (PDT) From: Salah Triki To: Jonathan Cameron , David Lechner , =?UTF-8?q?Nuno=20S=C3=A1?= , Andy Shevchenko Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Salah Triki Subject: [PATCH v5] iio: humidity: ens210: Fix missing I2C functionality checks Date: Wed, 6 May 2026 10:58:35 +0100 Message-ID: <20260506095835.10112-1-salah.triki@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The ENS210 driver uses SMBus transactions (such as byte, word, and block data reads/writes) during the probe and measurement phases. However, the initial functionality check only validated a subset of these capabilities, which could lead to loading failures on adapters requiring SMBus emulation or native-only controllers. To ensure compatibility across a wide range of I2C adapters, modify the functionality check to verify if the adapter supports the required native operations or, failing that, supports the SMBus emulation layer. Fixes: c524fbca672e ("iio: humidity: Add support for ENS210") Signed-off-by: Salah Triki Reviewed-by: Andy Shevchenko --- Changes since v4: - Fixed the alignment and indentation of the I2C functionality check per Andy's review. Changes since v3: - Fixed the alignment and indentation of the I2C functionality check per Andy's review. Changes since v2: - Fixed the alignment and indentation of the I2C functionality check per Maxime's review. Changes since v1: - Updated the I2C functionality test to check for both required native operations and SMBus emulation (`I2C_FUNC_SMBUS_EMUL`) to prevent loading issues on controllers lacking the emulation flag. drivers/iio/humidity/ens210.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/iio/humidity/ens210.c b/drivers/iio/humidity/ens210.c index 77418d97f30d..159a3c158c9f 100644 --- a/drivers/iio/humidity/ens210.c +++ b/drivers/iio/humidity/ens210.c @@ -204,7 +204,10 @@ static int ens210_probe(struct i2c_client *client) if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_WRITE_BYTE_DATA | I2C_FUNC_SMBUS_WRITE_BYTE | - I2C_FUNC_SMBUS_READ_I2C_BLOCK)) { + I2C_FUNC_SMBUS_READ_BYTE_DATA | + I2C_FUNC_SMBUS_READ_WORD_DATA | + I2C_FUNC_SMBUS_READ_I2C_BLOCK) && + !i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_EMUL)) { return dev_err_probe(&client->dev, -EOPNOTSUPP, "adapter does not support some i2c transactions\n"); } --=20 2.43.0