[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <73a4fc1d-6852-4050-85c0-8c29b4165e4d@pengutronix.de>
Date: Tue, 29 Jul 2025 10:20:32 +0200
From: Ahmad Fatoum <a.fatoum@...gutronix.de>
To: Pan Chuang <panchuang@...o.com>, tglx@...utronix.de,
linux-kernel@...r.kernel.org
Cc: miquel.raynal@...tlin.com, Jonathan.Cameron@...wei.com,
angeg.delregno@...labora.com, krzk@...nel.org, frank.li@...o.com
Subject: Re: [PATCH v8 1/1] genirq/devres: Add dev_err_probe() in
devm_request_threaded_irq() and devm_request_any_context_irq()
Hi Pan,
On 29.07.25 10:14, Pan Chuang wrote:
> -int devm_request_any_context_irq(struct device *dev, unsigned int irq,
> - irq_handler_t handler, unsigned long irqflags,
> - const char *devname, void *dev_id)
> +int devm_request_threaded_irq(struct device *dev, unsigned int irq,
> + irq_handler_t handler, irq_handler_t thread_fn,
> + unsigned long irqflags, const char *devname,
> + void *dev_id)
> +{
> + int rc = __devm_request_threaded_irq(dev, irq, handler, thread_fn,
> + irqflags, devname, dev_id);
> + if (!rc)
> + return 0;
> +
> + return dev_err_probe(dev, rc, "request_irq(%u) %pS %pS %s\n",
Compared to %ps, %pS also prints offset and size relative to the symbol.
This makes sense when you have an arbitrary program counter, but for
merely printing a function symbol, I'd suggest %ps as it's less noisy.
Cheers,
Ahmad
> + irq, handler, thread_fn, devname ? : "");
> +}
> +EXPORT_SYMBOL(devm_request_threaded_irq);
> +
> +static int __devm_request_any_context_irq(struct device *dev, unsigned int irq,
> + irq_handler_t handler,
> + unsigned long irqflags,
> + const char *devname, void *dev_id)
> {
> struct irq_devres *dr;
> int rc;
> @@ -124,6 +128,43 @@ int devm_request_any_context_irq(struct device *dev, unsigned int irq,
>
> return rc;
> }
> +
> +/**
> + * devm_request_any_context_irq - allocate an interrupt line for a managed device with error logging
> + * @dev: Device to request interrupt for
> + * @irq: Interrupt line to allocate
> + * @handler: Function to be called when the IRQ occurs
> + * @irqflags: Interrupt type flags
> + * @devname: An ascii name for the claiming device, dev_name(dev) if NULL
> + * @dev_id: A cookie passed back to the handler function
> + *
> + * Except for the extra @dev argument, this function takes the same arguments
> + * and performs the same function as request_any_context_irq(). IRQs requested
> + * with this function will be automatically freed on driver detach.
> + *
> + * If an IRQ allocated with this function needs to be freed separately,
> + * devm_free_irq() must be used.
> + *
> + * When the request fails, an error message is printed with contextual
> + * information (device name, interrupt number, handler functions and
> + * error code). Don't add extra error messages at the call sites.
> + *
> + * On failure, it returns a negative value. On success, it returns either
> + * IRQC_IS_HARDIRQ or IRQC_IS_NESTED.
> + */
> +int devm_request_any_context_irq(struct device *dev, unsigned int irq,
> + irq_handler_t handler, unsigned long irqflags,
> + const char *devname, void *dev_id)
> +{
> + int rc = __devm_request_any_context_irq(dev, irq, handler, irqflags,
> + devname, dev_id);
> + if (rc < 0) {
> + return dev_err_probe(dev, rc, "request_irq(%u) %pS %s\n",
> + irq, handler, devname ? : "");
> + }
> +
> + return rc;
> +}
> EXPORT_SYMBOL(devm_request_any_context_irq);
>
> /**
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Powered by blists - more mailing lists