public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Tom Rini <trini@konsulko.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH V2 07/12] board: LaCie: Move common headers to board-common directory
Date: Mon, 16 Nov 2015 19:45:11 -0500	[thread overview]
Message-ID: <20151117004511.GS8060@bill-the-cat> (raw)
In-Reply-To: <5649F76F.6040702@ti.com>

On Mon, Nov 16, 2015 at 09:34:07AM -0600, Nishanth Menon wrote:
> On 11/15/2015 09:32 PM, Masahiro Yamada wrote:
> > 2015-11-15 14:38 GMT+09:00 Nishanth Menon <nm@ti.com>:
> >> On 11/14/2015 05:56 PM, Masahiro Yamada wrote:
> >>> 2015-11-13 14:43 GMT+09:00 Nishanth Menon <nm@ti.com>:
> >>>> Header files can be located in a generic location without
> >>>> needing to reference them with ../common/
> >>>>
> >>>> Generated with the following script
> >>>>
> >>>>  #!/bin/bash
> >>>> vendor=board/LaCie
> >>>> common=$vendor/common
> >>>>
> >>>> cfiles=`git grep "../common" $vendor|grep "#include"|cut -d '"' -f2|sort -u|grep c$`
> >>>> headers=`git grep "../common" $vendor|grep "#include"|cut -d '"' -f2|sort -u|grep h$`
> >>>>
> >>>> mkdir -p $common/include/board-common
> >>>> set -x
> >>>> for header in $headers
> >>>> do
> >>>>         echo "processing $header in $common"
> >>>>         hbase=`basename $header`
> >>>>         git mv $common/$hbase $common/include/board-common
> >>>>         sed -i -e "s/\"..\/common\/$hbase\"/<board-common\/$hbase>/g" $vendor/*/*.[chS]
> >>>>         sed -i -e "s/\"$hbase\"/<board-common\/$hbase>/g" $vendor/common/*.[chS]
> >>>> done
> >>>>
> >>>> Cc: Simon Guinot <simon.guinot@sequanux.org>
> >>>> Cc: Albert ARIBAUD <albert.u.boot@aribaud.net>
> >>>>
> >>>> Signed-off-by: Nishanth Menon <nm@ti.com>
> >>>> ---
> >>>
> >>>
> >>> As far as I understood from 02 to 12,
> >>> the effect of this series is:
> >>>
> >>> either
> >>>   replace "../common/foo.h" with <board-common/foo.h>
> >> for board/specific board files.
> >>
> >>> or
> >>>   replace "bar.h" with <board-common/bar.h>
> >> yes - for board/common headers which are exposed.
> >>
> >>>
> >>> Vendor common headers are referenced within their own directory.
> >>> #include "..." is better than #include <...> in such cases.
> >>
> >> Not after this series, which is what is the 3rd change done by this
> >> series: The headers are moved to a common location away from the
> >> board/common directory.
> >>
> >> This is more inline with what you did with mach.
> >>
> >>> I still do not understand what problem this series wants to solve.
> >>
> >> standardize board common header inclusion strategy across boards in a
> >> consistent manner similar to what mach/ changes have been doing.
> >>
> >> Overall, you did mention in https://patchwork.ozlabs.org/patch/541068/
> >>
> >>
> >> [step 1] move SoC-specific headers to  arch/<arch>/mach-<soc>/include/mach
> >>
> >> [step 2] change  #include <asm/arch/foo.h> to #include <mach/foo.h>
> >>
> >>
> >>
> >> Why did we not let folks user relative includes such as #include
> >> "../../mach/xyz.h" ? because it constraints us from changing the
> >> directory architecture in the future.
> >>
> >> This is exactly the same problem that board/<vendor>/ folders have.
> >>
> >>
> >> Why is it that you dont see that as a problem?
> >>
> > 
> > 
> > You are misunderstanding.
> > 
> > SoC headers (either <asm/arch/*.h> in old style, or <mach/*.h> in new
> > style) are exported.
> > 
> > 
> > For example,  arch/asm/include/asm/gpio.h includes <asm/arch/gpio.h>.
> > Also, many files under drivers/ include <asm/arch/*.h>
> > 
> > I do not think any drivers should depend on SoC specific headers,
> > but it is the place where we stand now.
> > 
> > 
> > OTOH, vendor headers should be only referenced locally.
> > We should not expand the scope.   No need to standardize the include path.
> > 
> ^^^
> > 
> > Relative path is a correct way to include a header file with local scope.
> > 
> > Even Linux does so.
> > 
> > For example
> > 
> > drivers/pinctrl/sunxi/pinctrl-sunxi.c
> > 
> 
> Hmm... so, lets review our status currently:
> a) board/$(VENDOR)/board_X, board/$(VENDOR)/board_Y,
> board/$(VENDOR)/board_Z all need a common function, this is currently
> in board/$(VENDOR)/common/xyz.c.
> b) the function prototype for the function needs to be in xyz.h so
> that board/$(VENDOR)/board_[XYZ] can use the function.
> c) your suggestion is to stay in local scope for
> board/$(VENDOR)/board_[XYZ] by "../common/xyz.h"
> 
> So much I have understood. I dont understand *why* you feel that
> vendor headers should only be referenced locally. Could you elaborate
> a little more on that? Is it because of the risk that drivers will now
> be able to do <board-common/xyz.h> ?
> 
> If that is the case, and Tom, Simon, you folks agree as well, I can
> drop the entire series.

So I think I see the point that Masahiro (and others) are making and it
makes sense, sorry for not seeing it earlier myself.  Since we have many
matches on <board-common/foo.h> but no functions in common (or even
common function names but with different prototypes) we really aren't
gaining anything by doing this kind of change.  So yes, we should just
reference this locally since it is local to board/$(VENDOR).  Thanks for
taking the time to do this Nishanth but NAK.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20151116/5bfb2637/attachment.sig>

  reply	other threads:[~2015-11-17  0:45 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-13  5:43 [U-Boot] [PATCH V2 00/12] Series to move headers to a consistent include location Nishanth Menon
2015-11-13  5:43 ` [U-Boot] [PATCH V2 01/12] Makefile: Include vendor common library in include search path Nishanth Menon
2015-11-15 14:45   ` Igor Grinberg
2015-11-13  5:43 ` [U-Boot] [PATCH V2 02/12] board: BuR: Move common headers to board-common directory Nishanth Menon
2015-11-13  5:43 ` [U-Boot] [PATCH V2 03/12] board: compulab: " Nishanth Menon
2015-11-13  5:43 ` [U-Boot] [PATCH V2 05/12] board: gdsys: " Nishanth Menon
2015-11-16  8:01   ` Dirk Eibach
2015-11-16  8:04     ` Dirk Eibach
2015-11-13  5:43 ` [U-Boot] [PATCH V2 06/12] board: keymile: " Nishanth Menon
2015-11-18 13:58   ` Valentin Longchamp
2015-11-13  5:43 ` [U-Boot] [PATCH V2 07/12] board: LaCie: " Nishanth Menon
2015-11-13 10:30   ` Simon Guinot
2015-11-13 14:06     ` Tom Rini
2015-11-13 15:32       ` Simon Guinot
2015-11-13 23:57         ` Nishanth Menon
2015-11-14  2:05           ` Simon Glass
2015-11-16  1:53             ` Tom Rini
2015-11-14 23:56   ` Masahiro Yamada
2015-11-15  5:38     ` Nishanth Menon
2015-11-16  3:32       ` Masahiro Yamada
2015-11-16 15:34         ` Nishanth Menon
2015-11-17  0:45           ` Tom Rini [this message]
2015-11-13  5:43 ` [U-Boot] [PATCH V2 08/12] board: mpl: " Nishanth Menon
2015-11-13  8:19   ` David Müller (ELSOFT AG)
2015-11-13 14:02     ` Tom Rini
2015-11-13  5:43 ` [U-Boot] [PATCH V2 09/12] board: seco: " Nishanth Menon
2015-11-13  5:43 ` [U-Boot] [PATCH V2 10/12] board: siemens: " Nishanth Menon
2015-11-16  9:17   ` Egli, Samuel
2015-11-13  5:43 ` [U-Boot] [PATCH V2 11/12] board: varisys: " Nishanth Menon
2015-11-16  7:42   ` Andy Fleming
2015-11-13  5:43 ` [U-Boot] [PATCH V2 12/12] board: xes: " Nishanth Menon
2015-11-13  5:51 ` [U-Boot] [PATCH RESEND V2 04/12] board: freescale: " Nishanth Menon
2015-12-19 23:07 ` [U-Boot] [PATCH V2 00/12] Series to move headers to a consistent include location Simon Glass
2015-12-20  0:25   ` Nishanth Menon
2015-12-28  4:22     ` Simon Glass

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=20151117004511.GS8060@bill-the-cat \
    --to=trini@konsulko.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox