Commit 865f31e0 authored by David S. Miller's avatar David S. Miller

Merge bk://kernel.bkbits.net/acme/net-2.5

into nuts.ninka.net:/home/davem/src/BK/net-2.5
parents bb923b74 a59e8eb9
...@@ -1636,9 +1636,10 @@ int __init sdla_init(struct net_device *dev) ...@@ -1636,9 +1636,10 @@ int __init sdla_init(struct net_device *dev)
dev->change_mtu = sdla_change_mtu; dev->change_mtu = sdla_change_mtu;
dev->type = 0xFFFF; dev->type = 0xFFFF;
dev->hard_header_len = 0; dev->hard_header_len = 0;
dev->addr_len = 0; dev->addr_len = 0;
dev->mtu = SDLA_MAX_MTU; dev->mtu = SDLA_MAX_MTU;
SET_MODULE_OWNER(dev);
flp->activate = sdla_activate; flp->activate = sdla_activate;
flp->deactivate = sdla_deactivate; flp->deactivate = sdla_deactivate;
......
...@@ -914,7 +914,6 @@ static int if_init(struct net_device* dev) ...@@ -914,7 +914,6 @@ static int if_init(struct net_device* dev)
dev->get_stats = &if_stats; dev->get_stats = &if_stats;
dev->tx_timeout = &if_tx_timeout; dev->tx_timeout = &if_tx_timeout;
dev->watchdog_timeo = TX_TIMEOUT; dev->watchdog_timeo = TX_TIMEOUT;
/* Initialize media-specific parameters */ /* Initialize media-specific parameters */
dev->flags |= IFF_POINTOPOINT; dev->flags |= IFF_POINTOPOINT;
...@@ -951,6 +950,7 @@ static int if_init(struct net_device* dev) ...@@ -951,6 +950,7 @@ static int if_init(struct net_device* dev)
* by stack. * by stack.
*/ */
dev->tx_queue_len = 100; dev->tx_queue_len = 100;
SET_MODULE_OWNER(dev);
return 0; return 0;
} }
......
...@@ -1187,6 +1187,7 @@ static int if_init(struct net_device* dev) ...@@ -1187,6 +1187,7 @@ static int if_init(struct net_device* dev)
dev->base_addr = wandev->ioport; dev->base_addr = wandev->ioport;
dev->mem_start = wandev->maddr; dev->mem_start = wandev->maddr;
dev->mem_end = wandev->maddr + wandev->msize - 1; dev->mem_end = wandev->maddr + wandev->msize - 1;
SET_MODULE_OWNER(dev);
return 0; return 0;
} }
......
...@@ -722,6 +722,7 @@ static int if_init(struct net_device *dev) ...@@ -722,6 +722,7 @@ static int if_init(struct net_device *dev)
/* Set transmit buffer queue length */ /* Set transmit buffer queue length */
dev->tx_queue_len = 100; dev->tx_queue_len = 100;
SET_MODULE_OWNER(dev);
return 0; return 0;
} }
......
...@@ -1148,6 +1148,7 @@ static int if_init(struct net_device* dev) ...@@ -1148,6 +1148,7 @@ static int if_init(struct net_device* dev)
/* Set transmit buffer queue length */ /* Set transmit buffer queue length */
dev->tx_queue_len = 100; dev->tx_queue_len = 100;
SET_MODULE_OWNER(dev);
/* FIXME Why are we doing this */ /* FIXME Why are we doing this */
set_chan_state(dev, WAN_DISCONNECTED); set_chan_state(dev, WAN_DISCONNECTED);
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* This module is completely hardware-independent and provides * This module is completely hardware-independent and provides
* access to the router using Linux /proc filesystem. * access to the router using Linux /proc filesystem.
* *
* Author: Gideon Hack * Author: Gideon Hack
* *
* Copyright: (c) 1995-1999 Sangoma Technologies Inc. * Copyright: (c) 1995-1999 Sangoma Technologies Inc.
* *
...@@ -20,22 +20,17 @@ ...@@ -20,22 +20,17 @@
* Dec 13, 1996 Gene Kozin Initial version (based on Sangoma's WANPIPE) * Dec 13, 1996 Gene Kozin Initial version (based on Sangoma's WANPIPE)
*****************************************************************************/ *****************************************************************************/
#include <linux/version.h>
#include <linux/config.h> #include <linux/config.h>
#include <linux/init.h> /* __initfunc et al. */
#include <linux/stddef.h> /* offsetof(), etc. */ #include <linux/stddef.h> /* offsetof(), etc. */
#include <linux/errno.h> /* return codes */ #include <linux/errno.h> /* return codes */
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/slab.h> /* kmalloc(), kfree() */
#include <linux/mm.h> /* verify_area(), etc. */
#include <linux/string.h> /* inline mem*, str* functions */
#include <asm/byteorder.h> /* htons(), etc. */
#include <asm/io.h>
#include <linux/wanrouter.h> /* WAN router API definitions */ #include <linux/wanrouter.h> /* WAN router API definitions */
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/smp_lock.h> #include <linux/smp_lock.h>
#include <linux/init.h> /* __initfunc et al. */
#include <asm/uaccess.h> /* copy_to_user */ #include <asm/io.h>
#define PROC_STATS_FORMAT "%30s: %12lu\n" #define PROC_STATS_FORMAT "%30s: %12lu\n"
...@@ -47,16 +42,6 @@ ...@@ -47,16 +42,6 @@
(prot == WANCONFIG_CHDLC) ? " CHDLC": \ (prot == WANCONFIG_CHDLC) ? " CHDLC": \
(prot == WANCONFIG_MPPP) ? " MPPP" : \ (prot == WANCONFIG_MPPP) ? " MPPP" : \
" Unknown" ) " Unknown" )
/****** Data Types **********************************************************/
typedef struct wan_stat_entry
{
struct wan_stat_entry *next;
char *description; /* description string */
void *data; /* -> data */
unsigned data_type; /* data type */
} wan_stat_entry_t;
/****** Function Prototypes *************************************************/ /****** Function Prototypes *************************************************/
...@@ -74,11 +59,11 @@ typedef struct wan_stat_entry ...@@ -74,11 +59,11 @@ typedef struct wan_stat_entry
*/ */
/* /*
* Generic /proc/net/router/<file> file and inode operations * Generic /proc/net/router/<file> file and inode operations
*/ */
/* /*
* /proc/net/router * /proc/net/router
*/ */
static struct proc_dir_entry *proc_router; static struct proc_dir_entry *proc_router;
...@@ -106,12 +91,14 @@ static void *r_start(struct seq_file *m, loff_t *pos) ...@@ -106,12 +91,14 @@ static void *r_start(struct seq_file *m, loff_t *pos)
; ;
return wandev; return wandev;
} }
static void *r_next(struct seq_file *m, void *v, loff_t *pos) static void *r_next(struct seq_file *m, void *v, loff_t *pos)
{ {
struct wan_device *wandev = v; struct wan_device *wandev = v;
(*pos)++; (*pos)++;
return (v == (void *)1) ? router_devlist : wandev->next; return (v == (void *)1) ? router_devlist : wandev->next;
} }
static void r_stop(struct seq_file *m, void *v) static void r_stop(struct seq_file *m, void *v)
{ {
unlock_kernel(); unlock_kernel();
...@@ -121,8 +108,8 @@ static int config_show(struct seq_file *m, void *v) ...@@ -121,8 +108,8 @@ static int config_show(struct seq_file *m, void *v)
{ {
struct wan_device *p = v; struct wan_device *p = v;
if (v == (void *)1) { if (v == (void *)1) {
seq_puts(m, "Device name | port |IRQ|DMA| mem.addr |"); seq_puts(m, "Device name | port |IRQ|DMA| mem.addr |"
seq_puts(m, "mem.size|option1|option2|option3|option4\n"); "mem.size|option1|option2|option3|option4\n");
return 0; return 0;
} }
if (!p->state) if (!p->state)
...@@ -137,21 +124,21 @@ static int status_show(struct seq_file *m, void *v) ...@@ -137,21 +124,21 @@ static int status_show(struct seq_file *m, void *v)
{ {
struct wan_device *p = v; struct wan_device *p = v;
if (v == (void *)1) { if (v == (void *)1) {
seq_puts(m, "Device name |protocol|station|interface|"); seq_puts(m, "Device name |protocol|station|interface|"
seq_puts(m, "clocking|baud rate| MTU |ndev|link state\n"); "clocking|baud rate| MTU |ndev|link state\n");
return 0; return 0;
} }
if (!p->state) if (!p->state)
return 0; return 0;
seq_printf(m, "%-15s|%-8s|%-7s|%-9s|%-8s|%9u|%5u|%3u |", seq_printf(m, "%-15s|%-8s| %-7s| %-9s|%-8s|%9u|%5u|%3u |",
p->name, p->name,
PROT_DECODE(p->config_id), PROT_DECODE(p->config_id),
p->config_id == WANCONFIG_FR ? p->config_id == WANCONFIG_FR ?
(p->station ? " Node" : " CPE") : (p->station ? "Node" : "CPE") :
(p->config_id == WANCONFIG_X25 ? (p->config_id == WANCONFIG_X25 ?
(p->station ? " DCE" : " DTE") : (p->station ? "DCE" : "DTE") :
(" N/A")), ("N/A")),
p->interface ? " V.35" : " RS-232", p->interface ? "V.35" : "RS-232",
p->clocking ? "internal" : "external", p->clocking ? "internal" : "external",
p->bps, p->bps,
p->mtu, p->mtu,
...@@ -178,17 +165,17 @@ static int status_show(struct seq_file *m, void *v) ...@@ -178,17 +165,17 @@ static int status_show(struct seq_file *m, void *v)
} }
static struct seq_operations config_op = { static struct seq_operations config_op = {
.start =r_start, .start = r_start,
.next = r_next, .next = r_next,
.stop = r_stop, .stop = r_stop,
.show = config_show .show = config_show,
}; };
static struct seq_operations status_op = { static struct seq_operations status_op = {
.start =r_start, .start = r_start,
.next = r_next, .next = r_next,
.stop = r_stop, .stop = r_stop,
.show = status_show .show = status_show,
}; };
static int config_open(struct inode *inode, struct file *file) static int config_open(struct inode *inode, struct file *file)
...@@ -201,22 +188,20 @@ static int status_open(struct inode *inode, struct file *file) ...@@ -201,22 +188,20 @@ static int status_open(struct inode *inode, struct file *file)
return seq_open(file, &status_op); return seq_open(file, &status_op);
} }
static struct file_operations config_fops = static struct file_operations config_fops = {
{ .owner = THIS_MODULE,
.owner = THIS_MODULE, .open = config_open,
.open = config_open, .read = seq_read,
.read = seq_read, .llseek = seq_lseek,
.llseek = seq_lseek, .release = seq_release,
.release = seq_release,
}; };
static struct file_operations status_fops = static struct file_operations status_fops = {
{ .owner = THIS_MODULE,
.owner = THIS_MODULE, .open = status_open,
.open = status_open, .read = seq_read,
.read = seq_read, .llseek = seq_lseek,
.llseek = seq_lseek, .release = seq_release,
.release = seq_release,
}; };
static int wandev_show(struct seq_file *m, void *v) static int wandev_show(struct seq_file *m, void *v)
...@@ -235,11 +220,11 @@ static int wandev_show(struct seq_file *m, void *v) ...@@ -235,11 +220,11 @@ static int wandev_show(struct seq_file *m, void *v)
if (wandev->update) { if (wandev->update) {
int err = wandev->update(wandev); int err = wandev->update(wandev);
if (err == -EAGAIN) { if (err == -EAGAIN) {
seq_printf(m, "Device is busy!\n"); seq_puts(m, "Device is busy!\n");
return 0; return 0;
} }
if (err) { if (err) {
seq_printf(m, "Device is not configured!\n"); seq_puts(m, "Device is not configured!\n");
return 0; return 0;
} }
} }
...@@ -286,21 +271,20 @@ static int wandev_open(struct inode *inode, struct file *file) ...@@ -286,21 +271,20 @@ static int wandev_open(struct inode *inode, struct file *file)
return single_open(file, wandev_show, PDE(inode)->data); return single_open(file, wandev_show, PDE(inode)->data);
} }
static struct file_operations wandev_fops = static struct file_operations wandev_fops = {
{ .owner = THIS_MODULE,
.owner = THIS_MODULE, .open = wandev_open,
.open = wandev_open, .read = seq_read,
.read = seq_read, .llseek = seq_lseek,
.llseek = seq_lseek, .release = single_release,
.release = single_release, .ioctl = wanrouter_ioctl,
.ioctl = wanrouter_ioctl,
}; };
/* /*
* Initialize router proc interface. * Initialize router proc interface.
*/ */
int __init wanrouter_proc_init (void) int __init wanrouter_proc_init(void)
{ {
struct proc_dir_entry *p; struct proc_dir_entry *p;
proc_router = proc_mkdir(ROUTER_NAME, proc_net); proc_router = proc_mkdir(ROUTER_NAME, proc_net);
...@@ -328,11 +312,11 @@ int __init wanrouter_proc_init (void) ...@@ -328,11 +312,11 @@ int __init wanrouter_proc_init (void)
* Clean up router proc interface. * Clean up router proc interface.
*/ */
void wanrouter_proc_cleanup (void) void wanrouter_proc_cleanup(void)
{ {
remove_proc_entry("config", proc_router); remove_proc_entry("config", proc_router);
remove_proc_entry("status", proc_router); remove_proc_entry("status", proc_router);
remove_proc_entry(ROUTER_NAME,proc_net); remove_proc_entry(ROUTER_NAME, proc_net);
} }
/* /*
...@@ -343,7 +327,7 @@ int wanrouter_proc_add(struct wan_device* wandev) ...@@ -343,7 +327,7 @@ int wanrouter_proc_add(struct wan_device* wandev)
{ {
if (wandev->magic != ROUTER_MAGIC) if (wandev->magic != ROUTER_MAGIC)
return -EINVAL; return -EINVAL;
wandev->dent = create_proc_entry(wandev->name, S_IRUGO, proc_router); wandev->dent = create_proc_entry(wandev->name, S_IRUGO, proc_router);
if (!wandev->dent) if (!wandev->dent)
return -ENOMEM; return -ENOMEM;
...@@ -355,7 +339,6 @@ int wanrouter_proc_add(struct wan_device* wandev) ...@@ -355,7 +339,6 @@ int wanrouter_proc_add(struct wan_device* wandev)
/* /*
* Delete directory entry for WAN device. * Delete directory entry for WAN device.
*/ */
int wanrouter_proc_delete(struct wan_device* wandev) int wanrouter_proc_delete(struct wan_device* wandev)
{ {
if (wandev->magic != ROUTER_MAGIC) if (wandev->magic != ROUTER_MAGIC)
......
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