Re: [PATCHv2 2/3] x86: Add support for IDE on the legacy I/O ports
Alexander Shiyan
shc_work at mail.ru
Fri Apr 4 12:58:44 PDT 2014
Fri, 04 Apr 2014 20:19:14 +0200 от Michel Stam <michel at reverze.net>:
> I prefer to #ifdef out whatever code is not in use. That includes header
> files, as some don't play nice.
>
> In this way, one can be certain that code that is not used will not be
> compiled either, and as such will not cause needless errors either. It
> also clearly indicates why this particular piece of code is there, in
> this case the #include.
> For platform_ide.h maybe not strictly necessary, but call it a habit.
>
> While working on this bit of code I got some errors if the BIOS IDE
> support was not included, so I decided to fix it by ifdef-ing out
> unnecessary code.
Summing up, I want to say that a large number of #ifdef is not good.
Unused code generally should be discarded by linker.
> On 04/04/2014 09:12 PM, Alexander Shiyan wrote:
> > Fri, 4 Apr 2014 20:09:46 +0200 от michel at reverze.net:
> >> From: Michel Stam <m.stam at fugro.nl>
> >>
> >> ---
> >> arch/x86/boards/x86_generic/generic_pc.c | 73 +++++++++++++++++++++++
> >> drivers/ata/ide-sff.c | 94 ++++++++++++++++++++++++-----
> >> drivers/ata/intf_platform_ide.c | 33 +++++++++-
> >> include/ata_drive.h | 1 +
> >> 4 files changed, 180 insertions(+), 21 deletions(-)
> >>
> >> diff --git a/arch/x86/boards/x86_generic/generic_pc.c b/arch/x86/boards/x86_generic/generic_pc.c
> >> index 74a7224..895b88d 100644
> >> --- a/arch/x86/boards/x86_generic/generic_pc.c
> >> +++ b/arch/x86/boards/x86_generic/generic_pc.c
> >> @@ -27,6 +27,10 @@
> >> #include <ns16550.h>
> >> #include <linux/err.h>
> >>
> >> +#ifdef CONFIG_DISK_INTF_PLATFORM_IDE
> >> +#include <platform_ide.h>
> >> +#endif
> > Uhh, do you really need to #ifdef this?
> >
> > ---
---
More information about the barebox
mailing list