From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sergei Shtylyov Date: Thu, 30 Sep 2010 20:36:34 +0400 Subject: [U-Boot] [PATCH 13/17] post/i2c: Add ability to ignore I2C devices In-Reply-To: <1285861357.28947.19739.camel@petert> 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> <1285861357.28947.19739.camel@petert> Message-ID: <4CA4BC92.8000909@mvista.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hello. 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? If 'const' alone makes it go into the data section, then no. I didn't think it does. > Regards, > Peter WBR, Sergei