[Home]

Summary:ASTERISK-05697: [patch] Zaptel compilation fails on 2.6.15-rc2-git6
Reporter:puzzled (puzzled)Labels:
Date Opened:2005-11-29 20:45:20.000-0600Date Closed:2008-06-07 11:13:56
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) 20051201__bug5891.diff.txt
( 1) device.h
( 2) device.h_2.6.13-2.6.15-rc3.diff.txt
( 3) issue5891.patch
( 4) issue5891.rev2.patch
Description:Zaptel 1.2.0 compilation fails on kernel 2.6.15-rc2-git6 on 32 bit ppc. The API seems to have changed. Per Kevin's request I have attached a diff of device.h in 2.6.13 and 2.6.15-rc3 and device.h from 2.6.15-rc3. Here is the link to the history of device.h:
http://kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=history;h=12074a35b4ef36d7a971beaf42412b22f304cdd1;f=include/linux/device.h

Some commits that may have introduced the breakage:
http://kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blobdiff;h=10ab7807f8ea3c202106ecb3bf8ac5da1b84b156;hp=226e550ae2ea6e87c93b519d1661ed0c6a7e687b;hb=74be227f728ed68bfc270153665b43fc1f0fa845;f=include/linux/device.h
http://kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blobdiff;h=226e550ae2ea6e87c93b519d1661ed0c6a7e687b;hp=e86a580b72e186ac8c0d43be8bc7eb61c77d0819;hb=51d172d5f3a193e4b8f76179b2e55d7a36b94117;f=include/linux/device.h
http://kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blobdiff;h=e86a580b72e186ac8c0d43be8bc7eb61c77d0819;hp=a53a822c4d16f19e12024b0366849b6b156d2e30;hb=a7fd67062efc5b0fc9a61368c607fa92d1d57f9e;f=include/linux/device.h
http://kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blobdiff;h=a53a822c4d16f19e12024b0366849b6b156d2e30;hp=95d607a48f06edd22c6be64e0feaf74d1aa63467;hb=d8539d81aeee4dbdc0624a798321e822fb2df7ae;f=include/linux/device.h
Comments:By: puzzled (puzzled) 2005-11-29 20:48:15.000-0600

Might be handy to include the compilation error messages too:

/home/patrick/redhat/BUILD/zaptel-1.2.0/zaptel.c:4448: warning:
passing argument 2 of 'class_device_create' makes pointer from
integer without a cast
/home/patrick/redhat/BUILD/zaptel-1.2.0/zaptel.c:4448: warning:
passing argument 3 of 'class_device_create' makes integer from
pointer without a cast
/home/patrick/redhat/BUILD/zaptel-1.2.0/zaptel.c:4448: warning:
passing argument 4 of 'class_device_create' from incompatible
pointer type
/home/patrick/redhat/BUILD/zaptel-1.2.0/zaptel.c:4448: error:
too few arguments to function 'class_device_create'

By: Russell Bryant (russell) 2005-11-30 23:28:21.000-0600

This commit shows what we need to do:

http://kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=53f4654272df7c51064825024340554b39c9efba;hp=51d172d5f3a193e4b8f76179b2e55d7a36b94117

I will work on a patch.

By: Russell Bryant (russell) 2005-11-30 23:41:15.000-0600

Please test the attached patch.

By: puzzled (puzzled) 2005-12-01 16:31:22.000-0600

Did not work on a 2.6.15-rc4 kernel from Red Hat Rawhide logically called 2.6.14-1.1729. Output of failing compilation:

