]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
iio: light: veml6035: fix read_avail in no_irq case for veml6035
authorJavier Carrasco <javier.carrasco.cruz@gmail.com>
Mon, 7 Oct 2024 20:36:36 +0000 (22:36 +0200)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Tue, 15 Oct 2024 17:59:50 +0000 (18:59 +0100)
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>
Link: https://patch.msgid.link/20241007-veml7700-v1-1-fb85dd839d63@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/light/veml6030.c

index a5deae333554ebcabbde8f6f33e7758327b6cff6..ca0379945b1c9a2c6ef3074bf5b163e4be667987 100644 (file)
@@ -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,