Reputation: 375
There was a question like this a year ago, and it was never answered. Instead of asking a new question on an old thread, I am going to open a new question. Anyways, on to the question.
When compiling the Zen kernel for Linux, I came across this error while make-kpkg
ing the kernel source:
arch/x86/platform/intel-mid/early_printk_intel_mid.c: In function ‘dw_kmsg_dump’:
arch/x86/platform/intel-mid/early_printk_intel_mid.c:121:3: error: too few arguments to function ‘early_mrst_console.write’
early_mrst_console.write(&early_mrst_console, line, len);
Here's the code for early_mrst_console.write (early_mrst_console is a struct
, by the way, with a link to the function early_mrst_spi_write
for its write
function):
static void early_mrst_spi_write(struct console *con, const char *str,
unsigned n)
{
int i;
for (i = 0; i < n && *str; i++) {
if (*str == '\n')
early_mrst_spi_putc('\r');
early_mrst_spi_putc(*str);
str++;
}
}
Now, I'm not a C expert (not even an amateur, really), but it looks like that early_mrst_spi_write
takes 3 arguments, and the call to it gives 3 arguments. Why is it calling an error, and how can I change it to fix the problem?
EDIT: As per request, the struct
:
struct console early_mrst_console = {
.name = "earlymrst",
.write = early_mrst_spi_write,
.flags = CON_PRINTBUFFER,
.index = -1,
};
Upvotes: 0
Views: 1237
Reputation: 277
Give us the definition of "struct console". I guess it's write requires more parameters.
Some compilers might not give warnings about assignment of function of incompatible type depending on it's settings.
In any case when deciding if the number and types of arguments is correct, the compiler will only look at what it says in struct console and would not care about how you declare early_mrst_spi_write (this might matter during initialization of early_mrst_console and might give a warning).
Upvotes: 1