Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make DAHDI build against Kernel 5.15 #8

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
75 changes: 21 additions & 54 deletions drivers/dahdi/dahdi-base.c
Expand Up @@ -53,7 +53,7 @@
#include <linux/ktime.h>
#include <linux/slab.h>

#if defined(HAVE_UNLOCKED_IOCTL) && defined(CONFIG_BKL)
#if defined(CONFIG_BKL)
#include <linux/smp_lock.h>
#endif

Expand Down Expand Up @@ -1015,13 +1015,22 @@ static int dahdi_proc_open(struct inode *inode, struct file *file)
return single_open(file, dahdi_seq_show, PDE_DATA(inode));
}

#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
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,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
#endif

#endif

Expand Down Expand Up @@ -2131,7 +2140,11 @@ static int dahdi_xmit(struct sk_buff *skb, struct net_device *dev)
some space for us */
ss->outwritebuf = oldbuf;
}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0)
netif_trans_update(dev);
#else
dev->trans_start = jiffies;
#endif
stats->tx_packets++;
stats->tx_bytes += ss->writen[oldbuf];
print_debug_writebuf(ss, skb, oldbuf);
Expand All @@ -2143,10 +2156,12 @@ static int dahdi_xmit(struct sk_buff *skb, struct net_device *dev)
return retval;
}

#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0)
static int dahdi_net_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
{
return hdlc_ioctl(dev, ifr, cmd);
}
#endif /* < 5.15 */

#endif

Expand Down Expand Up @@ -4060,14 +4075,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;
Expand Down Expand Up @@ -4781,8 +4788,12 @@ static void recalc_slaves(struct dahdi_chan *chan)
static const struct net_device_ops dahdi_netdev_ops = {
.ndo_open = dahdi_net_open,
.ndo_stop = dahdi_net_stop,
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0)
.ndo_siocwandev = hdlc_ioctl,
#else
.ndo_do_ioctl = dahdi_net_ioctl,
.ndo_start_xmit = dahdi_xmit,
#endif
.ndo_start_xmit = hdlc_start_xmit,
};
#endif

Expand Down Expand Up @@ -7002,15 +7013,6 @@ dahdi_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long data)
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)
{
Expand All @@ -7019,7 +7021,6 @@ static long dahdi_ioctl_compat(struct file *file, unsigned int cmd,

return dahdi_unlocked_ioctl(file, cmd, data);
}
#endif

/**
* _get_next_channo - Return the next taken channel number from the span list.
Expand Down Expand Up @@ -10274,14 +10275,8 @@ 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,
Expand All @@ -10290,14 +10285,8 @@ 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,
Expand Down Expand Up @@ -10360,15 +10349,6 @@ 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)
{
Expand All @@ -10377,18 +10357,11 @@ static long nodev_ioctl_compat(struct file *file, unsigned int cmd,

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,
Expand All @@ -10398,14 +10371,8 @@ 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,
Expand Down
9 changes: 9 additions & 0 deletions drivers/dahdi/dahdi_dynamic_ethmf.c
Expand Up @@ -733,13 +733,22 @@ static int ztdethmf_proc_open(struct inode *inode, struct file *file)
return single_open(file, ztdethmf_proc_show, NULL);
}

#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
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 = {
.open = ztdethmf_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
};
#endif
#endif

static int __init ztdethmf_init(void)
{
Expand Down
11 changes: 0 additions & 11 deletions drivers/dahdi/dahdi_transcode.c
Expand Up @@ -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;
Expand All @@ -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,
Expand Down
13 changes: 13 additions & 0 deletions drivers/dahdi/xpp/card_bri.c
Expand Up @@ -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
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
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,
Expand Down Expand Up @@ -1740,6 +1744,14 @@ static int proc_bri_info_open(struct inode *inode, struct file *file)
return single_open(file, proc_bri_info_show, PDE_DATA(inode));
}

#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
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,
Expand All @@ -1748,6 +1760,7 @@ static const struct file_operations proc_bri_info_ops = {
.release = single_release,
};
#endif
#endif

static int bri_xpd_probe(struct device *dev)
{
Expand Down
26 changes: 26 additions & 0 deletions drivers/dahdi/xpp/card_fxo.c
Expand Up @@ -107,11 +107,19 @@ 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
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
static const struct proc_ops proc_fxo_info_ops;
#else
static const struct file_operations proc_fxo_info_ops;
#endif
#ifdef WITH_METERING
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
static const struct proc_ops proc_xpd_metering_ops;
#else
static const struct file_operations proc_xpd_metering_ops;
#endif
#endif
#endif
static void dahdi_report_battery(xpd_t *xpd, lineno_t chan);
static void report_polarity_reversal(xpd_t *xpd, xportno_t portno, char *msg);

Expand Down Expand Up @@ -1484,13 +1492,22 @@ static int proc_fxo_info_open(struct inode *inode, struct file *file)
return single_open(file, proc_fxo_info_show, PDE_DATA(inode));
}

#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
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)
Expand Down Expand Up @@ -1521,13 +1538,22 @@ static int proc_xpd_metering_open(struct inode *inode, struct file *file)
return single_open(file, proc_xpd_metering_show, PDE_DATA(inode));
}

#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
static const struct proc_ops proc_xpd_metering_ops = {
.proc_open = proc_xpd_metering_open,
.proc_read = seq_read,
.proc_lseek = seq_lseek,
.proc_release = single_release,
};
#else
static const struct file_operations proc_xpd_metering_ops = {
.owner = THIS_MODULE,
.open = proc_xpd_metering_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
#endif

#endif
#endif
Expand Down