public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Albert ARIBAUD <albert.u.boot@aribaud.net>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH V2 5/8] ARM: moved general function to arm/lib
Date: Sat, 15 Oct 2011 12:15:24 +0200	[thread overview]
Message-ID: <4E995D3C.7020806@aribaud.net> (raw)
In-Reply-To: <1318666015-4535-1-git-send-email-sbabic@denx.de>

Hi Stefano,

Le 15/10/2011 10:06, Stefano Babic a ?crit :
> Functions inside armv7/syslib can be used by other ARM
> architectures, too. The file is added as part of
> ARM library.
>
> Signed-off-by: Stefano Babic<sbabic@denx.de>
> CC: Albert ARIBAUD<albert.u.boot@aribaud.net>
> CC: Wolfgang Denk<wd@denx.de>
> ---
>
> Changes:
>
> - use -C in git format-patch to detect renames
>
>   arch/arm/cpu/armv7/Makefile          |    2 --
>   arch/arm/lib/Makefile                |    2 ++
>   arch/arm/{cpu/armv7 =>  lib}/syslib.c |    0
>   3 files changed, 2 insertions(+), 2 deletions(-)
>   rename arch/arm/{cpu/armv7 =>  lib}/syslib.c (100%)
>
> diff --git a/arch/arm/cpu/armv7/Makefile b/arch/arm/cpu/armv7/Makefile
> index 92a5a96..5b7f1c7 100644
> --- a/arch/arm/cpu/armv7/Makefile
> +++ b/arch/arm/cpu/armv7/Makefile
> @@ -32,8 +32,6 @@ COBJS	+= cache_v7.o
>   COBJS	+= cpu.o
>   endif
>
> -COBJS  += syslib.o
> -
>   SRCS	:= $(START:.o=.S) $(COBJS:.o=.c)
>   OBJS	:= $(addprefix $(obj),$(COBJS))
>   START	:= $(addprefix $(obj),$(START))
> diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile
> index 300c8fa..c966aa7 100644
> --- a/arch/arm/lib/Makefile
> +++ b/arch/arm/lib/Makefile
> @@ -48,6 +48,8 @@ SOBJS-$(CONFIG_USE_ARCH_MEMSET) += memset.o
>   SOBJS-$(CONFIG_USE_ARCH_MEMCPY) += memcpy.o
>   endif
>
> +COBJS-y	+= syslib.o
> +
>   SRCS	:= $(GLSOBJS:.o=.S) $(GLCOBJS:.o=.c) \
>   	   $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
>   OBJS	:= $(addprefix $(obj),$(SOBJS-y) $(COBJS-y))
> diff --git a/arch/arm/cpu/armv7/syslib.c b/arch/arm/lib/syslib.c
> similarity index 100%
> rename from arch/arm/cpu/armv7/syslib.c
> rename to arch/arm/lib/syslib.c

I agree with Wofgang that sdelay() is redundant wrt udelay() and has 
weaker semantics.

I'll add that sr32() is kind of not ARM specific, so I fail to see why 
it should move to generic ARM, and besides, it is a half-baked solution 
to the general problem of setting a bitfield in a register -- half-baked 
in that it only applies to bits. Besides, There's been a long discussion 
on this list about similar-minded helper macros, and the conclusion was 
that keeping the operation explicitly as logical combinations of 
bitmasks was the best way to let the reader know what is going on 
without forcing them to look up a macro or function definition.

As for wait-on_value(), it is based on the same weak semantics as 
sdelay(), i.e. a number of loops, the duration of which depends on many 
factors and is thus undependable. Besides, if the field changes value 
but is not the one expected, it wastes cycles waiting for the expected 
one. This is inefficient especially of the field is of the form "one 
value for "ok", many others for various failure cases", where even once 
a failure is indicated, the code still loops waiting for an "ok" that 
will never come.

I conclude like Wolfgang that despite this code having gone through 
review unnoticed, it should not be promoted for wider use.

If some functionality of these three functions is desirable and cannot 
be met with other means, please submit new code for general ARM 
inclusion (and maybe consider adapting armv7 to this new code).

Amicalement,
-- 
Albert.

  reply	other threads:[~2011-10-15 10:15 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-16  9:46 [U-Boot] [PATCH 1/8] MX35: added ESDC structure to imx-regs Stefano Babic
2011-09-16  9:46 ` [U-Boot] [PATCH 2/8] MX35: add pins definition for UART3 Stefano Babic
2011-09-16  9:46 ` [U-Boot] [PATCH 3/8] MX35: add reset cause as provided by other i.MX Stefano Babic
2011-09-16  9:46 ` [U-Boot] [PATCH 4/8] MX35: factorize common assembly code Stefano Babic
2011-09-16  9:46 ` [U-Boot] [PATCH 5/8] ARM: moved general function to arm/lib Stefano Babic
2011-09-28 18:22   ` Stefano Babic
2011-10-06 21:30   ` Wolfgang Denk
2011-10-06 22:11     ` stefano babic
2011-10-06 22:25       ` Wolfgang Denk
2011-09-16  9:46 ` [U-Boot] [PATCH 6/8] I2C: added I2C-2 and I2C-3 to MX35 Stefano Babic
2011-09-19  6:14   ` Heiko Schocher
2011-09-16  9:46 ` [U-Boot] [PATCH 7/8] MX35: Drop unnecessary prototypes from imx-regs.h Stefano Babic
2011-09-16  9:46 ` [U-Boot] [PATCH 8/8] MX35: add support for flea3 board Stefano Babic
2011-09-16 11:48   ` Fabio Estevam
2011-09-16 11:56     ` Stefano Babic
2011-09-16 11:49   ` Fabio Estevam
2011-09-16 11:50     ` Stefano Babic
2011-09-20 11:53   ` [U-Boot] [PATCH V2 " Stefano Babic
2011-10-06 21:29   ` [U-Boot] [PATCH " Wolfgang Denk
2011-09-20 14:12 ` [U-Boot] [PATCH V3 " Stefano Babic
2011-10-06 21:28   ` Wolfgang Denk
2011-10-06 22:03     ` stefano babic
2011-10-06 22:38 ` [U-Boot] [PATCH V4 " Stefano Babic
     [not found]   ` <CAOMZO5DqqOiUfeCTKFQTy33_fTsUHAMhSQ59bU0PnuU1AZ8Ckg@mail.gmail.com>
2011-10-08 12:24     ` Stefano Babic
2011-10-08 12:33 ` [U-Boot] [PATCH V5 " Stefano Babic
2011-10-15  8:06 ` [U-Boot] [PATCH V2 5/8] ARM: moved general function to arm/lib Stefano Babic
2011-10-15 10:15   ` Albert ARIBAUD [this message]
2011-10-15 11:12     ` Stefano Babic
2011-10-24  9:58 ` [U-Boot] [PATCH V6] MX35: add support for flea3 board Stefano Babic

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=4E995D3C.7020806@aribaud.net \
    --to=albert.u.boot@aribaud.net \
    --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