Re: [PATCH v6 07/12] gpio: regmap: Allow to allocate regmap-irq device
From: Mathieu Dubois-Briand
Date: Thu Apr 10 2025 - 05:13:19 EST
On Wed Apr 9, 2025 at 6:39 PM CEST, Andy Shevchenko wrote:
> On Wed, Apr 09, 2025 at 04:55:54PM +0200, Mathieu Dubois-Briand wrote:
>> GPIO controller often have support for IRQ: allow to easily allocate
>> both gpio-regmap and regmap-irq in one operation.
>
>>
>> - memcpy(d->prev_status_buf, d->status_buf, array_size(d->prev_status_buf));
>> + memcpy(d->prev_status_buf, d->status_buf,
>> + array_size(d->chip->num_regs, sizeof(d->prev_status_buf[0])));
>
> ...
>
>> +#ifdef CONFIG_REGMAP_IRQ
>> + if (config->regmap_irq_chip) {
>> + struct regmap_irq_chip_data *irq_chip_data;
>> +
>> + ret = devm_regmap_add_irq_chip_fwnode(config->parent, dev_fwnode(config->parent),
>> + config->regmap, config->regmap_irq_irqno,
>> + config->regmap_irq_flags, 0,
>> + config->regmap_irq_chip, &irq_chip_data);
>> + if (ret)
>> + goto err_free_gpio;
>> +
>> + irq_domain = regmap_irq_get_domain(irq_chip_data);
>> + } else
>> +#endif
>> + irq_domain = config->irq_domain;
>
>> +
>
> This is blank line is not needed, but I not mind either way.
>
I can remove it, but as the line above is potentially part of the
"else", I have a small preference for keeping it.
>> + if (irq_domain) {
>> + ret = gpiochip_irqchip_add_domain(chip, irq_domain);
>> if (ret)
>> goto err_remove_gpiochip;
>> }
>
> ...
>
>> + * @regmap_irq_chip: (Optional) Pointer on an regmap_irq_chip structure. If
>> + * set, a regmap-irq device will be created and the IRQ
>> + * domain will be set accordingly.
>
>> + * @regmap_irq_chip_data: (Optional) Pointer on an regmap_irq_chip_data
>> + * structure pointer. If set, it will be populated with a
>> + * pointer on allocated regmap_irq data.
>
> Leftover?
Yes, sorry...
>
>> + * @regmap_irq_irqno (Optional) The IRQ the device uses to signal interrupts.
>> + * @regmap_irq_flags (Optional) The IRQF_ flags to use for the interrupt.
>
> ...
>
>> +#ifdef CONFIG_REGMAP_IRQ
>> + struct regmap_irq_chip *regmap_irq_chip;
>> + int regmap_irq_irqno;
>
> Perhaps call it line?
>
> int regmap_irq_line;
>
Makes sense, thanks.
>> + unsigned long regmap_irq_flags;
>> +#endif
Thanks for your review.
Mathieu
--
Mathieu Dubois-Briand, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com