Commit 0fd6bf3e authored by Chas Williams's avatar Chas Williams Committed by David S. Miller

[ATM]: Cleanup pppoatm_ioctl_hook.

parent 0612fdbe
......@@ -129,8 +129,19 @@ EXPORT_SYMBOL(atm_clip_ops_set);
#endif
#if defined(CONFIG_PPPOATM) || defined(CONFIG_PPPOATM_MODULE)
int (*pppoatm_ioctl_hook)(struct atm_vcc *, unsigned int, unsigned long);
EXPORT_SYMBOL(pppoatm_ioctl_hook);
static DECLARE_MUTEX(pppoatm_ioctl_mutex);
static int (*pppoatm_ioctl_hook)(struct atm_vcc *, unsigned int, unsigned long);
void pppoatm_ioctl_set(int (*hook)(struct atm_vcc *, unsigned int, unsigned long))
{
down(&pppoatm_ioctl_mutex);
pppoatm_ioctl_hook = hook;
up(&pppoatm_ioctl_mutex);
}
#ifdef CONFIG_PPPOATM_MODULE
EXPORT_SYMBOL(pppoatm_ioctl_set);
#endif
#endif
#if defined(CONFIG_ATM_BR2684) || defined(CONFIG_ATM_BR2684_MODULE)
......@@ -859,12 +870,14 @@ int vcc_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
default:
break;
}
error = -ENOIOCTLCMD;
#if defined(CONFIG_PPPOATM) || defined(CONFIG_PPPOATM_MODULE)
if (pppoatm_ioctl_hook) {
down(&pppoatm_ioctl_mutex);
if (pppoatm_ioctl_hook)
error = pppoatm_ioctl_hook(vcc, cmd, arg);
if (error != -ENOIOCTLCMD)
goto done;
}
up(&pppoatm_ioctl_mutex);
if (error != -ENOIOCTLCMD)
goto done;
#endif
#if defined(CONFIG_ATM_BR2684) || defined(CONFIG_ATM_BR2684_MODULE)
if (br2684_ioctl_hook) {
......
......@@ -26,6 +26,8 @@ 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));
int atmpvc_init(void);
void atmpvc_exit(void);
int atmsvc_init(void);
......
......@@ -44,6 +44,8 @@
#include <linux/ppp_channel.h>
#include <linux/atmppp.h>
#include "common.h"
#if 0
#define DPRINTK(format, args...) \
printk(KERN_DEBUG "pppoatm: " format, ##args)
......@@ -344,17 +346,15 @@ static int pppoatm_ioctl(struct atm_vcc *atmvcc, unsigned int cmd,
/* the following avoids some spurious warnings from the compiler */
#define UNUSED __attribute__((unused))
extern int (*pppoatm_ioctl_hook)(struct atm_vcc *, unsigned int, unsigned long);
static int __init UNUSED pppoatm_init(void)
{
pppoatm_ioctl_hook = pppoatm_ioctl;
pppoatm_ioctl_set(pppoatm_ioctl);
return 0;
}
static void __exit UNUSED pppoatm_exit(void)
{
pppoatm_ioctl_hook = NULL;
pppoatm_ioctl_set(NULL);
}
module_init(pppoatm_init);
......
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