From nobody Sun Sep 27 00:35:30 2026 Received: from mail-pj1-f51.google.com (mail-pj1-f51.google.com [209.85.216.51]) (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 55EA3499F0D for ; Thu, 27 Aug 2026 17:21:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787851302; cv=none; b=O9V1qw0lDFH0FD7MHGsHtNNm1OBFnnaT6DFH/ke7yK2v8S/+1WV53KLHRg5i7725431Vh26ifb6hcvt9iTuKALAE0od7TK6KEjvKv7YVCOqEIqgGsYofB80SpdWh8DyLm/O7mYDBPP0ksoRcSvkmLfYmekxAQDQIU3VdfGusSTI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787851302; c=relaxed/simple; bh=i4ZF5tM1Z8ws8bEdVnkjHemZs7/wJkd9n0+slBx1btk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=XJLQB7JDHFVuSrAYO50vmt4NLXtf7DwQRgDahKdElaF5sQI8Xud5XWfpmcm0MONX6eBzTjcuZjSCIGKT7NoQwFTVdOdKivakRjy1x+mYzInoKnC3etLZUkcK1B/oDiI3bfE6EkZ+902ZE2/+atnU4wQ8jYcKg8jBRaebYortRZo= 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=JaBTrjnb; arc=none smtp.client-ip=209.85.216.51 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="JaBTrjnb" Received: by mail-pj1-f51.google.com with SMTP id 98e67ed59e1d1-38e7109321dso162017a91.3 for ; Thu, 27 Aug 2026 10:21:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787851301; x=1788456101; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=hUyG3QvGU6Q+HKsY6Ncct0FACqa/9VKrloUu7M3UGwc=; b=JaBTrjnbHbx15X8ZBStA7BXajy2ItOyCciIXoeq74yt26V6xnNHVNtTrbKHlrImUDt apP3P2nqDwcv77SsBBtj4dSA/ZiKXLxRjuN9YW4gChUcADOqGFE3go7iWUJO2UX4Se7Z IF/bw/IdTbDeVa74YJuom6fLqVUYaQP+1vfRs40ISQ+yIy94PbyZhX87X5gjuLoezugD wpJfo+NPCAlQygHX0jPLpqlite8WaBqFf1Vz6u+GgOvTylMAz3jEnOpqAoBRCjkQ18Io y8slw7EsChqMn7S8lZ0Tz6X8PUUG/0uykNnbBmHnTTIcUwdR0Ia4UDS2+o4RydDFcRun OChQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787851301; x=1788456101; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=hUyG3QvGU6Q+HKsY6Ncct0FACqa/9VKrloUu7M3UGwc=; b=bVMecW9wiW2IZQsCJb3UCsNxXAq9cd16CUlAMld4pYzr89kIc2yvWtwjFAJDL1HQ+H BXYo6wUD9zRDc6zKKTcF+KXe7/OWBlXSGNtj1vQU5urBYgIQMM1LfgS0HDlacAIeF4fB bttPmYvV/QTB6i0FWx+RdTT5QP3ngB8h0qhm7Ry1PAB09tzMRIl1IiUnb8627yPSEDZw R+WiW4i0Pg7fhtA3MoDFonCvHSFcTSVILwTcZxZAsfRB8svdyTZ7CIHkwi0aTG0sHb/5 zab8OfKveSRXedBaza8xvwIHpdDZOjDmLTQZ4JMtYo21DM9SFu4pHEtHS0ZmyLk74d9x 2wZQ== X-Forwarded-Encrypted: i=1; AHgh+RrK82c//x5MFy3XamIw++TeBoi9ctQGZS77pT2LhruSQoTMAuvEkByi1INra+g+EV2r4kBOYL9XZ7Gw9Dg=@vger.kernel.org X-Gm-Message-State: AFuF++k3ZENyXxMWEGySIACRE2gFsQDqOxFDq+e5uIx31ezEI05D1ikR hi5NjWlxq4+9v6aaD6KBbL8xHi7e5bzllgi+hh1KgoKmY9fXmI/1hoaa X-Gm-Gg: AR+sD10IOJ11Ciuy81VvCpa7h+K76e4VhosQ77r1H9ZpaYUeZyoq319rXGz3cuwUTay w2uLkZRv7k3F7rzC8mCLHOhYzrXFLlDxgNLc9epNkJxkv694/8LHnjTe5VYf3D0UDoLn/5zffxD pQe8PAF9cSRIBsRHEsR8i7CqO6HVmKJRYT7pmPumNN71bUyZn+ri5C3K0wGmMhlMxKI2tM3OjQN sMzQZgAPSU9msOxhnsoo55idM3KsrcKFq8aEbLTsVabKJlsiB+Np1Q5cMmVSthsOBj5JNv9eO5W zs4TlfgodlIjjHV9yOFXSU6zyD9p/3pfZ4r3NUCuaoh1ZfPQaC7A/cG4xPNHRSUC01K1SaIRk+v m/bjRbpOuw+IhfZEgHF97ZYFl62POO6MGv0S41cbsBNqKRAWasYmHIck+5cF5yzvgt7Ki/MsBHc UC+6T+lhpi+tSpwCffmMn5TrQQlJIeZKdDluRigcbjfP5inlaXeGspktp4cAU6rTt4xOjs/PuLa mMc1ppFtf4ugHjwpMgv45Y4MtaBa4HV981o X-Received: by 2002:a17:90b:17c7:b0:38e:9ef9:eb97 with SMTP id 98e67ed59e1d1-396d0fc1b2fmr1308289a91.16.1787851300583; Thu, 27 Aug 2026 10:21:40 -0700 (PDT) Received: from debian.ari ([47.30.51.191]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-141a8eedd13sm17797165c88.1.2026.08.27.10.21.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Aug 2026 10:21:39 -0700 (PDT) From: Archit Anant To: jic23@kernel.org Cc: dlechner@baylibre.com, andy@kernel.org, nuno.sa@analog.com, u.kleine-koenig@baylibre.com, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Archit Anant Subject: [PATCH v4 1/8] iio: adc: ti-ads1015: use DEFINE_RUNTIME_DEV_PM_OPS() Date: Thu, 27 Aug 2026 22:50:53 +0530 Message-Id: <20260827172100.39176-2-architanant5@gmail.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20260827172100.39176-1-architanant5@gmail.com> References: <20260827172100.39176-1-architanant5@gmail.com> 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" Replace the deprecated SET_RUNTIME_PM_OPS() with the modern DEFINE_RUNTIME_DEV_PM_OPS() macro. This allows for the removal of the macro automatically handles dropping unused functions when PM is disabled. Update the driver struct to use pm_ptr() to avoid unused variable warnings. Signed-off-by: Archit Anant --- drivers/iio/adc/ti-ads1015.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/iio/adc/ti-ads1015.c b/drivers/iio/adc/ti-ads1015.c index 0fbfa4e499aa..93a165c5416a 100644 --- a/drivers/iio/adc/ti-ads1015.c +++ b/drivers/iio/adc/ti-ads1015.c @@ -1059,7 +1059,6 @@ static int ads1015_probe(struct i2c_client *client) return devm_iio_device_register(&client->dev, indio_dev); } =20 -#ifdef CONFIG_PM static int ads1015_runtime_suspend(struct device *dev) { struct iio_dev *indio_dev =3D i2c_get_clientdata(to_i2c_client(dev)); @@ -1080,12 +1079,11 @@ static int ads1015_runtime_resume(struct device *de= v) =20 return ret; } -#endif =20 -static const struct dev_pm_ops ads1015_pm_ops =3D { - SET_RUNTIME_PM_OPS(ads1015_runtime_suspend, - ads1015_runtime_resume, NULL) -}; +static DEFINE_RUNTIME_DEV_PM_OPS(ads1015_pm_ops, + ads1015_runtime_suspend, + ads1015_runtime_resume, + NULL); =20 static const struct ads1015_chip_data ads1015_data =3D { .channels =3D ads1015_channels, @@ -1140,7 +1138,7 @@ static struct i2c_driver ads1015_driver =3D { .driver =3D { .name =3D ADS1015_DRV_NAME, .of_match_table =3D ads1015_of_match, - .pm =3D &ads1015_pm_ops, + .pm =3D pm_ptr(&ads1015_pm_ops), }, .probe =3D ads1015_probe, .id_table =3D ads1015_id, --=20 2.39.5 From nobody Sun Sep 27 00:35:30 2026 Received: from mail-pg1-f182.google.com (mail-pg1-f182.google.com [209.85.215.182]) (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 22BA34963C8 for ; Thu, 27 Aug 2026 17:21:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787851308; cv=none; b=qKP+P6ziukLpk4tjgUur5NR9G0+f0CmPSEsgPYQwNoaz+wNwgnyVjPgRsyA/QRlVYkF6v0m+maDZHJLfzBW2bVffqJe58RDJFfh6ef8fdILQVRyabdo2oAT0+8XJmccVZFFUlhhOeHm+5MpVyPF+Hb6eNqJ/0hcyY4hDCkU8448= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787851308; c=relaxed/simple; bh=Xvm4nW+2P4F0n2X493r3Kfa+UVebUnUFiPYaF5DZ4z4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=KuZmOAQp7M70xFrCiAC1RDQn7bFhEmWZhn3qol3qiEXff/s/Ei/FAJivlECyTQ6yalOZP7a7FX2c4S8zhQomqCc7r3hS7A9lDq4DUkWRYI7lCnxuAiY/J77XHn16QZC01sKB4QfHDoeAIMoLzwlo3Xl0hWdS8wdXmxskrXeZOjs= 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=X3wlUI0z; arc=none smtp.client-ip=209.85.215.182 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="X3wlUI0z" Received: by mail-pg1-f182.google.com with SMTP id 41be03b00d2f7-cc11a905ba5so114616a12.2 for ; Thu, 27 Aug 2026 10:21:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787851304; x=1788456104; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=refqYpnhzgPaSHSNEFWOu6CJsyfTdwor7wN0Moi5irg=; b=X3wlUI0zVcmUd7kX0E49qG6NSSjerq11J4S7Yvr8Tujd0ryT+Q6voJZkRY5659grXn Gq1CFJpBbn9geb1lYCA4bGgRup2u6bT+cu0YhGTVg9h+1gi/ozMpGnJ+OuutXjKtllJ0 trKhXfcQq9PpzJ3OSBwKlw6MjkCrIzvdto+3kekeN3H/XT3PVocmrzkxtXDoUCIqodnJ xdg/5K8zs+9NQsqJjPzlvFMbCLGlNnUXbBfbODWUa/HFmjzl1Dp+GzTUA0fUQ6OQM2Rg fRcc0RGB3u3n1IVgjU12HI7PTTm/b8S3r23z75Z4BHg/HQ3zibFAqqmk5mcNbthw+kmQ 0A7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787851304; x=1788456104; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=refqYpnhzgPaSHSNEFWOu6CJsyfTdwor7wN0Moi5irg=; b=GKxt4m8lqr8B7qjZgWwAIEKCeuVkngHjmJtg+1HgFSTSneFhoedjbY0vjb7Q5FvI9c ILKRJ6TWXjePtCvtRd/HSzxTo72kXGud5yy3GJsWYfHoYTJ9coymEg5LCVQp4DBbqFe2 uFfV6NpKk0w9x448RaCYM/HxdVWQW/cpSIsJUbh8J1Ak0KWWqCQ9SWHWKa/BwJRfwR7w 4ZmWutAO8J2OcqSxInscrNYj/cUEa8KoYbbUThgOtxn7+SIQYBSDYB2bpfspGB/P9z0Z V5mQrqLvMfE6qhRr29bKZiwB+EWXR2MJr45hBsVfdrBhe5/20mBPzhVxNYlRGj4fjKAu 9o8Q== X-Forwarded-Encrypted: i=1; AHgh+RqsKaNBQDgiqo44SLRqxfvlFen4Pl9ourvnb2lJRuig7OnbfdyVY7hTn8/ttGZmQtSNWB5ZjB6zOjsaYEI=@vger.kernel.org X-Gm-Message-State: AFuF++mBUZuMHNikJw0xEACIsSn2PmoyQO59Y8f1qEsF2QtOduh62PNC zhdvlNDkdTXg64pzRsg1x7lCzxRjFmGF8U1upCkHC4Tp1TkT5sOAvXzz X-Gm-Gg: AR+sD13T1k9P0rCa6DTxlmwfXAnllbIXI32DwOLS6By1mMKd3i7f0QzJor927r726I2 ojvAuKmw4LzcncoFIgJeMxIUH1+UXT46I+7B4UcAhovfE5O5eZk/cnhNd8iFzMEYIjs3KcWx/OP RGq0pfIA508Z+qhf4weHOAQnOrzlR1j12D/yCWIth+g6A8IaKe2bZ06d3dAhN16RxPbABA8M9Yk S1dB8rVxuz7inURMuN15DDWx1bjnRj2FGyNhJNpsWYt4qD814PxlIViwGJ7KH4DX2eaOgHWcR4o aWk1d+dUssmjdn14XbW7CTARpCJyBPcVFdmLJD+YEfBP/ju6VFXBg4pEHu4Ku8M7YKSgxwVENDI NiMbxvnZCFl5Y8Fyblsb0y8SKXqBxmoS0F1AUyLNQNZVdM2w0MM9hN/DaNDSXy6/AE+rTcXwFc0 mBo6t200r9ppBhaOSpb/AUf1iCwc1nHBU5lkUn5dE7Mn29KCQ29yjjX3jBh563azUZmPSHojzND Pdk040b0TBCOUnKAHqUMNkVy6fWnBSCxvgX X-Received: by 2002:a17:90b:2f0f:b0:396:41d1:cbc7 with SMTP id 98e67ed59e1d1-396d0d92d15mr1655610a91.3.1787851304248; Thu, 27 Aug 2026 10:21:44 -0700 (PDT) Received: from debian.ari ([47.30.51.191]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-141a8eedd13sm17797165c88.1.2026.08.27.10.21.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Aug 2026 10:21:43 -0700 (PDT) From: Archit Anant To: jic23@kernel.org Cc: dlechner@baylibre.com, andy@kernel.org, nuno.sa@analog.com, u.kleine-koenig@baylibre.com, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Archit Anant Subject: [PATCH v4 2/8] iio: adc: ti-ads1015: sort headers alphabetically Date: Thu, 27 Aug 2026 22:50:54 +0530 Message-Id: <20260827172100.39176-3-architanant5@gmail.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20260827172100.39176-1-architanant5@gmail.com> References: <20260827172100.39176-1-architanant5@gmail.com> 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" Reorder include headers alphabetically to comply with the preferred coding style and improve maintainability. No functional changes. Signed-off-by: Archit Anant --- drivers/iio/adc/ti-ads1015.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/iio/adc/ti-ads1015.c b/drivers/iio/adc/ti-ads1015.c index 93a165c5416a..ef03b74bda3e 100644 --- a/drivers/iio/adc/ti-ads1015.c +++ b/drivers/iio/adc/ti-ads1015.c @@ -11,24 +11,24 @@ * * 0x4B - ADDR connected to SCL */ =20 -#include #include +#include +#include #include #include -#include +#include +#include +#include #include #include -#include -#include -#include =20 +#include +#include #include -#include #include -#include -#include -#include #include +#include +#include =20 #define ADS1015_DRV_NAME "ads1015" =20 --=20 2.39.5 From nobody Sun Sep 27 00:35:30 2026 Received: from mail-pg1-f170.google.com (mail-pg1-f170.google.com [209.85.215.170]) (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 6B2324963B8 for ; Thu, 27 Aug 2026 17:21:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787851311; cv=none; b=THuF55+/lHAOsjcP3skQ0IKdeEyEYkKtSu9J6+vNjffvIJU5P250ajA+inrutezIs3KZ8j5AGk8Fy+qYDIC7vKAunP7KT87ecO/WvM6Tn+Vx0HxT9dmL7tYSr8xvCzvEAo45FObSCVIV+Y4JkYc6zIm6U6z8KLPKYlcTfGXYB2I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787851311; c=relaxed/simple; bh=tIj3Rwco4Ww1OkSETUoiv/BrdF5nP3f+DgIRRQpRcO8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Mm7PbmFJ9AOi+rFQo3ho1qw7NKBIZxYtojlfg48O61hLdk4qxHCJq3kPmwDiXPJVWPnbIpRwmrHlQcSGw80rAnWFR6I5pcmczOtltg72LW6XHaDNuM8b5kz3Et72ZeLQV6/oBGqVt3eR9Kr59O2HV3H7LpHaCzuZlCz2EyTgbU8= 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=nYznhukP; arc=none smtp.client-ip=209.85.215.170 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="nYznhukP" Received: by mail-pg1-f170.google.com with SMTP id 41be03b00d2f7-cc1cf287ef8so145962a12.3 for ; Thu, 27 Aug 2026 10:21:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787851308; x=1788456108; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=1gD1m0WaEvx2GvhSS9FSHrS8bwWBRtzwM1faMwnB9Q4=; b=nYznhukPhS+PLB/vwgeSYyieYfOyR7YSM4HD5f3BNTIz1dyb5w3LOvZje4rzumKJ0+ U3r/nY+IaxuZLNHeEnhBiKnkOdzTHu6/MFeECiXa7T2oXBJHHijfbkGLR7Qk717YWBtk JcdZvUeC+J/sVuGahnMOZqK9fqVbuMWBfyVnnXUFakykyjwK7qWiH2U5QCJq44xtkcuf 0TSW5a7EjQRGIKOfcjgolOP3OFvEawcxSiOtxXy/N1hz9geiK+ejLDDAcnYLkAr7gZab D/ysgYzzitidaL0zmmOUzIMwquHOCo9HhVKCnx4ccj9B28cd36oCOwyIT3e+cR46Yw0V CtcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787851308; x=1788456108; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=1gD1m0WaEvx2GvhSS9FSHrS8bwWBRtzwM1faMwnB9Q4=; b=hQKIhJELQ4EnCK/5n9NO4zm5HbXVwbRtzW6NUJiOVWOvVBTVuIszYz+uuIW6dq0jJ+ in4cy7rN0f17N/xJtqZdtTZhtvn+2gBqLlRRhbS7NdR4BCAeXS3Pvhu5fIUkFA87T+oa 7pYoLlv4ae4jS82FmBkw0Dh/8Q1dzgvGiv639STnIL1TU8w2cS80k1v7LWP46bD+SPI+ lTFRA3mEj7roqzLlVvyMROstgTNpWGI2225MOJ3bPTIkGLlBRyGGTEZBmbeywG1ZzF7Z XJxI67Imxd5FQqg9N8NDABEZ4IY77qb06Gw4rtmsTW9a+vRa/ruOBJyyaOlolTiLJA3Q 1edQ== X-Forwarded-Encrypted: i=1; AHgh+RpehKZ185s8BFLsSV0EaJTrjm+TH2C1x9Irsn6606taMX2YwOs0/YtufWofMobuoCLRK6xQ/dtdWv52E7c=@vger.kernel.org X-Gm-Message-State: AFuF++l1eINdPgPdg2ThYNahz0F7JkgzxBCc6iihYJr3iilxXJSvRItl 46707Y/OSmAupo4XkmlHrOJPqkQEQPceWFeg8gztmzJxcXCeJq9aw0kq X-Gm-Gg: AR+sD12bOo2rPG5gbzStRgoJuUgBm8m9IGIu7smOM3ywG/WANBGQXCfy++wzx/EZYsj 2lqFvkFQOOCyDtfOoU5itgi0Ba75AoWdHk7WUxITJIi9jbcXJ1/cqZpP7cD2P8q9LWW28vy8SmS k6p9Rr9yzZuXllbzrD8Z79GAo2EoHPaLWAHOnStcQqVYQh4BjtVb/ma3ErmpXF08VQfEV23BCLd owhKGT/1g2xlpmd5b1wwCL6muIlHE+0QnfkSfr0xpk5OtoNqb9fEhLfOc+x8Gtofi7R45MU22kx p/aQYtnCn8LjeS2ce7ye3tKNor5BnC4Dd++QoY+3LFDEAtRMIMaqvYzzPH3XDUeiP/5dI2SGWxB M9ErNBaNYNoSpJW2db/H2YGZe4QPzUgw7Hy5C/Xk9MARsbOXZOtTPRd7DTIfl5JAgD9J5ZeZwZl FrTItskRSc/WqrCRW4y88gB9+/wB+FmUNGfWJn03xhxfGy+2QNlQiiZg02o5hb2gRL1gDLqeXWs 6JP7WCLjDY51rCT4OMRqJYTFwit4rHMGYLX X-Received: by 2002:a17:90b:2552:b0:38e:9045:babe with SMTP id 98e67ed59e1d1-396d0f02a58mr1272578a91.7.1787851308430; Thu, 27 Aug 2026 10:21:48 -0700 (PDT) Received: from debian.ari ([47.30.51.191]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-141a8eedd13sm17797165c88.1.2026.08.27.10.21.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Aug 2026 10:21:47 -0700 (PDT) From: Archit Anant To: jic23@kernel.org Cc: dlechner@baylibre.com, andy@kernel.org, nuno.sa@analog.com, u.kleine-koenig@baylibre.com, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Archit Anant Subject: [PATCH v4 3/8] iio: adc: ti-ads1015: use local device pointer in probe Date: Thu, 27 Aug 2026 22:50:55 +0530 Message-Id: <20260827172100.39176-4-architanant5@gmail.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20260827172100.39176-1-architanant5@gmail.com> References: <20260827172100.39176-1-architanant5@gmail.com> 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" Introduce a local device pointer 'dev' in ads1015_probe to avoid accessing &client->dev repeatedly. Signed-off-by: Archit Anant --- drivers/iio/adc/ti-ads1015.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/drivers/iio/adc/ti-ads1015.c b/drivers/iio/adc/ti-ads1015.c index ef03b74bda3e..9c1d36db15e8 100644 --- a/drivers/iio/adc/ti-ads1015.c +++ b/drivers/iio/adc/ti-ads1015.c @@ -944,6 +944,7 @@ static void ads1015_power_down(void *p) static int ads1015_probe(struct i2c_client *client) { const struct ads1015_chip_data *chip; + struct device *dev =3D &client->dev; struct iio_dev *indio_dev; struct ads1015_data *data; int ret; @@ -951,9 +952,9 @@ static int ads1015_probe(struct i2c_client *client) =20 chip =3D i2c_get_match_data(client); if (!chip) - return dev_err_probe(&client->dev, -EINVAL, "Unknown chip\n"); + return dev_err_probe(dev, -EINVAL, "Unknown chip\n"); =20 - indio_dev =3D devm_iio_device_alloc(&client->dev, sizeof(*data)); + indio_dev =3D devm_iio_device_alloc(dev, sizeof(*data)); if (!indio_dev) return -ENOMEM; =20 @@ -993,7 +994,7 @@ static int ads1015_probe(struct i2c_client *client) return PTR_ERR(data->regmap); } =20 - ret =3D devm_iio_triggered_buffer_setup(&client->dev, indio_dev, NULL, + ret =3D devm_iio_triggered_buffer_setup(dev, indio_dev, NULL, ads1015_trigger_handler, &ads1015_buffer_setup_ops); if (ret < 0) { @@ -1029,7 +1030,7 @@ static int ads1015_probe(struct i2c_client *client) if (ret) return ret; =20 - ret =3D devm_request_threaded_irq(&client->dev, client->irq, + ret =3D devm_request_threaded_irq(dev, client->irq, NULL, ads1015_event_handler, irq_trig | IRQF_ONESHOT, client->name, indio_dev); @@ -1041,22 +1042,22 @@ static int ads1015_probe(struct i2c_client *client) if (ret) return ret; =20 - ret =3D devm_add_action_or_reset(&client->dev, ads1015_power_down, data); + ret =3D devm_add_action_or_reset(dev, ads1015_power_down, data); if (ret) return ret; =20 data->conv_invalid =3D true; =20 - ret =3D pm_runtime_set_active(&client->dev); + ret =3D pm_runtime_set_active(dev); if (ret) return ret; - pm_runtime_set_autosuspend_delay(&client->dev, ADS1015_SLEEP_DELAY_MS); - pm_runtime_use_autosuspend(&client->dev); - ret =3D devm_pm_runtime_enable(&client->dev); + pm_runtime_set_autosuspend_delay(dev, ADS1015_SLEEP_DELAY_MS); + pm_runtime_use_autosuspend(dev); + ret =3D devm_pm_runtime_enable(dev); if (ret) return ret; =20 - return devm_iio_device_register(&client->dev, indio_dev); + return devm_iio_device_register(dev, indio_dev); } =20 static int ads1015_runtime_suspend(struct device *dev) --=20 2.39.5 From nobody Sun Sep 27 00:35:30 2026 Received: from mail-pg1-f181.google.com (mail-pg1-f181.google.com [209.85.215.181]) (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 6DDB0499F1C for ; Thu, 27 Aug 2026 17:21:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787851314; cv=none; b=F7yfYA9XOIIva48TYZj7Ya5STaL7eWX1nfPBj3O0fsiRJNPZ4ViSZpyQf7ItrWCaqj4gh9zSnGbUk7YSwjghio05QA65g+Cx7c1rHzJVd5hlz7oEiunmFOXQgWrOPayrpOs3YbEFPl+yTjMnVrAIBzYv5EeMtpaCsSxxnEgSaCw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787851314; c=relaxed/simple; bh=igmrSe9EuyQLIlSQs2uRMnO+x4gxn/GFj+X4NNFKQeY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=RC1l4fQpmjLiUidwKaFD45T0PLbDNxFK71d1rRqpHPGPMBXxK2ZZ4dv08yF12VwP22btZ4LXHpNA6HjuVt+p3lB/VJlpN+lWhsJN/tWArrl1Lc4V81awZMSTtK0n+BzX4ZVMN1K2YAEdVbqrUYrNSf5ql3Xqm3ZvTK55f5duYb4= 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=MXtnkVId; arc=none smtp.client-ip=209.85.215.181 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="MXtnkVId" Received: by mail-pg1-f181.google.com with SMTP id 41be03b00d2f7-cc1bcdb3c4cso110371a12.2 for ; Thu, 27 Aug 2026 10:21:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787851313; x=1788456113; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=gVyblNOz28CCR2fJleofXkaBK4JpEkpfnQEO4VXpl3Q=; b=MXtnkVIdYioy/kUxU/NZXKvHfyu8abvK1Es5p/E2W4YzswXjplQMJXSjhfTPMPld0R 0oKIGdS5q01t+xL9HMs+BzAtuPrSKQn1a2nVDSa0I99oa/sd0rkk5CJKm+58APfZlPNb ZwPqykp+q1XFUa3m1mlFeTU3fi6QFPdhQe0q/ETLOlj5ggV9yhR5tr82RDHONoe9Gem0 l5Us0k1j0yILFOWJ9g7ROLvnFLY6xWwDKFLzCjcJ5rUKdmddRWe21vqLqOqc9fP8EHtt bzuqtr5wjzJcWrcIlzS5AHgaepg9EKbTZF3FOgNwr6+AdtwNmAoVBkGwpEPLtixc/RqW iCkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787851313; x=1788456113; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=gVyblNOz28CCR2fJleofXkaBK4JpEkpfnQEO4VXpl3Q=; b=XilMrvV/mLdoFIPF6A/BOj/DI2C29XXG5QDH4UEjxGv9SX0yZAc0pcDimjNKB1XAX6 EL8EemQm8qmSbH6T2EMPvnvu/e5tfnv5RSwHO30SvqAgF5wGwPBMSFnAJl3Pk5TGUtyc kys6J4BdDpBEWECOGrvZQcGhg9//zMocZF5vGDETm6sM5g8jW1Ku4gh4iFSE8naXGxQB BikamZz/K1HDV0WUUPmNwANaQJYf24eqGdSRZEYiX9nUjFrEoCoFXEJpc3ALlU/mhlSY eMtES9ToL3BIsvwMwChMtnW2C/+YqwWlln9cWpVkGNlp4yEuIz12AWQXMMsVplSePd28 57Vw== X-Forwarded-Encrypted: i=1; AHgh+Ro8g/z+GfEZ9rmjEJkf40TTa+p3gTaSAsoaJoTxIZo3rVLyd/GabRpP15aphldn9JEq2CIvxU7qg0aCh0I=@vger.kernel.org X-Gm-Message-State: AFuF++nY9ttcbNWQUtIKdcwpwSROZdN3IavyhGaN+4dt3zKM7aTgNkNN TGTNpaE28qz83revXvscU2hHQrAH4+0B3/dSDLo5T6IrfinVescxakKF X-Gm-Gg: AR+sD10Lt6XQUNATcT3HJIA1YCpnPaFO4ULMXbG4wRMH7S/PX9L3ronOe85j3olJ5so oCBWN5sgsm5hCWW3IrGfjaKH4TqEB5EOLxPQsyUQEmQuXRop6p3CW0tSQS1teFEWKFByTkooOs4 Osh6D5oU5ZU/hQ3dOPZXb8gruCdq/T1FvgSKFUto1egbuJM5wi1dTJIDjCfXy2pV8Ukha7bggMZ D+yS64nFDSd52l67Zt675fvopnf6bl59qNbD1QC4ELGuPYcZD5eaMRfO+k7W7b310JAfy+xge0u 4LUw88C5dF9dlMg+7SDbEQ61vb7yP1QUsalG5fd20RacavtIMoqFCWXMt2YQtESDm1BAyl/BXeX esSc6QThcLpHynd2rSK8GMG+u884bQ5svteeabVu2WCXD1ELiutzbkFQxJkBYPywJdQMBK1v5qd kPjk8noZeVRi2kutVVpvPuEFRChIEuQnRUjdt5iMsF0rkW2VfZ2l8RExLHIrDcCq+C7A+6y09xg UON54dBpB+pJx/g1jvBjcYAljiVUVWr+9Cv X-Received: by 2002:a05:6a21:6112:b0:3cd:9f0b:f7a2 with SMTP id adf61e73a8af0-3d267b647damr1085961637.11.1787851312523; Thu, 27 Aug 2026 10:21:52 -0700 (PDT) Received: from debian.ari ([47.30.51.191]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-141a8eedd13sm17797165c88.1.2026.08.27.10.21.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Aug 2026 10:21:52 -0700 (PDT) From: Archit Anant To: jic23@kernel.org Cc: dlechner@baylibre.com, andy@kernel.org, nuno.sa@analog.com, u.kleine-koenig@baylibre.com, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Archit Anant Subject: [PATCH v4 4/8] iio: adc: ti-ads1015: use dev_err_probe() for error handling Date: Thu, 27 Aug 2026 22:50:56 +0530 Message-Id: <20260827172100.39176-5-architanant5@gmail.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20260827172100.39176-1-architanant5@gmail.com> References: <20260827172100.39176-1-architanant5@gmail.com> 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" Simplify the error handling paths in ads1015_probe() and ads1015_client_get_channels_config() by converting dev_err() calls that are immediately followed by a return statement over to the modern dev_err_probe() helper. Note: This patch takes advantage of the previously introduced local 'dev' pointer when converting the legacy dev_err(&client->dev, ...) calls, avoiding unnecessary code churn. Suggested-by: Jonathan Cameron Signed-off-by: Archit Anant --- drivers/iio/adc/ti-ads1015.c | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/drivers/iio/adc/ti-ads1015.c b/drivers/iio/adc/ti-ads1015.c index 9c1d36db15e8..0d1006041819 100644 --- a/drivers/iio/adc/ti-ads1015.c +++ b/drivers/iio/adc/ti-ads1015.c @@ -883,18 +883,16 @@ static int ads1015_client_get_channels_config(struct = i2c_client *client) =20 if (!fwnode_property_read_u32(node, "ti,gain", &pval)) { pga =3D pval; - if (pga > 5) { - dev_err(dev, "invalid gain on %pfw\n", node); - return -EINVAL; - } + if (pga > 5) + return dev_err_probe(dev, -EINVAL, + "invalid gain on %pfw\n", node); } =20 if (!fwnode_property_read_u32(node, "ti,datarate", &pval)) { data_rate =3D pval; - if (data_rate > 7) { - dev_err(dev, "invalid data_rate on %pfw\n", node); - return -EINVAL; - } + if (data_rate > 7) + return dev_err_probe(dev, -EINVAL, + "invalid data_rate on %pfw\n", node); } =20 data->channel_data[channel].pga =3D pga; @@ -989,18 +987,16 @@ static int ads1015_probe(struct i2c_client *client) data->regmap =3D devm_regmap_init_i2c(client, chip->has_comparator ? &ads1015_regmap_config : &tla2024_regmap_config); - if (IS_ERR(data->regmap)) { - dev_err(&client->dev, "Failed to allocate register map\n"); - return PTR_ERR(data->regmap); - } + if (IS_ERR(data->regmap)) + return dev_err_probe(dev, PTR_ERR(data->regmap), + "Failed to allocate register map\n"); =20 ret =3D devm_iio_triggered_buffer_setup(dev, indio_dev, NULL, ads1015_trigger_handler, &ads1015_buffer_setup_ops); - if (ret < 0) { - dev_err(&client->dev, "iio triggered buffer setup failed\n"); - return ret; - } + if (ret < 0) + return dev_err_probe(dev, ret, + "iio triggered buffer setup failed\n"); =20 if (client->irq && chip->has_comparator) { unsigned long irq_trig =3D irq_get_trigger_type(client->irq); --=20 2.39.5 From nobody Sun Sep 27 00:35:30 2026 Received: from mail-pj1-f54.google.com (mail-pj1-f54.google.com [209.85.216.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 D68C2495036 for ; Thu, 27 Aug 2026 17:21:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787851320; cv=none; b=KdjRBSTvs3xtZ9E8Xp6jlDWJh0XePqXoABL80ZNF6AJ4CTjnaw4Kv1xh91w8N/HfxxReeXjTsyAOs/4VooABMGzaeezd37RB4KLMlJ/UMp8qA+KFliYZpyIeJGa7/KZmHSKQs5uvFhkVutnijIH0NNc/olUmRKyEs/cfLZPSAF8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787851320; c=relaxed/simple; bh=lXuGALADpdYx0vO4VSK8tnkYBICnr5QRqUa7sGpDYUo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=DTK0x157NsuzFw+g94CRbrSMspXtLnMjXo2eMJQDYW4MVsy5AibGuu5H6CC/bLsJu/ZzDV2oHA75Tz/1bz3nv/epT3A7kDcXp+QsJvwH9MCGoDKp2BJU6h8bkqXBUZ4RgDa0kLZrrUamqsOXY+BuN8wGJ4C6zrJPlBpKeFBmlNs= 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=HU5r6rJ/; arc=none smtp.client-ip=209.85.216.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="HU5r6rJ/" Received: by mail-pj1-f54.google.com with SMTP id 98e67ed59e1d1-38e347638adso323290a91.0 for ; Thu, 27 Aug 2026 10:21:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787851318; x=1788456118; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=Gw3dvZrCiTdARZjyeMDfU+Lq93+rhoJslG7bH+ap744=; b=HU5r6rJ/MlNZhwGSamRiFC+QCpdTHstCmx16xh4AaXhPvY0ACJHGClhC7bFqgacDP+ I/nBiPvHdH+dfrR23fYGD9opvIjRZkNLSNg1zp/BIOMzADaapAbYL3B5LUOYIRu8nXE9 edqjxYcNt3WpePJPW+OiNxwU5D/mBq2Cf+rhdpEfTMm4AWft3z/8sOggdKuLMAr3z16D +San9h92BJG4vgtyX/R3/viF03F8dQhpeOtYtMEZOBCYAVEDASQCyNr1H1Q3hq0nO/ro azg4wkG+j7JODInTXeABJOizdsc8jQ4YIevLyGgxOMywymdxqUVw9tNk0nm29GNPDuYc iCCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787851318; x=1788456118; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=Gw3dvZrCiTdARZjyeMDfU+Lq93+rhoJslG7bH+ap744=; b=VxzGimSEIwMXP1DQ3pZEPhmUapudeQE/52Ma2/qIBYVxZXF8BCfPL1TRikGq1f7lv7 kyxbDnG60qojMk+ZBorj+SGofqHlf14mo+P5zvDAb1/sC0F5DOGgpcGsjySkCJ3SPNxE pgv6tF/0fKC6Ig5iKH2h9eyiUNA3OwK2w363eOIsoaLxAeoYKrbxPfDLuRr6wY1IdzGO LSssk0AXSCXC9yRF8Jpp14nTSw5huQ8rYfhT7JwO3D+zw6X49oV0MD5OeBp6W3PXqKfE F100F9h7RLVgb/pd+A4otkGTUG6ziOZCJsMMJ/r32JTyx9MMLFGAkhJGKFm/FrA9aJQL KAEA== X-Forwarded-Encrypted: i=1; AHgh+RqrowfaaVhBtxBMBN+SySeWz3CKVkUVAYlrLX+BD2sIH+18DDUUqo5hw0AQghpkOUhN21GmoTgbE9+MK9U=@vger.kernel.org X-Gm-Message-State: AFuF++kEYsJZdpaD6G6rRgu07gMwHZkSewCPhEkwtL4FD0giMuXJkvzV 2Rty+cDP26Wy3geQXLW+dFfHAzGQX/0H7ks73zUa8cg5vFnHqph2XArp X-Gm-Gg: AR+sD12pSq++ZpUxl/lyhMQQQI7tADjf27ifEqcZ6w9LFfR8RhVLqB3Tmz0I5XyD+YW TdVvOmyRDgDvoSmqLR0GjnDMeqyf6M1QW5lms/qcFBlZUzamWrT5NJAtKze3nljPezPIz+1U0nb aGYN+JsipvSyyup5NPKOeSLYGXtuAQ2JVovmumSzcX5pI7MlUJ3f+CnucYZTwOsXQRChL2izp+P 8VowgQeLF0aji9aF8EVbYvPdEMuNbiWMkqZZqh9ZwxKFqS2M2PoUVeJVBJXeNd0x+oekb0Xq8ZV uNQiq7IQO9xtgWzOcAWXD7mO5+8stywBpLSQS7jS/Be28FNxSIeqvjh+ja1hGOKkTSjiND+2UVi B4k81h+7h865BVyIO3BMRuu92Nxr/FNsyt2po9JQZ/aS+G6gLUmqr/LunNd5oiiGAz9dIIyZymB dMkS020oTf2GYOLGmItsG3Spn9vx6WNUKhD6NeQxQHOilnT3R6cJ5M8PVFtX7QZ0pPTRqmtkKGL BnGapuw41DlijQyaYqNHh2p81cOKjudQujU X-Received: by 2002:a17:90a:e7cf:b0:38f:dec8:f7e9 with SMTP id 98e67ed59e1d1-396d0fccec0mr1155735a91.12.1787851317751; Thu, 27 Aug 2026 10:21:57 -0700 (PDT) Received: from debian.ari ([47.30.51.191]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-141a8eedd13sm17797165c88.1.2026.08.27.10.21.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Aug 2026 10:21:56 -0700 (PDT) From: Archit Anant To: jic23@kernel.org Cc: dlechner@baylibre.com, andy@kernel.org, nuno.sa@analog.com, u.kleine-koenig@baylibre.com, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Archit Anant , Andy Shevchenko Subject: [PATCH v4 5/8] iio: adc: ti-ads1015: drop unneeded < 0 error checks Date: Thu, 27 Aug 2026 22:50:57 +0530 Message-Id: <20260827172100.39176-6-architanant5@gmail.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20260827172100.39176-1-architanant5@gmail.com> References: <20260827172100.39176-1-architanant5@gmail.com> 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" Several functions in the driver only return 0 on success or a negative error code on failure. Change the error checking to align with standard kernel coding style. Suggested-by: Andy Shevchenko Signed-off-by: Archit Anant --- drivers/iio/adc/ti-ads1015.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/iio/adc/ti-ads1015.c b/drivers/iio/adc/ti-ads1015.c index 0d1006041819..ba4a01850531 100644 --- a/drivers/iio/adc/ti-ads1015.c +++ b/drivers/iio/adc/ti-ads1015.c @@ -539,7 +539,7 @@ static int __ads1015_read_info_raw(struct ads1015_data = *data, return -EBUSY; =20 ret =3D ads1015_set_power_state(data, true); - if (ret < 0) + if (ret) return ret; =20 ret =3D ads1015_get_adc_result(data, chan->address, val); @@ -727,7 +727,7 @@ static int ads1015_enable_event_config(struct ads1015_d= ata *data, return ret; =20 ret =3D ads1015_set_power_state(data, true); - if (ret < 0) + if (ret) return ret; =20 ads1015_event_channel_enable(data, chan->address, comp_mode); @@ -994,7 +994,7 @@ static int ads1015_probe(struct i2c_client *client) ret =3D devm_iio_triggered_buffer_setup(dev, indio_dev, NULL, ads1015_trigger_handler, &ads1015_buffer_setup_ops); - if (ret < 0) + if (ret) return dev_err_probe(dev, ret, "iio triggered buffer setup failed\n"); =20 --=20 2.39.5 From nobody Sun Sep 27 00:35:30 2026 Received: from mail-pj1-f50.google.com (mail-pj1-f50.google.com [209.85.216.50]) (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 B64A547D461 for ; Thu, 27 Aug 2026 17:22:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787851324; cv=none; b=d4NHrUbfMfk9U+3pjuTijClKBu8vm0jEYEx7GWEHjU8i7buDnVVXY6QIMxekDY9A3fVsjijLALb/9RqcrTDOYbzAe3ZnjRqfrxAOSdIU+pY6KtL9tGW/wLgkWt7ow1J4y3lg+O4SWZvAhUrKReE98odtBXS6r5PpWr0bIXq2RhE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787851324; c=relaxed/simple; bh=SQjMM6e5l1eXQ326406VN4Ppfu0Q1sDCfdFbTQj8lmk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Ztd7r2OAS8UUYLPdjTfIUhDaQuaJogdDql5H9EzKkWAL9uCILhRQiJznNOpk21L4BT5R7FYqCzMyZQdbIcuTp+5CvYherLplDWYQvHUFN1creE6rwDkO3WQYBLC7EvH4IGJqjIUeE+d4zhrBS4vI2eWS3fPyRcWYqPUw+estY38= 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=ahecb6Lj; arc=none smtp.client-ip=209.85.216.50 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="ahecb6Lj" Received: by mail-pj1-f50.google.com with SMTP id 98e67ed59e1d1-3965d3d9ab8so214686a91.3 for ; Thu, 27 Aug 2026 10:22:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787851323; x=1788456123; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=zSPvpz+bFRPPrDJKLP2l884CdP+OIZCEuQCCyJqs4wI=; b=ahecb6Lj8hn7UHxE4gAGhXJf4rfsX/io5wMhKVgL6cRjm3Do3dzKWiOFmBDxSl56+f OqyWjJHSardnItpUllhAU0+LDOlmbJjIBPyx1QsKKCk+LCfSo95nimLYePBRX2Zbltqa fxoPjwOQ6zkTDwwee8HV9ogC6Q9OcO5pTZrba56M+Hq3DNaCPX6fvxTiJY7APDB0Fz5g pHQwN6ArnLWZxG1wFiinBBsRubsuDTH9i/B1cwhoqDwUHk8+kJbFN+jWIpgUtES1+JrJ giWSRmrxG9wxWkHNp3BemQwLIqyD6dCzOHe9YgPlpEwiJ7YcKoO8x+Jl7AhXycsMeBRm xVEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787851323; x=1788456123; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=zSPvpz+bFRPPrDJKLP2l884CdP+OIZCEuQCCyJqs4wI=; b=Ni+iM/qG7cd5eCSg6HVdDmc+bD2i+ZlEDiSRD3d8LkaQmz4J1EMBIii6ofhIqKkVYI AT4fY6oh46t6+Rm25JiE9zpimMNP12gQsXPOA0Tqn2Z4iIDneubtcqAUcQHA+q0nOSNm zTs8PaJ6IeLG5oYUikmUSccKdX1x9FiwDxg4yDcQ90fO5kcuwtWzqNdmVoy9005t+xO+ kNwqn1dqnugenzT/VsvChNr5qzKJQpymRfl6O0BPFYWNKTuzHWbToERyYg7Qb5AmTz8x dy5wfyaw+xFdi0SnPtIugXVTkhwMCO+zaqyyWO4Jx0RZ+TIKPM21S8XbZi9yuY7zUYuu XO1w== X-Forwarded-Encrypted: i=1; AHgh+Rri3P2o+tsoyYm3i3k26viDlk+kq53Z/zCR+Q8vT9bJaYzdC9qXJ5jA5SBlS95H9iCp/TOIztjpj+4n2XI=@vger.kernel.org X-Gm-Message-State: AFuF++nvNjUnJkxRcVQwN2qOm92fBvFYr4iWKyrxAEBTbo5HCibl/mGw 7GyZNvH5tcv1EV63hraKO8Za3t412q/Z37sGBGjhYlfIEzwIIXBG7LX/ X-Gm-Gg: AR+sD12JsN8xuPMuyJGjQe+jWkJPfS0ebFq4f2peF362lMhioXCiIFl0irqzqyfV1T1 qnJERZCes59ED82BIjvzqrH+bq5VN63u5mXG7wjGlkzdwx9cl8b0dSU3pU4D7CfgienmBb1AHdQ BH6uMe39iIzPjsGYc+dQcPsoEPBSrYwxzaZsT8cdzN4rZtsiBow8zJtNMKdfk5+6dbfcLb1IgzD o202Flh1kn0N9bZsr8pNkPfSYRDJyJBw5gPfjKizlwvIFaWzlQQSktdEzM7aPz7Qi5owOH3ahGP AsWKgMKMZhplRdr+QS4Bwb+4OwCdKnCAV/DeD9LRyWFhmFB2U1KDA9jNJ7sGNx2XIyoTT1jAkon Iy25fcysscucHtuv6kGC/aDxCtJ5uQ78UA66AvPErPZtkhqpA9sOayXYQsXRDH+sP/wVWWrcYwS eLJC/v/oS/o1u+YtilgCYFW83paE5PAB0cZc7CwNpAncMSSDcXyjk7rN862GMkJeQ0e2ktUBcM4 v6W0GWZjJUWNOdDM00XaeT6sb/nKhIRdKIg X-Received: by 2002:a17:90b:384e:b0:38c:a59b:5189 with SMTP id 98e67ed59e1d1-396d104d0bfmr1151199a91.15.1787851322882; Thu, 27 Aug 2026 10:22:02 -0700 (PDT) Received: from debian.ari ([47.30.51.191]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-141a8eedd13sm17797165c88.1.2026.08.27.10.21.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Aug 2026 10:22:02 -0700 (PDT) From: Archit Anant To: jic23@kernel.org Cc: dlechner@baylibre.com, andy@kernel.org, nuno.sa@analog.com, u.kleine-koenig@baylibre.com, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Archit Anant Subject: [PATCH v4 6/8] iio: adc: ti-ads1015: Convert to managed resources Date: Thu, 27 Aug 2026 22:50:58 +0530 Message-Id: <20260827172100.39176-7-architanant5@gmail.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20260827172100.39176-1-architanant5@gmail.com> References: <20260827172100.39176-1-architanant5@gmail.com> 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" Use managed resource helpers for the mutex and runtime PM setup. Replace mutex_init() with devm_mutex_init() and replace the separate pm_runtime_set_active() and devm_pm_runtime_enable() calls with devm_pm_runtime_set_active_enabled(). This simplifies resource management and ensures resources are automatically cleaned up on probe failure and device removal. Signed-off-by: Archit Anant --- drivers/iio/adc/ti-ads1015.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/iio/adc/ti-ads1015.c b/drivers/iio/adc/ti-ads1015.c index ba4a01850531..a6dd85debc0e 100644 --- a/drivers/iio/adc/ti-ads1015.c +++ b/drivers/iio/adc/ti-ads1015.c @@ -959,7 +959,9 @@ static int ads1015_probe(struct i2c_client *client) data =3D iio_priv(indio_dev); i2c_set_clientdata(client, indio_dev); =20 - mutex_init(&data->lock); + ret =3D devm_mutex_init(dev, &data->lock); + if (ret) + return ret; =20 indio_dev->name =3D ADS1015_DRV_NAME; indio_dev->modes =3D INDIO_DIRECT_MODE; @@ -1044,12 +1046,9 @@ static int ads1015_probe(struct i2c_client *client) =20 data->conv_invalid =3D true; =20 - ret =3D pm_runtime_set_active(dev); - if (ret) - return ret; pm_runtime_set_autosuspend_delay(dev, ADS1015_SLEEP_DELAY_MS); pm_runtime_use_autosuspend(dev); - ret =3D devm_pm_runtime_enable(dev); + ret =3D devm_pm_runtime_set_active_enabled(dev); if (ret) return ret; =20 --=20 2.39.5 From nobody Sun Sep 27 00:35:30 2026 Received: from mail-pj1-f41.google.com (mail-pj1-f41.google.com [209.85.216.41]) (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 26292496914 for ; Thu, 27 Aug 2026 17:22:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787851329; cv=none; b=SEPsANKsxfKDnH4mk/sK8v/mJkW8SZ9uj5+DcRvgzoFpy5nbzQj4Ak6qEupQ02mNMVMPvF+ztYrmv5D3ZjKurE+Yoovq78VvjtACXNS8UQEG8tBgUatjShucdjbMBrDK16S2hlGVbQLg3UV6DD2DD47VGYHGIVwVVcC/8QZsjso= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787851329; c=relaxed/simple; bh=0k5RIH93Yjz24ksL9fHu9qf1zYGBe+t//mBUH0aQddc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=AcpLCW4UloTSHIacarbTstpE+vFcNWZVOb4wd2a9a8T3aHR38wmDt605kGHCwwhkJRnrD3MR6eI8VFnRDD8RjIw29nwO9US4QzutYbEs4zd/sxHL4Yz6xRjIbAJXQKQ08mj+jV5UwNWb+9yUvR826mYFM4c/sJw5AptWcbeTU8A= 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=sk6kih+4; arc=none smtp.client-ip=209.85.216.41 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="sk6kih+4" Received: by mail-pj1-f41.google.com with SMTP id 98e67ed59e1d1-38759bcd877so310325a91.2 for ; Thu, 27 Aug 2026 10:22:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787851327; x=1788456127; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=ext/cEoySzDhvG6GqDZxdkuFYWzU30RhxhzVbTbp7aI=; b=sk6kih+4q1q9x3tu2rRpEdIALNDyAuPNgB+/84rNjDmwiirDezG8YI/g7f1I/2WxJl UPiXLtPU4BMiAdhWv/3VbHGYhpQTk+TRmsVygNvWFYkjfltrXvVBMrDxJHwKjvZExmvt CWJV+9onglqlcyCKXnQzS9NvWovWDNezf7tbqD9q8RJ15RsK4fbkHVk3TP+ZrpiZJGdZ VMsrRBKoJ3Wdr+DArLhjKahXxi+rcHybfpBB/AupzBwpnHYOjwdnGBZOs4GKbMCuMV3C omXCuk3/WVp5TCwpWzbHw8rcRbnleb2JyOe+JqPRU8oWcuBvIzxQ4DPGTAJId9UkRw5s 95uA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787851327; x=1788456127; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=ext/cEoySzDhvG6GqDZxdkuFYWzU30RhxhzVbTbp7aI=; b=UD5UmH5a54ZU61bKTwdmZPKMVrMMC/5RrywhDVnqMXejhKNsIhZoZmnxUP6vqLeOvI VhWOMMozP9vfyA50Sz6gWISu6O+Z3o8ez9rEfPce8aONmR4AZEaP6lxW+TOv2P6MFInu 2ngMRsF01oitr4q328B7NzwjsI2sq1wN8IUgxnxl6QMSr47Svy6fy4FhaIUm8rEcyobj e3sbJv/ZrilI56eYN4Ih2wVI/+u232JCeMkRw/Q1vPcCnbHwXDB8jKqnlBIcHpk92lDe 0NckL0FFHTfAtxV4L9h8uzON9Exc4qEcdj6KsWgnqfYB0dg/BmLEHvOr7Jxida3gW8jT 5CNA== X-Forwarded-Encrypted: i=1; AHgh+RqSX2Xc+Z9fMVDuKPXjvZf/73aLayihpnnVPCW1eL9FdCz8eH7N4f/Ivg1hMH6sqBEoVnd52JJMdVPBaZI=@vger.kernel.org X-Gm-Message-State: AFuF++m8X0BmLLIOzB5F9cOOJPmLUeLPVgboLktYOk2lfDnDhUXHGnFX EC1NSqY0xcvpSG7n3gtxAK6J3vNuC8qUCg3q+YlmGxGi9Y+B5uQcJDpJ X-Gm-Gg: AR+sD11Es0JpZ6uSiprKGy8XvBAGYL6CkICS4prSI5saLyYt9uhDwTbyShWSe39B8je X2Askl7vInNjft0rMwHb+mU//GlyQFfG0eJKybxstdwEbxZjYV3d2FRC7SI1Rs3HkQeWhGSQYaX A/ypb9UMUhHFuEo4PmUmtYcxZYTbxraGCJ9g4xYuNKtSRZ0HpIW6TLZ3/G1DAelx5eOIpNyBLRp KN60BjqNDYdurp7jL6aR+2os7Po6xrq/qxEDeYivxUFVCqtrTbsiOI0nxSJtlKjcG+KeC0LuOTB LiUg9MfTIW+XoGH//4CDCvdARx/mmAJ2wv5pJYYq7GiT2Dfuc8g4R9Hax3CENgbFXGCEYAcRbj5 lz0RRSU39jLwrCAnkYw51lbSa/AWI+2NPTxyh1sa4nfQarj7wN2fWZbF/FuxWrnLLVKggmR2JxO GlWEIOzN/TJR5ZY+0e3gwiZCwB7+FNwG4Hf2E6qslaTrjinesda0JewKPLYKWFCILtAgefe6euE IVkrfkEd+7YlNU3uw85IQmoflzyf1SpbzZf8b2eUBpmqUsA X-Received: by 2002:a17:90b:1a8e:b0:396:4c63:7193 with SMTP id 98e67ed59e1d1-396d0fe45damr1226750a91.11.1787851327313; Thu, 27 Aug 2026 10:22:07 -0700 (PDT) Received: from debian.ari ([47.30.51.191]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-141a8eedd13sm17797165c88.1.2026.08.27.10.22.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Aug 2026 10:22:06 -0700 (PDT) From: Archit Anant To: jic23@kernel.org Cc: dlechner@baylibre.com, andy@kernel.org, nuno.sa@analog.com, u.kleine-koenig@baylibre.com, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Archit Anant Subject: [PATCH v4 7/8] iio: adc: ti-ads1015: replace custom shift macros with FIELD_PREP/GET Date: Thu, 27 Aug 2026 22:50:59 +0530 Message-Id: <20260827172100.39176-8-architanant5@gmail.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20260827172100.39176-1-architanant5@gmail.com> References: <20260827172100.39176-1-architanant5@gmail.com> 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 driver currently uses custom _SHIFT macros and manual bitwise operations to read and write to the configuration register. Modernize the bitwise logic by replacing all manual shifts with the standard FIELD_PREP() and FIELD_GET() macros from . This improves readability and prevents potential bitwise errors. Remove the now-unused _SHIFT macros from the top of the file. Suggested-by: Jonathan Cameron Signed-off-by: Archit Anant --- drivers/iio/adc/ti-ads1015.c | 40 +++++++++++++++--------------------- 1 file changed, 16 insertions(+), 24 deletions(-) diff --git a/drivers/iio/adc/ti-ads1015.c b/drivers/iio/adc/ti-ads1015.c index a6dd85debc0e..d675f82c0bd5 100644 --- a/drivers/iio/adc/ti-ads1015.c +++ b/drivers/iio/adc/ti-ads1015.c @@ -11,6 +11,7 @@ * * 0x4B - ADDR connected to SCL */ =20 +#include #include #include #include @@ -39,14 +40,7 @@ #define ADS1015_LO_THRESH_REG 0x02 #define ADS1015_HI_THRESH_REG 0x03 =20 -#define ADS1015_CFG_COMP_QUE_SHIFT 0 -#define ADS1015_CFG_COMP_LAT_SHIFT 2 -#define ADS1015_CFG_COMP_POL_SHIFT 3 -#define ADS1015_CFG_COMP_MODE_SHIFT 4 -#define ADS1015_CFG_DR_SHIFT 5 #define ADS1015_CFG_MOD_SHIFT 8 -#define ADS1015_CFG_PGA_SHIFT 9 -#define ADS1015_CFG_MUX_SHIFT 12 =20 #define ADS1015_CFG_COMP_QUE_MASK GENMASK(1, 0) #define ADS1015_CFG_COMP_LAT_MASK BIT(2) @@ -408,15 +402,15 @@ int ads1015_get_adc_result(struct ads1015_data *data,= int chan, int *val) dr =3D data->channel_data[chan].data_rate; mask =3D ADS1015_CFG_MUX_MASK | ADS1015_CFG_PGA_MASK | ADS1015_CFG_DR_MASK; - cfg =3D chan << ADS1015_CFG_MUX_SHIFT | pga << ADS1015_CFG_PGA_SHIFT | - dr << ADS1015_CFG_DR_SHIFT; + cfg =3D FIELD_PREP(ADS1015_CFG_MUX_MASK, chan) | FIELD_PREP(ADS1015_CFG_P= GA_MASK, pga) | + FIELD_PREP(ADS1015_CFG_DR_MASK, dr); =20 if (ads1015_event_channel_enabled(data)) { mask |=3D ADS1015_CFG_COMP_QUE_MASK | ADS1015_CFG_COMP_MODE_MASK; - cfg |=3D data->thresh_data[chan].comp_queue << - ADS1015_CFG_COMP_QUE_SHIFT | - data->comp_mode << - ADS1015_CFG_COMP_MODE_SHIFT; + cfg |=3D FIELD_PREP(ADS1015_CFG_COMP_QUE_MASK, + data->thresh_data[chan].comp_queue) | + FIELD_PREP(ADS1015_CFG_COMP_MODE_MASK, + data->comp_mode); } =20 cfg =3D (old & ~mask) | (cfg & mask); @@ -427,7 +421,7 @@ int ads1015_get_adc_result(struct ads1015_data *data, i= nt chan, int *val) data->conv_invalid =3D true; } if (data->conv_invalid) { - dr_old =3D (old & ADS1015_CFG_DR_MASK) >> ADS1015_CFG_DR_SHIFT; + dr_old =3D FIELD_GET(ADS1015_CFG_DR_MASK, old); conv_time =3D DIV_ROUND_UP(USEC_PER_SEC, data_rate[dr_old]); conv_time +=3D DIV_ROUND_UP(USEC_PER_SEC, data_rate[dr]); conv_time +=3D conv_time / 10; /* 10% internal clock inaccuracy */ @@ -744,6 +738,7 @@ static int ads1015_enable_event_config(struct ads1015_d= ata *data, static int ads1015_disable_event_config(struct ads1015_data *data, const struct iio_chan_spec *chan, int comp_mode) { + unsigned int val =3D FIELD_PREP(ADS1015_CFG_COMP_QUE_MASK, ADS1015_CFG_CO= MP_DISABLE); int ret; =20 if (!ads1015_event_channel_enabled(data)) @@ -756,10 +751,7 @@ static int ads1015_disable_event_config(struct ads1015= _data *data, comp_mode =3D=3D ADS1015_CFG_COMP_MODE_WINDOW) return 0; =20 - ret =3D regmap_update_bits(data->regmap, ADS1015_CFG_REG, - ADS1015_CFG_COMP_QUE_MASK, - ADS1015_CFG_COMP_DISABLE << - ADS1015_CFG_COMP_QUE_SHIFT); + ret =3D regmap_update_bits(data->regmap, ADS1015_CFG_REG, ADS1015_CFG_COM= P_QUE_MASK, val); if (ret) return ret; =20 @@ -1005,19 +997,19 @@ static int ads1015_probe(struct i2c_client *client) unsigned int cfg_comp_mask =3D ADS1015_CFG_COMP_QUE_MASK | ADS1015_CFG_COMP_LAT_MASK | ADS1015_CFG_COMP_POL_MASK; unsigned int cfg_comp =3D - ADS1015_CFG_COMP_DISABLE << ADS1015_CFG_COMP_QUE_SHIFT | - 1 << ADS1015_CFG_COMP_LAT_SHIFT; + FIELD_PREP(ADS1015_CFG_COMP_QUE_MASK, ADS1015_CFG_COMP_DISABLE) | + FIELD_PREP(ADS1015_CFG_COMP_LAT_MASK, 1); =20 switch (irq_trig) { case IRQF_TRIGGER_FALLING: case IRQF_TRIGGER_LOW: - cfg_comp |=3D ADS1015_CFG_COMP_POL_LOW << - ADS1015_CFG_COMP_POL_SHIFT; + cfg_comp |=3D FIELD_PREP(ADS1015_CFG_COMP_POL_MASK, + ADS1015_CFG_COMP_POL_LOW); break; case IRQF_TRIGGER_HIGH: case IRQF_TRIGGER_RISING: - cfg_comp |=3D ADS1015_CFG_COMP_POL_HIGH << - ADS1015_CFG_COMP_POL_SHIFT; + cfg_comp |=3D FIELD_PREP(ADS1015_CFG_COMP_POL_MASK, + ADS1015_CFG_COMP_POL_HIGH); break; default: return -EINVAL; --=20 2.39.5 From nobody Sun Sep 27 00:35:30 2026 Received: from mail-pg1-f171.google.com (mail-pg1-f171.google.com [209.85.215.171]) (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 CBEA34B04A2 for ; Thu, 27 Aug 2026 17:22:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787851334; cv=none; b=Jr2AYFhvsemSDh5IGyq8OGKoW3rYRn0z81kL/28B7i6peOB2JV4StY52+6P4Q3Kn5ruM2TQGx3kfwiCSU77xPbKMn0CWvdYbbOt2RP4Vg8L9njkwRqg+1l4LiKPcyKulWucihVWszFnFX3xXLQE1DSoox+PMtm/oGpm6S4A5Lwo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787851334; c=relaxed/simple; bh=J2EcOeMd2OmrNccebRyTDB0Wq+MHEvb9vc6I0fgxqgY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=j9pVlau9K/uhaeJR70fVf637ytKhll2Nx0Hh7qIlMGYaQHzAC+4W5jObcpbpMTbJawkYk7U/668p4jBiRLTB51XHtrsFFC4w5PaRs5oS6Pu+pEUffqjLRVn8bXMSAWH3ykdfHMXOR6vs+OYJF7Bv0FrE5lntZ0Ge2k97JxtItKE= 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=OYq0Knpx; arc=none smtp.client-ip=209.85.215.171 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="OYq0Knpx" Received: by mail-pg1-f171.google.com with SMTP id 41be03b00d2f7-cc1b838f9b6so146177a12.3 for ; Thu, 27 Aug 2026 10:22:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787851332; x=1788456132; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=OInfa0FfwgSOfH71N8TEeQkXznl+VqaYA4i5iO+q5S8=; b=OYq0KnpxTD4MdyfKvx4fW1vce6pyVHP+ALIslgja6PVahRp3aFXdqL0T/NVWzlNTaj kaBkQ1nAM4/TT02Aq/R8MNHfyjqQcgSxhdPkb/UiVaqT/6vAqdyhKTrxdDPGxjXNEsZA 9I1QB9Gk+IjuM082wsFfuBsggSxXEKND5LZ0vemCzM6W2EEdmIXh40I3WyGAgE014dAE yrrFqTBMQtkr0/UrplCAVAvHWmaBB7u9R3Qb+nRcocJNcwf3JI5TeVUdljI+zXmVnfRs kSN3dxkyGPm3EqlinmAssXEKG2liPNYEpiy9Eja0y9iDM8yjhp0G4cPvXDWTCwdqCHMy Wo2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787851332; x=1788456132; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=OInfa0FfwgSOfH71N8TEeQkXznl+VqaYA4i5iO+q5S8=; b=AsnXI/d+GQzEvDKZYvl+CFmsAf8VPXTFjN5/my++iT0/gk3cx2+kRU9+Qvqpm1aeBm EmwtMS2vQXRPpUakT0J9p4oTEXuLkr/OrlrqjWt6OIBKark+8JFCpxW/SIHvrbK14/SX diAH/ZXAba9herO8Q9lw6m+rKlPhR9+b29a1Up4mHlQJ/GlGrov2ub9A0ryHfEjazAF/ EYhPtyKLKOlGicxTGCDzEWTGqZ4TbQ30vUHthtPcI2BXlEmo2ocSiyrsGDFJ7GtzRwNb RuPBArH4x93BE2eM64D19jyy8DGp2wNxUBYXzDpOVgSfcNVz3L+JHCtA035djlvgdGZ2 4Pmw== X-Forwarded-Encrypted: i=1; AHgh+RpzRFVOCojczHOHNlgPyrdW+ZOh8ji6YYfu0M2kLSCWkedp7o7/Wj3ZBcjCje+OvrAASPRKlRY8f54J070=@vger.kernel.org X-Gm-Message-State: AFuF++nBXAYQQ9W8bhnusif7qEbvy/YVlIdgtf5mrNHJ9v1ORBwtJK53 RoMiRzfAw5ihjbWqFidSrL0O/OHOHtnJ2EB4NLE1PRIm/vvGHvhTgX5y X-Gm-Gg: AR+sD12NAjLsWmtTBHolkMy4hgGeUB0IMw0xlNPOBRt9rU9Po6J47zlFuEql4qqO2/W Mu1VuILTYpmync3s+D2WigiTWBPxRfRFf9f15bvSWEEu78JKxK4iFoZKvQhSqxj5g7yyffteKf/ 5YTzlgTo62n6do3eJkCkcLnJ2Yots3a4W2oOyt5hkB3YyHM891Nv/hFq8gYzpL5uRVbVQxbO3wF 3hHGsaEbZNDQUGJa6kg0prI4MLsI8GW+zethRqzkjSp/H4avUfPk2k8M9KMhRr2T4diArnKB47L 2iWFZoeaYUXFjbkkioB/9YgST08H6sqBs7KzDAa03LlnyXr5X2rWouiKaMSjrw34dy2wdY456NA Ysh5dNYrMIAmpy6uJP5n5GCPM9PPwYNryaqkovNvd5Apu5zhucUVeV0HujQyFGZwL6ShTOqPnWV 0oKtdFRBDhPFEIOTVTZisGYLUINllwA7kVVrFKHTCsa/TwNacWvReozh7/EPv50xlwcHMYDWPYt m4gIUSCMx/592WuD2q0xXAKH7W2srtyN23u X-Received: by 2002:a17:90b:1d04:b0:38e:4cb:51f with SMTP id 98e67ed59e1d1-396d0f75f2fmr1416549a91.11.1787851331929; Thu, 27 Aug 2026 10:22:11 -0700 (PDT) Received: from debian.ari ([47.30.51.191]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-141a8eedd13sm17797165c88.1.2026.08.27.10.22.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Aug 2026 10:22:11 -0700 (PDT) From: Archit Anant To: jic23@kernel.org Cc: dlechner@baylibre.com, andy@kernel.org, nuno.sa@analog.com, u.kleine-koenig@baylibre.com, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Archit Anant Subject: [PATCH v4 8/8] iio: adc: ti-ads1015: inline ads1015_set_conv_mode() Date: Thu, 27 Aug 2026 22:51:00 +0530 Message-Id: <20260827172100.39176-9-architanant5@gmail.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20260827172100.39176-1-architanant5@gmail.com> References: <20260827172100.39176-1-architanant5@gmail.com> 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 ads1015_set_conv_mode() helper function is a single-line wrapper around regmap_update_bits(). With the transition to the FIELD_PREP() macro, the raw register updates are now self-documenting and easy to read. Remove the wrapper function and inline the regmap calls directly at the call sites. This also allows for the removal of the final custom shift macro, ADS1015_CFG_MOD_SHIFT. Suggested-by: Jonathan Cameron Signed-off-by: Archit Anant --- drivers/iio/adc/ti-ads1015.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/drivers/iio/adc/ti-ads1015.c b/drivers/iio/adc/ti-ads1015.c index d675f82c0bd5..2072b9dd43e8 100644 --- a/drivers/iio/adc/ti-ads1015.c +++ b/drivers/iio/adc/ti-ads1015.c @@ -40,8 +40,6 @@ #define ADS1015_LO_THRESH_REG 0x02 #define ADS1015_HI_THRESH_REG 0x03 =20 -#define ADS1015_CFG_MOD_SHIFT 8 - #define ADS1015_CFG_COMP_QUE_MASK GENMASK(1, 0) #define ADS1015_CFG_COMP_LAT_MASK BIT(2) #define ADS1015_CFG_COMP_POL_MASK BIT(3) @@ -739,6 +737,7 @@ static int ads1015_disable_event_config(struct ads1015_= data *data, const struct iio_chan_spec *chan, int comp_mode) { unsigned int val =3D FIELD_PREP(ADS1015_CFG_COMP_QUE_MASK, ADS1015_CFG_CO= MP_DISABLE); + struct regmap *map =3D data->regmap; int ret; =20 if (!ads1015_event_channel_enabled(data)) @@ -751,7 +750,7 @@ static int ads1015_disable_event_config(struct ads1015_= data *data, comp_mode =3D=3D ADS1015_CFG_COMP_MODE_WINDOW) return 0; =20 - ret =3D regmap_update_bits(data->regmap, ADS1015_CFG_REG, ADS1015_CFG_COM= P_QUE_MASK, val); + ret =3D regmap_update_bits(map, ADS1015_CFG_REG, ADS1015_CFG_COMP_QUE_MAS= K, val); if (ret) return ret; =20 @@ -913,19 +912,14 @@ static void ads1015_get_channels_config(struct i2c_cl= ient *client) } } =20 -static int ads1015_set_conv_mode(struct ads1015_data *data, int mode) -{ - return regmap_update_bits(data->regmap, ADS1015_CFG_REG, - ADS1015_CFG_MOD_MASK, - mode << ADS1015_CFG_MOD_SHIFT); -} - static void ads1015_power_down(void *p) { + unsigned int val =3D FIELD_PREP(ADS1015_CFG_MOD_MASK, ADS1015_SINGLESHOT); struct ads1015_data *data =3D p; + struct regmap *map =3D data->regmap; int ret; =20 - ret =3D ads1015_set_conv_mode(data, ADS1015_SINGLESHOT); + ret =3D regmap_update_bits(map, ADS1015_CFG_REG, ADS1015_CFG_MOD_MASK, va= l); if (ret) dev_warn(regmap_get_device(data->regmap), "Failed to power down (%pe)\n", ERR_PTR(ret)); @@ -933,6 +927,7 @@ static void ads1015_power_down(void *p) =20 static int ads1015_probe(struct i2c_client *client) { + unsigned int cfg_mode =3D FIELD_PREP(ADS1015_CFG_MOD_MASK, ADS1015_CONTIN= UOUS); const struct ads1015_chip_data *chip; struct device *dev =3D &client->dev; struct iio_dev *indio_dev; @@ -1028,7 +1023,7 @@ static int ads1015_probe(struct i2c_client *client) return ret; } =20 - ret =3D ads1015_set_conv_mode(data, ADS1015_CONTINUOUS); + ret =3D regmap_update_bits(data->regmap, ADS1015_CFG_REG, ADS1015_CFG_MOD= _MASK, cfg_mode); if (ret) return ret; =20 @@ -1049,19 +1044,23 @@ static int ads1015_probe(struct i2c_client *client) =20 static int ads1015_runtime_suspend(struct device *dev) { + unsigned int val =3D FIELD_PREP(ADS1015_CFG_MOD_MASK, ADS1015_SINGLESHOT); struct iio_dev *indio_dev =3D i2c_get_clientdata(to_i2c_client(dev)); struct ads1015_data *data =3D iio_priv(indio_dev); + struct regmap *map =3D data->regmap; =20 - return ads1015_set_conv_mode(data, ADS1015_SINGLESHOT); + return regmap_update_bits(map, ADS1015_CFG_REG, ADS1015_CFG_MOD_MASK, val= ); } =20 static int ads1015_runtime_resume(struct device *dev) { + unsigned int val =3D FIELD_PREP(ADS1015_CFG_MOD_MASK, ADS1015_CONTINUOUS); struct iio_dev *indio_dev =3D i2c_get_clientdata(to_i2c_client(dev)); struct ads1015_data *data =3D iio_priv(indio_dev); + struct regmap *map =3D data->regmap; int ret; =20 - ret =3D ads1015_set_conv_mode(data, ADS1015_CONTINUOUS); + ret =3D regmap_update_bits(map, ADS1015_CFG_REG, ADS1015_CFG_MOD_MASK, va= l); if (!ret) data->conv_invalid =3D true; =20 --=20 2.39.5