Commit 52bae6c3 authored by Alan Cox's avatar Alan Cox Committed by Linus Torvalds

[PATCH] update wan drivers to new saner ioctls

parent 0a727c0d
...@@ -175,9 +175,8 @@ static int c101_close(struct net_device *dev) ...@@ -175,9 +175,8 @@ static int c101_close(struct net_device *dev)
static int c101_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) static int c101_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
{ {
union line_settings *line = &ifr->ifr_settings->ifs_line;
const size_t size = sizeof(sync_serial_settings); const size_t size = sizeof(sync_serial_settings);
sync_serial_settings new_line; sync_serial_settings new_line, *line = ifr->ifr_settings.ifs_ifsu.sync;
hdlc_device *hdlc = dev_to_hdlc(dev); hdlc_device *hdlc = dev_to_hdlc(dev);
port_t *port = hdlc_to_port(hdlc); port_t *port = hdlc_to_port(hdlc);
...@@ -190,10 +189,14 @@ static int c101_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) ...@@ -190,10 +189,14 @@ static int c101_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
if (cmd != SIOCWANDEV) if (cmd != SIOCWANDEV)
return hdlc_ioctl(dev, ifr, cmd); return hdlc_ioctl(dev, ifr, cmd);
switch(ifr->ifr_settings->type) { switch(ifr->ifr_settings.type) {
case IF_GET_IFACE: case IF_GET_IFACE:
ifr->ifr_settings->type = IF_IFACE_SYNC_SERIAL; ifr->ifr_settings.type = IF_IFACE_SYNC_SERIAL;
if (copy_to_user(&line->sync, &port->settings, size)) if (ifr->ifr_settings.size < size) {
ifr->ifr_settings.size = size; /* data size wanted */
return -ENOBUFS;
}
if (copy_to_user(line, &port->settings, size))
return -EFAULT; return -EFAULT;
return 0; return 0;
...@@ -201,7 +204,7 @@ static int c101_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) ...@@ -201,7 +204,7 @@ static int c101_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
if(!capable(CAP_NET_ADMIN)) if(!capable(CAP_NET_ADMIN))
return -EPERM; return -EPERM;
if (copy_from_user(&new_line, &line->sync, size)) if (copy_from_user(&new_line, line, size))
return -EFAULT; return -EFAULT;
if (new_line.clock_type != CLOCK_EXT && if (new_line.clock_type != CLOCK_EXT &&
......
...@@ -44,7 +44,6 @@ ...@@ -44,7 +44,6 @@
#include <linux/kernel.h> /* printk(), and other useful stuff */ #include <linux/kernel.h> /* printk(), and other useful stuff */
#include <linux/module.h> /* support for loadable modules */ #include <linux/module.h> /* support for loadable modules */
#include <linux/ioport.h> /* request_region(), release_region() */ #include <linux/ioport.h> /* request_region(), release_region() */
#include <linux/tqueue.h> /* for kernel task queues */
#include <linux/wanrouter.h> /* WAN router definitions */ #include <linux/wanrouter.h> /* WAN router definitions */
#include <linux/cyclomx.h> /* cyclomx common user API definitions */ #include <linux/cyclomx.h> /* cyclomx common user API definitions */
#include <asm/uaccess.h> /* kernel <-> user copy */ #include <asm/uaccess.h> /* kernel <-> user copy */
......
...@@ -1144,7 +1144,7 @@ static int dscc4_set_clock(struct net_device *dev, u32 *bps, u32 *state) ...@@ -1144,7 +1144,7 @@ static int dscc4_set_clock(struct net_device *dev, u32 *bps, u32 *state)
static int dscc4_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) static int dscc4_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
{ {
union line_settings *line = &ifr->ifr_settings->ifs_line; sync_serial_settings *line = ifr->ifr_settings.ifs_ifsu.sync;
struct dscc4_dev_priv *dpriv = dscc4_priv(dev); struct dscc4_dev_priv *dpriv = dscc4_priv(dev);
const size_t size = sizeof(dpriv->settings); const size_t size = sizeof(dpriv->settings);
int ret = 0; int ret = 0;
...@@ -1155,10 +1155,14 @@ static int dscc4_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) ...@@ -1155,10 +1155,14 @@ static int dscc4_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
if (cmd != SIOCWANDEV) if (cmd != SIOCWANDEV)
return -EOPNOTSUPP; return -EOPNOTSUPP;
switch(ifr->ifr_settings->type) { switch(ifr->ifr_settings.type) {
case IF_GET_IFACE: case IF_GET_IFACE:
ifr->ifr_settings->type = IF_IFACE_SYNC_SERIAL; ifr->ifr_settings.type = IF_IFACE_SYNC_SERIAL;
if (copy_to_user(&line->sync, &dpriv->settings, size)) if (ifr->ifr_settings.size < size) {
ifr->ifr_settings.size = size; /* data size wanted */
return -ENOBUFS;
}
if (copy_to_user(line, &dpriv->settings, size))
return -EFAULT; return -EFAULT;
break; break;
...@@ -1166,7 +1170,7 @@ static int dscc4_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) ...@@ -1166,7 +1170,7 @@ static int dscc4_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
if (!capable(CAP_NET_ADMIN)) if (!capable(CAP_NET_ADMIN))
return -EPERM; return -EPERM;
if (copy_from_user(&dpriv->settings, &line->sync, size)) if (copy_from_user(&dpriv->settings, line, size))
return -EFAULT; return -EFAULT;
ret = dscc4_set_iface(dpriv, dev); ret = dscc4_set_iface(dpriv, dev);
break; break;
......
...@@ -1010,11 +1010,11 @@ static int ...@@ -1010,11 +1010,11 @@ static int
fst_set_iface ( struct fst_card_info *card, struct fst_port_info *port, fst_set_iface ( struct fst_card_info *card, struct fst_port_info *port,
struct ifreq *ifr ) struct ifreq *ifr )
{ {
union line_settings *line = &ifr->ifr_settings->ifs_line;
sync_serial_settings sync; sync_serial_settings sync;
int i; int i;
if ( copy_from_user ( &sync, &line->sync, sizeof ( sync ))) if (copy_from_user (&sync, ifr->ifr_settings.ifs_ifsu.sync,
sizeof (sync)))
return -EFAULT; return -EFAULT;
if ( sync.loopback ) if ( sync.loopback )
...@@ -1022,7 +1022,7 @@ fst_set_iface ( struct fst_card_info *card, struct fst_port_info *port, ...@@ -1022,7 +1022,7 @@ fst_set_iface ( struct fst_card_info *card, struct fst_port_info *port,
i = port->index; i = port->index;
switch ( ifr->ifr_settings->type ) switch (ifr->ifr_settings.type)
{ {
case IF_IFACE_V35: case IF_IFACE_V35:
FST_WRW ( card, portConfig[i].lineInterface, V35 ); FST_WRW ( card, portConfig[i].lineInterface, V35 );
...@@ -1067,7 +1067,6 @@ static int ...@@ -1067,7 +1067,6 @@ static int
fst_get_iface ( struct fst_card_info *card, struct fst_port_info *port, fst_get_iface ( struct fst_card_info *card, struct fst_port_info *port,
struct ifreq *ifr ) struct ifreq *ifr )
{ {
union line_settings *line = &ifr->ifr_settings->ifs_line;
sync_serial_settings sync; sync_serial_settings sync;
int i; int i;
...@@ -1078,24 +1077,30 @@ fst_get_iface ( struct fst_card_info *card, struct fst_port_info *port, ...@@ -1078,24 +1077,30 @@ fst_get_iface ( struct fst_card_info *card, struct fst_port_info *port,
switch ( port->hwif ) switch ( port->hwif )
{ {
case V35: case V35:
ifr->ifr_settings->type = IF_IFACE_V35; ifr->ifr_settings.type = IF_IFACE_V35;
break; break;
case V24: case V24:
ifr->ifr_settings->type = IF_IFACE_V24; ifr->ifr_settings.type = IF_IFACE_V24;
break; break;
case X21: case X21:
default: default:
ifr->ifr_settings->type = IF_IFACE_X21; ifr->ifr_settings.type = IF_IFACE_X21;
break; break;
} }
if (ifr->ifr_settings.size < sizeof(sync)) {
ifr->ifr_settings.size = sizeof(sync); /* data size wanted */
return -ENOBUFS;
}
i = port->index; i = port->index;
sync.clock_rate = FST_RDL ( card, portConfig[i].lineSpeed ); sync.clock_rate = FST_RDL ( card, portConfig[i].lineSpeed );
/* Lucky card and linux use same encoding here */ /* Lucky card and linux use same encoding here */
sync.clock_type = FST_RDB ( card, portConfig[i].internalClock ); sync.clock_type = FST_RDB ( card, portConfig[i].internalClock );
sync.loopback = 0; sync.loopback = 0;
if ( copy_to_user (&line->sync, &sync, sizeof ( sync ))) if (copy_to_user (ifr->ifr_settings.ifs_ifsu.sync, &sync,
sizeof(sync)))
return -EFAULT; return -EFAULT;
return 0; return 0;
...@@ -1221,7 +1226,7 @@ fst_ioctl ( struct net_device *dev, struct ifreq *ifr, int cmd ) ...@@ -1221,7 +1226,7 @@ fst_ioctl ( struct net_device *dev, struct ifreq *ifr, int cmd )
return set_conf_from_info ( card, port, &info ); return set_conf_from_info ( card, port, &info );
case SIOCWANDEV: case SIOCWANDEV:
switch ( ifr->ifr_settings->type ) switch (ifr->ifr_settings.type)
{ {
case IF_GET_IFACE: case IF_GET_IFACE:
return fst_get_iface ( card, port, ifr ); return fst_get_iface ( card, port, ifr );
......
...@@ -247,15 +247,19 @@ static void cisco_close(hdlc_device *hdlc) ...@@ -247,15 +247,19 @@ static void cisco_close(hdlc_device *hdlc)
int hdlc_cisco_ioctl(hdlc_device *hdlc, struct ifreq *ifr) int hdlc_cisco_ioctl(hdlc_device *hdlc, struct ifreq *ifr)
{ {
cisco_proto *cisco_s = &ifr->ifr_settings->ifs_hdlc.cisco; cisco_proto *cisco_s = ifr->ifr_settings.ifs_ifsu.cisco;
const size_t size = sizeof(cisco_proto); const size_t size = sizeof(cisco_proto);
cisco_proto new_settings; cisco_proto new_settings;
struct net_device *dev = hdlc_to_dev(hdlc); struct net_device *dev = hdlc_to_dev(hdlc);
int result; int result;
switch (ifr->ifr_settings->type) { switch (ifr->ifr_settings.type) {
case IF_GET_PROTO: case IF_GET_PROTO:
ifr->ifr_settings->type = IF_PROTO_CISCO; ifr->ifr_settings.type = IF_PROTO_CISCO;
if (ifr->ifr_settings.size < size) {
ifr->ifr_settings.size = size; /* data size wanted */
return -ENOBUFS;
}
if (copy_to_user(cisco_s, &hdlc->state.cisco.settings, size)) if (copy_to_user(cisco_s, &hdlc->state.cisco.settings, size))
return -EFAULT; return -EFAULT;
return 0; return 0;
......
...@@ -778,16 +778,20 @@ static void fr_destroy(hdlc_device *hdlc) ...@@ -778,16 +778,20 @@ static void fr_destroy(hdlc_device *hdlc)
int hdlc_fr_ioctl(hdlc_device *hdlc, struct ifreq *ifr) int hdlc_fr_ioctl(hdlc_device *hdlc, struct ifreq *ifr)
{ {
fr_proto *fr_s = &ifr->ifr_settings->ifs_hdlc.fr; fr_proto *fr_s = ifr->ifr_settings.ifs_ifsu.fr;
const size_t size = sizeof(fr_proto); const size_t size = sizeof(fr_proto);
fr_proto new_settings; fr_proto new_settings;
struct net_device *dev = hdlc_to_dev(hdlc); struct net_device *dev = hdlc_to_dev(hdlc);
fr_proto_pvc pvc; fr_proto_pvc pvc;
int result; int result;
switch (ifr->ifr_settings->type) { switch (ifr->ifr_settings.type) {
case IF_GET_PROTO: case IF_GET_PROTO:
ifr->ifr_settings->type = IF_PROTO_FR; ifr->ifr_settings.type = IF_PROTO_FR;
if (ifr->ifr_settings.size < size) {
ifr->ifr_settings.size = size; /* data size wanted */
return -ENOBUFS;
}
if (copy_to_user(fr_s, &hdlc->state.fr.settings, size)) if (copy_to_user(fr_s, &hdlc->state.fr.settings, size))
return -EFAULT; return -EFAULT;
return 0; return 0;
...@@ -847,12 +851,12 @@ int hdlc_fr_ioctl(hdlc_device *hdlc, struct ifreq *ifr) ...@@ -847,12 +851,12 @@ int hdlc_fr_ioctl(hdlc_device *hdlc, struct ifreq *ifr)
if(!capable(CAP_NET_ADMIN)) if(!capable(CAP_NET_ADMIN))
return -EPERM; return -EPERM;
if (copy_from_user(&pvc, &ifr->ifr_settings->ifs_hdlc.fr_pvc, if (copy_from_user(&pvc, ifr->ifr_settings.ifs_ifsu.fr_pvc,
sizeof(fr_proto_pvc))) sizeof(fr_proto_pvc)))
return -EFAULT; return -EFAULT;
return fr_pvc(hdlc, pvc.dlci, return fr_pvc(hdlc, pvc.dlci,
ifr->ifr_settings->type == IF_PROTO_FR_ADD_PVC); ifr->ifr_settings.type == IF_PROTO_FR_ADD_PVC);
} }
return -EINVAL; return -EINVAL;
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
#include <linux/hdlc.h> #include <linux/hdlc.h>
static const char* version = "HDLC support module revision 1.10"; static const char* version = "HDLC support module revision 1.11";
static int hdlc_change_mtu(struct net_device *dev, int new_mtu) static int hdlc_change_mtu(struct net_device *dev, int new_mtu)
...@@ -95,13 +95,13 @@ int hdlc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) ...@@ -95,13 +95,13 @@ int hdlc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
if (cmd != SIOCWANDEV) if (cmd != SIOCWANDEV)
return -EINVAL; return -EINVAL;
switch(ifr->ifr_settings->type) { switch(ifr->ifr_settings.type) {
case IF_PROTO_HDLC: case IF_PROTO_HDLC:
case IF_PROTO_PPP: case IF_PROTO_PPP:
case IF_PROTO_CISCO: case IF_PROTO_CISCO:
case IF_PROTO_FR: case IF_PROTO_FR:
case IF_PROTO_X25: case IF_PROTO_X25:
proto = ifr->ifr_settings->type; proto = ifr->ifr_settings.type;
break; break;
default: default:
......
...@@ -82,9 +82,9 @@ int hdlc_ppp_ioctl(hdlc_device *hdlc, struct ifreq *ifr) ...@@ -82,9 +82,9 @@ int hdlc_ppp_ioctl(hdlc_device *hdlc, struct ifreq *ifr)
struct net_device *dev = hdlc_to_dev(hdlc); struct net_device *dev = hdlc_to_dev(hdlc);
int result; int result;
switch (ifr->ifr_settings->type) { switch (ifr->ifr_settings.type) {
case IF_GET_PROTO: case IF_GET_PROTO:
ifr->ifr_settings->type = IF_PROTO_PPP; ifr->ifr_settings.type = IF_PROTO_PPP;
return 0; /* return protocol only, no settable parameters */ return 0; /* return protocol only, no settable parameters */
case IF_PROTO_PPP: case IF_PROTO_PPP:
......
...@@ -37,15 +37,19 @@ static void raw_rx(struct sk_buff *skb) ...@@ -37,15 +37,19 @@ static void raw_rx(struct sk_buff *skb)
int hdlc_raw_ioctl(hdlc_device *hdlc, struct ifreq *ifr) int hdlc_raw_ioctl(hdlc_device *hdlc, struct ifreq *ifr)
{ {
raw_hdlc_proto *raw_s = &ifr->ifr_settings->ifs_hdlc.raw_hdlc; raw_hdlc_proto *raw_s = ifr->ifr_settings.ifs_ifsu.raw_hdlc;
const size_t size = sizeof(raw_hdlc_proto); const size_t size = sizeof(raw_hdlc_proto);
raw_hdlc_proto new_settings; raw_hdlc_proto new_settings;
struct net_device *dev = hdlc_to_dev(hdlc); struct net_device *dev = hdlc_to_dev(hdlc);
int result; int result;
switch (ifr->ifr_settings->type) { switch (ifr->ifr_settings.type) {
case IF_GET_PROTO: case IF_GET_PROTO:
ifr->ifr_settings->type = IF_PROTO_HDLC; ifr->ifr_settings.type = IF_PROTO_HDLC;
if (ifr->ifr_settings.size < size) {
ifr->ifr_settings.size = size; /* data size wanted */
return -ENOBUFS;
}
if (copy_to_user(raw_s, &hdlc->state.raw_hdlc.settings, size)) if (copy_to_user(raw_s, &hdlc->state.raw_hdlc.settings, size))
return -EFAULT; return -EFAULT;
return 0; return 0;
......
...@@ -184,9 +184,9 @@ int hdlc_x25_ioctl(hdlc_device *hdlc, struct ifreq *ifr) ...@@ -184,9 +184,9 @@ int hdlc_x25_ioctl(hdlc_device *hdlc, struct ifreq *ifr)
struct net_device *dev = hdlc_to_dev(hdlc); struct net_device *dev = hdlc_to_dev(hdlc);
int result; int result;
switch (ifr->ifr_settings->type) { switch (ifr->ifr_settings.type) {
case IF_GET_PROTO: case IF_GET_PROTO:
ifr->ifr_settings->type = IF_PROTO_X25; ifr->ifr_settings.type = IF_PROTO_X25;
return 0; /* return protocol only, no settable parameters */ return 0; /* return protocol only, no settable parameters */
case IF_PROTO_X25: case IF_PROTO_X25:
......
...@@ -246,9 +246,8 @@ static int n2_close(struct net_device *dev) ...@@ -246,9 +246,8 @@ static int n2_close(struct net_device *dev)
static int n2_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) static int n2_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
{ {
union line_settings *line = &ifr->ifr_settings->ifs_line;
const size_t size = sizeof(sync_serial_settings); const size_t size = sizeof(sync_serial_settings);
sync_serial_settings new_line; sync_serial_settings new_line, *line = ifr->ifr_settings.ifs_ifsu.sync;
hdlc_device *hdlc = dev_to_hdlc(dev); hdlc_device *hdlc = dev_to_hdlc(dev);
port_t *port = hdlc_to_port(hdlc); port_t *port = hdlc_to_port(hdlc);
...@@ -261,10 +260,14 @@ static int n2_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) ...@@ -261,10 +260,14 @@ static int n2_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
if (cmd != SIOCWANDEV) if (cmd != SIOCWANDEV)
return hdlc_ioctl(dev, ifr, cmd); return hdlc_ioctl(dev, ifr, cmd);
switch(ifr->ifr_settings->type) { switch(ifr->ifr_settings.type) {
case IF_GET_IFACE: case IF_GET_IFACE:
ifr->ifr_settings->type = IF_IFACE_SYNC_SERIAL; ifr->ifr_settings.type = IF_IFACE_SYNC_SERIAL;
if (copy_to_user(&line->sync, &port->settings, size)) if (ifr->ifr_settings.size < size) {
ifr->ifr_settings.size = size; /* data size wanted */
return -ENOBUFS;
}
if (copy_to_user(line, &port->settings, size))
return -EFAULT; return -EFAULT;
return 0; return 0;
...@@ -272,7 +275,7 @@ static int n2_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) ...@@ -272,7 +275,7 @@ static int n2_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
if(!capable(CAP_NET_ADMIN)) if(!capable(CAP_NET_ADMIN))
return -EPERM; return -EPERM;
if (copy_from_user(&new_line, &line->sync, size)) if (copy_from_user(&new_line, line, size))
return -EFAULT; return -EFAULT;
if (new_line.clock_type != CLOCK_EXT && if (new_line.clock_type != CLOCK_EXT &&
......
...@@ -2542,7 +2542,7 @@ int cpc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) ...@@ -2542,7 +2542,7 @@ int cpc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
pc300chconf_t *conf = (pc300chconf_t *) & chan->conf; pc300chconf_t *conf = (pc300chconf_t *) & chan->conf;
int ch = chan->channel; int ch = chan->channel;
void *arg = (void *) ifr->ifr_data; void *arg = (void *) ifr->ifr_data;
union line_settings * line = &ifr->ifr_settings->ifs_line; struct if_settings *settings = &ifr->ifr_settings;
uclong scabase = card->hw.scabase; uclong scabase = card->hw.scabase;
if (!capable(CAP_NET_ADMIN)) if (!capable(CAP_NET_ADMIN))
...@@ -2741,13 +2741,19 @@ int cpc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) ...@@ -2741,13 +2741,19 @@ int cpc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
} }
case SIOCWANDEV: case SIOCWANDEV:
switch (ifr->ifr_settings->type) { switch (ifr->ifr_settings.type) {
case IF_GET_IFACE: case IF_GET_IFACE:
{ {
const size_t size = sizeof(sync_serial_settings); const size_t size = sizeof(sync_serial_settings);
ifr->ifr_settings->type = conf->media; ifr->ifr_settings.type = conf->media;
if (ifr->ifr_settings.size < size) {
/* data size wanted */
ifr->ifr_settings.size = size;
return -ENOBUFS;
}
if (copy_to_user(&line->sync, &conf->phys_settings, size)) { if (copy_to_user(settings->ifs_ifsu.sync,
&conf->phys_settings, size)) {
return -EFAULT; return -EFAULT;
} }
return 0; return 0;
...@@ -2764,7 +2770,7 @@ int cpc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) ...@@ -2764,7 +2770,7 @@ int cpc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
} }
if (copy_from_user(&conf->phys_settings, if (copy_from_user(&conf->phys_settings,
&line->sync, size)) { settings->ifs_ifsu.sync, size)) {
return -EFAULT; return -EFAULT;
} }
...@@ -2773,7 +2779,7 @@ int cpc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) ...@@ -2773,7 +2779,7 @@ int cpc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
cpc_readb(card->hw.scabase + M_REG(MD2, ch)) | cpc_readb(card->hw.scabase + M_REG(MD2, ch)) |
MD2_LOOP_MIR); MD2_LOOP_MIR);
} }
conf->media = ifr->ifr_settings->type; conf->media = ifr->ifr_settings.type;
return 0; return 0;
} }
...@@ -2787,7 +2793,7 @@ int cpc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) ...@@ -2787,7 +2793,7 @@ int cpc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
} }
if (copy_from_user(&conf->phys_settings, if (copy_from_user(&conf->phys_settings,
&line->te1, size)) { settings->ifs_ifsu.te1, size)) {
return -EFAULT; return -EFAULT;
}/* Ignoring HDLC slot_map for a while */ }/* Ignoring HDLC slot_map for a while */
...@@ -2796,7 +2802,7 @@ int cpc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) ...@@ -2796,7 +2802,7 @@ int cpc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
cpc_readb(card->hw.scabase + M_REG(MD2, ch)) | cpc_readb(card->hw.scabase + M_REG(MD2, ch)) |
MD2_LOOP_MIR); MD2_LOOP_MIR);
} }
conf->media = ifr->ifr_settings->type; conf->media = ifr->ifr_settings.type;
return 0; return 0;
} }
default: default:
...@@ -3556,7 +3562,7 @@ cpc_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -3556,7 +3562,7 @@ cpc_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
#endif #endif
/* Set PCI drv pointer to the card structure */ /* Set PCI drv pointer to the card structure */
pdev->driver_data = card; pci_set_drvdata(pdev, card);
/* Set board type */ /* Set board type */
switch (device_id) { switch (device_id) {
...@@ -3631,7 +3637,7 @@ cpc_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -3631,7 +3637,7 @@ cpc_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
static void __devexit cpc_remove_one(struct pci_dev *pdev) static void __devexit cpc_remove_one(struct pci_dev *pdev)
{ {
pc300_t *card = (pc300_t *) pdev->driver_data; pc300_t *card = pci_get_drvdata(pdev);
if (card->hw.rambase != 0) { if (card->hw.rambase != 0) {
int i; int i;
......
...@@ -728,8 +728,8 @@ static void cpc_tty_rx_work(void * data) ...@@ -728,8 +728,8 @@ static void cpc_tty_rx_work(void * data)
if (cpc_tty->tty && (cpc_tty->tty->ldisc.receive_buf)) { if (cpc_tty->tty && (cpc_tty->tty->ldisc.receive_buf)) {
CPC_TTY_DBG("%s: call line disc. receive_buf\n",cpc_tty->name); CPC_TTY_DBG("%s: call line disc. receive_buf\n",cpc_tty->name);
cpc_tty->tty->ldisc.receive_buf(cpc_tty->tty, buf->data, cpc_tty->tty->ldisc.receive_buf(cpc_tty->tty, (char *)(buf->data),
&flags, buf->size); &flags, buf->size);
} }
cpc_tty->buf_rx.first = cpc_tty->buf_rx.first->next; cpc_tty->buf_rx.first = cpc_tty->buf_rx.first->next;
kfree((unsigned char *)buf); kfree((unsigned char *)buf);
......
...@@ -1665,7 +1665,10 @@ int __init sdla_c_setup(void) ...@@ -1665,7 +1665,10 @@ int __init sdla_c_setup(void)
} }
#ifdef MODULE #ifdef MODULE
static struct net_device sdla0 = {"sdla0", 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, sdla_init}; static struct net_device sdla0 = {
.name = "sdla0",
.init = sdla_init
};
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
#ifndef __HDLC_H #ifndef __HDLC_H
#define __HDLC_H #define __HDLC_H
#define GENERIC_HDLC_VERSION 3 /* For synchronization with sethdlc utility */ #define GENERIC_HDLC_VERSION 4 /* For synchronization with sethdlc utility */
#define CLOCK_DEFAULT 0 /* Default setting */ #define CLOCK_DEFAULT 0 /* Default setting */
#define CLOCK_EXT 1 /* External TX and RX clock - DTE */ #define CLOCK_EXT 1 /* External TX and RX clock - DTE */
......
...@@ -96,16 +96,20 @@ struct ifmap ...@@ -96,16 +96,20 @@ struct ifmap
struct if_settings struct if_settings
{ {
unsigned int type; /* Type of physical device or protocol */ unsigned int type; /* Type of physical device or protocol */
unsigned int size; /* Size of the data allocated by the caller */
union { union {
/* {atm/eth/dsl}_settings anyone ? */ /* {atm/eth/dsl}_settings anyone ? */
union hdlc_settings ifsu_hdlc; raw_hdlc_proto *raw_hdlc;
union line_settings ifsu_line; cisco_proto *cisco;
fr_proto *fr;
fr_proto_pvc *fr_pvc;
/* interface settings */
sync_serial_settings *sync;
te1_settings *te1;
} ifs_ifsu; } ifs_ifsu;
}; };
#define ifs_hdlc ifs_ifsu.ifsu_hdlc
#define ifs_line ifs_ifsu.ifsu_line
/* /*
* Interface request structure used for socket * Interface request structure used for socket
* ioctl's. All interface ioctl's must have parameter * ioctl's. All interface ioctl's must have parameter
...@@ -135,7 +139,7 @@ struct ifreq ...@@ -135,7 +139,7 @@ struct ifreq
char ifru_slave[IFNAMSIZ]; /* Just fits the size */ char ifru_slave[IFNAMSIZ]; /* Just fits the size */
char ifru_newname[IFNAMSIZ]; char ifru_newname[IFNAMSIZ];
char * ifru_data; char * ifru_data;
struct if_settings *ifru_settings; struct if_settings ifru_settings;
} ifr_ifru; } ifr_ifru;
}; };
......
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