All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andres Salomon <dilinger@queued.net>
To: Grant Likely <grant.likely@secretlab.ca>
Cc: devicetree-discuss@lists.ozlabs.org, sparclinux@vger.kernel.org,
	davem@davemloft.net, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] sparc: make driver/of/pdt no longer sparc-specific
Date: Mon, 09 Aug 2010 05:32:45 +0000	[thread overview]
Message-ID: <20100809013245.1cefb9bf@dev.queued.net> (raw)
In-Reply-To: <AANLkTimG7u5eXWSn5VznKfuFcFD+evTzo1_QpAFmCdpL@mail.gmail.com>

On Sun, 8 Aug 2010 23:12:21 -0600
Grant Likely <grant.likely@secretlab.ca> wrote:

> Hi Andres, thanks for the patch.  Comments below.
> 
> g.
> 
> On Sun, Aug 8, 2010 at 9:11 PM, Andres Salomon <dilinger@queued.net>
> wrote:
[...]
> > +
> >  unsigned int prom_early_allocated __initdata;
> >
> > -#include "../../../drivers/of/pdt.c"
> > +static struct of_pdt_ops prom_sparc_ops __initdata = {
> > +       .firstprop = prom_common_firstprop,
> > +       .nextprop = prom_common_nextprop,
> > +       .getproplen = (int (*)(phandle, const char
> > *))prom_getproplen,
> > +       .getproperty = (int (*)(phandle, const char *, char *,
> > int))prom_getproperty,
> > +       .getchild = (phandle (*)(phandle))prom_getchild,
> > +       .getsibling = (phandle (*)(phandle))prom_getsibling,
> 
> If you have to explicitly cast these function pointers, then you're
> doing it wrong.  :-)  Listen to and fix the compiler complaint here.
> 

Hm, can you please expand on that?  The reason it's necessary to cast is
because sparc's prom_* functions are using ints instead of phandles.  I
don't understand why casting is the wrong thing here.

I could write some 1-line wrapper functions that simply call prom_*
rather than casting, I suppose.

[...]
> > +}
> > diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig
> > index 1678dbc..c8a4b7c 100644
> > --- a/drivers/of/Kconfig
> > +++ b/drivers/of/Kconfig
> > @@ -5,6 +5,10 @@ config OF_FLATTREE
> >        bool
> >        depends on OF
> >
> > +config OF_PROMTREE
> > +       bool
> > +       depends on OF
> > +
> 
> I can tell from the context here you're working from an older tree.
> Please rebase onto Linus' current top-of-tree.  :-)  A bunch of OF
> related patches have been merged for 2.6.36 that will conflict with
> this patch.
> 

Sorry, will do.  Was just looking for more feedback (while testing)
before sending final versions of this stuff.


[...]
> 
> > +
> > +#if defined(CONFIG_SPARC)
> > +static unsigned int prom_unique_id __initdata;
> > +
> > +#define inc_unique_id(p) do { \
> > +       (p)->unique_id = prom_unique_id++; \
> > +} while (0)
> 
> Use a static inline.  C code is preferred over preprocessor code.
> Also preserver the namespace and use the of_pdt_ prefix (that goes for
> all the new functions here in this file).

This is processing multiple types, that's the reason for the macro.

'p' can be either a property struct, or device_node struct.


[...]
> > -       of_console_init();
> > +void __init of_pdt_set_ops(struct of_pdt_ops *ops)
> > +{
> > +       BUG_ON(!ops);
> >
> > -       printk("PROM: Built device tree with %u bytes of memory.\n",
> > -              prom_early_allocated);
> > +       prom_ops = *ops;
> 
> As mentioned above, why is the structure copied instead of just
> storing the pointer.
> 

Er, right, because originally the struct was handled differently.  No
reason for it to be copied anymore.

Thanks for the feedback!

WARNING: multiple messages have this Message-ID (diff)
From: Andres Salomon <dilinger@queued.net>
To: Grant Likely <grant.likely@secretlab.ca>
Cc: devicetree-discuss@lists.ozlabs.org, sparclinux@vger.kernel.org,
	davem@davemloft.net, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] sparc: make driver/of/pdt no longer sparc-specific
