From nobody Sat Jun 13 17:02:40 2026 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (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 498F83EDAA4 for ; Wed, 6 May 2026 09:46:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778060799; cv=none; b=XJ2ExmXMmQjdM+YUnu0w5SxacFiv9ITU/2AzHuNO/pOC+92JC+wiZwJeV86dA276F3hkxEIQnnjaTJl3C1ktnkFaBFTtlp/V26cSku5G9EyzlUZBOx0Th8bN3HI0iVYDI9sq6rNsDHAgbanFlHXfCGwvgQBCE5RoasY0vWltKGA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778060799; c=relaxed/simple; bh=O7H1bjWhe7G+p25CEte5AQNZVR4jOK7mE1NxJHripdI=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=DLuQ75aH79wzhF9KZS2Bg9jzuSRLhTsrzDOP/RPXCac4B1zwbGBYzYnjl/OJRmxnl1OJthCtLCA5hboC9PVO8NwVGXRgCTUd9GMo93Uu+fBeuntdCzlJROAwM72umDHVm+CdWugIjR3ZENGzMhV3uUVXbgtHTSmciMJWB1spJBk= 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=WZXc8uor; arc=none smtp.client-ip=209.85.128.54 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="WZXc8uor" Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-488b3f8fa2bso6850435e9.1 for ; Wed, 06 May 2026 02:46:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1778060797; x=1778665597; 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=JE7uJopuB1K2d8z6OYIS2HK/E7UeqDAO31A/wEEkRu4=; b=WZXc8uor7ntEbCJM5j4vRFCuznDc68XteuqXl1byn8/pedplsxVL9W/Qy4eXPZJFvM IGiRN74ZEd5ud4J1B5+AESPLCMkeovMuuPgi2AOlNpGNlQO8c2d4NYP+YUxP18l2v2ho kv89kg2ay3hd97MDTecTeDQ5NiBuCSPtFPn11d4NxJFsy86EbhBdcCAIgk93CKMW1aQ8 VvGM8I0xTbWla1iP2sjkdXvdfj3Dp7PBCmRuhaZt5BI0zCVFWT5OSta4KcDM+HubPjGa SKyQ4HBUINfuX7rQ+DjLPWMTMIxulIYfuZ9p7h7sxEWkddDGkmTiDByKfIQcfEFwKrgX kwEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778060797; x=1778665597; 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=JE7uJopuB1K2d8z6OYIS2HK/E7UeqDAO31A/wEEkRu4=; b=f0Sa/0kAzR18B/q19qvOR9yMAnidFGCBZ26BCJQpBIQboBgukq2uuSYdc8zTV4vE/S MLjOMEXc7qf1hfvOqgWY0Ngo6tLWtnTGiWB9aWuRX/TN/txU+f0qDWIBw9RUk9Bh3g5o IdSxC2Wjudpd7crYsBpOBnlcSY+qBWb7O4h4DoOfvTT66+8H0G2O2eAsm7Jdecpj7YdS 8uq2zn/Gu9EsxmVeecqGh+L35VlEoLW2E37Gl7fTOCYYql7JIhy7eimJ07Ry1p4/JTG/ 5Qc5+6ouTA7Imt93d//r7YdQnaR0BcIayQfKuaVrMkkUOOA/bR9DfizqcP2Ya/nuv0ju wY1w== X-Forwarded-Encrypted: i=1; AFNElJ98vutxXiXko39/hk9pmxaTXgfzf6/qfy3D7B8lhbbvCaVrQ6I/GD5diX84XHxCqmO+t0DfkC8lF32QPDM=@vger.kernel.org X-Gm-Message-State: AOJu0YxvbN7PM0U0DW6duvkqD1SHm92YaCB+lr2WTcBiEUgNzu6DDtvH K6cmGBZRHgWowRN6HDdeEq4uqLBH1wGi9zj/R6N18wHcHL8BRBtcqZd6 X-Gm-Gg: AeBDievywvF1So+Q0llLq3iBqi8IZu2OW7VB1wRhDnJwktO4j+7tS3i1n27gCxkXl+G jcG9DQg/m9dGitMXRQd01Q97pwcETrCW2hhxK87j173Tj5LOFzaBHxDFF0QqvFCIVNEw0uZjHpC EXHxE1cSYJgH8KivzaetB7lAwxW+f1LE/oEgQ6hAufeCHWYZn96hdvF5NSBAJ6c+Bp9EDP6ydTa wBX6FWcVxslBX0dw+Ndi4yhCRKFYJvoioYDyCpyjK9umdapJx1O4mw54Dcq4EHy3LRC9zEsrb3B 6+0jp8bum/Ne1P7pIfgWIvS64GXdbDiDjD0Kk4R81z5pJnpz3ea0khYSWCX1YyTsshipCFyNzWj RD3E12bfQIWIUp5WE9Hyw5/B4okMWtzh1mfm13Q/4ByuqlEIGELyqQTMWWrJt1XDhQII3RMyPZJ 2Uey/QJ9tgWkkLHuCI3NdRGrSYQ4NFrwxL9XRIgZ4lBAVu8rvh X-Received: by 2002:a05:600c:5291:b0:489:32b:ac0b with SMTP id 5b1f17b1804b1-48e52285af1mr34914935e9.6.1778060796440; Wed, 06 May 2026 02:46:36 -0700 (PDT) Received: from localhost.localdomain ([196.235.155.85]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48e538a517bsm37354135e9.4.2026.05.06.02.46.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 May 2026 02:46:35 -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 v4] iio: humidity: ens210: Fix missing I2C functionality checks Date: Wed, 6 May 2026 10:46:29 +0100 Message-ID: <20260506094629.8999-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 --- 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 | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/iio/humidity/ens210.c b/drivers/iio/humidity/ens210.c index 77418d97f30d..96076b0391a7 100644 --- a/drivers/iio/humidity/ens210.c +++ b/drivers/iio/humidity/ens210.c @@ -202,9 +202,12 @@ static int ens210_probe(struct i2c_client *client) int ret; =20 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_WRITE_BYTE_DATA | + I2C_FUNC_SMBUS_WRITE_BYTE | + 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