[flashrom] [PATCH] ioperm+include cleanup

Carl-Daniel Hailfinger c-d.hailfinger.devel.2006 at gmx.net
Sun Aug 9 16:03:45 CEST 2009


On 09.08.2009 15:51, Stefan Reinauer wrote:
> On 8/9/09 3:47 PM, Carl-Daniel Hailfinger wrote:
>   
>> Releasing IO permissions was done by hand everywhere. Use a proper
>> abstraction.
>> Kill unneeded #include statements.
>> Move #include statements for serprog inside #ifdef.
>>   
>>     
> I think serproc.c should not be compiled if SERPROG_SUPPORT is 0,
> instead of commenting out all code in that file.
>
> With that fixed, this is
> Acked-by: Stefan Reinauer <stepan at coresystems.de>
>   

Well, this is the same mechanism we use for ft2232_spi.c and back then
it was picked because it allowed us to avoid lots of ifdefs in generic
code. We'd need an ifdef in option parsing, an ifdef in the programmer
struct, an ifdef in the programmer enum, etc. With all those ifdefs, it
gets easy to miss one. Plus, we'd need to use #ifdef for the flashrom
usage message, the --list-supported parameter, and possibly the man
page. IMHO that's a nightmare and won't get better if we add support for
more external programmers. I have two of them (unfinished) on my disk,
Uwe has one or two as well.
The size benefits of not compiling serprog.c at all are ~256 bytes.

Regards,
Carl-Daniel

-- 
http://www.hailfinger.org/





More information about the flashrom mailing list