devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rob Herring <robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Dmitry Torokhov
	<dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Grant Likely
	<grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	"devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH] of/irq: introduce of_has_named_irqs helper
Date: Fri, 24 Jul 2015 15:59:39 -0500	[thread overview]
Message-ID: <CAL_JsqKRat-OH=z3c0bCYEKCUrKDKHJPHaDCw977mfUYaKPSTA@mail.gmail.com> (raw)
In-Reply-To: <20150724192619.GA33241@dtor-ws>

On Fri, Jul 24, 2015 at 2:26 PM, Dmitry Torokhov
<dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> On Fri, Jul 24, 2015 at 02:14:57PM -0500, Rob Herring wrote:
>> On Fri, Jul 24, 2015 at 1:26 PM, Dmitry Torokhov
>> <dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>> > Sometimes drivers might wish to transition from index-based to named
>> > interrupt descriptions. To aid in decision-making when parsing device
>> > tree data let's provide a helper that will indicate the scheme that is
>> > being used.
>>
>> Generally, IRQs are retrieved by platform_get_irq or
>> platform_get_irq_byname. Drivers should not call the of_irq_*
>> functions directly in most cases.
>
> That would be true for platform drivers, but not all devices are
> platform devices.

I should say for drivers, IRQs are retrieved by a bus specific method,
not DT functions. There are 3 cases of drivers using them:

arch/arm/mach-omap2/prm3xxx.c:                  irq_num = of_irq_get(np, 0);
arch/arm/mach-omap2/prm44xx.c:  irq_num = of_irq_get(prm_init_data->np, 0);
drivers/pinctrl/sirf/pinctrl-atlas7.c:          ret = of_irq_get(np, idx);

>> > Signed-off-by: Dmitry Torokhov <dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>> > ---
>> >
>> > The intent is to it like this:
>> >
>> >         if (of_has_named_irqs(np) {
>> >                 /* Wake IRQ is optional */
>> >                 dev->wakeirq = of_irq_get_byname(np, "wakeup");
>> >                 if (dev->wakeirq < 0 && dev->wakeirq != -ENODATA)
>> >                         return dev->wakeirq;
>> >         }
>>
>> of_irq_get_byname will already return an error if the property is not
>> present. Use that.
>
> I do not like that it returns -EINVAL when property is missing, can we
> change it to return -ENODATA (so it is the same as when the property is
> defined but such name is missing)?

It may be useful to distinguish between those cases. If you want audit
all the callers we could possibly change it though.

Really, I don't understand why you would care about any error code
other than EPROBE_DEFER. If it is optional, then you would want to
continue no matter what is returned.

Rob
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2015-07-24 20:59 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-24 18:26 [PATCH] of/irq: introduce of_has_named_irqs helper Dmitry Torokhov
2015-07-24 19:14 ` Rob Herring
     [not found]   ` <CAL_Jsq+JGpNBwS3HF1fF4HdefRCwhniaYCm5G4_WAnio7t-1og-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-07-24 19:26     ` Dmitry Torokhov
2015-07-24 20:16       ` Dmitry Torokhov
2015-07-28 13:23         ` Vignesh R
     [not found]           ` <55B78268.4040603-l0cyMroinI0@public.gmane.org>
2015-07-28 17:23             ` Dmitry Torokhov
2015-07-28 17:46               ` R, Vignesh
2015-07-28 18:07                 ` Dmitry Torokhov
2015-07-29  4:33                   ` Vignesh R
2015-07-24 20:59       ` Rob Herring [this message]
2015-07-24 21:22         ` Dmitry Torokhov
2015-07-24 19:35 ` Florian Fainelli

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='CAL_JsqKRat-OH=z3c0bCYEKCUrKDKHJPHaDCw977mfUYaKPSTA@mail.gmail.com' \
    --to=robherring2-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.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;
as well as URLs for NNTP newsgroup(s).