* [PATCH v1 1/1] regmap: irq: Get rid of duplicate check in regmap_del_irq_chip()
@ 2026-10-21 20:50 Andy Shevchenko
2026-10-22 8:13 ` Johan Hovold
0 siblings, 1 reply; 4+ messages in thread
From: Andy Shevchenko @ 2026-10-21 20:50 UTC (permalink / raw)
To: Andy Shevchenko, linux-kernel, driver-core
Cc: Mark Brown, Greg Kroah-Hartman, Rafael J. Wysocki,
Danilo Krummrich, Johan Hovold
irq_dispose_mapping() already 0-aware, so there is no need to
perform the same test outside of the call. Get rid of duplicate
check in regmap_del_irq_chip().
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/base/regmap/regmap-irq.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/base/regmap/regmap-irq.c b/drivers/base/regmap/regmap-irq.c
index 715eb9e7aa2a..bd7c89618dd7 100644
--- a/drivers/base/regmap/regmap-irq.c
+++ b/drivers/base/regmap/regmap-irq.c
@@ -1021,7 +1021,6 @@ EXPORT_SYMBOL_GPL(regmap_add_irq_chip);
*/
void regmap_del_irq_chip(int irq, struct regmap_irq_chip_data *d)
{
- unsigned int virq;
int i, hwirq;
if (!d)
@@ -1039,9 +1038,7 @@ void regmap_del_irq_chip(int irq, struct regmap_irq_chip_data *d)
* Find the virtual irq of hwirq on chip and if it is
* there then dispose it
*/
- virq = irq_find_mapping(d->domain, hwirq);
- if (virq)
- irq_dispose_mapping(virq);
+ irq_dispose_mapping(irq_find_mapping(d->domain, hwirq));
}
irq_domain_remove(d->domain);
--
2.50.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1 1/1] regmap: irq: Get rid of duplicate check in regmap_del_irq_chip()
2026-10-21 20:50 [PATCH v1 1/1] regmap: irq: Get rid of duplicate check in regmap_del_irq_chip() Andy Shevchenko
@ 2026-10-22 8:13 ` Johan Hovold
2026-10-22 13:26 ` Mark Brown
0 siblings, 1 reply; 4+ messages in thread
From: Johan Hovold @ 2026-10-22 8:13 UTC (permalink / raw)
To: Andy Shevchenko
Cc: linux-kernel, driver-core, Mark Brown, Greg Kroah-Hartman,
Rafael J. Wysocki, Danilo Krummrich
On Wed, Oct 21, 2026 at 10:50:35PM +0200, Andy Shevchenko wrote:
> irq_dispose_mapping() already 0-aware, so there is no need to
> perform the same test outside of the call. Get rid of duplicate
> check in regmap_del_irq_chip().
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> @@ -1039,9 +1038,7 @@ void regmap_del_irq_chip(int irq, struct regmap_irq_chip_data *d)
> * Find the virtual irq of hwirq on chip and if it is
> * there then dispose it
> */
> - virq = irq_find_mapping(d->domain, hwirq);
> - if (virq)
> - irq_dispose_mapping(virq);
> + irq_dispose_mapping(irq_find_mapping(d->domain, hwirq));
This just makes the code less readable, and for no good reason.
Johan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1 1/1] regmap: irq: Get rid of duplicate check in regmap_del_irq_chip()
2026-10-22 8:13 ` Johan Hovold
@ 2026-10-22 13:26 ` Mark Brown
2026-10-22 14:16 ` Johan Hovold
0 siblings, 1 reply; 4+ messages in thread
From: Mark Brown @ 2026-10-22 13:26 UTC (permalink / raw)
To: Johan Hovold
Cc: Andy Shevchenko, linux-kernel, driver-core, Greg Kroah-Hartman,
Rafael J. Wysocki, Danilo Krummrich
[-- Attachment #1: Type: text/plain, Size: 708 bytes --]
On Thu, Oct 22, 2026 at 10:13:57AM +0200, Johan Hovold wrote:
> On Wed, Oct 21, 2026 at 10:50:35PM +0200, Andy Shevchenko wrote:
> > irq_dispose_mapping() already 0-aware, so there is no need to
> > perform the same test outside of the call. Get rid of duplicate
> > check in regmap_del_irq_chip().
> > - virq = irq_find_mapping(d->domain, hwirq);
> > - if (virq)
> > - irq_dispose_mapping(virq);
> > + irq_dispose_mapping(irq_find_mapping(d->domain, hwirq));
> This just makes the code less readable, and for no good reason.
Is there intended to be a benefit from the error check? It seems like a
microopotimisation that just removes robustness from something that
really should not be a hot path.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1 1/1] regmap: irq: Get rid of duplicate check in regmap_del_irq_chip()
2026-10-22 13:26 ` Mark Brown
@ 2026-10-22 14:16 ` Johan Hovold
0 siblings, 0 replies; 4+ messages in thread
From: Johan Hovold @ 2026-10-22 14:16 UTC (permalink / raw)
To: Mark Brown
Cc: Andy Shevchenko, linux-kernel, driver-core, Greg Kroah-Hartman,
Rafael J. Wysocki, Danilo Krummrich
[-- Attachment #1: Type: text/plain, Size: 1044 bytes --]
On Thu, Oct 22, 2026 at 02:26:51PM +0100, Mark Brown wrote:
> On Thu, Oct 22, 2026 at 10:13:57AM +0200, Johan Hovold wrote:
> > On Wed, Oct 21, 2026 at 10:50:35PM +0200, Andy Shevchenko wrote:
> > > irq_dispose_mapping() already 0-aware, so there is no need to
> > > perform the same test outside of the call. Get rid of duplicate
> > > check in regmap_del_irq_chip().
>
> > > - virq = irq_find_mapping(d->domain, hwirq);
> > > - if (virq)
> > > - irq_dispose_mapping(virq);
> > > + irq_dispose_mapping(irq_find_mapping(d->domain, hwirq));
>
> > This just makes the code less readable, and for no good reason.
>
> Is there intended to be a benefit from the error check? It seems like a
> microopotimisation that just removes robustness from something that
> really should not be a hot path.
The code as it stands is easier to read and obviously correct (and
matches the preceding comment); you don't need look up the definition of
irq_dispose_mapping() and parse a ternary conditional to determine that.
Johan
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 265 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-10-22 14:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-21 20:50 [PATCH v1 1/1] regmap: irq: Get rid of duplicate check in regmap_del_irq_chip() Andy Shevchenko
2026-10-22 8:13 ` Johan Hovold
2026-10-22 13:26 ` Mark Brown
2026-10-22 14:16 ` Johan Hovold
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®