All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@citrix.com>
To: Ian Campbell <ian.campbell@citrix.com>, xen-devel@lists.xen.org
Cc: vijay.kilari@gmail.com, stefano.stabellini@eu.citrix.com,
	julien.grall@linaro.org, tim@xen.org, Chen Baozi <cbz@baozis.org>,
	Suravee Suthikulanit <suravee.suthikulpanit@amd.com>
Subject: Re: [PATCH v3 1/5] xen: dt: add dt_for_each_irq_map helper
Date: Wed, 29 Apr 2015 17:39:33 +0100	[thread overview]
Message-ID: <55410945.2050802@citrix.com> (raw)
In-Reply-To: <1429532165-19069-1-git-send-email-ian.campbell@citrix.com>

Hi Ian,

On 20/04/15 13:16, Ian Campbell wrote:
> This function iterates over a nodes interrupt-map property and calls a
> callback for each interrupt. For now it only supplies the raw IRQ
> since my use case has no need of e.g. child unit address. These can be
> added as needed by any future users.
> 
> This follows much the same logic as dt_irq_map_raw when parsing the
> interrupt-map, but doesn't walk up the tree doing the actual
> translation and it iterates over all entries instead of just looking
> for the first match.
> 
> I looked into refactoring dt_irq_map_raw but I couldn't find a way
> which I was confident in, plus I was reluctant to diverge from the
> Linux roots of this function any further.
> 
> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
> ---
>  xen/common/device_tree.c      |  140 +++++++++++++++++++++++++++++++++++++++++
>  xen/include/xen/device_tree.h |   12 ++++
>  2 files changed, 152 insertions(+)
> 
> diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c
> index 02cae91..174cc1f 100644
> --- a/xen/common/device_tree.c
> +++ b/xen/common/device_tree.c
> @@ -811,6 +811,146 @@ unsigned int dt_number_of_address(const struct dt_device_node *dev)
>      return (psize / onesize);
>  }
>  
> +int dt_for_each_irq_map(const struct dt_device_node *dev,
> +                        int (*cb)(const struct dt_device_node *,
> +                                  const struct dt_raw_irq *,

Do you plan to have callers which require the raw IRQ? If not, I would
directly pass the translated IRQ (i.e dt_irq) to the callback.

> +                                  void *),
> +                        void *data)
> +{

[..]

The implementation looks good to me. Although, I didn't read closely.

> diff --git a/xen/include/xen/device_tree.h b/xen/include/xen/device_tree.h
> index 57eb3ee..91bd23a 100644
> --- a/xen/include/xen/device_tree.h
> +++ b/xen/include/xen/device_tree.h
> @@ -528,6 +528,18 @@ int dt_device_get_raw_irq(const struct dt_device_node *device,
>  int dt_irq_translate(const struct dt_raw_irq *raw, struct dt_irq *out_irq);
>  
>  /**
> + * dt_for_each_irq_map - Iterate over a nodes interrupt-map property
> + * @dev: The node whose interrupt-map property should be iterated over
> + * @cb: Call back to call for each entry
> + * @data: Caller data passed to callback
> + */
> +int dt_for_each_irq_map(const struct dt_device_node *dev,
> +                        int (*cb)(const struct dt_device_node *,
> +                                  const struct dt_raw_irq *,
> +                                  void *),

I would add a typedef for the callback.

> +                        void *data);
> +
> +/**
>   * dt_n_size_cells - Helper to retrieve the number of cell for the size
>   * @np: node to get the value
>   *
> 


-- 
Julien Grall

  reply	other threads:[~2015-04-29 16:39 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-20 12:15 [PATCH v3 0/5] xen: arm: Parse PCI DT nodes' ranges and interrupt-map Ian Campbell
2015-04-20 12:16 ` [PATCH v3 1/5] xen: dt: add dt_for_each_irq_map helper Ian Campbell
2015-04-29 16:39   ` Julien Grall [this message]
2015-05-08 10:27     ` Ian Campbell
2015-05-08 10:42       ` Julien Grall
2015-04-20 12:16 ` [PATCH v3 2/5] xen: dt: add dt_for_each_range helper Ian Campbell
2015-04-30  9:20   ` Julien Grall
2015-04-20 12:16 ` [PATCH v3 3/5] xen: arm: slightly refactor gic DT node creation for domain 0 Ian Campbell
2015-04-29 15:59   ` Julien Grall
2015-05-08 10:38     ` Ian Campbell
2015-04-20 12:16 ` [PATCH v3 4/5] xen: arm: map child MMIO and IRQs to dom0 for PCI bus DT nodes Ian Campbell
2015-04-29 16:22   ` Julien Grall
2015-05-01 12:42     ` Ian Campbell
2015-05-01 12:46       ` Julien Grall
2015-05-08 10:42     ` Ian Campbell
2015-05-08 10:52       ` Julien Grall
2015-05-08 10:58         ` Ian Campbell
2015-04-20 12:16 ` [PATCH v3 5/5] xen: arm: Import of_bus PCI entry from Linux (as a dt_bus entry) Ian Campbell
2015-04-20 12:59 ` [PATCH v3 0/5] xen: arm: Parse PCI DT nodes' ranges and interrupt-map Chen Baozi
2015-04-23  7:52 ` Chen Baozi
2015-04-23  8:22   ` Chen Baozi
2015-04-23  9:02     ` Chen Baozi
2015-04-23 10:16       ` Ian Campbell
2015-04-23 11:29         ` Chen Baozi

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=55410945.2050802@citrix.com \
    --to=julien.grall@citrix.com \
    --cc=cbz@baozis.org \
    --cc=ian.campbell@citrix.com \
    --cc=julien.grall@linaro.org \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=suravee.suthikulpanit@amd.com \
    --cc=tim@xen.org \
    --cc=vijay.kilari@gmail.com \
    --cc=xen-devel@lists.xen.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.