All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jerry Van Baren <gerald.vanbaren@smiths-aerospace.com>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH] RFC: generic property fixup mechanism for LIBFDT
Date: Thu, 23 Aug 2007 13:01:14 -0400	[thread overview]
Message-ID: <46CDBD5A.3020106@smiths-aerospace.com> (raw)
In-Reply-To: <20070823112404.92bb25a0.kim.phillips@freescale.com>

Kim Phillips wrote:
> On Wed, 22 Aug 2007 19:16:16 -0400
> Jerry Van Baren <vanbargw@gmail.com> wrote:
>> Kim Phillips wrote:

[snip]

>>> What about having a list of functions to call?  It could be called
>>> something like fdt_update_sequence, and be similar in implementation to
>>> lib_ppc/board.c's init_sequence.  It could also reside in lib_ppc,
>>> esp. since, e.g. all powerpc's have a timebase, and to help naturally
>>> enforce a certain level of consistency among powerpc board code.  The
>>> updater/fixup/"setter" functions would only need be passed the pointer
>>> to the base of the blob to update.
>> We _have_ "a list of functions to call".  That is what is done with the 
>> 83xx which is what I advocated and what Bartlomiej had before rewriting 
>> it back into a table without functions.
> 
> yeah, I meant /just/ a list of functions to call, without all the extra
> fluff in both the existing 83xx and Bartlomiej's implementations.
> 
> Kim

Well, the table has the node, the property, and the "setter" routine. 
This allows us to re-use the "setter" routine where possible.  Where 
there are multiple setter routines is where, for instance, the property 
is based on a different clock or a different MAC address.  In those 
cases the setters are identical except for one line, but that one line 
is *why* they are different.

The first half of Grant's comment was:
 > These 4 functions are pretty close to identical (except for the
 > parameter to cpu_to_be32()).  Surely there is a more compact way to do
 > this.

My answer is "no, the whole reason there is one line different is 
because it *has to be*."  As the French say about the "Y" chromosome 
"...and viva la difference."  My first attempt, and Bartlomiej's 
proposed patch, tried (tries) to put the value in the table, but it is a 
*WORSE* solution because you have the problem with byteswapping or not 
and different sizes of values.  The scorecard for putting the values in 
the tables and also having it maintainable is 0 for 2.

Note that the original code is a repetitive in-line coding of what is 
inside the "setter" functions, with 100% duplication of code.  My change 
to a table driven method with "setter" functions drops the 100% 
duplication of code to less, probably 80%.

I would lay down a challenge to make the code both more compact *and* 
not lose maintainability.

"Make everything as simple as possible, but not simpler."
   -- Albert Einstein <http://www.quotedb.com/quotes/1360>

The second half of Grant's comment was:
 > In addition, these function don't really contain anything that
 > screams out "5xxx only!". Can this be common support code usable by
 > all boards?

To this I simply say "yup."  To date, this has been 83xx only (mostly?). 
  With more PPC CPU types comes the opportunity to identify and abstract 
the common "setter" functions.

*This* is where Bartlomiej should start IMHO.  It is where the payback is.

Best regards,
gvb

  reply	other threads:[~2007-08-23 17:01 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-02 18:24 [U-Boot-Users] [PATCH] fdt, mpc5xxx: Adapt MPC5xxx to use libfdt in ft_cpu_setup() Bartlomiej Sieka
2007-08-03  9:07 ` [U-Boot-Users] [PATCH CORRECTION] " Bartlomiej Sieka
2007-08-03 14:25   ` Grant Likely
2007-08-22 11:54     ` [U-Boot-Users] [PATCH] RFC: generic property fixup mechanism for LIBFDT Bartlomiej Sieka
2007-08-22 13:18       ` Jerry Van Baren
2007-08-22 21:09         ` Kim Phillips
2007-08-22 23:16           ` Jerry Van Baren
2007-08-23 16:24             ` Kim Phillips
2007-08-23 17:01               ` Jerry Van Baren [this message]
2007-08-29 18:01                 ` Grant Likely
2007-08-30  2:40                   ` Jerry Van Baren
2007-08-30 11:51                     ` Jerry Van Baren
2007-08-30 12:49                       ` Bartlomiej Sieka
2007-08-22 23:30           ` Wolfgang Denk
2007-08-23 16:48             ` Kim Phillips
2007-08-23 17:28               ` Jerry Van Baren
2007-08-23 19:25               ` Wolfgang Denk
2007-08-29 10:59     ` [U-Boot-Users] [PATCH CORRECTION] fdt, mpc5xxx: Adapt MPC5xxx to use libfdt in ft_cpu_setup() Wolfgang Denk
2007-08-29 18:23       ` Grant Likely
2007-08-04 21:21 ` [U-Boot-Users] [PATCH] " Jerry Van Baren

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=46CDBD5A.3020106@smiths-aerospace.com \
    --to=gerald.vanbaren@smiths-aerospace.com \
    --cc=u-boot@lists.denx.de \
    /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.