LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Rob Herring <robh+dt@kernel.org>
To: Michal Simek <michal.simek@xilinx.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Michal Simek <monstr@monstr.eu>,
	One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk>,
	Alexander Graf <agraf@suse.de>,
	devicetree@vger.kernel.org, Frank Rowand <frowand.list@gmail.com>
Subject: Re: [RFC PATCH 1/3] of: base: Introduce of_alias_check_id() to check alias IDs
Date: Thu, 26 Apr 2018 21:39:00 -0500	[thread overview]
Message-ID: <CAL_Jsq+69p1GstFua1-27LGv9MKT8dtbd1ytcq+GuvQ=VcEHKg@mail.gmail.com> (raw)
In-Reply-To: <6045807691c310ccdd57ab16524b7525f26a1dc1.1524751696.git.michal.simek@xilinx.com>

On Thu, Apr 26, 2018 at 9:08 AM, Michal Simek <michal.simek@xilinx.com> wrote:
> The function travers the lookup table to check if the request alias
> id is compatible with the device driver match structure.
> This function will be used by serial drivers to check if requested alias
> is allocated or free to use.
>
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> ---
>
>  drivers/of/base.c  | 49 ++++++++++++++++++++++++++++++++++++++++++++++
>  include/linux/of.h |  2 ++
>  2 files changed, 51 insertions(+)
>
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index 848f549164cd..382de01acc72 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -1892,6 +1892,55 @@ int of_alias_get_id(struct device_node *np, const char *stem)
>  }
>  EXPORT_SYMBOL_GPL(of_alias_get_id);
>
> +/**
> + * of_alias_check_id - Check alias id for the give compatibility
> + * @matches:   Array of of device match structures to search in
> + * @stem:      Alias stem of the given device_node
> + * @id:                Alias ID for checking
> + *
> + * The function travers the lookup table to check if the request alias id
> + * is compatible with the device driver match structure
> + *
> + * Return true if ID is allocated, return false if not
> + */
> +bool of_alias_check_id(const struct of_device_id *matches, const char *stem,
> +                      int id)

Wouldn't it be simpler to just return a bitmap of all allocated ids
that match rather than trying to build that up 1 bit at a time?

Rob

  reply	other threads:[~2018-04-27  2:39 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-26 14:08 [RFC PATCH 0/3] serial: uartps: Add run time support for more IPs than hardcoded 2 Michal Simek
2018-04-26 14:08 ` [RFC PATCH 1/3] of: base: Introduce of_alias_check_id() to check alias IDs Michal Simek
2018-04-27  2:39   ` Rob Herring [this message]
2018-04-27  6:10     ` Michal Simek
2018-04-27 13:02       ` Rob Herring
2018-04-27 14:14         ` Michal Simek
2018-04-27 21:58           ` Alexander Graf
2018-04-26 14:08 ` [RFC PATCH 2/3] serial: uartps: Move register to probe based on run time detection Michal Simek
2018-04-26 14:08 ` [RFC PATCH 3/3] serial: uartps: Change uart ports allocation Michal Simek
2018-05-05 13:10 ` [RFC PATCH 0/3] serial: uartps: Add run time support for more IPs than hardcoded 2 Maarten Brock
2018-05-09 12:09   ` Michal Simek

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_Jsq+69p1GstFua1-27LGv9MKT8dtbd1ytcq+GuvQ=VcEHKg@mail.gmail.com' \
    --to=robh+dt@kernel.org \
    --cc=agraf@suse.de \
    --cc=devicetree@vger.kernel.org \
    --cc=frowand.list@gmail.com \
    --cc=gnomes@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.simek@xilinx.com \
    --cc=monstr@monstr.eu \
    --subject='Re: [RFC PATCH 1/3] of: base: Introduce of_alias_check_id() to check alias IDs' \
    /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

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).