From: thierry.reding@gmail.com (Thierry Reding)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH] of/irq: do irq resolution in platform_get_irq_byname()
Date: Mon, 19 May 2014 14:57:39 +0200 [thread overview]
Message-ID: <20140519125738.GB9466@ulmo> (raw)
In-Reply-To: <1400506259-18397-1-git-send-email-grygorii.strashko@ti.com>
On Mon, May 19, 2014 at 04:30:59PM +0300, Grygorii Strashko wrote:
[...]
> diff --git a/drivers/of/irq.c b/drivers/of/irq.c
[...]
> /**
> + * of_irq_get_byname - Decode a node's IRQ and return it as a Linux irq number
> + * @dev: pointer to device tree node
> + * @name: zero-based index of the irq
This is a name, not an index.
> + *
> + * Returns Linux irq number on success, or -EPROBE_DEFER if the irq domain
> + * is not yet created, or errorno in case of failure.
s/errorno/error code/? Also EPROBE_DEFER is also an error code, so I'm
not sure if it's worth a special case in the description here.
> + *
> + */
> +int of_irq_get_byname(struct device_node *dev, const char *name)
> +{
> + const char *name_irq = NULL;
> + int index = 0;
> +
> + if (unlikely(!name))
> + return -EINVAL;
> +
> + while (!of_property_read_string_index(dev, "interrupt-names",
> + index, &name_irq))
> + if (!strcmp(name, name_irq))
> + return of_irq_get(dev, index);
Isn't this missing an index++ somewhere? Otherwise it seems like this
would loop infinitely if there was no match on the first entry.
Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140519/afe70448/attachment.sig>
WARNING: multiple messages have this Message-ID (diff)
From: Thierry Reding <thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Grygorii Strashko <grygorii.strashko-l0cyMroinI0@public.gmane.org>
Cc: Greg Kroah-Hartman
<gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>,
Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
Grant Likely
<grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
santosh.shilimkar-l0cyMroinI0@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
Russell King <linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org>,
Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
Subject: Re: [RFC PATCH] of/irq: do irq resolution in platform_get_irq_byname()
Date: Mon, 19 May 2014 14:57:39 +0200 [thread overview]
Message-ID: <20140519125738.GB9466@ulmo> (raw)
In-Reply-To: <1400506259-18397-1-git-send-email-grygorii.strashko-l0cyMroinI0@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 1115 bytes --]
On Mon, May 19, 2014 at 04:30:59PM +0300, Grygorii Strashko wrote:
[...]
> diff --git a/drivers/of/irq.c b/drivers/of/irq.c
[...]
> /**
> + * of_irq_get_byname - Decode a node's IRQ and return it as a Linux irq number
> + * @dev: pointer to device tree node
> + * @name: zero-based index of the irq
This is a name, not an index.
> + *
> + * Returns Linux irq number on success, or -EPROBE_DEFER if the irq domain
> + * is not yet created, or errorno in case of failure.
s/errorno/error code/? Also EPROBE_DEFER is also an error code, so I'm
not sure if it's worth a special case in the description here.
> + *
> + */
> +int of_irq_get_byname(struct device_node *dev, const char *name)
> +{
> + const char *name_irq = NULL;
> + int index = 0;
> +
> + if (unlikely(!name))
> + return -EINVAL;
> +
> + while (!of_property_read_string_index(dev, "interrupt-names",
> + index, &name_irq))
> + if (!strcmp(name, name_irq))
> + return of_irq_get(dev, index);
Isn't this missing an index++ somewhere? Otherwise it seems like this
would loop infinitely if there was no match on the first entry.
Thierry
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: Thierry Reding <thierry.reding@gmail.com>
To: Grygorii Strashko <grygorii.strashko@ti.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Rob Herring <robh+dt@kernel.org>,
Grant Likely <grant.likely@linaro.org>,
santosh.shilimkar@ti.com, linux-kernel@vger.kernel.org,
devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
Russell King <linux@arm.linux.org.uk>,
Rob Herring <robh@kernel.org>, Tony Lindgren <tony@atomide.com>
Subject: Re: [RFC PATCH] of/irq: do irq resolution in platform_get_irq_byname()
Date: Mon, 19 May 2014 14:57:39 +0200 [thread overview]
Message-ID: <20140519125738.GB9466@ulmo> (raw)
In-Reply-To: <1400506259-18397-1-git-send-email-grygorii.strashko@ti.com>
[-- Attachment #1: Type: text/plain, Size: 1115 bytes --]
On Mon, May 19, 2014 at 04:30:59PM +0300, Grygorii Strashko wrote:
[...]
> diff --git a/drivers/of/irq.c b/drivers/of/irq.c
[...]
> /**
> + * of_irq_get_byname - Decode a node's IRQ and return it as a Linux irq number
> + * @dev: pointer to device tree node
> + * @name: zero-based index of the irq
This is a name, not an index.
> + *
> + * Returns Linux irq number on success, or -EPROBE_DEFER if the irq domain
> + * is not yet created, or errorno in case of failure.
s/errorno/error code/? Also EPROBE_DEFER is also an error code, so I'm
not sure if it's worth a special case in the description here.
> + *
> + */
> +int of_irq_get_byname(struct device_node *dev, const char *name)
> +{
> + const char *name_irq = NULL;
> + int index = 0;
> +
> + if (unlikely(!name))
> + return -EINVAL;
> +
> + while (!of_property_read_string_index(dev, "interrupt-names",
> + index, &name_irq))
> + if (!strcmp(name, name_irq))
> + return of_irq_get(dev, index);
Isn't this missing an index++ somewhere? Otherwise it seems like this
would loop infinitely if there was no match on the first entry.
Thierry
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2014-05-19 12:57 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-19 13:30 [RFC PATCH] of/irq: do irq resolution in platform_get_irq_byname() Grygorii Strashko
2014-05-19 13:30 ` Grygorii Strashko
2014-05-19 13:30 ` Grygorii Strashko
2014-05-19 12:57 ` Thierry Reding [this message]
2014-05-19 12:57 ` Thierry Reding
2014-05-19 12:57 ` Thierry Reding
2014-05-20 6:17 ` Grant Likely
2014-05-20 6:17 ` Grant Likely
2014-05-20 6:17 ` Grant Likely
2014-05-20 10:45 ` Grygorii Strashko
2014-05-20 10:45 ` Grygorii Strashko
2014-05-20 10:45 ` Grygorii Strashko
2014-05-20 10:42 ` Grygorii Strashko
2014-05-20 10:42 ` Grygorii Strashko
2014-05-20 10:42 ` Grygorii Strashko
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=20140519125738.GB9466@ulmo \
--to=thierry.reding@gmail.com \
--cc=linux-arm-kernel@lists.infradead.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 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.