devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pawel Moll <pawel.moll@arm.com>
To: Dave Martin <dave.martin@linaro.org>
Cc: "devicetree-discuss@lists.ozlabs.org"
	<devicetree-discuss@lists.ozlabs.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v2 2/4] ARM: vexpress: Add DT support in v2m
Date: Mon, 28 Nov 2011 10:54:22 +0000	[thread overview]
Message-ID: <1322477662.3164.30.camel@hornet.cambridge.arm.com> (raw)
In-Reply-To: <20111125161808.GE2098@localhost.localdomain>

On Fri, 2011-11-25 at 16:18 +0000, Dave Martin wrote:
> [Since this text is now stable enough to be proofread, I'll list minor
> pedantic nits along with the other comments -- they aren't vital to the
> meaning though, and the documentation still "works" if they aren't
> acted on.]

[snip]

Most appreciated! I'll "process" all your suggestions, thanks!

> > @@ -50,10 +55,34 @@ static void __iomem *v2m_sysreg_base;
> >
> >  static void __init v2m_timer_init(void)
> >  {
> > -     void __iomem *sysctl_base;
> > -     void __iomem *timer01_base;
> > +     void __iomem *sysctl_base = NULL;
> > +     void __iomem *timer01_base = NULL;
> > +     unsigned int timer01_irq = NO_IRQ;
> > +
> > +     if (of_have_populated_dt()) {
> > +#if defined(CONFIG_ARCH_VEXPRESS_DT)
> > +             int err;
> > +             const char *path;
> > +             struct device_node *node;
> > +
> > +             node = of_find_compatible_node(NULL, NULL, "arm,sp810");
> > +             if (node)
> > +                     sysctl_base = of_iomap(node, 0);
> > +
> > +             err = of_property_read_string(of_aliases, "timer", &path);
> > +             if (!err)
> > +                     node = of_find_node_by_path(path);
> > +             if (node) {
> > +                     timer01_base = of_iomap(node, 0);
> > +                     timer01_irq = irq_of_parse_and_map(node, 0);
> > +             }
> > +#endif
> > +     } else {
> > +             sysctl_base = ioremap(V2M_SYSCTL, SZ_4K);
> > +             timer01_base = ioremap(V2M_TIMER01, SZ_4K);
> > +             timer01_irq = IRQ_V2M_TIMER0;
> > +     }
> 
> Do we even have of_have_populated_dt() in a non-DT kernel?
> 
> Maybe change this to
> 
> #if defined(CONFIG_ARCH_VEXPRESS_DT)
>         if (of_have_populated_dt()) {
>                 /* ... */
>         } else
> #endif
>         /* follow on from previous else */
>         {
>                 /* ... */
>         }
> 
> ...or if that feels a little unclear, maybe do this:
> 
> #if defined(CONFIG_ARCH_VEXPRESS_DT)
>         if (of_have_populated_dt()) {
>                 /* ... */
>         } else {
> #else
>         {
> #endif
>                 /* ... */
>         }

of_have_populated_dt() is safe, see "include/linux/of.h":

#ifdef CONFIG_OF 
static inline bool of_have_populated_dt(void)
{       
        return allnodes != NULL;
}       
#else /* CONFIG_OF */
static inline bool of_have_populated_dt(void)
{       
        return false;
}       
#endif /* CONFIG_OF */

> > @@ -63,20 +92,20 @@ static void __init v2m_timer_init(void)
> >               writel(scctrl, sysctl_base + SCCTRL);
> >       }
> >
> > -     timer01_base = ioremap(V2M_TIMER01, SZ_4K);
> > -     WARN_ON(!timer01_base);
> > -     if (timer01_base) {
> > +     WARN_ON(!timer01_base || timer01_irq != NO_IRQ);
> 
> Is that supposed to be !timer01_base || timer01_irq == NO_IRQ ?

Yes, I spotted and fixed this in the mean time.

> If so, is might be better to write
> 
> WARN_ON(!(expr));
> if (expr) {
>         ...
> 
> so that the conditions are clear inverses.

Good point, will do.

> > @@ -470,3 +499,99 @@ MACHINE_START(VEXPRESS, "ARM-Versatile Express")
> >       .timer          = &v2m_timer,
> >       .init_machine   = v2m_init,
> >  MACHINE_END
> 
> It would be useful to have a comment somewhere indicating that the
> DT_MACHINE_START() entries live in the corresponding ct-*.c files for
> DT-enabled coretiles.
> 
> Not essential, though ... most people do know how to use grep.

Where exactly would you see that comment?

Thanks for the review!

Paweł



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2011-11-28 10:54 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-23 15:01 [PATCH v2 0/4] Versatile Express DT support Pawel Moll
2011-11-23 15:01 ` [PATCH v2 1/4] ARM: vexpress: Get rid of MMIO_P2V Pawel Moll
     [not found]   ` <1322060508-11298-2-git-send-email-pawel.moll-5wv7dgnIgG8@public.gmane.org>
2011-11-25 16:15     ` Dave Martin
2011-11-28 10:40       ` Pawel Moll
     [not found]       ` <20111125161500.GD2098-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2011-11-28 10:44         ` Russell King - ARM Linux
     [not found]           ` <20111128104416.GD9581-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2011-11-28 10:53             ` Dave Martin
2011-11-23 15:01 ` [PATCH v2 2/4] ARM: vexpress: Add DT support in v2m Pawel Moll
2011-11-23 16:10   ` Pawel Moll
     [not found]   ` <1322060508-11298-3-git-send-email-pawel.moll-5wv7dgnIgG8@public.gmane.org>
2011-11-25 16:18     ` Dave Martin
2011-11-28 10:54       ` Pawel Moll [this message]
     [not found]         ` <1322477662.3164.30.camel-okZbbLrgpR/YkXV2EHHjLW3o5bpOHsLO@public.gmane.org>
2011-11-28 11:38           ` Dave Martin
2011-11-23 15:01 ` [PATCH v2 3/4] ARM: vexpress: Initial RS1 memory map support Pawel Moll
2011-11-23 15:01 ` [PATCH v2 4/4] ARM: vexpress: DT-based support for CoreTiles Express A5x2 and A9x4 Pawel Moll
     [not found]   ` <1322060508-11298-5-git-send-email-pawel.moll-5wv7dgnIgG8@public.gmane.org>
2011-11-28 16:29     ` Dave Martin
2011-11-28 17:00       ` Pawel Moll
     [not found]         ` <1322499602.3164.73.camel-okZbbLrgpR/YkXV2EHHjLW3o5bpOHsLO@public.gmane.org>
2011-11-28 17:08           ` Dave Martin
     [not found] ` <1322060508-11298-1-git-send-email-pawel.moll-5wv7dgnIgG8@public.gmane.org>
2011-11-28 14:25   ` [PATCH v2 0/4] Versatile Express DT support Rob Herring
     [not found]     ` <4ED399C8.9080908-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2011-11-28 14:42       ` Dave Martin
2011-11-28 14:57       ` Dave Martin
2011-11-28 15:09         ` Pawel Moll
     [not found]           ` <1322492947.3164.44.camel-okZbbLrgpR/YkXV2EHHjLW3o5bpOHsLO@public.gmane.org>
2011-11-28 15:14             ` Dave Martin
2011-11-28 15:20     ` Pawel Moll
     [not found]       ` <1322493617.3164.56.camel-okZbbLrgpR/YkXV2EHHjLW3o5bpOHsLO@public.gmane.org>
2011-11-28 15:39         ` Rob Herring
2011-11-28 16:02           ` Pawel Moll

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=1322477662.3164.30.camel@hornet.cambridge.arm.com \
    --to=pawel.moll@arm.com \
    --cc=dave.martin@linaro.org \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --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 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).