Re: compilation error
- From: Kees Theunissen <theuniss@xxxxxxxx>
- Date: Sun, 29 Jun 2008 10:33:17 +0200
Amadeus W.M. wrote:
I need an expert's help in compiling a kernel module. Specifically, I'm trying to compile x10dev-2 (http://wish.sourceforge.net/).
As an aside, there exists a way to control the lights and appliances in your house from your computer. To do so, you need an X10 device that you plug in a power outlet at one end and at the other end you connect it to your computer via the usb or the serial port. Naturally, there has to be a driver to talk to the device, and this is what x10dev is.
Long story short, when trying to compile it, I get these errors:
/usr/local/src/x10dev-2.1.7/dev/dev.c:621: error: void value not ignored as it ought to be
/usr/local/src/x10dev-2.1.7/dev/dev.c:626: error: void value not ignored as it ought to be
make[3]: *** [/usr/local/src/x10dev-2.1.7/dev/dev.o] Error 1
make[2]: *** [_module_/usr/local/src/x10dev-2.1.7/dev] Error 2
This is the function where both errors occur:
614 void __exit
615 x10_exit (void)
616 {
617 dbg ("%s", "Unloading X10 driver");
618
619 if (x10api.data >= 0) {
620 dbg ("unregistering %d:%s", x10api.data, DATA_DEVICE_NAME);
621 if (unregister_chrdev (x10api.data, DATA_DEVICE_NAME) == -EINVAL)
622 dbg ("error unregistering %s", DATA_DEVICE_NAME);
623 }
624 if (x10api.control >= 0) {
625 dbg ("unregistering %d:%s", x10api.control, CONTROL_DEVICE_NAME);
626 if (unregister_chrdev (x10api.control, CONTROL_DEVICE_NAME) == -
EINVAL)
627 dbg ("error unregistering %s", CONTROL_DEVICE_NAME);
628 }
629 remove_proc_entry(procinfoname,procdir);
630 remove_proc_entry(procdirname,NULL);
631 info ("X10 driver unloaded");
632 }
I don't understand why the compiler complains about not ignoring the return value on line 621 and 626 when those are if clauses. The function does not return there. I wonder if it's a compiler bug. I tried compiling it on F9 with gcc 4.3.0 and on F7 with gcc 4.1.2.
This is not about returning a return value in the void function
x10_exit. The if clauses on lines 621 and 626 try to _use_ the return
value of the void function unregister_chrdev.
The web page you mentioned says that this is a driver for 2.6.7+ and 2.4
kernels.
In recent 2.6 kernels (I checked 2.6.24.5) unregister_chrdev is defined
in <kernel-source>/fs/char_dev.c as:
void unregister_chrdev(unsigned int major, const char *name)
In early 2.6 kernels it might have been an "int" function. I didn't
check this because I don't have early 2.6 sources at hand. But in 2.4
if _was_ an "int" function.
In 2.4.31 it's defined in <kernel-source>/fs/devices.c as:
int unregister_chrdev(unsigned int major, const char * name)
The project seems to be unmaintained and I emailed the author, but no reply so far. I did manage to install and use this driver before, probably in FC6 or so.
Does anybody understand what's going on here?
Thanks!
If this are the only incompatibilities with recent kernels then it's
sufficient to replace the mentioned if clauses with only a call of
unregister_chrdev:
void __exit
x10_exit (void)
{
dbg ("%s", "Unloading X10 driver");
if (x10api.data >= 0) {
dbg ("unregistering %d:%s", x10api.data, DATA_DEVICE_NAME);
unregister_chrdev (x10api.data, DATA_DEVICE_NAME);
}
if (x10api.control >= 0) {
dbg ("unregistering %d:%s", x10api.control, CONTROL_DEVICE_NAME);
unregister_chrdev (x10api.control, CONTROL_DEVICE_NAME);
}
remove_proc_entry(procinfoname,procdir);
remove_proc_entry(procdirname,NULL);
info ("X10 driver unloaded");
}
Regards,
Kees.
--
Kees Theunissen.
.
- References:
- compilation error
- From: Amadeus W.M.
- compilation error
- Prev by Date: Re: Grub multiboot problems
- Next by Date: Re: Good 2003 post on why to avoid Linux: Linux is a confused mess of beta quality software.
- Previous by thread: compilation error
- Next by thread: Grub multiboot problems
- Index(es):