Compare commits

..

12 Commits

Author SHA1 Message Date
Shaun Ruffell
5c840cf438 Kbuild: Rename 'hostprogs-y' to 'hostprogs'
Quiets the following warnings that are a result of commit ("kbuild: rename
hostprogs-y/always to hostprogs/always-y"
5f2fb52fac15a8a8e10ce020dd532504a8abfc4e) [1]:

  scripts/Makefile.lib:8: 'always' is deprecated. Please use 'always-y' instead
  scripts/Makefile.lib:12: 'hostprogs-y' is deprecated. Please use 'hostprogs' instead

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5f2fb52fac15a8a8e10ce02

Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
2020-11-16 22:01:24 -06:00
Shaun Ruffell
d228a12f1c vpmadt032: Create .o.cmd file for the shipped object file.
Kernel version 5.8, in commit "modpost: use read_text_file() and
get_line() for reading text files" [1] made it an error if the .o.cmd
file is missing. However, this file is not generated for shipped .o
files.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=70f30cfe5b892fcb7f98e7df72ed6ccfe3225628

Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
2020-11-16 22:01:23 -06:00
Shaun Ruffell
6d4c748e04 Remove checks for HAVE_UNLOCKED_IOCTL for kernel >= 5.9
In upstream commit (4e24566a134ea1674 "fs: remove the HAVE_UNLOCKED_IOCTL and
HAVE_COMPAT_IOCTL defines") [1] the kernel removed these defines.

All supported kernels include support for the unlocked_ioctl now, so
DAHDI can also remove these checks.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=4e24566a134ea167441a1ffa3d439a27c

Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
2020-11-16 22:01:22 -06:00
Shaun Ruffell
4df746fe3f Remove support for 32-bit userspace with 64-bit kernel
I am not aware of anyone who tests in this configuration, and I'm not
sure if it currently works. I'll remove any support for the time being
and can add it back in if someone comes forward needing support for it.

Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
2020-11-16 22:01:21 -06:00
Shaun Ruffell
97e744ad96 test: Need to add -y flags to (dnf|yum) update
Without this, the containers will hang if an update is available.
2020-02-26 08:56:44 -06:00
Shaun Ruffell
90e8a54e3a Add docker-compose.yml to be used for compile tests
Ideally this will be expanded in order to simplify compilation tests of
DAHDI on supported distributions.

Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
2020-02-23 19:39:26 -06:00
Shaun Ruffell
26fb7c34cb wctdm24xxp: Fix uninitialized variable warning.
gcc 10.x detected the following use of an uninitialized variable:

  ../drivers/dahdi/wctdm24xxp/xhfc.c: In function 'wctdm_init_b400m':
  ../drivers/dahdi/wctdm24xxp/xhfc.c:624:5: warning: 'x' may be used uninitialized in this function [-Wmaybe-uninitialized]
    624 |  if (*lastreg != (unsigned char)addr) {
        |     ^
  ../drivers/dahdi/wctdm24xxp/xhfc.c:2557:20: note: 'x' was declared here
   2557 |  unsigned char id, x;
        |

Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
2020-02-23 19:39:25 -06:00
Shaun Ruffell
34b9c77c9a Use proc_ops on kernels >= 5.6
In commit (d56c0d45f0e27 "proc: decouple proc from VFS with "struct proc_ops"")
[1], proc_create_data no longer takes a file_operations structure, but instead
takes a struct proc_ops in order to conserve memory in the kernel.

This change is necessary for DAHDI to work with kernels >= 5.6

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d56c0d45f0e27f814e87a1676b6bd

Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
2020-02-23 19:39:24 -06:00
Shaun Ruffell
c98f59eead Makefile: 'M=' is preferred to 'KBUILD_EXTMOD=' for external modules.
I should have used 'M=' in (e93c53ce05 "Makefile: SUBDIRS ->
KBUILD_EXTMOD") originally.

See:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/kbuild/modules.rst?h=v5.3#n77
Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
2019-11-20 22:53:18 -06:00
Shaun Ruffell
ac300cd895 wcte13xp: Fix unintended fall through in t13x_set_linemode for J1
Found by GCC with -Wimplicit-fallthrough.

Also fix the log message to report that the mode was switched to J1 mode.

Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
2019-09-24 20:18:31 -05:00
Shaun Ruffell
6e5197fed4 Annotate switch-case fall through
Quiets warnings like:
  drivers/dahdi/dahdi-base.c:8494:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
     if (chan->txstate != DAHDI_TXSTATE_OFFHOOK) break;
        ^

Needed since Linux 5.4 commit (a035d552a93bb9ef60487, "Makefile: Globally enable
fall-33bb9f2a0dc857ff869through warning") [1]

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a035d552a93bb9ef6048733bb9f2a0dc857

Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
2019-09-24 20:12:36 -05:00
Shaun Ruffell
45ac6a30f9 voicebus, wcaxx, wct4xxp: Remove include of pci-aspm.h
Linux 5.4, in commit  (7ce2e76a0420801fb4b53b9e685094 "PCI: Move ASPM
declarations to linux/pci.h") [1], removed pci-aspm.h.

This commit removes the global include of pci-aspm.h in include/dahdi/kernel.h
(because it only pertains to certain drivers), and moves the conditional include
into only the drivers that need it.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=7ce2e76a0420801fb4b53b9e685094

Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
2019-09-24 19:51:22 -05:00
28 changed files with 392 additions and 161 deletions

2
.gitignore vendored
View File

@@ -3,6 +3,7 @@
/.pc
.cache.mk
*.[oa]
*.mod
*.mod.[oc]
@@ -16,6 +17,7 @@ cscope.*
*.symvers
*.markers
.*.o.d
*.ur-safe
README.html
modules.order

View File

@@ -53,7 +53,7 @@ INST_HEADERS:=kernel.h user.h fasthdlc.h wctdm_user.h dahdi_config.h
DAHDI_BUILD_ALL:=m
KMAKE=+$(MAKE) -C $(KSRC) KBUILD_EXTMOD=$(PWD)/drivers/dahdi DAHDI_INCLUDE=$(PWD)/include DAHDI_MODULES_EXTRA="$(DAHDI_MODULES_EXTRA)" HOTPLUG_FIRMWARE=$(HOTPLUG_FIRMWARE)
KMAKE=+$(MAKE) -C $(KSRC) M=$(PWD)/drivers/dahdi DAHDI_INCLUDE=$(PWD)/include DAHDI_MODULES_EXTRA="$(DAHDI_MODULES_EXTRA)" HOTPLUG_FIRMWARE=$(HOTPLUG_FIRMWARE)
ROOT_PREFIX:=

57
docker-compose.yml Normal file
View File

@@ -0,0 +1,57 @@
version: '3'
services:
test-centos7:
build:
context: ./
dockerfile: test/docker/centos7
volumes:
- ./:/source
network_mode: "host"
security_opt:
- label=type:container_runtime_t
tty: true
test-centos6:
build:
context: ./
dockerfile: test/docker/centos6
volumes:
- ./:/source
network_mode: "host"
security_opt:
- label=type:container_runtime_t
tty: true
test-debianstable:
build:
context: ./
dockerfile: test/docker/debianstable
volumes:
- ./:/source
network_mode: "host"
security_opt:
- label=type:container_runtime_t
tty: true
test-debiantesting:
build:
context: ./
dockerfile: test/docker/debiantesting
volumes:
- ./:/source
network_mode: "host"
security_opt:
- label=type:container_runtime_t
tty: true
test-fedorarawhide:
build:
context: ./
dockerfile: test/docker/fedorarawhide
volumes:
- ./:/source
network_mode: "host"
security_opt:
- label=type:container_runtime_t
tty: true

View File

@@ -127,6 +127,7 @@ dahdi_vpmadt032_loader-objs := vpmadt032_loader/dahdi_vpmadt032_loader.o
ifneq ($(DAHDI_ARCH),)
ifneq ($(wildcard $(src)/vpmadt032_loader/vpmadt032_$(DAHDI_ARCH).o_shipped),)
$(shell touch $(KBUILD_EXTMOD)/vpmadt032_loader/.vpmadt032_$(DAHDI_ARCH).o.cmd)
VPMADT032_LOADER_PRESENT=yes
dahdi_vpmadt032_loader-objs += vpmadt032_loader/vpmadt032_$(DAHDI_ARCH).o
obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_VPMADT032_LOADER) += dahdi_vpmadt032_loader.o
@@ -152,7 +153,7 @@ obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_ECHOCAN_HPEC) += dahdi_echocan_hpec.o
endif
hostprogs-y := makefw
hostprogs := makefw

View File

@@ -53,10 +53,6 @@
#include <linux/ktime.h>
#include <linux/slab.h>
#if defined(HAVE_UNLOCKED_IOCTL) && defined(CONFIG_BKL)
#include <linux/smp_lock.h>
#endif
#include <linux/ppp_defs.h>
#include <asm/atomic.h>
@@ -1015,6 +1011,14 @@ static int dahdi_proc_open(struct inode *inode, struct file *file)
return single_open(file, dahdi_seq_show, PDE_DATA(inode));
}
#ifdef DAHDI_HAVE_PROC_OPS
static const struct proc_ops dahdi_proc_ops = {
.proc_open = dahdi_proc_open,
.proc_read = seq_read,
.proc_lseek = seq_lseek,
.proc_release = single_release,
};
#else
static const struct file_operations dahdi_proc_ops = {
.owner = THIS_MODULE,
.open = dahdi_proc_open,
@@ -1022,6 +1026,7 @@ static const struct file_operations dahdi_proc_ops = {
.llseek = seq_lseek,
.release = single_release,
};
#endif /* DAHDI_HAVE_PROC_OPS */
#endif
@@ -4060,14 +4065,6 @@ dahdi_timer_unlocked_ioctl(struct file *file, unsigned int cmd,
return 0;
}
#ifndef HAVE_UNLOCKED_IOCTL
static int dahdi_timer_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long data)
{
return dahdi_timer_unlocked_ioctl(file, cmd, data);
}
#endif
static int dahdi_ioctl_getgains(struct file *file, unsigned long data)
{
int res = 0;
@@ -7002,25 +6999,6 @@ exit:
return ret;
}
#ifndef HAVE_UNLOCKED_IOCTL
static int dahdi_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long data)
{
return dahdi_unlocked_ioctl(file, cmd, data);
}
#endif
#ifdef HAVE_COMPAT_IOCTL
static long dahdi_ioctl_compat(struct file *file, unsigned int cmd,
unsigned long data)
{
if (cmd == DAHDI_SFCONFIG)
return -ENOTTY; /* Not supported yet */
return dahdi_unlocked_ioctl(file, cmd, data);
}
#endif
/**
* _get_next_channo - Return the next taken channel number from the span list.
* @span: The span with which to start the search.
@@ -7943,7 +7921,7 @@ static inline void __dahdi_process_getaudio_chunk(struct dahdi_chan *ss, unsigne
memset(getlin, 0, DAHDI_CHUNKSIZE * sizeof(short));
txb[0] = DAHDI_LIN2X(0, ms);
memset(txb + 1, txb[0], DAHDI_CHUNKSIZE - 1);
/* fall through to normal conf mode */
/* fallthrough */
case DAHDI_CONF_CONF: /* Normal conference mode */
if (is_pseudo_chan(ms)) /* if pseudo-channel */
{
@@ -8506,7 +8484,7 @@ static void __dahdi_hooksig_pvt(struct dahdi_chan *chan, enum dahdi_rxsig rxsig)
break;
}
#endif
/* fall through intentionally */
/* fallthrough */
case DAHDI_SIG_FXSGS: /* FXS Groundstart */
if (rxsig == DAHDI_RXSIG_ONHOOK) {
chan->ringdebtimer = RING_DEBOUNCE_TIME;
@@ -8525,7 +8503,7 @@ static void __dahdi_hooksig_pvt(struct dahdi_chan *chan, enum dahdi_rxsig rxsig)
chan->gotgs = 1;
}
}
/* fall through intentionally */
/* fallthrough */
case DAHDI_SIG_FXOLS: /* FXO Loopstart */
case DAHDI_SIG_FXOKS: /* FXO Kewlstart */
switch(rxsig) {
@@ -10274,14 +10252,7 @@ static const struct file_operations dahdi_fops = {
.owner = THIS_MODULE,
.open = dahdi_open,
.release = dahdi_release,
#ifdef HAVE_UNLOCKED_IOCTL
.unlocked_ioctl = dahdi_unlocked_ioctl,
#ifdef HAVE_COMPAT_IOCTL
.compat_ioctl = dahdi_ioctl_compat,
#endif
#else
.ioctl = dahdi_ioctl,
#endif
.poll = dahdi_poll,
.read = dahdi_no_read,
.write = dahdi_no_write,
@@ -10290,14 +10261,7 @@ static const struct file_operations dahdi_fops = {
static const struct file_operations dahdi_timer_fops = {
.owner = THIS_MODULE,
.release = dahdi_timer_release,
#ifdef HAVE_UNLOCKED_IOCTL
.unlocked_ioctl = dahdi_timer_unlocked_ioctl,
#ifdef HAVE_COMPAT_IOCTL
.compat_ioctl = dahdi_timer_unlocked_ioctl,
#endif
#else
.ioctl = dahdi_timer_ioctl,
#endif
.poll = dahdi_timer_poll,
.read = dahdi_no_read,
.write = dahdi_no_write,
@@ -10360,35 +10324,9 @@ nodev_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long data)
return nodev_common("ioctl");
}
#ifndef HAVE_UNLOCKED_IOCTL
static int nodev_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long data)
{
return nodev_unlocked_ioctl(file, cmd, data);
}
#endif
#ifdef HAVE_COMPAT_IOCTL
static long nodev_ioctl_compat(struct file *file, unsigned int cmd,
unsigned long data)
{
if (cmd == DAHDI_SFCONFIG)
return -ENOTTY; /* Not supported yet */
return nodev_unlocked_ioctl(file, cmd, data);
}
#endif
static const struct file_operations nodev_fops = {
.owner = THIS_MODULE,
#ifdef HAVE_UNLOCKED_IOCTL
.unlocked_ioctl = nodev_unlocked_ioctl,
#ifdef HAVE_COMPAT_IOCTL
.compat_ioctl = nodev_ioctl_compat,
#endif
#else
.ioctl = nodev_ioctl,
#endif
.read = nodev_chan_read,
.write = nodev_chan_write,
.poll = nodev_chan_poll,
@@ -10398,14 +10336,7 @@ static const struct file_operations dahdi_chan_fops = {
.owner = THIS_MODULE,
.open = dahdi_open,
.release = dahdi_release,
#ifdef HAVE_UNLOCKED_IOCTL
.unlocked_ioctl = dahdi_unlocked_ioctl,
#ifdef HAVE_COMPAT_IOCTL
.compat_ioctl = dahdi_ioctl_compat,
#endif
#else
.ioctl = dahdi_ioctl,
#endif
.read = dahdi_chan_read,
.write = dahdi_chan_write,
.poll = dahdi_chan_poll,

View File

@@ -733,12 +733,22 @@ static int ztdethmf_proc_open(struct inode *inode, struct file *file)
return single_open(file, ztdethmf_proc_show, NULL);
}
static const struct file_operations ztdethmf_proc_fops = {
.open = ztdethmf_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
#ifdef DAHDI_HAVE_PROC_OPS
static const struct proc_ops ztdethmf_proc_fops = {
.proc_open = ztdethmf_proc_open,
.proc_read = seq_read,
.proc_lseek = seq_lseek,
.proc_release = seq_release,
};
#else
static const struct file_operations ztdethmf_proc_fops = {
.owner = THIS_MODULE,
.open = ztdethmf_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
};
#endif /* DAHDI_HAVE_PROC_OPS */
#endif
static int __init ztdethmf_init(void)

View File

@@ -397,13 +397,6 @@ static long dahdi_tc_unlocked_ioctl(struct file *file, unsigned int cmd, unsigne
};
}
#ifndef HAVE_UNLOCKED_IOCTL
static int dahdi_tc_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long data)
{
return (int)dahdi_tc_unlocked_ioctl(file, cmd, data);
}
#endif
static unsigned int dahdi_tc_poll(struct file *file, struct poll_table_struct *wait_table)
{
int ret;
@@ -427,11 +420,7 @@ static struct file_operations __dahdi_transcode_fops = {
.owner = THIS_MODULE,
.open = dahdi_tc_open,
.release = dahdi_tc_release,
#ifdef HAVE_UNLOCKED_IOCTL
.unlocked_ioctl = dahdi_tc_unlocked_ioctl,
#else
.ioctl = dahdi_tc_ioctl,
#endif
.read = dahdi_tc_read,
.write = dahdi_tc_write,
.poll = dahdi_tc_poll,

View File

@@ -8,7 +8,7 @@ PWD=$(shell pwd)
MODULESO:=$(MODULES:%=%.o)
MODULESKO:=$(MODULES:%=%.ko)
KMAKE = $(MAKE) -C $(KSRC) KBUILD_EXTMOD=$(PWD)
KMAKE = $(MAKE) -C $(KSRC) M=$(PWD)
KMAKE_INST = $(KMAKE) \
INSTALL_MOD_PATH=$(INSTALL_PREFIX) INSTALL_MOD_DIR=misc modules_install

View File

@@ -64,7 +64,11 @@
* platform does not support it.
*
*/
#undef CONFIG_VOICEBUS_DISABLE_ASPM
#ifdef CONFIG_VOICEBUS_DISABLE_ASPM
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0)
#include <linux/pci-aspm.h>
#endif
#endif
/* Define this to use a FIFO for the software echocan reference.
* (experimental) */

View File

@@ -67,6 +67,12 @@
#include "wcxb_spi.h"
#include "wcxb_flash.h"
#ifdef CONFIG_VOICEBUS_DISABLE_ASPM
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0)
#include <linux/pci-aspm.h>
#endif
#endif
/*!
* \brief Default ringer debounce (in ms)
*/
@@ -1446,11 +1452,13 @@ wcaxx_check_battery_lost(struct wcaxx *wc, struct wcaxx_module *const mod)
break;
case BATTERY_UNKNOWN:
mod_hooksig(wc, mod, DAHDI_RXSIG_ONHOOK);
/* fallthrough */
case BATTERY_PRESENT:
fxo->battery_state = BATTERY_DEBOUNCING_LOST;
fxo->battdebounce_timer = wc->framecount + battdebounce;
break;
case BATTERY_DEBOUNCING_LOST_FROM_PRESENT_ALARM:
/* fallthrough */
case BATTERY_DEBOUNCING_LOST: /* Intentional drop through */
if (time_after(wc->framecount, fxo->battdebounce_timer)) {
if (debug) {
@@ -1501,7 +1509,8 @@ wcaxx_check_battery_present(struct wcaxx *wc, struct wcaxx_module *const mod)
switch (fxo->battery_state) {
case BATTERY_DEBOUNCING_PRESENT_FROM_LOST_ALARM:
case BATTERY_DEBOUNCING_PRESENT: /* intentional drop through */
/* fallthrough */
case BATTERY_DEBOUNCING_PRESENT:
if (time_after(wc->framecount, fxo->battdebounce_timer)) {
if (debug) {
dev_info(&wc->xb.pdev->dev,
@@ -1554,7 +1563,8 @@ wcaxx_check_battery_present(struct wcaxx *wc, struct wcaxx_module *const mod)
break;
case BATTERY_UNKNOWN:
mod_hooksig(wc, mod, DAHDI_RXSIG_OFFHOOK);
case BATTERY_LOST: /* intentional drop through */
/* fallthrough */
case BATTERY_LOST:
fxo->battery_state = BATTERY_DEBOUNCING_PRESENT;
fxo->battdebounce_timer = wc->framecount + battdebounce;
break;

View File

@@ -87,6 +87,12 @@
*/
/* #define CONFIG_WCT4XXP_DISABLE_ASPM */
#ifdef CONFIG_WCT4XXP_DISABLE_ASPM
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0)
#include <linux/pci-aspm.h>
#endif
#endif
#if defined(CONFIG_FORCE_EXTENDED_RESET) && defined(CONFIG_NOEXTENDED_RESET)
#error "You cannot define both CONFIG_FORCE_EXTENDED_RESET and " \
"CONFIG_NOEXTENDED_RESET."

View File

@@ -1955,12 +1955,14 @@ wctdm_check_battery_lost(struct wctdm *wc, struct wctdm_module *const mod)
break;
case BATTERY_UNKNOWN:
mod_hooksig(wc, mod, DAHDI_RXSIG_ONHOOK);
/* fallthrough */
case BATTERY_PRESENT:
fxo->battery_state = BATTERY_DEBOUNCING_LOST;
fxo->battdebounce_timer = wc->framecount + battdebounce;
break;
case BATTERY_DEBOUNCING_LOST_FROM_PRESENT_ALARM:
case BATTERY_DEBOUNCING_LOST: /* Intentional drop through */
/* fallthrough */
case BATTERY_DEBOUNCING_LOST:
if (time_after(wc->framecount, fxo->battdebounce_timer)) {
if (debug) {
dev_info(&wc->vb.pdev->dev,
@@ -2063,7 +2065,8 @@ wctdm_check_battery_present(struct wctdm *wc, struct wctdm_module *const mod)
break;
case BATTERY_UNKNOWN:
mod_hooksig(wc, mod, DAHDI_RXSIG_OFFHOOK);
case BATTERY_LOST: /* intentional drop through */
/* fallthrough */
case BATTERY_LOST:
fxo->battery_state = BATTERY_DEBOUNCING_PRESENT;
fxo->battdebounce_timer = wc->framecount + battdebounce;
break;

View File

@@ -2558,9 +2558,10 @@ static int b400m_probe(struct wctdm *wc, int modpos)
struct b400m *b4;
unsigned long flags;
int chiprev;
u8 lastreg = 0;
wctdm_setreg(wc, &wc->mods[modpos], 0x10, 0x10);
id = xhfc_getreg(wc, &wc->mods[modpos], R_CHIP_ID, &x);
id = xhfc_getreg(wc, &wc->mods[modpos], R_CHIP_ID, &lastreg);
/* chip ID high 7 bits must be 0x62, see datasheet */
if ((id & 0xfe) != 0x62)
@@ -2575,6 +2576,7 @@ static int b400m_probe(struct wctdm *wc, int modpos)
/* card found, enabled and main struct allocated. Fill it out. */
b4->wc = wc;
b4->lastreg = lastreg;
b4->position = modpos;
/* which B400M in the system is this one? count all of them found so

View File

@@ -1872,9 +1872,10 @@ static int t13x_set_linemode(struct dahdi_span *span, enum spantypes linemode)
break;
case SPANTYPE_DIGITAL_J1:
dev_info(&wc->xb.pdev->dev,
"Changing from %s to E1 line mode.\n",
"Changing from %s to J1 line mode.\n",
dahdi_spantype2str(wc->span.spantype));
res = t13x_software_init(wc, J1);
break;
default:
dev_err(&wc->xb.pdev->dev,
"Got invalid linemode '%s' from dahdi\n",

View File

@@ -57,8 +57,8 @@ xpp_verified = $(foreach file, $(xpp_verifications), $(file).verified)
FXO_MODES = $(src)/../fxo_modes.h
FXO_VERIFY = $(obj)/init_card_2_$(XPP_PROTOCOL_VERSION) -v $(obj)/init_fxo_modes
hostprogs-y := print_fxo_modes
always := $(xpp_verified)
hostprogs := print_fxo_modes
always-y := $(xpp_verified)
print_fxo_modes-objs := print_fxo_modes.o
HOSTCFLAGS_print_fxo_modes.o += -include $(FXO_MODES)

View File

@@ -153,8 +153,12 @@ static int write_state_register(xpd_t *xpd, __u8 value);
static bool bri_packet_is_valid(xpacket_t *pack);
static void bri_packet_dump(const char *msg, xpacket_t *pack);
#ifdef CONFIG_PROC_FS
#ifdef DAHDI_HAVE_PROC_OPS
static const struct proc_ops proc_bri_info_ops;
#else
static const struct file_operations proc_bri_info_ops;
#endif
#endif
static int bri_spanconfig(struct file *file, struct dahdi_span *span,
struct dahdi_lineconfig *lc);
static int bri_chanconfig(struct file *file, struct dahdi_chan *chan,
@@ -1740,13 +1744,22 @@ static int proc_bri_info_open(struct inode *inode, struct file *file)
return single_open(file, proc_bri_info_show, PDE_DATA(inode));
}
static const struct file_operations proc_bri_info_ops = {
.owner = THIS_MODULE,
.open = proc_bri_info_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
#ifdef DAHDI_HAVE_PROC_OPS
static const struct proc_ops proc_bri_info_ops = {
.proc_open = proc_bri_info_open,
.proc_read = seq_read,
.proc_lseek = seq_lseek,
.proc_release = single_release,
};
#else
static const struct file_operations proc_bri_info_ops = {
.owner = THIS_MODULE,
.open = proc_bri_info_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
#endif /* DAHDI_HAVE_PROC_OPS */
#endif
static int bri_xpd_probe(struct device *dev)

View File

@@ -107,9 +107,13 @@ enum fxo_leds {
static bool fxo_packet_is_valid(xpacket_t *pack);
static void fxo_packet_dump(const char *msg, xpacket_t *pack);
#ifdef CONFIG_PROC_FS
#ifdef DAHDI_HAVE_PROC_OPS
static const struct proc_ops proc_fxo_info_ops;
#else
static const struct file_operations proc_fxo_info_ops;
#endif
#ifdef WITH_METERING
static const struct file_operations proc_xpd_metering_ops;
static const struct proc_ops proc_xpd_metering_ops;
#endif
#endif
static void dahdi_report_battery(xpd_t *xpd, lineno_t chan);
@@ -1484,13 +1488,22 @@ static int proc_fxo_info_open(struct inode *inode, struct file *file)
return single_open(file, proc_fxo_info_show, PDE_DATA(inode));
}
static const struct file_operations proc_fxo_info_ops = {
.owner = THIS_MODULE,
.open = proc_fxo_info_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
#ifdef DAHDI_HAVE_PROC_OPS
static const struct proc_ops proc_fxo_info_ops = {
.proc_open = proc_fxo_info_open,
.proc_read = seq_read,
.proc_lseek = seq_lseek,
.proc_release = single_release,
};
#else
static const struct file_operations proc_fxo_info_ops = {
.owner = THIS_MODULE,
.open = proc_fxo_info_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
#endif
#ifdef WITH_METERING
static int proc_xpd_metering_show(struct seq_file *sfile, void *not_used)

View File

@@ -160,11 +160,19 @@ enum neon_state {
static bool fxs_packet_is_valid(xpacket_t *pack);
static void fxs_packet_dump(const char *msg, xpacket_t *pack);
#ifdef CONFIG_PROC_FS
#ifdef DAHDI_HAVE_PROC_OPS
static const struct proc_ops proc_fxs_info_ops;
#else
static const struct file_operations proc_fxs_info_ops;
#endif
#ifdef WITH_METERING
#ifdef DAHDI_HAVE_PROC_OPS
static const struct proc_ops proc_xpd_metering_ops;
#else
static const struct file_operations proc_xpd_metering_ops;
#endif
#endif
#endif
static void start_stop_vm_led(xbus_t *xbus, xpd_t *xpd, lineno_t pos);
#define PROC_FXS_INFO_FNAME "fxs_info"
@@ -2115,13 +2123,22 @@ static int proc_fxs_info_open(struct inode *inode, struct file *file)
return single_open(file, proc_fxs_info_show, PDE_DATA(inode));
}
static const struct file_operations proc_fxs_info_ops = {
.owner = THIS_MODULE,
.open = proc_fxs_info_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
#ifdef DAHDI_HAVE_PROC_OPS
static const struct proc_ops proc_fxs_info_ops = {
.proc_open = proc_fxs_info_open,
.proc_read = seq_read,
.proc_lseek = seq_lseek,
.proc_release = single_release,
};
#else
static const struct file_operations proc_fxs_info_ops = {
.owner = THIS_MODULE,
.open = proc_fxs_info_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
#endif
#ifdef WITH_METERING
static ssize_t proc_xpd_metering_write(struct file *file,
@@ -2165,12 +2182,20 @@ static int proc_xpd_metering_open(struct inode *inode, struct file *file)
file->private_data = PDE_DATA(inode);
}
#ifdef DAHDI_HAVE_PROC_OPS
static const struct proc_ops proc_xpd_metering_ops = {
.proc_open = proc_xpd_metering_open,
.proc_write = proc_xpd_metering_write,
.proc_release = single_release,
};
#else
static const struct file_operations proc_xpd_metering_ops = {
.owner = THIS_MODULE,
.open = proc_xpd_metering_open,
.write = proc_xpd_metering_write,
.release = single_release,
};
#endif /* DAHDI_HAVE_PROC_OPS */
#endif
#endif

View File

@@ -50,8 +50,15 @@ static const char rcsid[] = "$Id$";
#ifdef PROTOCOL_DEBUG
#ifdef CONFIG_PROC_FS
#define PROC_XBUS_COMMAND "command"
#ifdef DAHDI_HAVE_PROC_OPS
static const struct proc_ops proc_xbus_command_ops;
#else
static const struct file_operations proc_xbus_command_ops;
#endif /* DAHDI_HAVE_PROC_OPS */
#endif
#endif
/* Command line parameters */
@@ -65,8 +72,15 @@ static DEF_PARM_BOOL(dahdi_autoreg, 0, 0444,
"Register devices automatically (1) or not (0). UNUSED.");
#ifdef CONFIG_PROC_FS
#ifdef DAHDI_HAVE_PROC_OPS
static const struct proc_ops xbus_read_proc_ops;
#else
static const struct file_operations xbus_read_proc_ops;
#endif
#endif /* DAHDI_HAVE_PROC_OPS */
#endif /* CONFIG_PROC_FS */
static void transport_init(xbus_t *xbus, struct xbus_ops *ops,
ushort max_send_size,
struct device *transport_device, void *priv);
@@ -1828,13 +1842,22 @@ static int xbus_read_proc_open(struct inode *inode, struct file *file)
return single_open(file, xbus_proc_show, PDE_DATA(inode));
}
static const struct file_operations xbus_read_proc_ops = {
.owner = THIS_MODULE,
.open = xbus_read_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
#ifdef DAHDI_HAVE_PROC_OPS
static const struct proc_ops xbus_read_proc_ops = {
.proc_open = xbus_read_proc_open,
.proc_read = seq_read,
.proc_lseek = seq_lseek,
.proc_release = single_release,
};
#else
static const struct file_operations xbus_read_proc_ops = {
.owner = THIS_MODULE,
.open = xbus_read_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
#endif /* DAHDI_HAVE_PROC_OPS */
#ifdef PROTOCOL_DEBUG
static ssize_t proc_xbus_command_write(struct file *file,
@@ -1927,11 +1950,19 @@ static int proc_xbus_command_open(struct inode *inode, struct file *file)
return 0;
}
#ifdef DAHDI_HAVE_PROC_OPS
static const struct proc_ops proc_xbus_command_ops = {
.proc_open = proc_xbus_command_open,
.proc_write = proc_xbus_command_write,
};
#else
static const struct file_operations proc_xbus_command_ops = {
.owner = THIS_MODULE,
.open = proc_xbus_command_open,
.write = proc_xbus_command_write,
};
#endif /* DAHDI_HAVE_PROC_OPS */
#endif
static int xpp_proc_read_show(struct seq_file *sfile, void *data)
@@ -1961,13 +1992,22 @@ static int xpp_proc_read_open(struct inode *inode, struct file *file)
return single_open(file, xpp_proc_read_show, PDE_DATA(inode));
}
static const struct file_operations xpp_proc_read_ops = {
.owner = THIS_MODULE,
.open = xpp_proc_read_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
#ifdef DAHDI_HAVE_PROC_OPS
static const struct proc_ops xpp_proc_read_ops = {
.proc_open = xpp_proc_read_open,
.proc_read = seq_read,
.proc_lseek = seq_lseek,
.proc_release = single_release,
};
#else
static const struct file_operations xpp_proc_read_ops = {
.owner = THIS_MODULE,
.open = xpp_proc_read_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
#endif /* DAHDI_HAVE_PROC_OPS */
#endif

View File

@@ -103,8 +103,12 @@ int total_registered_spans(void)
}
#ifdef CONFIG_PROC_FS
#ifdef DAHDI_HAVE_PROC_OPS
static const struct proc_ops xpd_read_proc_ops;
#else
static const struct file_operations xpd_read_proc_ops;
#endif
#endif
/*------------------------- XPD Management -------------------------*/
@@ -392,13 +396,22 @@ static int xpd_read_proc_open(struct inode *inode, struct file *file)
return single_open(file, xpd_read_proc_show, PDE_DATA(inode));
}
static const struct file_operations xpd_read_proc_ops = {
.owner = THIS_MODULE,
.open = xpd_read_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
#ifdef DAHDI_HAVE_PROC_OPS
static const struct proc_ops xpd_read_proc_ops = {
.proc_open = xpd_read_proc_open,
.proc_read = seq_read,
.proc_lseek = seq_lseek,
.proc_release = single_release,
};
#else
static const struct file_operations xpd_read_proc_ops = {
.owner = THIS_MODULE,
.open = xpd_read_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
#endif
#endif

View File

@@ -227,9 +227,14 @@ static void xpp_receive_callback(struct urb *urb);
static int xusb_probe(struct usb_interface *interface,
const struct usb_device_id *id);
static void xusb_disconnect(struct usb_interface *interface);
#ifdef CONFIG_PROC_FS
#ifdef CONFIG_PROC_FS
#ifdef DAHDI_HAVE_PROC_OPS
static const struct proc_ops xusb_read_proc_ops;
#else
static const struct file_operations xusb_read_proc_ops;
#endif
#endif
/*------------------------------------------------------------------*/
@@ -1108,13 +1113,22 @@ static int xusb_read_proc_open(struct inode *inode, struct file *file)
return single_open(file, xusb_read_proc_show, PDE_DATA(inode));
}
static const struct file_operations xusb_read_proc_ops = {
.owner = THIS_MODULE,
.open = xusb_read_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
#ifdef DAHDI_HAVE_PROC_OPS
static const struct proc_ops xusb_read_proc_ops = {
.proc_open = xusb_read_proc_open,
.proc_read = seq_read,
.proc_lseek = seq_lseek,
.proc_release = single_release,
};
#else
static const struct file_operations xusb_read_proc_ops = {
.owner = THIS_MODULE,
.open = xusb_read_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
#endif
#endif

View File

@@ -58,14 +58,12 @@
#include <linux/poll.h>
#ifdef CONFIG_PCI
#include <linux/pci-aspm.h>
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29)
#define HAVE_NET_DEVICE_OPS
#endif
#define DAHDI_HAVE_PROC_OPS
/* __dev* were removed in 3.8. They still have effect in 2.6.18. */
#ifndef __devinit
# define __devinit
@@ -1373,6 +1371,10 @@ static inline short dahdi_txtone_nextsample(struct dahdi_chan *ss)
/*! Maximum audio mask */
#define DAHDI_FORMAT_AUDIO_MASK ((1 << 16) - 1)
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 6, 0)
#undef DAHDI_HAVE_PROC_OPS
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
#ifndef TIMER_DATA_TYPE
@@ -1483,14 +1485,13 @@ static inline void *PDE_DATA(const struct inode *inode)
#endif /* 4.10.0 */
#endif /* 4.11.0 */
#endif /* 4.13.0 */
#else /* >= 4.15.0 */
#endif /* 4.15.0 */
#endif /* 5.6 */
#ifndef TIMER_DATA_TYPE
#define TIMER_DATA_TYPE struct timer_list *
#endif
#endif /* 4.15.0 */
#ifndef dahdi_ktime_equal
static inline int dahdi_ktime_equal(const ktime_t cmp1, const ktime_t cmp2)
{

10
test/docker/centos6 Normal file
View File

@@ -0,0 +1,10 @@
FROM centos:6
RUN yum update -y
RUN yum install -y \
gcc \
git \
make \
wget
RUN yum install -y kernel-devel
CMD ["/source/test/test-build.sh"]

10
test/docker/centos7 Normal file
View File

@@ -0,0 +1,10 @@
FROM centos:7
RUN yum update -y
RUN yum install -y \
gcc \
git \
make \
wget
RUN yum install -y kernel-devel.x86_64 0:3.10.0-1062.12.1
CMD ["/source/test/test-build.sh"]

12
test/docker/debianstable Normal file
View File

@@ -0,0 +1,12 @@
FROM debian:stable
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get install -y \
gcc \
git \
linux-headers-amd64 \
make \
wget
CMD ["/source/test/test-build.sh"]

12
test/docker/debiantesting Normal file
View File

@@ -0,0 +1,12 @@
FROM debian:testing
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get install -y \
gcc \
git \
linux-headers-amd64 \
make \
wget
CMD ["/source/test/test-build.sh"]

11
test/docker/fedorarawhide Normal file
View File

@@ -0,0 +1,11 @@
FROM fedora:rawhide
RUN dnf update -y && dnf install -y \
diffutils \
gcc \
git \
kmod \
make \
wget
RUN dnf update -y && dnf install -y kernel-devel
CMD ["/source/test/test-build.sh"]

41
test/test-build.sh Executable file
View File

@@ -0,0 +1,41 @@
#!/bin/sh
set -e
if [ "$1" != "" ]; then
JOBS=$1
fi
if command -v apt >/dev/null; then
if [ ! -e /root/last-update ]; then
date > /root/last-update
fi
if [ -z "$(find /root/last-update -mmin -60)" ]; then
apt-get update && apt-get install -y linux-headers-amd64
date > /root/last-update
fi
KERNELS=$(find /usr/src -maxdepth 1 -type d -name 'linux-headers-*' -not -name '*common*')
else
if command -v dnf > /dev/null ; then
dnf update -y dnf kernel-devel
else
yum update -y kernel-devel
fi
KERNELS=$(find /usr/src/kernels -maxdepth 1 -type d -regextype sed -regex '.*[.]\(el\|fc\).*')
fi
if [ "$KERNELS" = "" ]; then
echo >&2 "Failed to find any kernels"
exit 1
fi
# Copy the source into the container so we can run builds in parallel
rm -fr /root/code
cp -fr /source /root/code
cd /root/code
for KSRC in $KERNELS ; do
echo "Building against $KSRC"
export KSRC=$KSRC
make -s clean
make -s -j $(grep -c "^processor" /proc/cpuinfo)
done