From nobody Mon Jun 15 13:42:42 2026 Received: from mail-yw1-f172.google.com (mail-yw1-f172.google.com [209.85.128.172]) (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 8D4571A683A for ; Fri, 10 Apr 2026 16:15:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775837720; cv=none; b=raJLOciYesRXGTVMtuNMVE4BPkrj2PzcbF80+DYCvrAhBjXH7HmZZ1GdDmKzMIk+0QqaSEQzCoIN1WMn2PeLlJSDBUXXQnfvJSSau8PUVhJ/xWNZ8H51XRLfj3C1/Yyt4KyhXdIAKj0wqUXXphmqbCB9Lp8idGylf6GmHgvwhQ0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775837720; c=relaxed/simple; bh=v2rZtfsGEcqvkNleqRX3XjmSo2Lct8wNsREjYiEreN4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=FaDdBzl4VfQYg5ZItabwkKUrSGNqazmk9rc6Pg9xYN4vUB8PjNffLlD8mCW4ONeYrRiXfJyLPnP9y8/WXOyUPaUcSQkyf/+3S10o/S0irHhB3R1YzTXpYb4J69KU469m3htse6Je0rmeAoeDLmAzL4xcgH9ekeqGWY81O7WKQTc= 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=lhzgmgzY; arc=none smtp.client-ip=209.85.128.172 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="lhzgmgzY" Received: by mail-yw1-f172.google.com with SMTP id 00721157ae682-7982c3b7dfcso22888017b3.0 for ; Fri, 10 Apr 2026 09:15:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1775837718; x=1776442518; 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=AdS8fPV/eM7tvbU7iuT8bTWahQQCYtva+pfa9FZ/WIw=; b=lhzgmgzY/A9HvmJaGznZK/ej1FVUiAgO5bQA6uhJCSD9943x3pKKhRakg/66gHIRaL 4AUa2NEDyTOXSU7gcUp5etiIUfLFwnSoBSX4ZYIzQrOVNOoNYlplIxbNelxDsOpVILTX Ad1YZqkaFno7905TYVjP4uiGFMfEVVpoR6P5ljO5174N0xJrQaAyl3P/n3gRVAmRWGwq 1JHlp1HCDEY88VLlaPRJ5jj6VehjfOy1MmoUnh1VjQMRPh7qYc3uNQMlrtmNN7blGsUq bNq7DGo9OxSQGHqsxR2/RYOApAd930TKrM5Dtg01LG28lheztpv+0+nc5msx3cG0ROmv fEMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775837719; x=1776442519; 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=AdS8fPV/eM7tvbU7iuT8bTWahQQCYtva+pfa9FZ/WIw=; b=FidarPt1AF5h0wxYBiTqd01DXWsGr1RKwC0hbtRx9fM35TWG7cuLZpp32B3n7i7Vmq gB1hVr/U5PETNbvcVBJJSqjAvQEtF6S3KHF3z7jtP7AP5cJ9I/cnpA1twUFtihqfD0M7 ciRF75bwgAeiXXt5tIlaQ+2+IZ62/lUZj+Vog7SJmuBUvyH/uXne//Y0bS0oSSpRv8US cVgBdYTeb5lZxhPMh02tGPeUStTvDgulqTk0g1rb9wPjzPxqX/uDU0F18ggz+gxN+3HR z3Pt3JD31JXp0LOBqD7R05+/YJq72mEcaDp5hdkpGmeKqOX+jCrnt3SFjgP6CSDNe30+ hi6A== X-Forwarded-Encrypted: i=1; AJvYcCWf8rsQoUjxk+FdGBg3A/nRBA5PAuLy3u+SQlgGY+G2OJIU6rNGmN1LLJOXhqWsurjVqT0MFg5SxJOVU90=@vger.kernel.org X-Gm-Message-State: AOJu0Yydx8yrBr0dF9ULrWVIytySF7y4w/CDU7xCoWk4hU1GF84kRraT lq9MMG2iVzbMHLe4zGBNs2AC6+MP95gmO+QoKCwIn5OAtTpO0nox7v9r X-Gm-Gg: AeBDiesN67BgU7wteKiN7klKyLOcJCKUcEa6+sFN9RWpVNeTxxmduXQIJfKoLPHJz9g f80kgQasmD280GztrUh/So6Vm2IE7i4oqpvxyfMWdS3kvbPlIEr7V8+R1Qgqpli8bN/4uMG+33d oVMjAcu1ltJp01eRA59Kac+puE+qU+9z1xLaY2uPO7prInBdB2HhNfIciXsoeskLoaxIJu8PucT sOqVi9CDnmScbakfMzWfG1ydIk/jRD1PoGbz9z7Rfh1++bUrUOl/qXgZ2Y4uy/qNS0Wz5OBQa+h odY2Ri3DlkoZfqBD3VFRpWoDVu6mCklN8AxwUWg/+PoZyW0Esiy/vXTv8jCkpQMrHYSVyFFMjBW y2ecNzIybvAKp9Mrah5wK8GNsAJdh1aF1EHo3J7eubvJWS9U6c6gdUd+5MtlszeWgLfIXv9NJNk l67CQ5QlYadrywpnLwHxOamxzXcSSXGjvWnEuQ X-Received: by 2002:a05:690c:6b01:b0:79d:67bd:53f9 with SMTP id 00721157ae682-7af6ec4c6e4mr40745757b3.4.1775837718433; Fri, 10 Apr 2026 09:15:18 -0700 (PDT) Received: from [192.168.0.39] ([79.133.247.80]) by smtp.gmail.com with ESMTPSA id 00721157ae682-7af3fa05b48sm15408337b3.33.2026.04.10.09.13.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2026 09:15:17 -0700 (PDT) From: Erikas Bitovtas Date: Fri, 10 Apr 2026 19:11:17 +0300 Subject: [PATCH v3 1/6] 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: <20260410-vcnl4000-drop-enum-v3-1-2ea2bc6f5dfb@gmail.com> References: <20260410-vcnl4000-drop-enum-v3-0-2ea2bc6f5dfb@gmail.com> In-Reply-To: <20260410-vcnl4000-drop-enum-v3-0-2ea2bc6f5dfb@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 , Andy Shevchenko X-Mailer: b4 0.15.1 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. Reviewed-by: Andy Shevchenko 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.53.0 From nobody Mon Jun 15 13:42:42 2026 Received: from mail-yx1-f48.google.com (mail-yx1-f48.google.com [74.125.224.48]) (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 DFD3B2EBBB7 for ; Fri, 10 Apr 2026 16:15:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.224.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775837760; cv=none; b=QP0ILeOdeGKICom8TLQMSeWJ2Of2lrH/cVfmIsG1kWut6Ot+b46cYD2Rg48myDxVgLCwKaYxn4aP4qQsoHZdjkImpWgIbIMVj09HhYOmySX2iP+8aEELgBalV7IeNxg47s0vEg5QfwRLD/9B9hEjHKVbga5AKUehkILir7xIQ2M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775837760; c=relaxed/simple; bh=HYuBVvTYYb55Y4/eAe8/nY1GiKvbIyaGdjh1yZlzxJs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=d3kvGGu+V6H1ZNc+9ID2BbOc3ShZ1NiN9q/3930kAcUS7UdWfcwzxhnzstKzub97KMSglvmaS4kOFvntpSOJINXuOUJIqV+mSoid8sCOfHo4mI7XyoDBmiPimUYvBl5AqWRnpfyFwrOXe2nztJepmtZZ4QUiL9qwP50TmNo4NZw= 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=NJxUHcLZ; arc=none smtp.client-ip=74.125.224.48 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="NJxUHcLZ" Received: by mail-yx1-f48.google.com with SMTP id 956f58d0204a3-6501d32b04bso2423675d50.2 for ; Fri, 10 Apr 2026 09:15:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1775837758; x=1776442558; 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=PEC+NZji/WPrxNlnU3fGBPXtsIIFdYI/pacJYdiIFV0=; b=NJxUHcLZ8XFxRGYjHFTHqy5IK7PWeAfgwPXm6lCEq+wjbBDccukmd9DVS37s1kw7gz wjWC012HU18xl9JfPB3PNEOvcPeOwhX+750x6r1l2pyzrERvvkueQZtYXn58Oy0WjJSc lCm4q1BjPWndLMld+JezejDtuhs1rSDeEEMD7GS8JYRABzNFcRvEt0bpPvhuP327EC3H Nd4PeAblwaP5k6pyjO5+raiAoJUoeSSIrX3SdF6ggBxIDyEandy7oxKaSUEmzYucj1Be 1Xb2aBG49RREUksW9tDIU0Bfdd1L5Xf2Wuhqcpy7t/qrCQG1NZwIbJVN9j9kjdyGYOpK RtTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775837758; x=1776442558; 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=PEC+NZji/WPrxNlnU3fGBPXtsIIFdYI/pacJYdiIFV0=; b=HrB09g5/4B+4gjJOGVbaDKpbPVGKR7UBfzmDnMc1PHpOW049sk9FZMA8MwoeRATW68 v9mZWmAtq1ocMO5DX09bj6kg0UePfBUglhZRd+Oq5opENNuCMfbVZg5WBfRD9yDvyGrC UUSv8f1+IcRoFF/ngSBgOnKvGPOzM/DvS4qB7PPbKmqhyEtH2neVzqFtQxB8fgLsMOCf PR/78Vo7Vsz9/fcQ8/71qh++Y5hWVTBvEnH1i2AHhHQNoAVJa8l6+RQYxQb/6I4yOMut mIWCh0v7k8C5KNVpYbLHCUHFju6uC4LJ0P2agQxs4FFZIxlW2BkDOxd2Y9XNw4zQr0XF Umag== X-Forwarded-Encrypted: i=1; AJvYcCWW0+cJ11S14NaMGMEdCT3UlaUxx6cfYyFvyn4IvzIVLpFR+AcjizHxl6wIdb9CxiXWbTYwAIGfHepdfiI=@vger.kernel.org X-Gm-Message-State: AOJu0YzR9GIXY+DkgPLbU4pesV/fExCwEwe5cmhCH4ulvJY1TOvEbTWj zZF8RVoB0ZYT+vWBPFb9tSgXtMzJkK84uICEYXqZ73Em75XdOzSSPGWB X-Gm-Gg: AeBDievXVtVoAaVlqvl34eIckfBVSC9PL+5ztUd45j5SqJGvZRdtCVxL2dOU27FIbfz fGs1Zxfwt3oxMnVK0pxBxn3xPk4rcA+k3TbDXtNJt5zXAbLcvIqKAa7eVRt84W+ZY1b7nebO0Wf 1mTs1zFEs3Ug7ePqfvoi4BQ7S77jEQMZ+kLIMZsaT/Sk/Aodwlr/zHoKgWuZZTMAVnrx+3AZm5o 4ot10mHFgBnK2MjkkpMFJQu/pxS9zmw1TkwOFKbME9jEtg9RGVXiRvw5bJJ5rk4ptBIZncMunHc qQgknj0qmLptDjrOfxzUdI8/juQ1YH+TJ9uf46MEb+rQd7+ZkZ8ycV04r2ArW+TrtpPC8i6jjhO fDtgWsZP0crwb7x+eXi+08AwlMrt390O6mcXknB1IANFq+2raRa9dKNRi1nX9Pb0/T1Z4RvQzZb P9G56K+2F1rHNna28N0ZjqJb+2Cg== X-Received: by 2002:a05:690c:6604:b0:79b:82a1:645d with SMTP id 00721157ae682-7af71282b58mr41933277b3.29.1775837757694; Fri, 10 Apr 2026 09:15:57 -0700 (PDT) Received: from [192.168.0.39] ([79.133.247.80]) by smtp.gmail.com with ESMTPSA id 00721157ae682-7af3fa05b48sm15408337b3.33.2026.04.10.09.15.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2026 09:15:57 -0700 (PDT) From: Erikas Bitovtas Date: Fri, 10 Apr 2026 19:11:18 +0300 Subject: [PATCH v3 2/6] iio: light: vcnl4000: drop enum id table in favor of chip structs 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: <20260410-vcnl4000-drop-enum-v3-2-2ea2bc6f5dfb@gmail.com> References: <20260410-vcnl4000-drop-enum-v3-0-2ea2bc6f5dfb@gmail.com> In-Reply-To: <20260410-vcnl4000-drop-enum-v3-0-2ea2bc6f5dfb@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.15.1 Instead of creating an enum table with chip IDs, store pointers to structs directly. This drops the association between chip structs and enum IDs and allows for easier addition or removal of new devices. Signed-off-by: Erikas Bitovtas Reviewed-by: Andy Shevchenko --- drivers/iio/light/vcnl4000.c | 205 +++++++++++++++++++++------------------= ---- 1 file changed, 98 insertions(+), 107 deletions(-) diff --git a/drivers/iio/light/vcnl4000.c b/drivers/iio/light/vcnl4000.c index 72d68d54864e..cbe0a9e056ec 100644 --- a/drivers/iio/light/vcnl4000.c +++ b/drivers/iio/light/vcnl4000.c @@ -185,14 +185,6 @@ static const int vcnl4040_ps_oversampling_ratio[] =3D = {1, 2, 4, 8}; =20 #define VCNL4000_SLEEP_DELAY_MS 2000 /* before we enter pm_runtime_suspend= */ =20 -enum vcnl4000_device_ids { - CM36672P, - VCNL4000, - VCNL4010, - VCNL4040, - VCNL4200, -}; - struct vcnl4200_channel { u8 reg; ktime_t last_measurement; @@ -202,7 +194,6 @@ struct vcnl4200_channel { =20 struct vcnl4000_data { struct i2c_client *client; - enum vcnl4000_device_ids id; int rev; int al_scale; int ps_scale; @@ -237,18 +228,6 @@ struct vcnl4000_chip_spec { const int prod_id; }; =20 -static const struct i2c_device_id vcnl4000_id[] =3D { - { "cm36672p", CM36672P }, - { "cm36686", VCNL4040 }, - { "vcnl4000", VCNL4000 }, - { "vcnl4010", VCNL4010 }, - { "vcnl4020", VCNL4010 }, - { "vcnl4040", VCNL4040 }, - { "vcnl4200", VCNL4200 }, - { } -}; -MODULE_DEVICE_TABLE(i2c, vcnl4000_id); - static int vcnl4000_set_power_state(struct vcnl4000_data *data, bool on) { /* no suspend op */ @@ -1889,82 +1868,84 @@ static const struct iio_info vcnl4040_info =3D { .read_avail =3D vcnl4040_read_avail, }; =20 -static const struct vcnl4000_chip_spec vcnl4000_chip_spec_cfg[] =3D { - [CM36672P] =3D { - .prod =3D "CM36672P", - .init =3D vcnl4200_init, - .measure_proximity =3D vcnl4200_measure_proximity, - .set_power_state =3D vcnl4200_set_power_state, - .channels =3D cm36672p_channels, - .num_channels =3D ARRAY_SIZE(cm36672p_channels), - .info =3D &vcnl4040_info, - .irq_thread =3D vcnl4040_irq_thread, - .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", - .init =3D vcnl4000_init, - .measure_light =3D vcnl4000_measure_light, - .measure_proximity =3D vcnl4000_measure_proximity, - .set_power_state =3D vcnl4000_set_power_state, - .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", - .init =3D vcnl4000_init, - .measure_light =3D vcnl4000_measure_light, - .measure_proximity =3D vcnl4000_measure_proximity, - .set_power_state =3D vcnl4000_set_power_state, - .channels =3D vcnl4010_channels, - .num_channels =3D ARRAY_SIZE(vcnl4010_channels), - .info =3D &vcnl4010_info, - .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", - .init =3D vcnl4200_init, - .measure_light =3D vcnl4200_measure_light, - .measure_proximity =3D vcnl4200_measure_proximity, - .set_power_state =3D vcnl4200_set_power_state, - .channels =3D vcnl4040_channels, - .num_channels =3D ARRAY_SIZE(vcnl4040_channels), - .info =3D &vcnl4040_info, - .irq_thread =3D vcnl4040_irq_thread, - .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), - .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", - .init =3D vcnl4200_init, - .measure_light =3D vcnl4200_measure_light, - .measure_proximity =3D vcnl4200_measure_proximity, - .set_power_state =3D vcnl4200_set_power_state, - .channels =3D vcnl4040_channels, - .num_channels =3D ARRAY_SIZE(vcnl4000_channels), - .info =3D &vcnl4040_info, - .irq_thread =3D vcnl4040_irq_thread, - .int_reg =3D VCNL4200_INT_FLAGS, - .ps_it_times =3D &vcnl4200_ps_it_times, - .num_ps_it_times =3D ARRAY_SIZE(vcnl4200_ps_it_times), - .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, - }, +static const struct vcnl4000_chip_spec cm36672p_spec =3D { + .prod =3D "CM36672P", + .init =3D vcnl4200_init, + .measure_proximity =3D vcnl4200_measure_proximity, + .set_power_state =3D vcnl4200_set_power_state, + .channels =3D cm36672p_channels, + .num_channels =3D ARRAY_SIZE(cm36672p_channels), + .info =3D &vcnl4040_info, + .irq_thread =3D vcnl4040_irq_thread, + .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, +}; + +static const struct vcnl4000_chip_spec vcnl4000_spec =3D { + .prod =3D "VCNL4000", + .init =3D vcnl4000_init, + .measure_light =3D vcnl4000_measure_light, + .measure_proximity =3D vcnl4000_measure_proximity, + .set_power_state =3D vcnl4000_set_power_state, + .channels =3D vcnl4000_channels, + .num_channels =3D ARRAY_SIZE(vcnl4000_channels), + .info =3D &vcnl4000_info, + .prod_id =3D VCNL4000_PROD_ID, +}; + +static const struct vcnl4000_chip_spec vcnl4010_spec =3D { + .prod =3D "VCNL4010/4020", + .init =3D vcnl4000_init, + .measure_light =3D vcnl4000_measure_light, + .measure_proximity =3D vcnl4000_measure_proximity, + .set_power_state =3D vcnl4000_set_power_state, + .channels =3D vcnl4010_channels, + .num_channels =3D ARRAY_SIZE(vcnl4010_channels), + .info =3D &vcnl4010_info, + .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, +}; + +static const struct vcnl4000_chip_spec vcnl4040_spec =3D { + .prod =3D "VCNL4040", + .init =3D vcnl4200_init, + .measure_light =3D vcnl4200_measure_light, + .measure_proximity =3D vcnl4200_measure_proximity, + .set_power_state =3D vcnl4200_set_power_state, + .channels =3D vcnl4040_channels, + .num_channels =3D ARRAY_SIZE(vcnl4040_channels), + .info =3D &vcnl4040_info, + .irq_thread =3D vcnl4040_irq_thread, + .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), + .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, +}; + +static const struct vcnl4000_chip_spec vcnl4200_spec =3D { + .prod =3D "VCNL4200", + .init =3D vcnl4200_init, + .measure_light =3D vcnl4200_measure_light, + .measure_proximity =3D vcnl4200_measure_proximity, + .set_power_state =3D vcnl4200_set_power_state, + .channels =3D vcnl4040_channels, + .num_channels =3D ARRAY_SIZE(vcnl4000_channels), + .info =3D &vcnl4040_info, + .irq_thread =3D vcnl4040_irq_thread, + .int_reg =3D VCNL4200_INT_FLAGS, + .ps_it_times =3D &vcnl4200_ps_it_times, + .num_ps_it_times =3D ARRAY_SIZE(vcnl4200_ps_it_times), + .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 static const struct iio_trigger_ops vcnl4010_trigger_ops =3D { @@ -1991,7 +1972,6 @@ static int vcnl4010_probe_trigger(struct iio_dev *ind= io_dev) =20 static int vcnl4000_probe(struct i2c_client *client) { - const struct i2c_device_id *id =3D i2c_client_get_device_id(client); const char * const regulator_names[] =3D { "vdd", "vio", "vled" }; struct device *dev =3D &client->dev; struct vcnl4000_data *data; @@ -2005,8 +1985,7 @@ static int vcnl4000_probe(struct i2c_client *client) data =3D iio_priv(indio_dev); i2c_set_clientdata(client, indio_dev); data->client =3D client; - data->id =3D id->driver_data; - data->chip_spec =3D &vcnl4000_chip_spec_cfg[data->id]; + data->chip_spec =3D i2c_get_match_data(client); =20 ret =3D devm_regulator_bulk_get_enable(dev, ARRAY_SIZE(regulator_names), regulator_names); @@ -2081,32 +2060,32 @@ static int vcnl4000_probe(struct i2c_client *client) static const struct of_device_id vcnl_4000_of_match[] =3D { { .compatible =3D "capella,cm36672p", - .data =3D (void *)CM36672P, + .data =3D &cm36672p_spec, }, /* Capella CM36686 is fully compatible with Vishay VCNL4040 */ { .compatible =3D "capella,cm36686", - .data =3D (void *)VCNL4040, + .data =3D &vcnl4040_spec, }, { .compatible =3D "vishay,vcnl4000", - .data =3D (void *)VCNL4000, + .data =3D &vcnl4000_spec, }, { .compatible =3D "vishay,vcnl4010", - .data =3D (void *)VCNL4010, + .data =3D &vcnl4010_spec, }, { .compatible =3D "vishay,vcnl4020", - .data =3D (void *)VCNL4010, + .data =3D &vcnl4010_spec, }, { .compatible =3D "vishay,vcnl4040", - .data =3D (void *)VCNL4040, + .data =3D &vcnl4040_spec, }, { .compatible =3D "vishay,vcnl4200", - .data =3D (void *)VCNL4200, + .data =3D &vcnl4200_spec, }, { } }; @@ -2148,6 +2127,18 @@ static int vcnl4000_runtime_resume(struct device *de= v) static DEFINE_RUNTIME_DEV_PM_OPS(vcnl4000_pm_ops, vcnl4000_runtime_suspend, vcnl4000_runtime_resume, NULL); =20 +static const struct i2c_device_id vcnl4000_id[] =3D { + { "cm36672p", (kernel_ulong_t)&cm36672p_spec }, + { "cm36686", (kernel_ulong_t)&vcnl4040_spec }, + { "vcnl4000", (kernel_ulong_t)&vcnl4000_spec }, + { "vcnl4010", (kernel_ulong_t)&vcnl4010_spec }, + { "vcnl4020", (kernel_ulong_t)&vcnl4010_spec }, + { "vcnl4040", (kernel_ulong_t)&vcnl4040_spec }, + { "vcnl4200", (kernel_ulong_t)&vcnl4200_spec }, + { } +}; +MODULE_DEVICE_TABLE(i2c, vcnl4000_id); + static struct i2c_driver vcnl4000_driver =3D { .driver =3D { .name =3D VCNL4000_DRV_NAME, --=20 2.53.0 From nobody Mon Jun 15 13:42:42 2026 Received: from mail-yw1-f176.google.com (mail-yw1-f176.google.com [209.85.128.176]) (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 91CAC3CA4A3 for ; Fri, 10 Apr 2026 16:17:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775837823; cv=none; b=Re+JVhrl5r+fTX+i34/OzYLaHmoqvBIO2IEYD3p21vXB2q8x0mUc8xMDfcw4jF//QaykOm0s26J+Wcxtd9wqGunmeVcTsTAj0goB0lmExVzYaZGs55Ww+w2JMoYIJoU67WxbyIMsmp5tz+6AZMGhAptzWfWAAeCP2W0nUSlushA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775837823; c=relaxed/simple; bh=mxyFmPwNypnb/i1vvxXGnnPTZWNSDKGqY59IT8MU9IU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=sieEidHETeMnLfSBbA+meO+HwnGcp56p+ALGCcMJs6l38e7a4+ZyWcw/1o8mabk2Kgf8PsyBeBsbUavwbPxxUZpQI9FzGerM/YEIsO8GMTI7mwJeC77rHdbpP7V8sWYgp5/e+ITBn6iIWvlfRw7C4mwjr2RmnwLMZiACF4qXwy4= 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=OBSnat+q; arc=none smtp.client-ip=209.85.128.176 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="OBSnat+q" Received: by mail-yw1-f176.google.com with SMTP id 00721157ae682-7a2b6adbfa6so23576587b3.0 for ; Fri, 10 Apr 2026 09:17:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1775837821; x=1776442621; 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=Q34ZECdqnWZTzC8ru2SL9aBOUfVgsn1mbx9InWC6dPY=; b=OBSnat+qpmgp4JbLfKmkJafLt/inQ0uo+8941lAnJ0c3hrzvyo7jlcR4gKUa/BFCiD Dg2lWZvLD8zypaGOx8eDprWdY+iQdbpwnZjEyMrj3UJizHXk3fqiF1tseq2Q3WIi788B kyjAdAurVKcS6AiBmA7zsvFNm95zDIDPuS3A2v5xzzU+xhkD6O7Dn1aqcaNdeEX/hp1o PJswKt2hV3XLn1W0xdsnZNYst4uTkOb3Uh+MeTLedXAa4WIUlHTUuSM4EP/UUu2yvEqZ fLQat6/2e/zvKwEs1/6JY9+3cUhZMiNLDtv18HymO84qStPGSf5zbFWXYa2e9fzPh+q7 p6CA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775837821; x=1776442621; 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=Q34ZECdqnWZTzC8ru2SL9aBOUfVgsn1mbx9InWC6dPY=; b=TasXy8CwwQEd9d2bHUBCPGUuasdHZlmKDuLkooztfcXPdJUVq20IDqy/xQ9OTVx9C6 3lCO9WAkvjq8hyQM0zYtUY0utMGARss+2mMOGJN963Otqp92CY7CQVVV4Vadtt/L4Q0A iAn5oZCOiD2hyRC/J193ptDc0vu8j0fGUj9yQQ/sGPyfRmFjkZc54tyis/a/GBbsi3iz qCoM7zDIp9OJXNFZ1/sIGoT5BUbM1r2MK7hL6UUlDHfTw5/Cpm2+VwBC6G9TcNEKYQH/ LmPpevnUBs9qDpeO5JO2BX9p0dC/Os4jVCHsBbNhj6L8HbKDP0JbHsUK8jfUBcF/g1Q7 ETHw== X-Forwarded-Encrypted: i=1; AJvYcCWx+eVaI9NK5SVLReySqKobeMLHStV3IswWXpMtlgVwcowm3XeMNiNJM9QATcQGAz1cPbVLzrLsDlKSVWU=@vger.kernel.org X-Gm-Message-State: AOJu0YxTQ6rnV8YO8T25YjARtgRlPV9HUtM1w+Aat63oCMUF9OD+H8lh Tk72nEDiA4TM04zYdeDlncav1khlRuhsYMB2HNnmTBeyfEZfHlVA19Xy X-Gm-Gg: AeBDieuropdgFmMUtafG8Y9TKtLj6/+klSrDr7YbYaVPgQ+27LKL+npHs6nmb8KtXKO OjZsHmEIGipWmK3I2HokYM0OO4dXDMenlvLs12wnDH9rwchxDEaLsTDi/Pb5QzvfvBYmRZOBy3p LYcRuyI6Z1VAwWGSmjM/+OA4Ngp+sBcEHLX916ozJhIBauR4X7twzPGVPrWRr+/5SgnX0PRzkam 9HGGsd7I0A545Hwq7+ckKuVQ8qLzmH1caionSJX67hltxj0y9abonkM8+K0aOUedPCez9Dpg3Hm zFMUObqqt2SiEybC4uSls0ofdiTRhQzm/seYCNHBi9O5/swr8+pOXaVqZdoZ09hyJNJFgtkUHN3 1/7zEV1dok1QjDil8J1SPEnYh+bjh3uSojDnDpCNKbNyVsNXin7rDsuSZv3FGu2zqOZdWtrypEv MedKcqfPaTTOYgARWCNfXltHzPZnzOpHLozL8d X-Received: by 2002:a05:690c:c511:b0:79d:dce:587d with SMTP id 00721157ae682-7af71281871mr43549567b3.30.1775837821421; Fri, 10 Apr 2026 09:17:01 -0700 (PDT) Received: from [192.168.0.39] ([79.133.247.80]) by smtp.gmail.com with ESMTPSA id 00721157ae682-7af3fa05b48sm15408337b3.33.2026.04.10.09.15.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2026 09:17:00 -0700 (PDT) From: Erikas Bitovtas Date: Fri, 10 Apr 2026 19:11:19 +0300 Subject: [PATCH v3 3/6] iio: light: vcnl4000: move device tree entries into one line 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: <20260410-vcnl4000-drop-enum-v3-3-2ea2bc6f5dfb@gmail.com> References: <20260410-vcnl4000-drop-enum-v3-0-2ea2bc6f5dfb@gmail.com> In-Reply-To: <20260410-vcnl4000-drop-enum-v3-0-2ea2bc6f5dfb@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.15.1 Make device tree entries one line each to save space and LOC. Signed-off-by: Erikas Bitovtas --- drivers/iio/light/vcnl4000.c | 35 +++++++---------------------------- 1 file changed, 7 insertions(+), 28 deletions(-) diff --git a/drivers/iio/light/vcnl4000.c b/drivers/iio/light/vcnl4000.c index cbe0a9e056ec..bbb84b71f226 100644 --- a/drivers/iio/light/vcnl4000.c +++ b/drivers/iio/light/vcnl4000.c @@ -2058,35 +2058,14 @@ static int vcnl4000_probe(struct i2c_client *client) } =20 static const struct of_device_id vcnl_4000_of_match[] =3D { - { - .compatible =3D "capella,cm36672p", - .data =3D &cm36672p_spec, - }, + { .compatible =3D "capella,cm36672p", .data =3D &cm36672p_spec, }, /* Capella CM36686 is fully compatible with Vishay VCNL4040 */ - { - .compatible =3D "capella,cm36686", - .data =3D &vcnl4040_spec, - }, - { - .compatible =3D "vishay,vcnl4000", - .data =3D &vcnl4000_spec, - }, - { - .compatible =3D "vishay,vcnl4010", - .data =3D &vcnl4010_spec, - }, - { - .compatible =3D "vishay,vcnl4020", - .data =3D &vcnl4010_spec, - }, - { - .compatible =3D "vishay,vcnl4040", - .data =3D &vcnl4040_spec, - }, - { - .compatible =3D "vishay,vcnl4200", - .data =3D &vcnl4200_spec, - }, + { .compatible =3D "capella,cm36686", .data =3D &vcnl4040_spec, }, + { .compatible =3D "vishay,vcnl4000", .data =3D &vcnl4000_spec, }, + { .compatible =3D "vishay,vcnl4010", .data =3D &vcnl4010_spec, }, + { .compatible =3D "vishay,vcnl4020", .data =3D &vcnl4010_spec, }, + { .compatible =3D "vishay,vcnl4040", .data =3D &vcnl4040_spec, }, + { .compatible =3D "vishay,vcnl4200", .data =3D &vcnl4200_spec, }, { } }; MODULE_DEVICE_TABLE(of, vcnl_4000_of_match); --=20 2.53.0 From nobody Mon Jun 15 13:42:42 2026 Received: from mail-yw1-f173.google.com (mail-yw1-f173.google.com [209.85.128.173]) (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 0E29D3DA5B1 for ; Fri, 10 Apr 2026 16:18:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775837908; cv=none; b=ZaZfz8HAe9HyDrpzEUbv/6GNXnT5PfZDCdA8wP6yMX6CILtgcv/YIdGs2rm3S8ywyQe05MWavTAXE8nRONoGUjLFXekKRY7Q+sFMr+SMCPFeHlgaDekb7v1VS6zhlXgxeoLEbZASCc7CpQ5al6cf1L6C7hjgZrT4ZaszVYH6dxY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775837908; c=relaxed/simple; bh=UWCf9yxUH0KSymAnEJkJ2BEH4P7e3mxEvJRji5s6cPk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=XJQ01YhVORQ4wBVh9DrsvtgdZm+jbKed6D3WBmtRtUiKigoHOTdvi3bYhHmXf/YY0exY4fEBcZk2tkw9GFJxZ+OBYfnDhx8p09w113Q7ZxtykmCC37ymoCO8WOl1JtYKI0zFNdEkxIJlnzA8dTqvrMFW2o//pIlLhT8FRfk50Gg= 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=XV78dHec; arc=none smtp.client-ip=209.85.128.173 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="XV78dHec" Received: by mail-yw1-f173.google.com with SMTP id 00721157ae682-79be0de8610so22607217b3.2 for ; Fri, 10 Apr 2026 09:18:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1775837906; x=1776442706; 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=EaDXs1KL4TBYMnF8Pcyas7BLMGtBZ4AvI2WNsZOhvxk=; b=XV78dHecI4iYrbMpgmBJV9sSATOL8pA+Ldqj1QRbIfKEt3OYaoAagZxxzqbZ0mAaoV a5cZVCUFcfvexeWf9JNWYR+0sPErOzynEjcARcx3JiNY4sAv7bEqlakcI9zODNHn1V3e 0wNm5tkwpRraZ2kiZJ81c4cYzM3DgkUiooOd01OBGF+VI8MmzGhCLLBGcFaWPE54LoXY LiperhN7ig9yNNczPDFGmApHaDd9/Sq4u/J+VbR8o2L9Gw81dcOIJzW5mHU0x6Jyul0T 8giDBx7mgoNKdWJ2rX98VkB0gl6HVhYI69FaVNpo9X9qtaxQGtMcjzLFNiX/X7aMCVs6 UXPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775837906; x=1776442706; 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=EaDXs1KL4TBYMnF8Pcyas7BLMGtBZ4AvI2WNsZOhvxk=; b=eUxSrHWBaB+6pNZd917OWOmGePlMAYaKhOdL71MhY0JPEHmLzX2qy7P8ahFg2YGP1s rJz84/at80yC86CTajDg0W8EeRZR07YJv/O+bLA3qozjYASdEofi2fkrJ3dHnQpJzftf wOoIxGJBx1JpmorcZ44rSKwJCAl6U31BfoFimXXJxafeaPH7fct8/9vYlWp5xlp7NdaY egqhrXBMj2LqH6OVvcXviO6QBL243RXQrQKeR/JEcSSA/ou7VJR6+zuP2OFWf8hewBzn sYcXai3QthVHPkwxhix62qCwPHjrEEF7R57G4rYsVUAGEQJGZznkhb/+YwPsY3Jsf9nK yZag== X-Forwarded-Encrypted: i=1; AJvYcCU01Dq74+VyG65zNTFefOOAiA9aHpUribFwRw3KFY7d1ooFzRYQTpUpDKf4Bn2t4hwC4fVrL8VN9uix2RI=@vger.kernel.org X-Gm-Message-State: AOJu0YxR+2pAclHp6evRmCLEk7t0VUWQp0PRM8Z1q4orXNmUHqiUAz1C uEsqF4s20ao0u6g0EJm25tjEaziwtMXm85rrcTRfG+VjjzeWtYqFucQi X-Gm-Gg: AeBDiesd/0uTOyjg1SRtS/mgVolG3er7Lf4otJDFzDMuTGCYu8emPKLWeS/4g1J1Hi1 uzvUcoUO4hGuIFqSjUYAYnIDmfgSXQZ1XHu1bKYd0Bif5FZmwj+fCwmnd8RzqTejB2/WZyFs11Z K6a29a6lqLWnzyjJIn9J4tdi1dQtXRVWBF9pxBQlczBUQ+booQvW3EQL9qRwyaLSXb+QPPlJsjJ jaUtPlFS523SUi5FVKCVNFUmdQGyOL55yxZ5Nss/VJvlnAuiUMp4PVlDlBx8jg29mJ8cct9g0PD R94WJgU5TZPsybLHDPkTQ/7IvcmLfSYwvw1vfGUaqNIfyBn7DZTRyWrPrRX09WsRYGF8FMOTITD w7IstmpBvsysQf+IoIgsuXMqhC7enl4U5fS1pW0EPpER602e2vOVXpkY7yZS6omojnqFK5mq7cn D1WDDRmXQ7Ng2v/uHD3HJ4Ufvq3A== X-Received: by 2002:a05:690c:e3cd:b0:7a3:20e7:fbd6 with SMTP id 00721157ae682-7af7213ee0bmr41471737b3.45.1775837905872; Fri, 10 Apr 2026 09:18:25 -0700 (PDT) Received: from [192.168.0.39] ([79.133.247.80]) by smtp.gmail.com with ESMTPSA id 00721157ae682-7af3fa05b48sm15408337b3.33.2026.04.10.09.17.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2026 09:18:25 -0700 (PDT) From: Erikas Bitovtas Date: Fri, 10 Apr 2026 19:11:20 +0300 Subject: [PATCH v3 4/6] iio: light: vcnl4000: move power state function into device-managed action 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: <20260410-vcnl4000-drop-enum-v3-4-2ea2bc6f5dfb@gmail.com> References: <20260410-vcnl4000-drop-enum-v3-0-2ea2bc6f5dfb@gmail.com> In-Reply-To: <20260410-vcnl4000-drop-enum-v3-0-2ea2bc6f5dfb@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.15.1 Move power state setting into a device-managed action to get rid of fail_poweroff goto label and remove it from vcnl4000_remove() function. Signed-off-by: Erikas Bitovtas --- drivers/iio/light/vcnl4000.c | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/drivers/iio/light/vcnl4000.c b/drivers/iio/light/vcnl4000.c index bbb84b71f226..1a8672564cc4 100644 --- a/drivers/iio/light/vcnl4000.c +++ b/drivers/iio/light/vcnl4000.c @@ -1970,6 +1970,18 @@ static int vcnl4010_probe_trigger(struct iio_dev *in= dio_dev) return devm_iio_trigger_register(&client->dev, trigger); } =20 +static void vcnl4000_cleanup(void *data) +{ + struct iio_dev *indio_dev =3D data; + struct vcnl4000_data *chip =3D iio_priv(indio_dev); + struct device *dev =3D &chip->client->dev; + int ret; + + ret =3D chip->chip_spec->set_power_state(chip, false); + if (ret) + dev_warn(dev, "Failed to power down (%pe)", ERR_PTR(ret)); +} + static int vcnl4000_probe(struct i2c_client *client) { const char * const regulator_names[] =3D { "vdd", "vio", "vled" }; @@ -2004,6 +2016,10 @@ static int vcnl4000_probe(struct i2c_client *client) if (ret) return ret; =20 + ret =3D devm_add_action_or_reset(dev, vcnl4000_cleanup, indio_dev); + if (ret) + return ret; + dev_dbg(dev, "%s Ambient light/proximity sensor, Rev: %02x\n", data->chip_spec->prod, data->rev); =20 @@ -2041,19 +2057,20 @@ static int vcnl4000_probe(struct i2c_client *client) =20 ret =3D pm_runtime_set_active(dev); if (ret < 0) - goto fail_poweroff; + return ret; =20 ret =3D iio_device_register(indio_dev); if (ret < 0) - goto fail_poweroff; + goto fail_register; =20 pm_runtime_enable(dev); pm_runtime_set_autosuspend_delay(dev, VCNL4000_SLEEP_DELAY_MS); pm_runtime_use_autosuspend(dev); =20 return 0; -fail_poweroff: - data->chip_spec->set_power_state(data, false); + +fail_register: + pm_runtime_set_suspended(dev); return ret; } =20 @@ -2073,18 +2090,11 @@ MODULE_DEVICE_TABLE(of, vcnl_4000_of_match); static void vcnl4000_remove(struct i2c_client *client) { struct iio_dev *indio_dev =3D i2c_get_clientdata(client); - struct vcnl4000_data *data =3D iio_priv(indio_dev); - int ret; =20 pm_runtime_dont_use_autosuspend(&client->dev); pm_runtime_disable(&client->dev); iio_device_unregister(indio_dev); pm_runtime_set_suspended(&client->dev); - - ret =3D data->chip_spec->set_power_state(data, false); - if (ret) - dev_warn(&client->dev, "Failed to power down (%pe)\n", - ERR_PTR(ret)); } =20 static int vcnl4000_runtime_suspend(struct device *dev) --=20 2.53.0 From nobody Mon Jun 15 13:42:42 2026 Received: from mail-yw1-f180.google.com (mail-yw1-f180.google.com [209.85.128.180]) (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 91A483D47DB for ; Fri, 10 Apr 2026 16:19:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775837962; cv=none; b=nHszjwC/IfclqUn8VuzGf6A9wcDhgP037RWDpDoFyWPhNothV9scOvXwB4KVlvav1HaBvsuBjP6JXN3mB8iaoGJ1SCyvK/ZAtWyzZr4S6RB3Q4ifvMJfpJX4MSjQdEBkzZhQMaYPG61gRbX//muhEXZ8f6nOI2+6BdYXF/sbYmo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775837962; c=relaxed/simple; bh=jF7QrJPWozjagYtKlcGbAqUjNIO6FBn/dqF4amW6Mmw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=B3jgNjhyQjX5Xj/5xcModir8TFI16kCGGk+Di2ybTUuHdXadyGaJvXh6xcaEHlBZ7EPlP06iLRx6A42jmemc1jVPVf3zmpqex1d7jgMJCThJjawooxH5s2RlHYqe0cLWL4B9NSJ1kKO4O5sz0WVLHptd8DMJBzSXIl8wHKak1VI= 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=jc12SOZf; arc=none smtp.client-ip=209.85.128.180 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="jc12SOZf" Received: by mail-yw1-f180.google.com with SMTP id 00721157ae682-7982c3b7dfcso22952717b3.0 for ; Fri, 10 Apr 2026 09:19:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1775837960; x=1776442760; 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=00/sSIScn/UuAAJmy+1XJn6CWmZCg/mywV0xNQGgwVU=; b=jc12SOZfK+eA2erg5nVouYDIHB3sIKA0LsTr7/f6indrOXNGpbnHrOf9v7gC6Q7laH 3n5vHOUTqPZqIi07kzveLYJprHohucCWgKgcFGB/n1HeZB4OBLP5voc7ao58apbq/bx9 xbxzBoVytQYu6zHtC8NP5DV6/mPp13RNvcO62C6iP0JSIFVumaiglActA6UlJgOrsroz V8eG2tdz+V65G1Q8z78amA0TBNTC7nPsrCHDSUCwXypBKqw7NTNteDfQq+/nPA2IHhak EoSOllkN67oUVpm0Pn3UxBhcJAK1EUN3h5PxJKwC926oqfqGL1CV0F6oGzYB6KwWU67l 36LA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775837960; x=1776442760; 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=00/sSIScn/UuAAJmy+1XJn6CWmZCg/mywV0xNQGgwVU=; b=KhXJD5w8qYt9sZjB14X1rpXvji2jDt3/0V3iAmZedv+tEgdpNnGjRpCZyGQ2kdqf92 FUlZhIbcSwX8cPPvDcIFKJqdmZ2AC0P104ypvVDqt8S4NYFy6vjwQU5X3M+yVyxTwnB9 FGDyCYRLMEm16RoqJFaQM92Zyjt0SYA7DGm/k4KACF50sidi81UXbCyCXQINLE68j9YK 86U+UbuQZUXM8f7c8aN7Y5oqPgxxXiS4YvX8GbaSDXbRbxBN/Jx7JonywEKsr+QTto1s y+S9fsV9b2xEx8DdK17iyTVvUxm42hyDrQQYCZLFRsfJvgDkfI+Ueu9wAY7JP06y0Jee sb+A== X-Forwarded-Encrypted: i=1; AJvYcCV8G/1b4fIOURsxDOoYzjG9Ra3C+JmxnDO0Ob9EJ1BYDYlLG2jjyzGv6A4vlLe2Eh9/hKbjQapogWqzlcU=@vger.kernel.org X-Gm-Message-State: AOJu0YzaCODlPglb3J/4lwB/kfTsaebc4h4xHxmtYbtCtqpbFPSpvHvH aY6/BscNcytnF3sjJqMMiLgPcIPThAzgvKi+UzODoJEB4+1vpqWW3Ga26c+s1tF3 X-Gm-Gg: AeBDiesmTse+BqvX3dvUQaLxHr/ZeuSz2UtgbYqGir8q+fAxYQMhbTmgsbgP3AQmQlJ 2ekRDSU6FYCRST0HjX3mg4fR74rrtGieAilOtHXZ1Xi9fFTwKUdlJ2p6SdjYkPlbLG955ovxMGf yd0D2EBZ2jL3QKZTFFx9vXI/LiBXmET4ftDJBeAF1QlKGf46qeVFiUTTH4G9Gr9TXdgZqL3F2fX cG/6p2GSk+I5Km5f+Omb/jX3mk6j2eEq+gaHqQMTfMAQIKcNv9LPVXG39M8+S9xgN1gE0sfrxT4 veaV/CcbhMv11LOrIv7Y+LSqU9G6Y3LuW8P0go1mmf/uolHrXDXMvCJwYFKH7dypz+r8A0Y61/G MxUeruM88PFu4lus16XyQs+hMzQqVkFrpsVz9Q55QHt/DZRt6gidLDtOvaELiG6HXCBETrxTJtC YTG4xDdBGJ3gqIQeGSTAJmbymc/g== X-Received: by 2002:a05:690c:e04e:b0:799:1d0a:aca8 with SMTP id 00721157ae682-7af6f80be65mr32206387b3.19.1775837960646; Fri, 10 Apr 2026 09:19:20 -0700 (PDT) Received: from [192.168.0.39] ([79.133.247.80]) by smtp.gmail.com with ESMTPSA id 00721157ae682-7af3fa05b48sm15408337b3.33.2026.04.10.09.18.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2026 09:19:20 -0700 (PDT) From: Erikas Bitovtas Date: Fri, 10 Apr 2026 19:11:21 +0300 Subject: [PATCH v3 5/6] iio: light: vcnl4000: make pm_runtime_enable() device-managed 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: <20260410-vcnl4000-drop-enum-v3-5-2ea2bc6f5dfb@gmail.com> References: <20260410-vcnl4000-drop-enum-v3-0-2ea2bc6f5dfb@gmail.com> In-Reply-To: <20260410-vcnl4000-drop-enum-v3-0-2ea2bc6f5dfb@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.15.1 Replace pm_runtime_set_active() and pm_runtime_enable() with their device-managed counterpart to remove them from vcnl4000_remove(). Signed-off-by: Erikas Bitovtas Reviewed-by: Andy Shevchenko --- drivers/iio/light/vcnl4000.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/drivers/iio/light/vcnl4000.c b/drivers/iio/light/vcnl4000.c index 1a8672564cc4..b08cb6b33d33 100644 --- a/drivers/iio/light/vcnl4000.c +++ b/drivers/iio/light/vcnl4000.c @@ -2055,23 +2055,18 @@ static int vcnl4000_probe(struct i2c_client *client) return ret; } =20 - ret =3D pm_runtime_set_active(dev); - if (ret < 0) + ret =3D devm_pm_runtime_set_active_enabled(dev); + if (ret) return ret; =20 ret =3D iio_device_register(indio_dev); if (ret < 0) - goto fail_register; + return ret; =20 - pm_runtime_enable(dev); pm_runtime_set_autosuspend_delay(dev, VCNL4000_SLEEP_DELAY_MS); pm_runtime_use_autosuspend(dev); =20 return 0; - -fail_register: - pm_runtime_set_suspended(dev); - return ret; } =20 static const struct of_device_id vcnl_4000_of_match[] =3D { @@ -2091,10 +2086,7 @@ static void vcnl4000_remove(struct i2c_client *clien= t) { struct iio_dev *indio_dev =3D i2c_get_clientdata(client); =20 - pm_runtime_dont_use_autosuspend(&client->dev); - pm_runtime_disable(&client->dev); iio_device_unregister(indio_dev); - pm_runtime_set_suspended(&client->dev); } =20 static int vcnl4000_runtime_suspend(struct device *dev) --=20 2.53.0 From nobody Mon Jun 15 13:42:42 2026 Received: from mail-yw1-f178.google.com (mail-yw1-f178.google.com [209.85.128.178]) (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 E4DA43C73C2 for ; Fri, 10 Apr 2026 16:20:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775838006; cv=none; b=Y7QCWcVhHeYHfId+Lh3SNkG9xwZ6pueNamUmDKSf13OOEA5kDonytwuKl3zFoF8i8AlWKdWc+h5Ai35BhuBwKDG9BpUJjbBAl8Q1OWQL+LWdpgq3YhmOeQtlaszSQjIAaXKKUa31Nh+33R2KwqrJirdN7twE3jp8LqRN8AeDxcY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775838006; c=relaxed/simple; bh=r/jXjAutn0sgIrFPdW80ckJd7XRi5ViYFyeURSC8krg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=C4q3LGn2C8C/eiu3cXnTI8WUAarA/qX4c9wxLTUEnOyEXb7kDIiGGd2+mjIsL7nd9U63NhebYKtj7Pnjjo6qdePKrGF9f2OfTKDJK0dIIQElJdHPyq3gIJ8YpHjWJdHSgGj3r4nJ9B9xain919PhBOnNdIf7iQVnnS1C1jCMP78= 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=CKUAsJz8; arc=none smtp.client-ip=209.85.128.178 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="CKUAsJz8" Received: by mail-yw1-f178.google.com with SMTP id 00721157ae682-7986e0553bdso23047457b3.2 for ; Fri, 10 Apr 2026 09:20:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1775838004; x=1776442804; 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=nnHBqJA8JZ40KTknuTFFFFvoEdkYaSYsNZRBUHIVWOQ=; b=CKUAsJz8o4OOD6t39PRfV2QZet5EVucFxQZkZPNIknyS4EYsnV7JgUORYjAKx1/w79 PyN0UdgkOz1ph5/wsrBQ2GG7oEVqxnMUO+xw57WNhoE36XlSZBZltOlBwFLiQrRYZjgU styfi+6P7Njzgoa3Sg4K4nAFi5+O962vvTNvo0dF9ef0yYRZOoMQyraPDjDhwFMVKIwo waGfg0fjLNNKNhI10HINDbMuFs+g7s2VL/5Eww5Aw+JrLEhjynWzxvQMe45pDCiVuZoY vOhlBH2LKEelfI6or823xt0Khm7dsLLouFFk5xAk6RTMs07DH2dRI1tCWWVQllfQd/bU E32g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775838004; x=1776442804; 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=nnHBqJA8JZ40KTknuTFFFFvoEdkYaSYsNZRBUHIVWOQ=; b=ITBsYtfOwOHSWoftAPO/DtayfcO74WTnjvyWGvhGustJVUTDDSMX+wm9Tuj5QKCg37 uuIKeX74px9yHl9s22vsV0C+7AA6aJGx0UWn2W1tVi8/2ozZeUvdshEUnvC8tSSkr2Zm hCw59hHGtTzb64I2kJCqw1ryDo32nRNxIr2Z5AqTMfVQZ+t1EmfSzHCq9naFeUMPF5lk 6bzyP4NkYGkkJIFHcsiJXEG21qZ/Slp5CfEaqS01y1RyTiZWmkw0z8XDN0GtKtVu3xvM aKBZ5qWtDeoDVJZJVfpnGV9AJOV02pVbzs/1IZcyiiP6XFUejX86S99WQ0toQ7PGvjSr EyOg== X-Forwarded-Encrypted: i=1; AJvYcCUjiukJ1IMMLpr8/jyeLXIPEdp6Ikz52UrGWQ0xKMMDXTDeWUFTCnIW8Fo+K0K8kKxGsw6W6ukuis7RNR4=@vger.kernel.org X-Gm-Message-State: AOJu0YyWEV8q+1MoOmj2jbCzjvJaN8l29jzE6ScT/b3LvIJeQjex1dvW GuU2dTQVFzPenLQTTBhgxEUpmunbEaR1OsgJbNQY3zTjQaezChA+tNxn5Cq5iqKb X-Gm-Gg: AeBDiesXq5wCjaf7+G1McIiVTpkPC4yl0LnaITxzhMCwlykluwNWvuxD4NLId1ruq2T o7dUwjZJwUfOQ4WF7pH2KI1uVHmrLmTXj5cTvj+QXZ5O7QFT7PI34/bpC65efl2as/1UtKzfdAt qEPftXAkxTtVh7vJMcptxhYXP3DxQ5rThghxR6X+ohXQ01VWXKGXDv/a8fL8/vUKtV73+/l+4VV 1+EpL0Oqgzc1gnHGTH5Ie8eSu0nspEBaUMFYdSwlkb7OAv2jdj3rGtjCUv5Rs7iYtqsco6IE/by EZ2VcQ6wdpEQHmI57wVfB1dyg17EGqUxRMp9eJchjn82k3H0C4KJjiL78KgTMkHVE76HeYIkela rafrjY723859B5jwEP4KF/cevyBYa8dsxQfa3QZy1dEeg8Rc227cHzh9xnLL5and23g2DPxUMwd 9rIA84751tv1Y1m4qn+2XZxZT0oA== X-Received: by 2002:a05:690c:d94:b0:797:d386:44e4 with SMTP id 00721157ae682-7af6fa02e95mr44067907b3.16.1775838003818; Fri, 10 Apr 2026 09:20:03 -0700 (PDT) Received: from [192.168.0.39] ([79.133.247.80]) by smtp.gmail.com with ESMTPSA id 00721157ae682-7af3fa05b48sm15408337b3.33.2026.04.10.09.19.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2026 09:20:03 -0700 (PDT) From: Erikas Bitovtas Date: Fri, 10 Apr 2026 19:11:22 +0300 Subject: [PATCH v3 6/6] iio: light: vcnl4000: register an IIO device with a device-managed function 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: <20260410-vcnl4000-drop-enum-v3-6-2ea2bc6f5dfb@gmail.com> References: <20260410-vcnl4000-drop-enum-v3-0-2ea2bc6f5dfb@gmail.com> In-Reply-To: <20260410-vcnl4000-drop-enum-v3-0-2ea2bc6f5dfb@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.15.1 Use a device-managed counterpart of iio_device_register() and remove the redundant iio_device_unregister() call in driver remove function, allowing us to remove vcnl4000_remove() function altogether. Signed-off-by: Erikas Bitovtas Reviewed-by: Andy Shevchenko --- drivers/iio/light/vcnl4000.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/drivers/iio/light/vcnl4000.c b/drivers/iio/light/vcnl4000.c index b08cb6b33d33..c2d3121be687 100644 --- a/drivers/iio/light/vcnl4000.c +++ b/drivers/iio/light/vcnl4000.c @@ -2059,8 +2059,8 @@ static int vcnl4000_probe(struct i2c_client *client) if (ret) return ret; =20 - ret =3D iio_device_register(indio_dev); - if (ret < 0) + ret =3D devm_iio_device_register(dev, indio_dev); + if (ret) return ret; =20 pm_runtime_set_autosuspend_delay(dev, VCNL4000_SLEEP_DELAY_MS); @@ -2082,13 +2082,6 @@ static const struct of_device_id vcnl_4000_of_match[= ] =3D { }; MODULE_DEVICE_TABLE(of, vcnl_4000_of_match); =20 -static void vcnl4000_remove(struct i2c_client *client) -{ - struct iio_dev *indio_dev =3D i2c_get_clientdata(client); - - iio_device_unregister(indio_dev); -} - static int vcnl4000_runtime_suspend(struct device *dev) { struct iio_dev *indio_dev =3D i2c_get_clientdata(to_i2c_client(dev)); @@ -2128,7 +2121,6 @@ static struct i2c_driver vcnl4000_driver =3D { }, .probe =3D vcnl4000_probe, .id_table =3D vcnl4000_id, - .remove =3D vcnl4000_remove, }; =20 module_i2c_driver(vcnl4000_driver); --=20 2.53.0