From mboxrd@z Thu Jan 1 00:00:00 1970 From: Timur Tabi Date: Tue, 16 Dec 2008 12:51:32 -0600 Subject: [U-Boot] [PATCH v3] i2c: merge all i2c_reg_read() and i2c_reg_write() into inline functions In-Reply-To: References: <1228325310-19275-1-git-send-email-timur@freescale.com> <20081215224707.D70FD832E8A1@gemini.denx.de> <4946EB64.5060900@freescale.com> <4947C6E5.3070403@freescale.com> Message-ID: <4947F8B4.8070804@freescale.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de ksi at koi8.net wrote: > That looks messy... Why would we use two different versions if we can make > everything uniform? Because we already have something that makes it uniform, and it's broken. The idea of having a "current i2c bus" that needs to be set before read/write operations can be performed is the broken part! > Eh, you can just set bus number every time you're gonna do i2c read/write... Not with the current i2c command line. We would need another global variable in the i2c command line code to store what IT thinks is the current bus. > That i2c_get_bus_num() doesn't make any sence at all. Just set bus number > every time you access i2c device. That's risky. Sooner or later, you will want to know what the current bus number is, at least for debugging or status purposes. > U-boot is single-task so there is no other > process that can change it from under you and you do not save anything with > checking that bus number. Sounds to me like you haven't really looked at the U-Boot code. There are plenty of places where one function does I2C operations, then calls another function that does its own. I think all this boils down to one core disagreement we have: I think the idea of a "current" i2c bus is a bad one. -- Timur Tabi Linux kernel developer at Freescale