[U-Boot] [EXT] Re: [PATCH v2 2/4] armv8: ls2088aqds: The ls2088aqds board supports the I2C driver model.

Wolfgang Denk wd at denx.de
Fri Jul 26 06:28:39 UTC 2019


Dear Chuanhua Han,

In message <AM6PR04MB43572355560DF1349D6BC16097C10 at AM6PR04MB4357.eurprd04.prod.outlook.com> 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
> > <offset>, <data> 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


More information about the U-Boot mailing list