Re: [PATCH] PCI: fix build errors with CONFIG_PCI=n

From: Randy.Dunlap
Date: Tue Nov 16 2004 - 19:13:48 EST


Andries Brouwer wrote:
On Tue, Nov 16, 2004 at 02:34:48PM -0800, Randy.Dunlap wrote:

Fix (most of) kernel build for CONFIG_PCI=n. Fixes these 3 errors:

1. drivers/parport/parport_pc.c:3162: error: `parport_init_mode'
undeclared (first use in this function)


Life is easier if you do not use attachments.
(Then I can more easily comment the code.)

I understand. If the decision were only so simple.

You write

-static int __init parport_init_mode_setup(const char *str) {
-
+#ifdef CONFIG_PCI
+static int __init parport_init_mode_setup(const char *str)

In my tree I have

static int __init parport_init_mode_setup(char *str) {

in order to avoid the warning for

__setup("parport_init_mode=",parport_init_mode_setup);

since the parameter is a int (*setup_func)(char *); - see

struct obs_kernel_param {
const char *str;
int (*setup_func)(char *);
int early;
};

Yes, I'm familiar with that, but I made a patch against current
top of tree.

Apart from this prototype change I only moved the single line

static int __initdata parport_init_mode = 0;

outside the #ifdef's. Is that not good enough, and better
than introducing more #ifdef's? Keeps the source smaller.

It can be good enough. It keeps the source smaller, at
the expense of adding some unneeded code (the
parport_init_mode_setup() function e.g.).

--
~Randy
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/