Date: Mon, 9 Aug 2010 01:32:45 -0400	[thread overview]
Message-ID: <20100809013245.1cefb9bf@dev.queued.net> (raw)
In-Reply-To: <AANLkTimG7u5eXWSn5VznKfuFcFD+evTzo1_QpAFmCdpL@mail.gmail.com>

On Sun, 8 Aug 2010 23:12:21 -0600
Grant Likely <grant.likely@secretlab.ca> wrote:

> Hi Andres, thanks for the patch.  Comments below.
> 
> g.
> 
> On Sun, Aug 8, 2010 at 9:11 PM, Andres Salomon <dilinger@queued.net>
> wrote:
[...]
> > +
> >  unsigned int prom_early_allocated __initdata;
> >
> > -#include "../../../drivers/of/pdt.c"
> > +static struct of_pdt_ops prom_sparc_ops __initdata = {
> > +       .firstprop = prom_common_firstprop,
> > +       .nextprop = prom_common_nextprop,
> > +       .getproplen = (int (*)(phandle, const char
> > *))prom_getproplen,
> > +       .getproperty = (int (*)(phandle, const char *, char *,
> > int))prom_getproperty,
> > +       .getchild = (phandle (*)(phandle))prom_getchild,
> > +       .getsibling = (phandle (*)(phandle))prom_getsibling,
> 
> If you have to explicitly cast these function pointers, then you're
> doing it wrong.  :-)  Listen to and fix the compiler complaint here.
> 

Hm, can you please expand on that?  The reason it's necessary to cast is
because sparc's prom_* functions are using ints instead of phandles.  I
don't understand why casting is the wrong thing here.

I could write some 1-line wrapper functions that simply call prom_*
rather than casting, I suppose.

[...]
> > +}
> > diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig
> > index 1678dbc..c8a4b7c 100644
> > --- a/drivers/of/Kconfig
> > +++ b/drivers/of/Kconfig
> > @@ -5,6 +5,10 @@ config OF_FLATTREE
> >        bool
> >        depends on OF
> >
> > +config OF_PROMTREE
> > +       bool
> > +       depends on OF
> > +
> 
> I can tell from the context here you're working from an older tree.
> Please rebase onto Linus' current top-of-tree.  :-)  A bunch of OF
> related patches have been merged for 2.6.36 that will conflict with
> this patch.
> 

Sorry, will do.  Was just looking for more feedback (while testing)
before sending final versions of this stuff.


[...]
> 
> > +
> > +#if defined(CONFIG_SPARC)
> > +static unsigned int prom_unique_id __initdata;
> > +
> > +#define inc_unique_id(p) do { \
> > +       (p)->unique_id = prom_unique_id++; \
> > +} while (0)
> 
> Use a static inline.  C code is preferred over preprocessor code.
> Also preserver the namespace and use the of_pdt_ prefix (that goes for
> all the new functions here in this file).

This is processing multiple types, that's the reason for the macro.

'p' can be either a property struct, or device_node struct.


[...]
> > -       of_console_init();
> > +void __init of_pdt_set_ops(struct of_pdt_ops *ops)
> > +{
> > +       BUG_ON(!ops);
> >
> > -       printk("PROM: Built device tree with %u bytes of memory.\n",
> > -              prom_early_allocated);
> > +       prom_ops = *ops;
> 
> As mentioned above, why is the structure copied instead of just
> storing the pointer.
> 

Er, right, because originally the struct was handled differently.  No
reason for it to be copied anymore.

Thanks for the feedback!

WARNING: multiple messages have this Message-ID (diff)
From: Andres Salomon <dilinger@queued.net>
To: Grant Likely <grant.likely@secretlab.ca>
Cc: devicetree-discuss@lists.ozlabs.org, sparclinux@vger.kernel.org,
	davem@davemloft.net, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] sparc: make driver/of/pdt no longer sparc-specific
Date: Mon, 9 Aug 2010 01:32:45 -0400	[thread overview]
Message-ID: <20100809013245.1cefb9bf@dev.queued.net> (raw)
In-Reply-To: <AANLkTimG7u5eXWSn5VznKfuFcFD+evTzo1_QpAFmCdpL@mail.gmail.com>

On Sun, 8 Aug 2010 23:12:21 -0600
Grant Likely <grant.likely@secretlab.ca> wrote:

