From nobody Wed Apr 1 22:19:12 2026 Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) (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 D53E133436A for ; Wed, 1 Apr 2026 11:24:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775042675; cv=none; b=QRChb9d3OG2o8P5UwN8WtyASOZZYB3Rn/FLEvnaiOnQwlD+2heBk5wvGL0BueHb6+na2NFANOWbZkpXp0irnHEFqGScZO5k9+Ylaltn9KDAQH+TjkBCf1fqunfWzsqEtGtu0VdeTZvhvZ7HJJIw5lz8BOO1pp6mCqGQAizS9z3s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775042675; c=relaxed/simple; bh=3IjlnXsQWM7Aj87wzBBDGiJHN8ZzSaBFZTOLaBH9gj8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=IzIMABw+aR00chUxk+0ioqYNGtM6E+/NsfJSiLBCb+lhN8zaoFseCBZ72cCIcYwnS9drXMp1AboIsts6fuv3t8n7g1ZCkyVE06sHClkRIZ+R2jitI23l1UP+ntc1larcXPsqmxY49OEqyputX7Sr4mwuUfa/YAockM6CNEBy1/I= 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=ayMMnfTH; arc=none smtp.client-ip=209.85.128.42 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="ayMMnfTH" Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-4887eca00c4so11792605e9.2 for ; Wed, 01 Apr 2026 04:24:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1775042672; x=1775647472; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=FVZxzasvJgXpw52P6Yruea8GpgUI8zXUa3GTgD1XQVo=; b=ayMMnfTH0FmCGnzWHnQw5S6teixojaJqr4L10ohMe453u2GAO2l2V+gV4ZdS5BH7MH nAIQ9H1BS7tOztHmMoPLE07WouC5/wvJ/gGBcyGywMRS0MgkgWchctLFp6u8WrdfTlJ/ XY63Jy2OcbAJh5NPyoJFOMBypdBcytafrr/sS8Fz4D+tQZ63e1t0zko3cM7ism8zCtlc 9GxEBIBgPXziNIk8E/DRBHur+ffDsCdrcy4dPfgX0w8mAt8ULVE4Zle4sDGM+W4OoKy/ nyhnlbHMNsC/LJ5wgUyClrt1BQpJp3R+CIJivAsSTtjR3jPQtyUletwjp8vb5R4iRQCF RfIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775042672; x=1775647472; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=FVZxzasvJgXpw52P6Yruea8GpgUI8zXUa3GTgD1XQVo=; b=cPz+jVp2h/xnemKX8CQwpuj5o4UTX+O2iyB1BstqVvwBan8pNlyuVQx4Cr0w25kwGf DP8JzDqEwWwO+KFtZD41hGT4Q7VP//v9lYf9a66bRHoLfYcUTyj6CWHxn/cRnz2iSkm6 3VEJDPLLzS0bMppoVmrGvb2xIz2e7CUnR5lnfXHQSSFUXaVkxatt0iUFRB3oxlkKzkjL Z1PGlETs45pSg5hJ3vZrEutS9egKt4FUr/woOvNF7fJOtpTeoHUp5UCQhPIukknHSSus ps8Jukcgpw8MVAWT4txh4lcImPYtFdx8b+/t03SOlQJJg8QVDfZNSybNBhQLuOi+3N8/ A3dw== X-Forwarded-Encrypted: i=1; AJvYcCVPkziNYc5gxxRGmyLTZcj04K3Ppvc8VrXLEsGM8D2HgUNZldyOd5lBnbU+4zEnYY6HeIq8CG9NFTSCiQI=@vger.kernel.org X-Gm-Message-State: AOJu0YzwNMJZk1NFozFAfHP4Ig/UWmNEM+s0reEeN3AAM62GhA0DIrkr hjDIZz/HMgBheTRe5AIirU9DgfryZFOsFluIrNGicSEombFKXZy9oF+P/hSP1w== X-Gm-Gg: ATEYQzw4Tp3TBg6WPv/Ca3/pBt5ZO1CxuyJvoXB5TOiJineV9F5BHEeeukA6Fe/c09Q J5qD5gzuHge9+Z5ZdNo0ifjMZCuuQDQBH2LlhaRSkszwyNIKdSmANdHFRHk0zhsKwBC/iQM0sqS EOQjgQu/Ix7VZwSaNoRDwC7QeHGar0vgCQdqim+K3KJPQmZh/lbevHP4FKbE4r5QHn6cP0aLrSF TSk5Nfgw32FRSokL7IXAdOOWDLnu6zyitV9wwFagIajQ340tQ4LMQPuB+pN9+M/9R+T80+ywM7a VqXMu5nsPvQF9UX5hCTW4eLLklAZ9ECMki2IeiDv4fYic2Wn4vvpMLHorT5jk3sFMqcqa3Q8d0m tDVJ/674H7keF+oEIU9usMNubmgYq9S6wDi7fTx9STErYbF43mDPeh6ZQohir+irRPONb4rWeWZ to9prfaqRlMvKtWO4L+bbc7Q== X-Received: by 2002:a05:600c:858e:b0:485:3ee1:eba5 with SMTP id 5b1f17b1804b1-488835ccc9dmr43122425e9.27.1775042671874; Wed, 01 Apr 2026 04:24:31 -0700 (PDT) Received: from [127.0.0.1] ([79.133.247.80]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4887aacb99csm43450165e9.1.2026.04.01.04.24.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Apr 2026 04:24:31 -0700 (PDT) From: Erikas Bitovtas Date: Wed, 01 Apr 2026 14:22:36 +0300 Subject: [PATCH 1/3] iio: light: vcnl4000: validate device by prod ID instead of table ID Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260401-vcnl4000-drop-enum-v1-1-ffd201f0c848@gmail.com> References: <20260401-vcnl4000-drop-enum-v1-0-ffd201f0c848@gmail.com> In-Reply-To: <20260401-vcnl4000-drop-enum-v1-0-ffd201f0c848@gmail.com> To: Jonathan Cameron , David Lechner , =?utf-8?q?Nuno_S=C3=A1?= , Andy Shevchenko Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Erikas Bitovtas X-Mailer: b4 0.14.3 Add a new field for vcnl4000_chip_spec and check if we have the right device by that instead of the index from enum table. This leaves the enum table being used only for picking the right vcnl4000_chip_spec, allowing us to drop it later on. Signed-off-by: Erikas Bitovtas --- drivers/iio/light/vcnl4000.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/iio/light/vcnl4000.c b/drivers/iio/light/vcnl4000.c index 9650dbc41f2b..72d68d54864e 100644 --- a/drivers/iio/light/vcnl4000.c +++ b/drivers/iio/light/vcnl4000.c @@ -234,6 +234,7 @@ struct vcnl4000_chip_spec { const int(*als_it_times)[][2]; const int num_als_it_times; const unsigned int ulux_step; + const int prod_id; }; =20 static const struct i2c_device_id vcnl4000_id[] =3D { @@ -265,12 +266,12 @@ static int vcnl4000_init(struct vcnl4000_data *data) prod_id =3D ret >> 4; switch (prod_id) { case VCNL4000_PROD_ID: - if (data->id !=3D VCNL4000) + if (data->chip_spec->prod_id !=3D VCNL4000_PROD_ID) dev_warn(&data->client->dev, "wrong device id, use vcnl4000"); break; case VCNL4010_PROD_ID: - if (data->id !=3D VCNL4010) + if (data->chip_spec->prod_id !=3D VCNL4010_PROD_ID) dev_warn(&data->client->dev, "wrong device id, use vcnl4010/4020"); break; @@ -1901,6 +1902,7 @@ static const struct vcnl4000_chip_spec vcnl4000_chip_= spec_cfg[] =3D { .int_reg =3D VCNL4040_INT_FLAGS, .ps_it_times =3D &vcnl4040_ps_it_times, .num_ps_it_times =3D ARRAY_SIZE(vcnl4040_ps_it_times), + .prod_id =3D VCNL4040_PROD_ID, }, [VCNL4000] =3D { .prod =3D "VCNL4000", @@ -1911,6 +1913,7 @@ static const struct vcnl4000_chip_spec vcnl4000_chip_= spec_cfg[] =3D { .channels =3D vcnl4000_channels, .num_channels =3D ARRAY_SIZE(vcnl4000_channels), .info =3D &vcnl4000_info, + .prod_id =3D VCNL4000_PROD_ID, }, [VCNL4010] =3D { .prod =3D "VCNL4010/4020", @@ -1924,6 +1927,7 @@ static const struct vcnl4000_chip_spec vcnl4000_chip_= spec_cfg[] =3D { .irq_thread =3D vcnl4010_irq_thread, .trig_buffer_func =3D vcnl4010_trigger_handler, .buffer_setup_ops =3D &vcnl4010_buffer_ops, + .prod_id =3D VCNL4010_PROD_ID, }, [VCNL4040] =3D { .prod =3D "VCNL4040", @@ -1941,6 +1945,7 @@ static const struct vcnl4000_chip_spec vcnl4000_chip_= spec_cfg[] =3D { .als_it_times =3D &vcnl4040_als_it_times, .num_als_it_times =3D ARRAY_SIZE(vcnl4040_als_it_times), .ulux_step =3D 100000, + .prod_id =3D VCNL4040_PROD_ID, }, [VCNL4200] =3D { .prod =3D "VCNL4200", @@ -1958,6 +1963,7 @@ static const struct vcnl4000_chip_spec vcnl4000_chip_= spec_cfg[] =3D { .als_it_times =3D &vcnl4200_als_it_times, .num_als_it_times =3D ARRAY_SIZE(vcnl4200_als_it_times), .ulux_step =3D 24000, + .prod_id =3D VCNL4200_PROD_ID, }, }; =20 --=20 2.52.0