/usr/bin/make -C /lib/modules/2.6.14-1.1729_FC5/build SUBDIRS=/home/patrick/redhat/BUILD/zaptel-1.2.0 modules
make[1]: Entering directory `/usr/src/kernels/2.6.14-1.1729_FC5-ppc'
 CC [M]  /home/patrick/redhat/BUILD/zaptel-1.2.0/zaptel.o
/home/patrick/redhat/BUILD/zaptel-1.2.0/zaptel.c:1747:5: warning: "CONFIG_ZAPATA_DEBUG" is not defined
/home/patrick/redhat/BUILD/zaptel-1.2.0/zaptel.c:1934:5: warning: "CONFIG_ZAPATA_DEBUG" is not defined
/home/patrick/redhat/BUILD/zaptel-1.2.0/zaptel.c:3043:5: warning: "CONFIG_ZAPATA_DEBUG" is not defined
/home/patrick/redhat/BUILD/zaptel-1.2.0/zaptel.c:3050:5: warning: "CONFIG_ZAPATA_DEBUG" is not defined
/home/patrick/redhat/BUILD/zaptel-1.2.0/zaptel.c:3059:5: warning: "CONFIG_ZAPATA_DEBUG" is not defined
/home/patrick/redhat/BUILD/zaptel-1.2.0/zaptel.c:3306:5: warning: "CONFIG_ZAPATA_DEBUG" is not defined
/home/patrick/redhat/BUILD/zaptel-1.2.0/zaptel.c: In function 'zt_register':
/home/patrick/redhat/BUILD/zaptel-1.2.0/zaptel.c:4459: warning: passing argument 2 of 'class_device_create' makes pointer from integer without a cast
/home/patrick/redhat/BUILD/zaptel-1.2.0/zaptel.c:4459: warning: passing argument 3 of 'class_device_create' makes integer from pointer without a cast
/home/patrick/redhat/BUILD/zaptel-1.2.0/zaptel.c:4459: warning: passing argument 4 of 'class_device_create' from incompatible pointer type
/home/patrick/redhat/BUILD/zaptel-1.2.0/zaptel.c:4459: error: too few arguments to function 'class_device_create'
/home/patrick/redhat/BUILD/zaptel-1.2.0/zaptel.c:5298:5: warning: "CONFIG_ZAPATA_DEBUG" is not defined
/home/patrick/redhat/BUILD/zaptel-1.2.0/zaptel.c:5817:5: warning: "CONFIG_ZAPATA_DEBUG" is not defined
/home/patrick/redhat/BUILD/zaptel-1.2.0/zaptel.c:5887:5: warning: "CONFIG_ZAPATA_DEBUG" is not defined
/home/patrick/redhat/BUILD/zaptel-1.2.0/zaptel.c:5910:5: warning: "CONFIG_ZAPATA_DEBUG" is not defined
/home/patrick/redhat/BUILD/zaptel-1.2.0/zaptel.c: In function 'zt_init':
/home/patrick/redhat/BUILD/zaptel-1.2.0/zaptel.c:6518: warning: passing argument 2 of 'class_device_create' makes pointer from integer without a cast
/home/patrick/redhat/BUILD/zaptel-1.2.0/zaptel.c:6518: warning: passing argument 3 of 'class_device_create' makes integer from pointer without a cast
/home/patrick/redhat/BUILD/zaptel-1.2.0/zaptel.c:6518: warning: passing argument 4 of 'class_device_create' from incompatible pointer type
/home/patrick/redhat/BUILD/zaptel-1.2.0/zaptel.c:6518: error: too few arguments to function 'class_device_create'
/home/patrick/redhat/BUILD/zaptel-1.2.0/zaptel.c:6519: warning: passing argument 2 of 'class_device_create' makes pointer from integer without a cast
/home/patrick/redhat/BUILD/zaptel-1.2.0/zaptel.c:6519: warning: passing argument 3 of 'class_device_create' makes integer from pointer without a cast
/home/patrick/redhat/BUILD/zaptel-1.2.0/zaptel.c:6519: warning: passing argument 4 of 'class_device_create' from incompatible pointer type
/home/patrick/redhat/BUILD/zaptel-1.2.0/zaptel.c:6519: error: too few arguments to function 'class_device_create'
/home/patrick/redhat/BUILD/zaptel-1.2.0/zaptel.c:6520: warning: passing argument 2 of 'class_device_create' makes pointer from integer without a cast
/home/patrick/redhat/BUILD/zaptel-1.2.0/zaptel.c:6520: warning: passing argument 3 of 'class_device_create' makes integer from pointer without a cast
/home/patrick/redhat/BUILD/zaptel-1.2.0/zaptel.c:6520: warning: passing argument 4 of 'class_device_create' from incompatible pointer type
/home/patrick/redhat/BUILD/zaptel-1.2.0/zaptel.c:6520: error: too few arguments to function 'class_device_create'
/home/patrick/redhat/BUILD/zaptel-1.2.0/zaptel.c:6521: warning: passing argument 2 of 'class_device_create' makes pointer from integer without a cast
/home/patrick/redhat/BUILD/zaptel-1.2.0/zaptel.c:6521: warning: passing argument 3 of 'class_device_create' makes integer from pointer without a cast
/home/patrick/redhat/BUILD/zaptel-1.2.0/zaptel.c:6521: warning: passing argument 4 of 'class_device_create' from incompatible pointer type
/home/patrick/redhat/BUILD/zaptel-1.2.0/zaptel.c:6521: error: too few arguments to function 'class_device_create'
make[2]: *** [/home/patrick/redhat/BUILD/zaptel-1.2.0/zaptel.o] Error 1
make[1]: *** [_module_/home/patrick/redhat/BUILD/zaptel-1.2.0] Error 2
make[1]: Leaving directory `/usr/src/kernels/2.6.14-1.1729_FC5-ppc'
make: *** [linux26] Error 2

