From: Peter Tyser Date: Thu, 30 Sep 2010 10:42:37 -0500 Subject: [U-Boot] [PATCH 13/17] post/i2c: Add ability to ignore I2C devices In-Reply-To: <4CA4A715.6040202@mvista.com> References: <1285787156-6005-1-git-send-email-ptyser@xes-inc.com> <1285787156-6005-13-git-send-email-ptyser@xes-inc.com> <4CA46DC2.80209@mvista.com> <4CA46EA1.4080203@emk-elektronik.de> <1285857518.28947.19649.camel@petert> <4CA4A715.6040202@mvista.com> Message-ID: <1285861357.28947.19739.camel@petert> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Sergei, > Peter Tyser wrote: > > >>>> +#ifdef I2C_ADDR_IGNORE_LIST > >>>> + unsigned char i2c_ignore_list[] = I2C_ADDR_IGNORE_LIST; > > >>> This array is aking to be *static*... > > >> ... and *const* as well ? > > > I'll add 'const' in the next version, but I'm not sure if the 'static' > > adds any benefit since its a local variable. > > Have you considered the amount of code needed for non-static array > initialization? I think I did:) I'd think a const array would generate nearly identical code with or without the static qualifier. In either case the function will load a pointer to the array and loop through it. The array should be stored in the data section of the U-Boot binary so I'm not sure how the array initialization differs. I did a quick comparison for this specific case and the resulting sizes came out the same: ptyser at petert u-boot $ size ./i2c-static.o text data bss dec hex filename 347 12 0 359 167 ./i2c-static.o ptyser at petert u-boot $ size ./i2c-nonstatic.o text data bss dec hex filename 347 12 0 359 167 ./i2c-nonstatic.o Is there something I'm overlooking? Regards, Peter