From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (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 D4D4F3DD842 for ; Thu, 14 May 2026 08:42:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778748123; cv=none; b=neTR7YmMuW83Yw0N+34ddti3qPM4FsYsl5Y+K2s6L7NATe2fZuyVVCCDrEyCxBIgdONxlmwuNTMsF/0v0Ybo2dw0Kqo7qZ3KLlwBs78Pnnn4vwfpzj/Bfb9m1UhMwTjjNyN67H2Rv3srIh4wTCyvrFik5dYKE5De7dPnE+GRNb8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778748123; c=relaxed/simple; bh=LuPxpyHvmy+t1hj/p2H8/JlujCymj9F2cMcV+eBA5WI=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=N9Bz1dk+48tW3UneS73gbroQh+QZP0pe5RX+17nmGtcvvxvrab+yNfZzPYQmYDGGNJJmc3VpiMpTOvD81Lt3LLX1H0E690Ie1UqDGRmW0FHl2sKO7YkDAIk+uQSo8Unzyq+9GNxmnao4SwF+4S3GZahyT/4wXOpI1pYT6iSEagE= 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=QlbgcrVn; arc=none smtp.client-ip=209.85.128.49 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="QlbgcrVn" Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-488d2079582so78831395e9.2 for ; Thu, 14 May 2026 01:42:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1778748120; x=1779352920; 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=oKh3xbTRFTYgVsr7K3mUWoC6h/DQrJ3+p7VCS66GyV0=; b=QlbgcrVncZMD4iKF5thLzM1U+i3/u89/T1fZfg/rLUTXEXSGfv8vE2dKMiMJuKHeTg qZF4z4p9Jukt7qfzcJz/jcuHdZHESdiBSWurFeVaawTYHV8RYIIhgAoKJuuTDsWKVfHl njDVDc0ma9T9NS7mviTUPEiHD7oT7mEFKow32/pPVavHggwckEqocRFxmkPAxtv8HxYJ LbKcRGG0MQYghWljDYC4OIynyLcno8vkdIG51nnIprlZp4pws1XelleQqXKawgKJ9TOp yHIddfuyySXrGo6NG3HHah6qWfDlpDUnD4WguFgpHcE40L8v7qdb+HpnXRY6suW+XLht TUYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778748120; x=1779352920; 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=oKh3xbTRFTYgVsr7K3mUWoC6h/DQrJ3+p7VCS66GyV0=; b=sORUaCDNksjK2BUF1f90p0yp1BDTZrb14I0iotigC6CTrVpdJg+qLRKzULk59lr52B DiVs5DZlxF2q5Z7Dt+S4JRgpK5MPh40H/mZocGDukssGaTbLJRl1w9+7hKuJRtNCk81o UBnheSCNo5ZQkvCUUL15lxK3sEjWcudApma2HfIDeF117lsL51Xip2YUmlE6//4zO7Wk MFTWXIpcEV/vT2MFUxnTHfqH+t6YYuLjsVrvTuCn3Jn81vQfbCVEXEHYg31i5LDTNJCh mgsG+mXbofPCy1NsnZZpl7iR2gvpHei8HCUT+IfO+w+DnI6N07R46MztsPEziyeVwYAU Dm0A== X-Forwarded-Encrypted: i=1; AFNElJ/t0HdYQqNdYiANOwJC6HEq/VmA2Nm0g6BbxTb6jIDcO93FQKkV/mm9yK4CEYFNqQvCNbXkCmpyhjcwybs=@vger.kernel.org X-Gm-Message-State: AOJu0YznHEI4j/38S7XReLcfHP6kXQ/DMuBU66aHqiHLlp3Kv7Xm9VsY mZ53r4ufe2wUTuKeIYrjth9Ec5ReITh/MZ1ejjFmPWwXx574z/MFlpfy X-Gm-Gg: Acq92OGMBP+8yI5BOYe8zLhWvKx66FhD2ILCvtb68Fzgb5AvmFK/2+yz70TkqZ8Vdrd USmTxuumHo6jYUY6Kjn5Jpd3Qrbqxx8FAPuWU3WTDWVdtDGo5ybHwyYEOrsN98pGJrq5/1lHj8n fkUUZalUwnaQ/hIzLvv045wwC3ABTteIaVZ14HhuRtj3GKjQYr9AWokBjejSymUjTrpIr++YBa/ O2RWMk5VmkFNeEL+Nx3AajMv+d5RxpJUQSx8vlsGoPGLsELYLGxZkwg2TW6ii1JCggj5ljDP693 HdzSjfG3O04qzLz2Im6r6Vp2OKiOXo2JKPSmUYPn/aMqHhxkXbdy9pI9L+nWC4ZJmuuP9YFOmxJ r5vcgdxsG6iZbVvPzDsXP7gdzcGK9sxxYSED24OxMC+PKZcrKLpn8Wkv0A/XNAzBrVRTA1naiRF joel3cQKDdq/zfcra/XsQ1pA1lcTdi6BnfDQt67w== X-Received: by 2002:a05:600c:8105:b0:48f:d5e8:758c with SMTP id 5b1f17b1804b1-48fd5e875e7mr52919755e9.16.1778748120041; Thu, 14 May 2026 01:42:00 -0700 (PDT) Received: from localhost.localdomain ([196.235.65.162]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48fd649a21asm53190365e9.6.2026.05.14.01.41.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2026 01:41:59 -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 v7] iio: humidity: ens210: Extend I2C functionality check Date: Thu, 14 May 2026 09:41:54 +0100 Message-ID: <20260514084154.298154-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: 8bit The ENS210 driver requires several specific SMBus protocols to operate: - WRITE_BYTE for sending commands. - BYTE_DATA and WORD_DATA for register access. - I2C_BLOCK_DATA for reading humidity/temperature results. Update the probe function to explicitly check for these required functionalities using standard macros. This ensures the driver only binds to adapters that support the necessary transaction types. Signed-off-by: Salah Triki --- Changes since v6: - Replaced the incorrect use of I2C_FUNC_SMBUS_EMUL with an explicit list of required SMBus functionalities as requested by Jonathan Cameron. - Used combined macros (BYTE_DATA, WORD_DATA) to simplify the check. Changes since v5: - Changed patch title from "Fix missing I2C functionality checks" to "Simplify I2C functionality check" to reflect the new approach. - Dropped the Fixes tag as the change is now considered hardening rather than a bug fix. - Replaced individual functionality checks with a single check for I2C_FUNC_SMBUS_EMUL as suggested by Jonathan Cameron. 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`) drivers/iio/humidity/ens210.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/iio/humidity/ens210.c b/drivers/iio/humidity/ens210.c index 77418d97f30d..d209f30d61ed 100644 --- a/drivers/iio/humidity/ens210.c +++ b/drivers/iio/humidity/ens210.c @@ -204,6 +204,8 @@ 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_BYTE_DATA | + I2C_FUNC_SMBUS_WORD_DATA | I2C_FUNC_SMBUS_READ_I2C_BLOCK)) { return dev_err_probe(&client->dev, -EOPNOTSUPP, "adapter does not support some i2c transactions\n"); -- 2.43.0