Re: [PATCH v7 08/11] gpio: max7360: Add MAX7360 gpio support

From: Mathieu Dubois-Briand
Date: Fri May 02 2025 - 08:32:27 EST


On Fri May 2, 2025 at 12:39 PM CEST, Andy Shevchenko wrote:
> On Mon, Apr 28, 2025 at 01:57:26PM +0200, Mathieu Dubois-Briand wrote:
>> +static int max7360_gpio_probe(struct platform_device *pdev)
>> +{
>> + const struct max7360_gpio_plat_data *plat_data;
>> + struct gpio_regmap_config gpio_config = { };
>> + struct regmap_irq_chip *irq_chip;
>> + struct device *dev = &pdev->dev;
>> + struct regmap *regmap;
>> + unsigned int outconf;
>> + int ret;
>> +
>> + regmap = dev_get_regmap(dev->parent, NULL);
>> + if (!regmap)
>> + return dev_err_probe(dev, -ENODEV, "could not get parent regmap\n");
>> +
>> + plat_data = device_get_match_data(dev);
>> + if (plat_data->function == MAX7360_GPIO_PORT) {
>> + if (device_property_read_bool(dev, "interrupt-controller")) {
>> + /*
>> + * Port GPIOs with interrupt-controller property: add IRQ
>> + * controller.
>> + */
>> + gpio_config.regmap_irq_flags = IRQF_ONESHOT | IRQF_SHARED;
>> + gpio_config.regmap_irq_line =
>> + fwnode_irq_get_byname(dev_fwnode(dev->parent), "inti");
>> + if (gpio_config.regmap_irq_line < 0)
>> + return dev_err_probe(dev, gpio_config.regmap_irq_line,
>> + "Failed to get IRQ\n");
>
>> + irq_chip = devm_kzalloc(dev, sizeof(*irq_chip), GFP_KERNEL);
>
> Can this be made static const instead?
>

Sorry, I don't think we can. We do have a few data that will vary:
->name, but above all ->irq_drv_data, as it will point on the regmap of
the specific device.

> ...

OK with all other comments.

Thanks for your review.
Mathieu

--
Mathieu Dubois-Briand, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com