From mboxrd@z Thu Jan 1 00:00:00 1970 From: Detlev Zundel Date: Wed, 06 Jul 2011 10:33:52 +0200 Subject: [U-Boot] [RFC] gpio command: return value on write, additional actions In-Reply-To: <1309893315.15056.88.camel@ws-apr.office.loc> (Andreas Pretzsch's message of "Tue, 05 Jul 2011 21:15:15 +0200") References: <1309885156.15056.45.camel@ws-apr.office.loc> <201107051344.15873.vapier@gentoo.org> <1309893315.15056.88.camel@ws-apr.office.loc> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Andreas, > I'd say clear/set/toggle are changeable, don't see any legit > return-value-usage here. For 100% backward compatibility, one could > leave them as they are and use 0|1 as new actions with return 0, as > proposed. > > So these variants: > gpio clear|0 => set to output, write 0, return success > gpio set|1 => set to output, write 1, return success > gpio toggle => (set to output), toggle output, return success > gpio input => set to input, return pin value > gpio value => return current pin/latch/whatever value I'd propose to fix the commands to be sensible now. Actually I believe that they should not be in heavy use "in the wild" and so we should take the opportunity and declare the current behaviour as buggy and fix it. Rather now than later ;) Actually I would expect the "output" commands to return true when they were able to do what was requestes from them, i.e. drive the requested value to the output. I guess this cannot be done in the general case, but for a "weak output" that can be read back, this would be the most sensible thing to do. Cheers Detlev -- Helena ist verh?ltnism??ig leicht zu besetzen. Eine Frau, zarteste Jugend mit sinnlicher Reife verbindend; ?u?erst intelligent, indes von durchaus weiblicher Denkart; phlegmatisch, aber sensibel; un?bertrefflich sch?n und dabei von sehr pers?nlichem Charme - mehr wird da nicht verlangt. -- Peter Hacks -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de