All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
	Pan Chuang <panchuang@vivo.com>
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org,
	miquel.raynal@bootlin.com, Jonathan.Cameron@Huawei.com,
	u.kleine-koenig@pengutronix.de, angeg.delregno@collabora.com,
	krzk@kernel.org, a.fatoum@pengutronix.de, frank.li@vivo.com
Subject: Re: [PATCH v9 1/1] genirq/devres: Add dev_err_probe() in devm_request_threaded_irq() and devm_request_any_context_irq()
Date: Wed, 30 Jul 2025 19:27:13 +0200	[thread overview]
Message-ID: <87ms8lio7i.ffs@tglx> (raw)
In-Reply-To: <2afd89be-713e-4075-b91b-36ec7fb6072d@wanadoo.fr>

On Wed, Jul 30 2025 at 18:48, Christophe JAILLET wrote:
> Le 30/07/2025 à 08:25, Pan Chuang a écrit :
>> +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 ? : "");
>> +	}
>
> Extra { } should be removed.

No. Even when C does not require it, brackets should only be omitted
when there is truly a single line after the condition. That's just
simpler to read because w/o brackets the brain pattern recognition
mechanism expects _one_ line not two or more and if there are more the
reading flow is interrupted as you have to parse it. With the brackets
it's obvious that there are more lines to read than one.

>  From my PoV, it would look more logical to have the same logic in 
> devm_request_threaded_irq() and in devm_request_any_context_irq().

As they print the same thing the right thing to do is:

        int rc = __devm_request_any_context_irq(....);

        return devm_request_result(dev, rc, irq, handler, NULL, devname);

and in devm_request_threaded_irq() invoke it with:

        return devm_request_result(dev, rc, irq, handler, thread_fn, devname);

and let that function return rc if (rc >= 0), which handles both cases.

>>   EXPORT_SYMBOL(devm_request_any_context_irq);
>
> On version 5 of the patch, there was a comment related to using 
> EXPORT_SYMBOL_GPL(), does it still make sense?
> (no strong opinion from me, just noted that and wondered if done on purpose)

That's an existing export. If at all that needs to be a seperate patch.

Thanks,

        tglx

  reply	other threads:[~2025-07-30 17:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-30  6:25 [PATCH v9 0/1] genirq/devres: Add dev_err_probe() in devm_request_threaded_irq() and devm_request_any_context_irq() Pan Chuang
2025-07-30  6:25 ` [PATCH v9 1/1] " Pan Chuang
2025-07-30 16:48   ` Christophe JAILLET
2025-07-30 17:27     ` Thomas Gleixner [this message]
2025-07-31  3:07       ` PanChuang
2025-08-01 11:00       ` PanChuang
2025-07-31  2:44     ` PanChuang
2025-07-30  6:45 ` [PATCH v9 0/1] " Markus Elfring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ms8lio7i.ffs@tglx \
    --to=tglx@linutronix.de \
    --cc=Jonathan.Cameron@Huawei.com \
    --cc=a.fatoum@pengutronix.de \
    --cc=angeg.delregno@collabora.com \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=frank.li@vivo.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=krzk@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=panchuang@vivo.com \
    --cc=u.kleine-koenig@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.