From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-yw1-f181.google.com (mail-yw1-f181.google.com [209.85.128.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 5D764344059 for ; Mon, 23 Feb 2026 03:40:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.181 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771818049; cv=none; b=jCiTiLwKJYX9hD55Th8ELRfkipqNi+ACBhfLk9+Dy22G/eGUHL/Y7ooZ2uflS2hiOovX2GAdTiiYDqDosddymAZ3PvQ27XGj9gRfVoKKyTDaymkFrDsAFrOScwpNIuPt8Ox53jZsiwdXcTQq+dlKnRx4IWOor0RJtlpam5xzwQo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771818049; c=relaxed/simple; bh=u8tJfTiMhFLOgBGY/qJjB7+tG3jV629MS3lZouBe+Tc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=J3/hmwVyjJRoLAISMJ2CnZw2ruQV7UtC3EqbMwUQUd55M3Ay/uYbQdXADGdvNg5VFMEBnVpAcewiSpsZQACckEY3KuevBupbQOdrzfRAuzHEtli2PdkI1A/q/puCHC9LwlWn8xvvjVx+BPyrR/j2Vn6kqSSYqRqLmwcCJmxMTgg= 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=b0qPSCR1; arc=none smtp.client-ip=209.85.128.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="b0qPSCR1" Received: by mail-yw1-f181.google.com with SMTP id 00721157ae682-79495b1aaa7so32050817b3.1 for ; Sun, 22 Feb 2026 19:40:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1771818047; x=1772422847; 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; bh=SFIDfb+fiqqkIYg8UaViqwuxTwVr1uGT5nI/+TRKG8o=; b=b0qPSCR1SV1AG21ZNatWXh3e8QLSAIdlWXaQDSD3YSVBxGuUig5uqjr6dBCWV8+OhV K+NxlGwBf3jjSRzMu5XUCB2sSRAUBk7Bged7NKuXXdkDwX/G4BciR7ka1Dk6ULTqC16C i/EJtUT84h7g+g2zlBlHNaoz1gsYwGkr8BzaLuTVc9hZUen4gEsbnq+XAHW+XmLxutxF NrPkUltgufXV83gs2AcTY6w5ojq0SdhRreNOQDUouJwuot2Zy6dBHbJ6Bot+55tImsb0 uu2+vrVw0ctU0wkO4nkkRwhUAtME6CqAwLB3PCL2GgstbrMWGJ/O+Q1WegV4Hgr5lrGx tHhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771818047; x=1772422847; 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; bh=SFIDfb+fiqqkIYg8UaViqwuxTwVr1uGT5nI/+TRKG8o=; b=nuBxsEcqbQDiqAhHGQc2rIkQgezshir9rkrdme6Q+vNx0oGnYIzSbhELp4fPqLnm6H +uobxVHrydGrWUb3yW3E7koMJymOns6UlVa6GLpN/u2n/z/pU8sq21OMs6Lb+7tf0qqS e8Y16FAvCXujSxqtnKFwpnZqu5ndTkbHCQRBq+sQqkHBNtOjXBYyylGfEyMNELp+wdXT mS3vUm8yQ+augUOigJR/2bxemdHLsC09VKyESpQA15OwmiWwYI9IXsd1AVIElVKIQvX3 0/8TcvWOk1rCBLJly/D0pBWhQu0UIdxG3puEHNejrMgVajU9GMM5ESgCRo3ntjL1BKX3 Y2dg== X-Forwarded-Encrypted: i=1; AJvYcCVTb4OFN7mx4KcfB2JeFZ48KoDVPqqikpcz4u/haEoBn9SBbzwxrPGyXdYXwbQzpuq104/CgHPFgM56blY=@vger.kernel.org X-Gm-Message-State: AOJu0YxhNRglkQVL7w1kMypbmZf5GaOHhts9LHRnREVCqPYs3XMR6v/9 9cwIiP5RhMt1J7lX9jaGax/7/8LOCVjPLKFBN+vUPMbva71AQ70GVHxc X-Gm-Gg: ATEYQzyFUxzy/FMnb0jSBIrDGMcG0zb8TRSjY+r3T8J0yBC26h+xqESNFOCqWYpTHPt fNvIUhlE6y2qPskp1gnAsmlq3YWY8jGqpopu3+kTMKYRJ9db8vn5D/3DZ8D/1tfFIW+fDJHTvbR vc4JZScl3cFEqgkz6NoeCSKU64lKUrJ05zKa+WhVYJiBXQdQhZJan7IZoU3wpVK1kIc2rzT8GND CcgYtNumm8bhgWXL2l/KaJtls6zeSp582FicKqUciTg5pNHkHxz0fSb3/9xB55Ff7xKrEPCugWZ j3uOMGoog1wbb5gZZqoEBO+WRfdq9e5Uqg/qkK89V1I7dYGLHPQmMAelZ2K3IsJVbUd5X3PAOgH PDKaadxV3CODtcSq55d/4DL/27CGTDkZstwl2hd/8B2MJdbImllWys8PzmAQEcQZeoIbeBbD1+z fholtixXLTII0I2oQG3u3oy2rXfTP9+JV4Aw/S33JCDtJ+qO2LEsBOZvVZtirq7NhedRrBcTwOM 7PyrRWaLSxAToajGv25rNYC X-Received: by 2002:a05:690c:a92:b0:797:df7c:3e1b with SMTP id 00721157ae682-79828ef29afmr63385657b3.4.1771818047348; Sun, 22 Feb 2026 19:40:47 -0800 (PST) Received: from tux ([2601:7c0:c37c:4c00::5c0b]) by smtp.gmail.com with ESMTPSA id 00721157ae682-7982dbd5939sm27285237b3.15.2026.02.22.19.40.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Feb 2026 19:40:46 -0800 (PST) From: Ethan Tidmore To: Jonathan Cameron , Andy Shevchenko Cc: David Lechner , =?UTF-8?q?Nuno=20S=C3=A1?= , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Andy Shevchenko , Ethan Tidmore Subject: [PATCH v5 07/10] iio: light: gp2ap020a00f: Use temporary variable for struct device Date: Sun, 22 Feb 2026 21:40:17 -0600 Message-ID: <20260223034020.27625-8-ethantidmore06@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260223034020.27625-1-ethantidmore06@gmail.com> References: <20260223034020.27625-1-ethantidmore06@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: 8bit From: Andy Shevchenko Use temporary variable for struct device to make code neater. Signed-off-by: Andy Shevchenko Signed-off-by: Ethan Tidmore --- v5: - No change. v4: - Integrate Andy Shevchenko's cleanups. drivers/iio/light/gp2ap020a00f.c | 34 +++++++++++++++----------------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/drivers/iio/light/gp2ap020a00f.c b/drivers/iio/light/gp2ap020a00f.c index b2434d00e10a..97630ce9ade0 100644 --- a/drivers/iio/light/gp2ap020a00f.c +++ b/drivers/iio/light/gp2ap020a00f.c @@ -1187,6 +1187,7 @@ static int gp2ap020a00f_read_event_config(struct iio_dev *indio_dev, static int gp2ap020a00f_read_channel(struct gp2ap020a00f_data *data, struct iio_chan_spec const *chan, int *val) { + struct device *dev = &data->client->dev; enum gp2ap020a00f_cmd cmd; int err; @@ -1206,27 +1207,23 @@ static int gp2ap020a00f_read_channel(struct gp2ap020a00f_data *data, err = gp2ap020a00f_exec_cmd(data, cmd); if (err < 0) { - dev_err(&data->client->dev, - "gp2ap020a00f_exec_cmd failed\n"); - goto error_ret; + dev_err(dev, "gp2ap020a00f_exec_cmd failed\n"); + return err; } err = gp2ap020a00f_read_output(data, chan->address, val); if (err < 0) - dev_err(&data->client->dev, - "gp2ap020a00f_read_output failed\n"); + dev_err(dev, "gp2ap020a00f_read_output failed\n"); err = gp2ap020a00f_set_operation_mode(data, GP2AP020A00F_OPMODE_SHUTDOWN); if (err < 0) - dev_err(&data->client->dev, - "Failed to shut down the device.\n"); + dev_err(dev, "Failed to shut down the device.\n"); if (cmd == GP2AP020A00F_CMD_READ_RAW_CLEAR || cmd == GP2AP020A00F_CMD_READ_RAW_IR) gp2ap020a00f_output_to_lux(data, val); -error_ret: return err; } @@ -1415,18 +1412,19 @@ static const struct iio_buffer_setup_ops gp2ap020a00f_buffer_setup_ops = { static int gp2ap020a00f_probe(struct i2c_client *client) { const struct i2c_device_id *id = i2c_client_get_device_id(client); + struct device *dev = &client->dev; struct gp2ap020a00f_data *data; struct iio_dev *indio_dev; struct regmap *regmap; int err; - indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data)); + indio_dev = devm_iio_device_alloc(dev, sizeof(*data)); if (!indio_dev) return -ENOMEM; data = iio_priv(indio_dev); - data->vled_reg = devm_regulator_get(&client->dev, "vled"); + data->vled_reg = devm_regulator_get(dev, "vled"); if (IS_ERR(data->vled_reg)) return PTR_ERR(data->vled_reg); @@ -1436,7 +1434,7 @@ static int gp2ap020a00f_probe(struct i2c_client *client) regmap = devm_regmap_init_i2c(client, &gp2ap020a00f_regmap_config); if (IS_ERR(regmap)) { - dev_err(&client->dev, "Regmap initialization failed.\n"); + dev_err(dev, "Regmap initialization failed.\n"); err = PTR_ERR(regmap); goto error_regulator_disable; } @@ -1447,7 +1445,7 @@ static int gp2ap020a00f_probe(struct i2c_client *client) ARRAY_SIZE(gp2ap020a00f_reg_init_tab)); if (err < 0) { - dev_err(&client->dev, "Device initialization failed.\n"); + dev_err(dev, "Device initialization failed.\n"); goto error_regulator_disable; } @@ -1472,11 +1470,10 @@ static int gp2ap020a00f_probe(struct i2c_client *client) goto error_regulator_disable; /* Allocate trigger */ - data->trig = devm_iio_trigger_alloc(&client->dev, "%s-trigger", - indio_dev->name); + data->trig = devm_iio_trigger_alloc(dev, "%s-trigger", indio_dev->name); if (data->trig == NULL) { err = -ENOMEM; - dev_err(&indio_dev->dev, "Failed to allocate iio trigger.\n"); + dev_err(dev, "Failed to allocate iio trigger.\n"); goto error_uninit_buffer; } @@ -1488,7 +1485,7 @@ static int gp2ap020a00f_probe(struct i2c_client *client) "gp2ap020a00f_als_event", indio_dev); if (err < 0) { - dev_err(&client->dev, "Irq request failed.\n"); + dev_err(dev, "Irq request failed.\n"); goto error_uninit_buffer; } @@ -1496,7 +1493,7 @@ static int gp2ap020a00f_probe(struct i2c_client *client) err = iio_trigger_register(data->trig); if (err < 0) { - dev_err(&client->dev, "Failed to register iio trigger.\n"); + dev_err(dev, "Failed to register iio trigger.\n"); goto error_free_irq; } @@ -1522,12 +1519,13 @@ static void gp2ap020a00f_remove(struct i2c_client *client) { struct iio_dev *indio_dev = i2c_get_clientdata(client); struct gp2ap020a00f_data *data = iio_priv(indio_dev); + struct device *dev = &client->dev; int err; err = gp2ap020a00f_set_operation_mode(data, GP2AP020A00F_OPMODE_SHUTDOWN); if (err < 0) - dev_err(&indio_dev->dev, "Failed to power off the device.\n"); + dev_err(dev, "Failed to power off the device.\n"); iio_device_unregister(indio_dev); iio_trigger_unregister(data->trig); -- 2.53.0