From: Rodolfo Giometti <giometti@enneenne.com>
To: "Farber, Eliav" <farbere@amazon.com>
Cc: "Chocron, Jonathan" <jonnyc@amazon.com>,
"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
"mschmidt@redhat.com" <mschmidt@redhat.com>,
"calvin@wbinvd.org" <calvin@wbinvd.org>,
"tglx@linutronix.de" <tglx@linutronix.de>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] pps: clients: gpio: fix interrupt handling order in remove path
Date: Tue, 27 May 2025 12:19:16 +0200 [thread overview]
Message-ID: <20ba69f0-7ed9-48e7-8239-74a55c993c0b@enneenne.com> (raw)
In-Reply-To: <d6358648c5b9420d8202bb9c23ac1824@amazon.com>
On 27/05/25 11:11, Farber, Eliav wrote:
>>> @@ -228,6 +228,7 @@ static void pps_gpio_remove(struct platform_device *pdev)
>>> {
>>> struct pps_gpio_device_data *data = platform_get_drvdata(pdev);
>>>
>>> + free_irq(data->irq, data);
>>
>> Why not just use devm_free_irq()?
>
> As far as I understand, the main purpose of devm_*() is to provide
> hands-off resource management. devm_request_irq() is intended to
> eliminate the need for explicit cleanup in the remove() function by
> automatically freeing the IRQ after remove() returns.
In linux/kernel/irq/devres.c we can read:
/**
* devm_free_irq - free an interrupt
* @dev: device to free interrupt for
* @irq: Interrupt line to free
* @dev_id: Device identity to free
*
* Except for the extra @dev argument, this function takes the
* same arguments and performs the same function as free_irq().
* This function instead of free_irq() should be used to manually
* free IRQs allocated with devm_request_irq().
*/
> In my opinion, calling devm_free_irq() undermines the benefit of using
> devm_request_irq() in the first place. If I need to explicitly free the
> IRQ during remove(), then I’m no longer relying on devm’s automatic
> cleanup - I’m effectively reverting to manual resource management while
> still using devm-style registration, which I find unnecessary.
>
> That said, if you still favor devm_free_irq(), I’ll revise the patch
> accordingly.
Since devm_free_irq() works exactly as free_irq() and can be used to manually
free IRQs allocated with devm_request_irq(), I think it is less invasive. Isn't
it? :-)
Ciao,
Rodolfo
--
GNU/Linux Solutions e-mail: giometti@enneenne.com
Linux Device Driver giometti@linux.it
Embedded Systems phone: +39 349 2432127
UNIX programming
next prev parent reply other threads:[~2025-05-27 10:22 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-27 9:11 Farber, Eliav
2025-05-27 10:19 ` Rodolfo Giometti [this message]
2025-05-27 10:24 ` gregkh
-- strict thread matches above, loose matches on Subject: below --
2025-05-27 5:33 Eliav Farber
2025-05-27 8:00 ` Rodolfo Giometti
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=20ba69f0-7ed9-48e7-8239-74a55c993c0b@enneenne.com \
--to=giometti@enneenne.com \
--cc=calvin@wbinvd.org \
--cc=farbere@amazon.com \
--cc=gregkh@linuxfoundation.org \
--cc=jonnyc@amazon.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mschmidt@redhat.com \
--cc=tglx@linutronix.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 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®