All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: David Gibson <david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org>
Cc: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	"devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [RFC 1/3] checks: Add infrastructure for setting bus type of nodes
Date: Thu, 31 Mar 2016 10:17:46 -0500	[thread overview]
Message-ID: <CAL_JsqKTarcy2UHKD5m2F7TNP3stNnpCdxTrptGeiTXJJHiGaA@mail.gmail.com> (raw)
In-Reply-To: <20160331052247.GD416-1s0os16eZneny3qCrzbmXA@public.gmane.org>

On Thu, Mar 31, 2016 at 12:22 AM, David Gibson
<david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org> wrote:
> On Wed, Mar 23, 2016 at 07:40:19PM -0500, Rob Herring wrote:
>> In preparation to support bus specific checks, add the necessary
>> infrastructure to determine the bus type for nodes. Initially, PCI and
>> simple bus are supported.
>>
>> Signed-off-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
>> ---
>> David,
>
> Sorry it's taken me a while to look at this.  I've been a mixture of
> busy and sick :/

No problem.

[...]

>> +static bool is_pci_bridge(struct node *node)
>> +{
>> +     struct property *prop;
>> +
>> +     if (!node)
>> +             return false;
>> +
>> +     prop = get_property(node, "device_type");
>> +     if (!prop)
>> +             return false;
>> +
>> +     if (strcmp(prop->val.val, "pci") == 0)
>> +             return true;
>> +
>> +     return false;
>> +}
>
> So, I don't love using device_type here, since that's generally
> discouraged in modern flat trees, but I don't know of a better way to
> detect a pci bridge, so I guess it's ok.

True, but pci, cpu, and memory remain as accepted uses. We'd have to
define a "pci-bridge" or "pci-bus" compatible to replace it.

>> +struct bus_type pci_bus_type = {
>> +        .expected_addr_cells = 3,
>> +        .expected_size_cells = 2,
>
> I'm a bit torn here.  Part of me wants to suggest a 'check_bridge'
> function which handles this and can also make more subtle checks, but
> then just the expected cells values will handle nearly all real cases
> more succinctly.

I left them as you had them, but I'm not so sure these are all that
useful. It works for PCI as the sizes are fixed, but then we could
just check against fixed values. For simple-bus, we need more
flexibility because the size could be 1 or 2. For other cases like I2C
or SPI buses, we know the sizes, but we can't really detect those
buses.

Rob

  parent reply	other threads:[~2016-03-31 15:17 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-24  0:40 [RFC 1/3] checks: Add infrastructure for setting bus type of nodes Rob Herring
     [not found] ` <1458780021-5052-1-git-send-email-robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2016-03-24  0:40   ` [RFC 2/3] checks: Add unit-address checks for simple-bus and default Rob Herring
     [not found]     ` <1458780021-5052-2-git-send-email-robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2016-03-31  5:29       ` David Gibson
     [not found]         ` <20160331052912.GE416-1s0os16eZneny3qCrzbmXA@public.gmane.org>
2016-03-31 16:18           ` Rob Herring
     [not found]             ` <CAL_JsqJO+9Wna4mjeRLj+ELy7BwL7K=QEVrNGs3CuAaE3Y_Q3A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-04-01  2:27               ` David Gibson
     [not found]                 ` <20160401022735.GJ416-1s0os16eZneny3qCrzbmXA@public.gmane.org>
2016-04-01 18:50                   ` Rob Herring
     [not found]                     ` <CAL_JsqLup+esWdQ1dzpOaj17BaE2d2CJ6sJAqBUcNx2xBvNFKg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-04-04  0:22                       ` David Gibson
2016-03-24  0:40   ` [RFC 3/3] checks: Add unit-address checks for PCI buses Rob Herring
     [not found]     ` <1458780021-5052-3-git-send-email-robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2016-03-31  5:32       ` David Gibson
     [not found]         ` <20160331053220.GF416-1s0os16eZneny3qCrzbmXA@public.gmane.org>
2016-04-01 19:52           ` Rob Herring
     [not found]             ` <CAL_JsqK5Ze4P8ofykfebV30TrMzur0cvhZi_RQMkW-kUbsvTpw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-04-04  1:08               ` David Gibson
2016-03-31  5:22   ` [RFC 1/3] checks: Add infrastructure for setting bus type of nodes David Gibson
     [not found]     ` <20160331052247.GD416-1s0os16eZneny3qCrzbmXA@public.gmane.org>
2016-03-31 15:17       ` Rob Herring [this message]
     [not found]         ` <CAL_JsqKTarcy2UHKD5m2F7TNP3stNnpCdxTrptGeiTXJJHiGaA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-04-01  2:23           ` David Gibson

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_JsqKTarcy2UHKD5m2F7TNP3stNnpCdxTrptGeiTXJJHiGaA@mail.gmail.com \
    --to=robh-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
    --cc=david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org \
    --cc=devicetree-compiler-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@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 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.