devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Javier Carrasco <javier.carrasco.cruz@gmail.com>
To: Jonathan Cameron <jic23@kernel.org>,
	 Lars-Peter Clausen <lars@metafoo.de>,
	Rob Herring <robh@kernel.org>,
	 Krzysztof Kozlowski <krzk+dt@kernel.org>,
	 Conor Dooley <conor+dt@kernel.org>,
	Rishi Gupta <gupt21@gmail.com>
Cc: Jonathan Cameron <Jonathan.Cameron@huawei.com>,
	 linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
	 devicetree@vger.kernel.org,
	 Javier Carrasco <javier.carrasco.cruz@gmail.com>
Subject: [PATCH 1/3] iio: light: veml6035: fix read_avail in no_irq case for veml6035
Date: Mon, 07 Oct 2024 22:36:36 +0200	[thread overview]
Message-ID: <20241007-veml7700-v1-1-fb85dd839d63@gmail.com> (raw)
In-Reply-To: <20241007-veml7700-v1-0-fb85dd839d63@gmail.com>

The iio_info is identical for veml6030 and veml6035. Moreover,
veml6035_info_no_irq is missing the initialization of the read_avail
member, which is actually a bug if no irq is provided.

Instead of adding the missing initialization, remove the device-specific
iio_info and use the existing one for the veml6030.

Fixes: ccc26bd7d7d7 ("iio: light: veml6030: add support for veml6035")
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
---
 drivers/iio/light/veml6030.c | 26 ++------------------------
 1 file changed, 2 insertions(+), 24 deletions(-)

diff --git a/drivers/iio/light/veml6030.c b/drivers/iio/light/veml6030.c
index a5deae333554..ca0379945b1c 100644
--- a/drivers/iio/light/veml6030.c
+++ b/drivers/iio/light/veml6030.c
@@ -56,8 +56,6 @@ struct veml603x_chip {
 	const char *name;
 	const int(*scale_vals)[][2];
 	const int num_scale_vals;
-	const struct iio_info *info;
-	const struct iio_info *info_no_irq;
 	int (*hw_init)(struct iio_dev *indio_dev, struct device *dev);
 	int (*set_als_gain)(struct iio_dev *indio_dev, int val, int val2);
 	int (*get_als_gain)(struct iio_dev *indio_dev, int *val, int *val2);
@@ -829,28 +827,12 @@ static const struct iio_info veml6030_info = {
 	.event_attrs = &veml6030_event_attr_group,
 };
 
-static const struct iio_info veml6035_info = {
-	.read_raw  = veml6030_read_raw,
-	.read_avail  = veml6030_read_avail,
-	.write_raw = veml6030_write_raw,
-	.read_event_value = veml6030_read_event_val,
-	.write_event_value = veml6030_write_event_val,
-	.read_event_config = veml6030_read_interrupt_config,
-	.write_event_config = veml6030_write_interrupt_config,
-	.event_attrs = &veml6030_event_attr_group,
-};
-
 static const struct iio_info veml6030_info_no_irq = {
 	.read_raw  = veml6030_read_raw,
 	.read_avail  = veml6030_read_avail,
 	.write_raw = veml6030_write_raw,
 };
 
-static const struct iio_info veml6035_info_no_irq = {
-	.read_raw  = veml6030_read_raw,
-	.write_raw = veml6030_write_raw,
-};
-
 static irqreturn_t veml6030_event_handler(int irq, void *private)
 {
 	int ret, reg, evtdir;
@@ -1039,9 +1021,9 @@ static int veml6030_probe(struct i2c_client *client)
 					     "irq %d request failed\n",
 					     client->irq);
 
-		indio_dev->info = data->chip->info;
+		indio_dev->info = &veml6030_info;
 	} else {
-		indio_dev->info = data->chip->info_no_irq;
+		indio_dev->info = &veml6030_info_no_irq;
 	}
 
 	ret = data->chip->hw_init(indio_dev, &client->dev);
@@ -1084,8 +1066,6 @@ static const struct veml603x_chip veml6030_chip = {
 	.name = "veml6030",
 	.scale_vals = &veml6030_scale_vals,
 	.num_scale_vals = ARRAY_SIZE(veml6030_scale_vals),
-	.info = &veml6030_info,
-	.info_no_irq = &veml6030_info_no_irq,
 	.hw_init = veml6030_hw_init,
 	.set_als_gain = veml6030_set_als_gain,
 	.get_als_gain = veml6030_get_als_gain,
@@ -1095,8 +1075,6 @@ static const struct veml603x_chip veml6035_chip = {
 	.name = "veml6035",
 	.scale_vals = &veml6035_scale_vals,
 	.num_scale_vals = ARRAY_SIZE(veml6035_scale_vals),
-	.info = &veml6035_info,
-	.info_no_irq = &veml6035_info_no_irq,
 	.hw_init = veml6035_hw_init,
 	.set_als_gain = veml6035_set_als_gain,
 	.get_als_gain = veml6035_get_als_gain,

-- 
2.43.0


  reply	other threads:[~2024-10-07 20:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-07 20:36 [PATCH 0/3] iio: light: veml6030: add support for veml7700 Javier Carrasco
2024-10-07 20:36 ` Javier Carrasco [this message]
2024-10-07 20:36 ` [PATCH 2/3] dt-bindings: iio: light: veml6030: add veml7700 Javier Carrasco
2024-10-08  7:56   ` Krzysztof Kozlowski
2024-10-08  8:01     ` Krzysztof Kozlowski
2024-10-08  8:07       ` Javier Carrasco
2024-10-08 13:36   ` Krzysztof Kozlowski
2024-10-07 20:36 ` [PATCH 3/3] iio: light: veml6030: add support for veml7700 Javier Carrasco
2024-10-12 14:11 ` [PATCH 0/3] " Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241007-veml7700-v1-1-fb85dd839d63@gmail.com \
    --to=javier.carrasco.cruz@gmail.com \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=gupt21@gmail.com \
    --cc=jic23@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).