From: Wolfgang Denk <wd@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 01/21] Define new system_restart() and emergency_restart()
Date: Mon, 11 Apr 2011 20:31:15 +0200 [thread overview]
Message-ID: <20110411183115.6B764151F83@gemini.denx.de> (raw)
In-Reply-To: <AANLkTikjCJ6TuJ49TRJWHMh3y=OhFjCKMZd=XxNLvuUD@mail.gmail.com>
Dear Graeme Russ,
sorry for the delay.
In message <AANLkTikjCJ6TuJ49TRJWHMh3y=OhFjCKMZd=XxNLvuUD@mail.gmail.com> you wrote:
>
> My point was that everything can be piped through panic()
Yes, it can. But I don't think that makes sense.
> > Can you please show me a specific case where you would use such
> > different arguments to panic() in the existing code?
>
> My reasoning is cleaning up the reset()/hang()/panic() API.
Then please keep up with good old Unix philosophy: use small building
block, where each of them fulfils a single purpose, and this done
well.
I seriously dislike the idea of a multifunction panic()
implementation.
> Also, consider devices which do not normally have any device attached to
> log serial output, but you may want to log reset/hang reasons for diagnosis
> later. Board defined hang() and reset() can log the reason in NVRAM and at
> next bootup (with a serial console attached) part of the startup message
> could be 'Last Reset Reason'
Please re-read what I wrote. Things like hang() or reset() are
supposed to hang or reset _only_. Any logging is another layer.
> How? For example, if an Ethernet device which the board uses to tftp a file
> from fails to initialise, that failure is detected in the common driver
> code and as a consequence hang(), reset(), or panic() is called. The driver
> can print out a message before calling hang() or reset() (useless if you
> have no serial console attached) and by the time any arch or board specific
> code gets called, all information regarding the failure has been lost. Why
> should a common driver decide if the board should hang or reset? What if
OK, you just proed your own argument wrong. I agree, a driver should
never just hang(), reset(), or panic() as long as there is a
reasonable way to continue normal operation.
> I am suggesting an API that goes along the lines of:
I understand what you are proposing, and I do not want to accept that.
It is IMO a wrong approach. Functions hang(), reset(), or panic() are
the lowest layer of the implementation, they are function promitives
that are useful as is, and they do exactly what you expect them to do,
without any magic stuff. Feel free to build your own error handling
and repostiong and logging functions on top of them. If they are
generally useful these may then be reused in more code. But don't try
to put any such stuff into the function primitives.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"I like your game but we have to change the rules."
next prev parent reply other threads:[~2011-04-11 18:31 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-07 17:37 [U-Boot] [PATCH 0/21] Generic cross-architecture system restart support Kyle Moffett
2011-03-07 17:37 ` [U-Boot] [PATCH 01/21] Define new system_restart() and emergency_restart() Kyle Moffett
2011-03-07 21:40 ` Mike Frysinger
2011-03-07 21:56 ` Moffett, Kyle D
2011-03-07 22:10 ` Mike Frysinger
2011-03-07 23:09 ` Graeme Russ
2011-03-08 2:45 ` Mike Frysinger
2011-03-13 19:24 ` Wolfgang Denk
2011-03-14 16:23 ` Moffett, Kyle D
2011-03-14 18:59 ` Wolfgang Denk
2011-03-14 19:52 ` Moffett, Kyle D
2011-03-14 20:38 ` Wolfgang Denk
2011-03-14 21:20 ` Moffett, Kyle D
2011-03-14 22:01 ` Wolfgang Denk
2011-03-21 11:43 ` Graeme Russ
2011-03-21 12:00 ` Wolfgang Denk
2011-03-22 12:05 ` Graeme Russ
2011-03-22 13:28 ` Wolfgang Denk
2011-03-23 0:19 ` Graeme Russ
2011-04-11 18:31 ` Wolfgang Denk [this message]
2011-03-07 17:37 ` [U-Boot] [PATCH 02/21] Replace do_reset() calls with {system, emergency}_restart() Kyle Moffett
2011-03-07 17:37 ` [U-Boot] [PATCH 03/21] arm: Call "panic()" instead of "hang()" for div-by-zero Kyle Moffett
2011-03-07 17:37 ` [U-Boot] [PATCH 04/21] arm: Replace unnecessary bad_mode() with panic() Kyle Moffett
2011-03-07 17:37 ` [U-Boot] [PATCH 05/21] arm: cpux9k2: Remove unnecessary XF_do_reset assignment Kyle Moffett
2011-03-07 17:37 ` [U-Boot] [PATCH 06/21] arm: Rename nonstandard board_reset() as at91_board_reset() Kyle Moffett
2011-03-07 17:37 ` [U-Boot] [PATCH 07/21] arm: Generic system restart support Kyle Moffett
2011-03-07 17:37 ` [U-Boot] [PATCH 08/21] avr32: " Kyle Moffett
2011-03-07 17:37 ` [U-Boot] [PATCH 09/21] blackfin: Replace "bfin_reset_or_hang()" with "panic()" Kyle Moffett
2011-03-07 21:44 ` Mike Frysinger
2011-03-07 17:37 ` [U-Boot] [PATCH 10/21] blackfin: Generic system restart support Kyle Moffett
2011-03-07 17:37 ` [U-Boot] [PATCH 11/21] i386: " Kyle Moffett
2011-03-07 21:54 ` Graeme Russ
2011-03-07 22:06 ` Moffett, Kyle D
2011-03-07 22:26 ` Graeme Russ
2011-03-07 22:57 ` Moffett, Kyle D
2011-03-07 23:06 ` Graeme Russ
2011-03-07 17:37 ` [U-Boot] [PATCH 12/21] m68k: " Kyle Moffett
2011-03-07 17:37 ` [U-Boot] [PATCH 13/21] microblaze: " Kyle Moffett
2011-03-07 17:37 ` [U-Boot] [PATCH 14/21] mips: " Kyle Moffett
2011-03-07 17:37 ` [U-Boot] [PATCH 15/21] nios2: " Kyle Moffett
2011-03-09 0:13 ` Scott McNutt
2011-03-09 0:42 ` Moffett, Kyle D
2011-03-09 1:33 ` Scott McNutt
2011-03-07 17:37 ` [U-Boot] [PATCH 16/21] powerpc: " Kyle Moffett
2011-03-07 17:37 ` [U-Boot] [PATCH 17/21] sh: Unify duplicate reset code Kyle Moffett
2011-03-07 17:37 ` [U-Boot] [PATCH 18/21] sh: Generic system restart support Kyle Moffett
2011-03-07 17:37 ` [U-Boot] [PATCH 19/21] sparc: Unify duplicate reset code Kyle Moffett
2011-03-07 17:37 ` [U-Boot] [PATCH 20/21] sparc: Generic system restart support Kyle Moffett
2011-03-07 17:37 ` [U-Boot] [PATCH 21/21] Remove legacy do_reset() function Kyle Moffett
2011-03-07 21:55 ` Graeme Russ
2011-03-07 23:00 ` Moffett, Kyle D
2011-03-07 23:03 ` Graeme Russ
2011-03-07 21:44 ` [U-Boot] [PATCH 0/21] Generic cross-architecture system restart support Graeme Russ
2011-03-13 19:16 ` Wolfgang Denk
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=20110411183115.6B764151F83@gemini.denx.de \
--to=wd@denx.de \
--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