Thread (36 messages) 36 messages, 5 authors, 2025-05-07

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

From: "Mathieu Dubois-Briand" <mathieu.dubois-briand@bootlin.com>
Date: 2025-05-02 12:31:16
Also in: linux-gpio, linux-input, linux-pwm, lkml

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:
quoted
+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");
quoted
+			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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help