Index: pciradio.c =================================================================== RCS file: /usr/cvsroot/zaptel/pciradio.c,v retrieving revision 1.10 diff -u -r1.10 pciradio.c --- pciradio.c 24 Jan 2005 06:30:14 -0000 1.10 +++ pciradio.c 14 Apr 2005 18:08:11 -0000 @@ -1703,6 +1703,11 @@ { int res; + if (zt_conflict("ztdummy")) { + printk("Module pciradio conflicts with ztdummy. Unload ztdummy first.\n"); + return -1; + } + res = pci_module_init(&pciradio_driver); if (res) return -ENODEV; Index: tor2.c =================================================================== RCS file: /usr/cvsroot/zaptel/tor2.c,v retrieving revision 1.24 diff -u -r1.24 tor2.c --- tor2.c 15 Jan 2005 22:59:18 -0000 1.24 +++ tor2.c 14 Apr 2005 18:08:11 -0000 @@ -647,6 +647,10 @@ static int __init tor2_init(void) { int res; + if (zt_conflict("ztdummy")) { + printk("Module tor2 conflicts with ztdummy. Unload ztdummy first.\n"); + return -1; + } res = pci_module_init(&tor2_driver); printk("Registered Tormenta2 PCI\n"); return res; Index: torisa.c =================================================================== RCS file: /usr/cvsroot/zaptel/torisa.c,v retrieving revision 1.12 diff -u -r1.12 torisa.c --- torisa.c 15 Jan 2005 22:59:18 -0000 1.12 +++ torisa.c 14 Apr 2005 18:08:11 -0000 @@ -1060,6 +1060,10 @@ static int __init tor_init(void) { + if (zt_conflict("ztdummy")) { + printk("Module torisa conflicts with ztdummy. Unload ztdummy first.\n"); + return -1; + } if (!base) { printk("Specify address with base=0xNNNNN\n"); return -EIO; Index: wcfxo.c =================================================================== RCS file: /usr/cvsroot/zaptel/wcfxo.c,v retrieving revision 1.30 diff -u -r1.30 wcfxo.c --- wcfxo.c 15 Jan 2005 22:59:18 -0000 1.30 +++ wcfxo.c 14 Apr 2005 18:08:11 -0000 @@ -1000,6 +1000,10 @@ { int res; int x; + if (zt_conflict("ztdummy")) { + printk("Module wcfxo conflicts with ztdummy. Unload ztdummy first.\n"); + return -1; + } if ((opermode >= sizeof(fxo_modes) / sizeof(fxo_modes[0])) || (opermode < 0)) { printk("Invalid/unknown operating mode specified. Please choose one of:\n"); for (x=0;x #include #include +#include #ifdef CONFIG_DEVFS_FS #include #endif /* CONFIG_DEVFS_FS */ @@ -133,6 +134,7 @@ EXPORT_SYMBOL(zt_lboname); EXPORT_SYMBOL(zt_transmit); EXPORT_SYMBOL(zt_receive); +EXPORT_SYMBOL(zt_conflict); EXPORT_SYMBOL(zt_rbsbits); EXPORT_SYMBOL(zt_qevent_nolock); EXPORT_SYMBOL(zt_qevent_lock); @@ -6000,6 +6002,20 @@ } else { __zt_receive_chunk(chan, chan->readchunk); } +} + +static inline _syscall5(int,query_module,const char *,name,int,which,void *,buf,size_t,bufsize,size_t *,ret); + +int zt_conflict(const char *name) +{ + struct module_info info; + int i; + if (!query_module(name, QM_INFO, &info, sizeof(info), &i)) { + if (errno == ENOENT) { + return 0; + } + } + return 1; } int zt_transmit(struct zt_span *span) Index: zaptel.h =================================================================== RCS file: /usr/cvsroot/zaptel/zaptel.h,v retrieving revision 1.41 diff -u -r1.41 zaptel.h --- zaptel.h 21 Jan 2005 01:46:41 -0000 1.41 +++ zaptel.h 14 Apr 2005 18:08:11 -0000 @@ -1353,6 +1353,9 @@ /* Initialize a tone state */ extern void zt_init_tone_state(struct zt_tone_state *ts, struct zt_tone *zt); +/* Check if a conflicting module is loaded */ +extern int zt_conflict(const char *name); + /* Get a given DTMF or MF tone struct, suitable for zt_tone_nextsample. Set 'mf' to 0 for DTMF or 1 for MFv1 */ extern struct zt_tone *zt_dtmf_tone(char digit, int mf); Index: ztcfg.c =================================================================== RCS file: /usr/cvsroot/zaptel/ztcfg.c,v retrieving revision 1.20 diff -u -r1.20 ztcfg.c --- ztcfg.c 10 Jan 2005 04:06:49 -0000 1.20 +++ ztcfg.c 14 Apr 2005 18:08:11 -0000 @@ -1226,6 +1226,9 @@ if (errno == EINVAL) { fprintf(stderr, "Did you forget that FXS interfaces are configured with FXO signalling\n" "and that FXO interfaces use FXS signalling?\n"); + } else if (errno == EISCONN) { + /* Don't abort configuring the other channels if this is just a (preexisting) NetHDLC device */ + continue; } close(fd); exit(1); Index: ztdummy.c =================================================================== RCS file: /usr/cvsroot/zaptel/ztdummy.c,v retrieving revision 1.9 diff -u -r1.9 ztdummy.c --- ztdummy.c 21 Jan 2005 01:46:41 -0000 1.9 +++ ztdummy.c 14 Apr 2005 18:08:11 -0000 @@ -165,6 +165,10 @@ } #endif + if (zt_conflict("torisa") || zt_conflict("tor2") || zt_conflict("wct1xxp") || zt_conflict("wct4xxp") || zt_conflict("wcte11xp") || zt_conflict("wcfxo") || zt_conflict("wctdm") || zt_conflict("pciradio") || zt_conflict("wcusb") || zt_conflict("wcfxsusb")) { + printk("ztdummy may not be loaded concurrently with hardware timers.\n"); + return -1; + } ztd = kmalloc(sizeof(struct ztdummy), GFP_KERNEL); if (ztd == NULL) { printk("ztdummy: Unable to allocate memory\n");