Re: [PATCH 3/3] iio: light: ltr501: Add ltr329 driver support
From: Esben Haabendal
Date: Wed Jul 15 2026 - 08:31:27 EST
"Joshua Crofts" <joshua.crofts1@xxxxxxxxx> writes:
> On Wed, 15 Jul 2026 10:23:50 +0200
> Esben Haabendal <esben@xxxxxxxxxx> wrote:
>> @@ -1257,6 +1269,18 @@ static const struct ltr501_chip_info ltr501_chip_info_tbl[] = {
>> .channels = ltr301_channels,
>> .no_channels = ARRAY_SIZE(ltr301_channels),
>> },
>> + [ltr329] = {
>> + .partid = 0x0A,
>> + .als_gain = ltr559_als_gain_tbl,
>> + .als_gain_tbl_size = ARRAY_SIZE(ltr559_als_gain_tbl),
>
> While you're at it, add `#include <linux/array_size.h>`
Will do.
>> + .als_mode_active = BIT(0),
>> + .als_gain_mask = BIT(2) | BIT(3) | BIT(4),
>> + .als_gain_shift = 2,
>> + .info = <r301_info_no_irq,
>> + .info_no_irq = <r301_info_no_irq,
>> + .channels = ltr301_channels,
>> + .no_channels = ARRAY_SIZE(ltr301_channels),
>> + },
>> };
>>
>> static int ltr501_write_contr(struct ltr501_data *data, u8 als_val, u8 ps_val)
>> @@ -1531,6 +1555,11 @@ static int ltr501_probe(struct i2c_client *client)
>> return ret;
>>
>> if (client->irq > 0) {
>> + if (!ltr501_has_irq_support(data->chip_info)) {
>> + dev_err(&client->dev, "chip does not support irq\n");
>> + return -EINVAL;
>
> Shouldn't this jump to the powerdown_on_error label instead of returning?
Yes.
And I will add a similar change for the devm_request_threaded_irq()
error handling where I think we should do that as well.
/Esben