From: Wolfgang Denk Date: Tue, 11 Dec 2012 13:39:14 +0100 Subject: [U-Boot] [PATCH 4/8] Add a poll function to monitor events In-Reply-To: <1355223289-15685-5-git-send-email-hatim.rv@samsung.com> References: <1355223289-15685-1-git-send-email-hatim.rv@samsung.com> <1355223289-15685-5-git-send-email-hatim.rv@samsung.com> Message-ID: <20121211123914.3CC5A200FD5@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Hatim Ali, In message <1355223289-15685-5-git-send-email-hatim.rv@samsung.com> you wrote: > From: Akshay Saraswat > > Adding a generic polling function to continuously monitor events and > trigger actions corresponding to them. > > Signed-off-by: Akshay Saraswat > Acked-by: Simon Glass > > diff --git a/README b/README > index 037513a..0e4083c 100644 > --- a/README > +++ b/README > @@ -2841,6 +2841,13 @@ Configuration Settings: > the application (usually a Linux kernel) when it is > booted > > +- CONFIG_BOARD_POLL > + There are various scenarios in which parallel-thread like > + polling is required to monitor status of variety of devices. > + For such situations CONFIG_BOARD_POLL shall be enabled > + and funtion call board_poll_devices() from console_tstc() > + will then poll for the device status as defined inside function. Sorry, but I dislike this, for a number of reasons. 1) There is, and has always been, a very basic design decision, that U-Boot is strictly single-tasking, i. e. we don't have any kind of "background activities" goind on. Your introduction of a device polling mechanism violates this principle. I don't say that this is unacceptable, but we have to be aware that this is a far-reaching decision, so we should consider it very carefully. If anything like this gets implemented, it has to be done in a way that will be general enough to be useful to others as well. 2) U-Boot is a boot loader, not an OS. Do we really need continuous temperature management in U-Boot? I think not. After all, our main purpose is to boot an OS, and do that as fast as possible. The majority of users will see U-Boot running only for a few milliseconds, and only when they boot the device - which may be very seldom. So what exactly do we need this for? 3) Your hooking of a device polling into console_tstc() is broken by design. It may be sufficient for the specific use case you have in mind here, but it is totally useless for any other purpose. This needs a lot of additional thought, and major changes to the implementation. 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 Without facts, the decision cannot be made logically. You must rely on your human intuition. -- Spock, "Assignment: Earth", stardate unknown