By: Russell Bryant (russell) 2005-12-01 16:45:35.000-0600

Oops.  That's what I get for doing this in the middle of the night.  I forgot part of the patch.  :)

I have posted an updated patch for you to try.

By: Tilghman Lesher (tilghman) 2005-12-01 16:48:28.000-0600

Here's an updated patch.  Try this one.

By: puzzled (puzzled) 2005-12-01 16:49:04.000-0600

In the zt_register function at line 4455 class_device_create is called with the "old" syntax. The same applies for to the zt_init function in line 6516.
If I add the NULL then the compilation works fine. But I guess that is hardcoding it and does not cater to kernels < 2.6.15. My knowledge of C pretty much stops here so can't give you the proper fix

4459: class_device_create(zap_class, NULL, MKDEV(ZT_MAJOR, span->chans[x].channo), NULL, chan_name);

6518: class_device_create(zap_class, NULL, MKDEV(ZT_MAJOR, 253), NULL, "zaptimer");
6519: class_device_create(zap_class, NULL, MKDEV(ZT_MAJOR, 254), NULL, "zapchannel");
6520: class_device_create(zap_class, NULL, MKDEV(ZT_MAJOR, 255), NULL, "zappseudo");
6521 class_device_create(zap_class, NULL, MKDEV(ZT_MAJOR, 0), NULL, "zapctl");

By: Russell Bryant (russell) 2005-12-01 16:52:47.000-0600

Yeah, that's what these macros I have added are supposed to handle.  They should add the extra NULL argument if it's 2.6.15 or above.  I just forgot to change the function calls to use the macro.  :)  Both mine and Corydon's updated patch do this.

Let us know if this clears it up for you.

By: Russell Bryant (russell) 2005-12-01 18:03:24.000-0600

fixed in the trunk and 1.2 branch

By: Digium Subversion (svnbot) 2008-06-07 11:13:44

Repository: dahdi
Revision: 842

U   trunk/zaptel.c

------------------------------------------------------------------------
r842 | russell | 2008-06-07 11:13:43 -0500 (Sat, 07 Jun 2008) | 2 lines

fix udev support for 2.6.15 (issue ASTERISK-5697)

------------------------------------------------------------------------

http://svn.digium.com/view/dahdi?view=rev&revision=842

By: Digium Subversion (svnbot) 2008-06-07 11:13:48

Repository: dahdi
Revision: 843

U   branches/1.2/zaptel.c

------------------------------------------------------------------------
r843 | russell | 2008-06-07 11:13:47 -0500 (Sat, 07 Jun 2008) | 2 lines

fix udev support for 2.6.15 (issue ASTERISK-5697)

------------------------------------------------------------------------

http://svn.digium.com/view/dahdi?view=rev&revision=843

By: Digium Subversion (svnbot) 2008-06-07 11:13:56

Repository: dahdi
Revision: 844

_U  trunk/
U   trunk/Makefile

------------------------------------------------------------------------
r844 | kpfleming | 2008-06-07 11:13:50 -0500 (Sat, 07 Jun 2008) | 15 lines

Merged revisions 841,843 via svnmerge from
https://origsvn.digium.com/svn/zaptel/branches/1.2

........
r841 | kpfleming | 2005-12-01 17:14:59 -0600 (Thu, 01 Dec 2005) | 2 lines

Makefile 'update' target now supports updating from Subversion repositories (issue ASTERISK-5722)

........
r843 | russell | 2005-12-01 18:03:01 -0600 (Thu, 01 Dec 2005) | 2 lines

fix udev support for 2.6.15 (issue ASTERISK-5697)

........

------------------------------------------------------------------------

http://svn.digium.com/view/dahdi?view=rev&revision=844