Commit 63e2c2ce authored by Chas Williams's avatar Chas Williams Committed by David S. Miller

[ATM]: Cleanup br2684_ioctl_hook.

parent 0fd6bf3e
......@@ -16,9 +16,12 @@ Author: Marcell GAL, 2000, XDSL Ltd, Hungary
#include <linux/ip.h>
#include <asm/uaccess.h>
#include <net/arp.h>
#include <linux/atm.h>
#include <linux/atmdev.h>
#include <linux/atmbr2684.h>
#include "common.h"
#include "ipcommon.h"
/*
......@@ -768,8 +771,6 @@ static struct file_operations br2684_proc_operations = {
extern struct proc_dir_entry *atm_proc_root; /* from proc.c */
extern int (*br2684_ioctl_hook)(struct atm_vcc *, unsigned int, unsigned long);
/* the following avoids some spurious warnings from the compiler */
#define UNUSED __attribute__((unused))
......@@ -779,14 +780,14 @@ static int __init UNUSED br2684_init(void)
if ((p = create_proc_entry("br2684", 0, atm_proc_root)) == NULL)
return -ENOMEM;
p->proc_fops = &br2684_proc_operations;
br2684_ioctl_hook = br2684_ioctl;
br2684_ioctl_set(br2684_ioctl);
return 0;
}
static void __exit UNUSED br2684_exit(void)
{
struct br2684_dev *brdev;
br2684_ioctl_hook = NULL;
br2684_ioctl_set(NULL);
remove_proc_entry("br2684", atm_proc_root);
while (!list_empty(&br2684_devs)) {
brdev = list_entry_brdev(br2684_devs.next);
......
......@@ -145,9 +145,18 @@ EXPORT_SYMBOL(pppoatm_ioctl_set);
#endif
#if defined(CONFIG_ATM_BR2684) || defined(CONFIG_ATM_BR2684_MODULE)
int (*br2684_ioctl_hook)(struct atm_vcc *, unsigned int, unsigned long);
static DECLARE_MUTEX(br2684_ioctl_mutex);
static int (*br2684_ioctl_hook)(struct atm_vcc *, unsigned int, unsigned long);
void br2684_ioctl_set(int (*hook)(struct atm_vcc *, unsigned int, unsigned long))
{
down(&br2684_ioctl_mutex);
br2684_ioctl_hook = hook;
up(&br2684_ioctl_mutex);
}
#ifdef CONFIG_ATM_BR2684_MODULE
EXPORT_SYMBOL(br2684_ioctl_hook);
EXPORT_SYMBOL(br2684_ioctl_set);
#endif
#endif
......@@ -880,11 +889,12 @@ int vcc_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
goto done;
#endif
#if defined(CONFIG_ATM_BR2684) || defined(CONFIG_ATM_BR2684_MODULE)
if (br2684_ioctl_hook) {
down(&br2684_ioctl_mutex);
if (br2684_ioctl_hook)
error = br2684_ioctl_hook(vcc, cmd, arg);
if (error != -ENOIOCTLCMD)
goto done;
}
up(&br2684_ioctl_mutex);
if (error != -ENOIOCTLCMD)
goto done;
#endif
error = atm_dev_ioctl(cmd, arg);
......
......@@ -27,6 +27,7 @@ int vcc_getsockopt(struct socket *sock, int level, int optname, char *optval,
void atm_shutdown_dev(struct atm_dev *dev);
void pppoatm_ioctl_set(int (*hook)(struct atm_vcc *, unsigned int, unsigned long));
void br2684_ioctl_set(int (*hook)(struct atm_vcc *, unsigned int, unsigned long));
int atmpvc_init(void);
void atmpvc_exit(void);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment