From: Wolfgang Denk Date: Fri, 26 Jul 2019 08:28:39 +0200 Subject: [U-Boot] [EXT] Re: [PATCH v2 2/4] armv8: ls2088aqds: The ls2088aqds board supports the I2C driver model. In-Reply-To: References: <20190725043934.30236-1-chuanhua.han@nxp.com> <20190725043934.30236-2-chuanhua.han@nxp.com> <20190725073941.50A61240049@gemini.denx.de> Message-ID: <20190726062839.E9E0624003E@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 Chuanhua Han, In message you wrote: > > > This is a really long list where you repeat the very same code again and again > > and again. Would it not make sense to declare a data array (holding pairs of > > , entries), and then iterrate over the loop? The could would be > > much easier to read and also much smaller... > It seems feasible to use the array you mentioned, but some of the > values to be set by i2c are obtained by index I /j in other > arrays. Yes, so what? You can write these values into your data array, too, right? > So we keep setting the i2c register in the same way as before. Please don't. This code is ugly. Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk 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 Physician: One upon whom we set our hopes when ill and our dogs when well. - Ambrose Bierce