> Hi Andres, thanks for the patch.  Comments below.
> 
> g.
> 
> On Sun, Aug 8, 2010 at 9:11 PM, Andres Salomon <dilinger@queued.net>
> wrote:
[...]
> > +
> >  unsigned int prom_early_allocated __initdata;
> >
> > -#include "../../../drivers/of/pdt.c"
> > +static struct of_pdt_ops prom_sparc_ops __initdata = {
> > +       .firstprop = prom_common_firstprop,
> > +       .nextprop = prom_common_nextprop,
> > +       .getproplen = (int (*)(phandle, const char
> > *))prom_getproplen,
> > +       .getproperty = (int (*)(phandle, const char *, char *,
> > int))prom_getproperty,
> > +       .getchild = (phandle (*)(phandle))prom_getchild,
> > +       .getsibling = (phandle (*)(phandle))prom_getsibling,
> 
> If you have to explicitly cast these function pointers, then you're
> doing it wrong.  :-)  Listen to and fix the compiler complaint here.
> 

Hm, can you please expand on that?  The reason it's necessary to cast is
because sparc's prom_* functions are using ints instead of phandles.  I
don't understand why casting is the wrong thing here.

I could write some 1-line wrapper functions that simply call prom_*
rather than casting, I suppose.

[...]
> > +}
> > diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig
> > index 1678dbc..c8a4b7c 100644
> > --- a/drivers/of/Kconfig
> > +++ b/drivers/of/Kconfig
> > @@ -5,6 +5,10 @@ config OF_FLATTREE
> >        bool
> >        depends on OF
> >
> > +config OF_PROMTREE
> > +       bool
> > +       depends on OF
> > +
> 
> I can tell from the context here you're working from an older tree.
> Please rebase onto Linus' current top-of-tree.  :-)  A bunch of OF
> related patches have been merged for 2.6.36 that will conflict with
> this patch.
> 

Sorry, will do.  Was just looking for more feedback (while testing)
before sending final versions of this stuff.


[...]
> 
> > +
> > +#if defined(CONFIG_SPARC)
> > +static unsigned int prom_unique_id __initdata;
> > +
> > +#define inc_unique_id(p) do { \
> > +       (p)->unique_id = prom_unique_id++; \
> > +} while (0)
> 
> Use a static inline.  C code is preferred over preprocessor code.
> Also preserver the namespace and use the of_pdt_ prefix (that goes for
> all the new functions here in this file).

This is processing multiple types, that's the reason for the macro.

'p' can be either a property struct, or device_node struct.


[...]
> > -       of_console_init();
> > +void __init of_pdt_set_ops(struct of_pdt_ops *ops)
> > +{
> > +       BUG_ON(!ops);
> >
> > -       printk("PROM: Built device tree with %u bytes of memory.\n",
> > -              prom_early_allocated);
> > +       prom_ops = *ops;
> 
> As mentioned above, why is the structure copied instead of just
> storing the pointer.
> 

Er, right, because originally the struct was handled differently.  No
reason for it to be copied anymore.

Thanks for the feedback!
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2010-08-09  5:32 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-09  3:11 [PATCH 2/3] sparc: make driver/of/pdt no longer sparc-specific Andres Salomon
2010-08-09  3:11 ` Andres Salomon
2010-08-09  5:12 ` Grant Likely
2010-08-09  5:12   ` Grant Likely
2010-08-09  5:12   ` Grant Likely
2010-08-09  5:32   ` Andres Salomon [this message]
2010-08-09  5:32     ` Andres Salomon
2010-08-09  5:32     ` Andres Salomon
2010-08-09  5:34     ` David Miller
2010-08-09  5:34       ` David Miller
     [not found]       ` <20100808.223444.62324566.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2010-08-16  4:22         ` Andres Salomon
2010-08-16  4:22           ` Andres Salomon
2010-08-16  4:22           ` Andres Salomon
2010-08-16  6:17           ` David Miller
2010-08-16  6:17             ` David Miller
     [not found]     ` <20100809013245.1cefb9bf-ztAUm9HJea/EueBKFXcDjA@public.gmane.org>
2010-08-09  5:41       ` Grant Likely
2010-08-09  5:41         ` Grant Likely
2010-08-09  5:41         ` Grant Likely

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=20100809013245.1cefb9bf@dev.queued.net \
    --to=dilinger@queued.net \
    --cc=davem@davemloft.net \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=grant.likely@secretlab.ca \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sparclinux@vger.kernel.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.