From: liuxiang <liuxiang_1999@126.com>
To: "Rob Herring" <robh+dt@kernel.org>
Cc: liu.xiang6@zte.com.cn, "Frank Rowand" <frowand.list@gmail.com>,
devicetree@vger.kernel.org,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re:Re: [PATCH] of: irq: Add a helper function for irq_of_parse_and_map
Date: Tue, 24 Jul 2018 21:19:20 +0800 (CST) [thread overview]
Message-ID: <549a231a.a051.164cc71b1c8.Coremail.liuxiang_1999@126.com> (raw)
In-Reply-To: <CAL_JsqLozSJ-0YeajN=qHuR69KCjeR_xO21MyZxr-n6tR5G0cw@mail.gmail.com>
I found in probe function some drivers use irq_of_parse_and_map
and do not call irq_dispose_mapping in err path, while other drivers do.
So I think a resource managed irq_of_parse_and_map function can
be better to finish this job.
At 2018-07-23 23:28:52, "Rob Herring" <robh+dt@kernel.org> wrote:
>On Sat, Jul 21, 2018 at 9:38 AM Liu Xiang <liu.xiang6@zte.com.cn> wrote:
>>
>> Implement a resource managed irq_of_parse_and_map function.
>
>That is obvious from the diff. Why do you need this?
>
>Anything that is a platform device should use platform_get_irq. The
>mapping is created by the core Also, of_irq_get() is preferred over
>irq_of_parse_and_map() for new users as it has better error return
>handling.
>
>>
>> Signed-off-by: Liu Xiang <liu.xiang6@zte.com.cn>
>> ---
>> drivers/of/irq.c | 38 ++++++++++++++++++++++++++++++++++++++
>> include/linux/of_irq.h | 7 +++++++
>> 2 files changed, 45 insertions(+)
>>
>> diff --git a/drivers/of/irq.c b/drivers/of/irq.c
>> index 02ad93a..947fe41 100644
>> --- a/drivers/of/irq.c
>> +++ b/drivers/of/irq.c
>> @@ -45,6 +45,44 @@ unsigned int irq_of_parse_and_map(struct device_node *dev, int index)
>> }
>> EXPORT_SYMBOL_GPL(irq_of_parse_and_map);
>>
>> +static void devm_irq_dispose_mapping(struct device *dev, void *res)
>> +{
>> + irq_dispose_mapping(*(unsigned int *)res);
>
>We don't ref count creating mappings, so this would break for any shared irq.
>
>Rob
prev parent reply other threads:[~2018-07-24 13:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1532187494-2704-1-git-send-email-liu.xiang6@zte.com.cn>
2018-07-23 15:28 ` Rob Herring
2018-07-24 13:19 ` liuxiang [this message]
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=549a231a.a051.164cc71b1c8.Coremail.liuxiang_1999@126.com \
--to=liuxiang_1999@126.com \
--cc=devicetree@vger.kernel.org \
--cc=frowand.list@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=liu.xiang6@zte.com.cn \
--cc=robh+dt@kernel.org \
/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®