return -ENXIO;
}
// MOD_INC_USE_COUNT;
- ia_timer.next = NULL;
- ia_timer.prev = NULL;
+ init_timer(&ia_timer);
ia_timer.expires = jiffies + 3*HZ;
ia_timer.data = 0UL;
ia_timer.function = ia_led_timer;
(long) ft, millisec, where);
#endif
- if (ft->tl.next || ft->tl.prev) {
+ if (timer_pending(&ft->tl)) {
printk(KERN_WARNING "FsmAddTimer: timer already active!\n");
ft->fi->printdebug(ft->fi, "FsmAddTimer already active!");
return -1;
(long) ft, millisec, where);
#endif
- if (ft->tl.next || ft->tl.prev)
+ if (timer_pending(&ft->tl))
del_timer(&ft->tl);
init_timer(&ft->tl);
ft->event = event;
L3AddTimer(struct L3Timer *t,
int millisec, int event)
{
- if (t->tl.next || t->tl.prev) {
+ if (timer_pending(&t->tl)) {
printk(KERN_WARNING "L3AddTimer: timer already active!\n");
return -1;
}
dev->base_addr = card->iobase; /* IO address */
dev->irq = card->irq; /* irq */
dev->init = net_init; /* the init function of the device */
- dev->name = ((struct net_local *) dev)->dev_name; /* device name */
if ((i = register_netdev(dev))) {
printk(KERN_WARNING "HYSDN: unable to create network device\n");
kfree(dev);
strcpy(netdev->local->name, " ");
else
strcpy(netdev->local->name, name);
- netdev->dev.name = netdev->local->name;
+ strcpy(netdev->dev.name, netdev->local->name);
netdev->dev.priv = netdev->local;
netdev->dev.init = isdn_net_init;
netdev->local->p_encap = ISDN_NET_ENCAP_RAWIP;
/* Index to functions, as function prototypes. */
-extern int atp_probe(struct net_device *dev);
-
static int atp_probe1(struct net_device *dev, short ioaddr);
static void get_node_ID(struct net_device *dev);
static unsigned short eeprom_op(short ioaddr, unsigned int cmd);
static int io = 0;
static struct net_device atp_dev = {
- "", 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, atp_probe };
+ "", 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, atp_init };
MODULE_PARM(io, "I/O port of the pocket adapter");
#ifdef MODULE
#define MAX_ES_CARDS 4 /* Max number of ES3210 cards per module */
#define NAMELEN 8 /* # of chars for storing dev->name */
-static char namelist[NAMELEN * MAX_ES_CARDS] = { 0, };
static struct net_device dev_es3210[MAX_ES_CARDS] = {
{
- NULL, /* assign a chunk of namelist[] below */
+ "", /* device name is inserted by net_init.c */
0, 0, 0, 0,
0, 0,
0, 0, 0, NULL, NULL
for (this_dev = 0; this_dev < MAX_ES_CARDS; this_dev++) {
struct net_device *dev = &dev_es3210[this_dev];
- dev->name = namelist+(NAMELEN*this_dev);
dev->irq = irq[this_dev];
dev->base_addr = io[this_dev];
dev->mem_start = mem[this_dev]; /* Currently ignored by driver */
static int unit;
MODULE_PARM(unit,"i");
-static char devicename[9] = { 0, };
-
static struct net_device dev_ethertap =
{
- devicename,
+ " ",
0, 0, 0, 0,
1, 5,
0, 0, 0, NULL, ethertap_probe
int init_module(void)
{
dev_ethertap.base_addr=unit+NETLINK_TAPBASE;
- sprintf(devicename,"tap%d",unit);
- if (dev_get(devicename))
+ sprintf(dev_ethertap.name,"tap%d",unit);
+ if (dev_get(dev_ethertap.name))
{
- printk(KERN_INFO "%s already loaded.\n", devicename);
+ printk(KERN_INFO "%s already loaded.\n", dev_ethertap.name);
return -EBUSY;
}
if (register_netdev(&dev_ethertap) != 0)
new->next = dev->next;
dev->next = new;
dev = dev->next; /* point to the new device */
- dev->name = (char *) (dev + 1);
if (num_eth > 9999) {
sprintf(dev->name, "eth????"); /* New device name */
} else {
typedef struct sixpack_ctrl {
- char if_name[8]; /* "sp0\0" .. "sp99999\0" */
struct sixpack ctrl; /* 6pack things */
struct net_device dev; /* the device */
} sixpack_ctrl_t;
/* Initialize channel control data */
set_bit(SIXPF_INUSE, &spp->ctrl.flags);
spp->ctrl.tty = NULL;
- sprintf(spp->if_name, "sp%d", i);
- spp->dev.name = spp->if_name;
+ sprintf(spp->dev.name, "sp%d", i);
spp->dev.base_addr = i;
spp->dev.priv = (void*)&(spp->ctrl);
spp->dev.next = NULL;
unsigned int bitrate;
unsigned char stat;
- char ifname[HDLCDRV_IFNAMELEN];
-
struct {
unsigned int intclk;
unsigned int fclk;
{
#ifdef KISS_VERBOSE
-#define PKP(a,b) printk(KERN_INFO "%s: channel params: " a "\n", bc->ifname, b)
+#define PKP(a,b) printk(KERN_INFO "baycomm_epp: channel params: " a "\n", b)
#else /* KISS_VERBOSE */
#define PKP(a,b)
#endif /* KISS_VERBOSE */
return;
pktlen = bc->hdlcrx.bufcnt-2+1; /* KISS kludge */
if (!(skb = dev_alloc_skb(pktlen))) {
- printk("%s: memory squeeze, dropping packet\n", bc->ifname);
+ printk("%s: memory squeeze, dropping packet\n", dev->name);
bc->stats.rx_dropped++;
return;
}
*/
memset(bc, 0, sizeof(struct baycom_state));
bc->magic = BAYCOM_MAGIC;
- sprintf(bc->ifname, "bce%d", i);
+ sprintf(dev->name, "bce%d", i);
bc->cfg.fclk = 19666600;
bc->cfg.bps = 9600;
/*
* initialize part of the device struct
*/
- dev->name = bc->ifname;
dev->if_port = 0;
dev->init = baycom_probe;
dev->base_addr = iobase[i];
dev->irq = 0;
dev->dma = 0;
if (register_netdev(dev)) {
- printk(KERN_WARNING "%s: cannot register net device %s\n", bc_drvname, bc->ifname);
+ printk(KERN_WARNING "%s: cannot register net device %s\n", bc_drvname, dev->name);
kfree(dev->priv);
return -ENXIO;
}
int i, j, found = 0;
char set_hw = 1;
struct baycom_state *bc;
- char ifname[HDLCDRV_IFNAMELEN];
printk(bc_drvinfo);
/*
*/
for (i = 0; i < NR_PORTS; i++) {
struct net_device *dev = baycom_device+i;
- sprintf(ifname, "bcp%d", i);
+ sprintf(dev->name, "bcp%d", i);
if (!mode[i])
set_hw = 0;
if (!set_hw)
iobase[i] = 0;
j = hdlcdrv_register_hdlcdrv(dev, &par96_ops, sizeof(struct baycom_state),
- ifname, iobase[i], 0, 0);
+ dev->name, iobase[i], 0, 0);
if (!j) {
bc = (struct baycom_state *)dev->priv;
if (set_hw && baycom_setmode(bc, mode[i]))
int i, j, found = 0;
char set_hw = 1;
struct baycom_state *bc;
- char ifname[HDLCDRV_IFNAMELEN];
-
printk(bc_drvinfo);
/*
*/
for (i = 0; i < NR_PORTS; i++) {
struct net_device *dev = baycom_device+i;
- sprintf(ifname, "bcsf%d", i);
+ sprintf(dev->name, "bcsf%d", i);
if (!mode[i])
set_hw = 0;
if (!set_hw)
iobase[i] = irq[i] = 0;
j = hdlcdrv_register_hdlcdrv(dev, &ser12_ops, sizeof(struct baycom_state),
- ifname, iobase[i], irq[i], 0);
+ dev->name, iobase[i], irq[i], 0);
if (!j) {
bc = (struct baycom_state *)dev->priv;
if (set_hw && baycom_setmode(bc, mode[i]))
int i, j, found = 0;
char set_hw = 1;
struct baycom_state *bc;
- char ifname[HDLCDRV_IFNAMELEN];
-
printk(bc_drvinfo);
/*
*/
for (i = 0; i < NR_PORTS; i++) {
struct net_device *dev = baycom_device+i;
- sprintf(ifname, "bcsh%d", i);
+ sprintf(dev->name, "bcsh%d", i);
if (!mode[i])
set_hw = 0;
if (!set_hw)
iobase[i] = irq[i] = 0;
j = hdlcdrv_register_hdlcdrv(dev, &ser12_ops, sizeof(struct baycom_state),
- ifname, iobase[i], irq[i], 0);
+ dev->name, iobase[i], irq[i], 0);
if (!j) {
bc = (struct baycom_state *)dev->priv;
if (set_hw && baycom_setmode(bc, mode[i]))
static int bpq_new_device(struct net_device *dev)
{
int k;
- unsigned char *buf;
struct bpqdev *bpq, *bpq2;
if ((bpq = kmalloc(sizeof(struct bpqdev), GFP_KERNEL)) == NULL)
memcpy(bpq->acpt_addr, bcast_addr, sizeof(bpq_eth_addr));
dev = &bpq->axdev;
- buf = kmalloc(14, GFP_KERNEL);
for (k = 0; k < MAXBPQDEV; k++) {
struct net_device *odev;
- sprintf(buf, "bpq%d", k);
+ sprintf(dev->name, "bpq%d", k);
- if ((odev = __dev_get_by_name(buf)) == NULL || bpq_check_devices(odev))
+ if ((odev = __dev_get_by_name(dev->name)) == NULL || bpq_check_devices(odev))
break;
}
}
dev->priv = (void *)bpq; /* pointer back */
- dev->name = buf;
dev->init = bpq_dev_init;
/* We should be locked, call register_netdevice() directly. */
};
struct scc_priv {
- char name[10];
struct enet_statistics stats;
struct scc_info *info;
int channel;
for (i = 0; i < 2; i++) {
dev = &info->dev[i];
priv = &info->priv[i];
- sprintf(priv->name, "dmascc%i", 2*n+i);
priv->info = info;
priv->channel = i;
priv->cmd = info->scc_base + (i ? SCCB_CMD : SCCA_CMD);
priv->rx_task.routine = rx_bh;
priv->rx_task.data = dev;
dev->priv = priv;
- dev->name = priv->name;
+ sprintf(dev->name, "dmascc%i", 2*n+i);
dev->base_addr = io;
dev->irq = irq;
dev->open = scc_open;
dev_init_buffers(dev);
if (register_netdevice(dev)) {
printk("dmascc: could not register %s\n", dev->name);
- dev->name = NULL;
}
}
return;
pkt_len = s->hdlcrx.len - 2 + 1; /* KISS kludge */
if (!(skb = dev_alloc_skb(pkt_len))) {
- printk("%s: memory squeeze, dropping packet\n",
- s->ifname);
+ printk("%s: memory squeeze, dropping packet\n", dev->name);
s->stats.rx_dropped++;
return;
}
{
#ifdef KISS_VERBOSE
-#define PKP(a,b) printk(KERN_INFO "%s: channel params: " a "\n", s->ifname, b)
+#define PKP(a,b) printk(KERN_INFO "hdlcdrv.c: channel params: " a "\n", b)
#else /* KISS_VERBOSE */
#define PKP(a,b)
#endif /* KISS_VERBOSE */
*/
memset(s, 0, privsize);
s->magic = HDLCDRV_MAGIC;
- strncpy(s->ifname, ifname, sizeof(s->ifname));
+ strncpy(dev->name, ifname, sizeof(dev->name));
s->ops = ops;
/*
* initialize part of the device struct
*/
- dev->name = s->ifname;
dev->if_port = 0;
dev->init = hdlcdrv_probe;
dev->base_addr = baseaddr;
dev->dma = dma;
if (register_netdev(dev)) {
printk(KERN_WARNING "hdlcdrv: cannot register net "
- "device %s\n", s->ifname);
+ "device %s\n", dev->name);
kfree(dev->priv);
return -ENXIO;
}
};
typedef struct ax25_ctrl {
- char if_name[8]; /* "ax0\0" .. "ax99999\0" */
struct ax_disp ctrl; /* */
struct net_device dev; /* the device */
} ax25_ctrl_t;
/* Initialize channel control data */
set_bit(AXF_INUSE, &axp->ctrl.flags);
- sprintf(axp->if_name, "ax%d", i++);
+ sprintf(axp->dev.name, "ax%d", i++);
axp->ctrl.tty = NULL;
- axp->dev.name = axp->if_name;
axp->dev.base_addr = i;
axp->dev.priv = (void *)&axp->ctrl;
axp->dev.next = NULL;
static int scc_net_setup(struct scc_channel *scc, unsigned char *name, int addev)
{
- unsigned char *buf;
struct net_device *dev;
if (dev_get(name))
dev = scc->dev;
memset(dev, 0, sizeof(struct net_device));
- if ((buf = (unsigned char *) kmalloc(10, GFP_KERNEL)) == NULL)
- return -ENOMEM;
-
- strcpy(buf, name);
-
+ strcpy(dev->name, name);
dev->priv = (void *) scc;
- dev->name = buf;
dev->init = scc_net_init;
if ((addev? register_netdevice(dev) : register_netdev(dev)) != 0)
/* --------------------------------------------------------------------- */
-static void sm_output_open(struct sm_state *sm)
+static void sm_output_open(struct sm_state *sm, const char *ifname)
{
enum uart u = c_uart_unknown;
struct parport *pp = NULL;
else if ((~pp->modes) & (PARPORT_MODE_PCSPP | PARPORT_MODE_SAFEININT))
printk(KERN_WARNING "%s: parport at address 0x%x cannot be used\n", sm_drvname, sm->hdrv.ptt_out.pariobase);
else {
- sm->pardev = parport_register_device(pp, sm->hdrv.ifname, NULL, NULL, NULL, PARPORT_DEV_EXCL, NULL);
+ sm->pardev = parport_register_device(pp, ifname, NULL, NULL, NULL, PARPORT_DEV_EXCL, NULL);
if (!sm->pardev) {
pp = NULL;
printk(KERN_WARNING "%s: cannot register parport device (address 0x%x)\n", sm_drvname, sm->hdrv.ptt_out.pariobase);
err = sm->hwdrv->open(dev, sm);
if (err)
return err;
- sm_output_open(sm);
+ sm_output_open(sm, dev->name);
MOD_INC_USE_COUNT;
printk(KERN_INFO "%s: %s mode %s.%s at iobase 0x%lx irq %u dma %u dma2 %u\n",
sm_drvname, sm->hwdrv->hw_name, sm->mode_tx->name,
int i, j, found = 0;
char set_hw = 1;
struct sm_state *sm;
- char ifname[HDLCDRV_IFNAMELEN];
printk(sm_drvinfo);
/*
*/
for (i = 0; i < NR_PORTS; i++) {
struct net_device *dev = sm_device+i;
- sprintf(ifname, "sm%d", i);
+ sprintf(dev->name, "sm%d", i);
if (!mode[i])
set_hw = 0;
}
if (!set_hw)
iobase[i] = irq[i] = 0;
- j = hdlcdrv_register_hdlcdrv(dev, &sm_ops, sizeof(struct sm_state), ifname, iobase[i], irq[i], dma[i]);
+ j = hdlcdrv_register_hdlcdrv(dev, &sm_ops, sizeof(struct sm_state), dev->name, iobase[i], irq[i], dma[i]);
if (!j) {
sm = (struct sm_state *)dev->priv;
sm->hdrv.ptt_out.dma2 = dma2[i];
int iobase;
int irq;
int dupmode;
- char name[16];
struct net_device dev;
for (i = 0; i < NR_PORTS; i++) {
if (yam_ports[i].iobase == 0 || yam_ports[i].irq == 0)
continue;
- len += sprintf(buffer + len, "Device %s\n", yam_ports[i].name);
+ len += sprintf(buffer + len, "Device yam%d\n", i);
len += sprintf(buffer + len, " Up %d\n", netif_running(&yam_ports[i].dev));
len += sprintf(buffer + len, " Speed %u\n", yam_ports[i].bitrate);
len += sprintf(buffer + len, " IoBase 0x%x\n", yam_ports[i].iobase);
memset(yam_ports, 0, sizeof(yam_ports));
for (i = 0; i < NR_PORTS; i++) {
- sprintf(yam_ports[i].name, "yam%d", i);
+ sprintf(yam_ports[i].dev.name, "yam%d", i);
yam_ports[i].magic = YAM_MAGIC;
yam_ports[i].bitrate = DEFAULT_BITRATE;
yam_ports[i].baudrate = DEFAULT_BITRATE * 2;
dev = &yam_ports[i].dev;
dev->priv = &yam_ports[i];
- dev->name = yam_ports[i].name;
dev->base_addr = yam_ports[i].iobase;
dev->irq = yam_ports[i].irq;
dev->init = yam_probe;
dev->do_ioctl = &el3_ioctl;
dev->set_multicast_list = &set_rx_mode;
ether_setup(dev);
- dev->name = lp->node.dev_name;
+ strcpy(dev->name, lp->node.dev_name);
dev->init = &tc574_init;
dev->open = &el3_open;
dev->stop = &el3_close;
dev->get_stats = &el3_get_stats;
dev->set_multicast_list = &set_multicast_list;
ether_setup(dev);
- dev->name = lp->node.dev_name;
+ strcpy(dev->name, lp->node.dev_name);
dev->init = &tc589_init;
dev->open = &el3_open;
dev->stop = &el3_close;
dev->get_stats = &awc_get_stats;
// dev->set_multicast_list = &awc_set_multicast_list;
- ether_setup(dev);
+ strcpy(dev->name, ((struct awc_private *)dev->priv)->node.dev_name);
- dev->name = ((struct awc_private *)dev->priv)->node.dev_name;
+ ether_setup(dev);
dev->init = &awc_pcmcia_init;
dev->open = &awc_pcmcia_open;
dev->set_config = &fjn_config;
dev->get_stats = &fjn_get_stats;
dev->set_multicast_list = &set_rx_mode;
+ strcpy(dev->name, lp->node.dev_name);
ether_setup(dev);
- dev->name = lp->node.dev_name;
dev->init = &fmvj18x_init;
dev->open = &fjn_open;
dev->stop = &fjn_close;
dev->do_ioctl = &netwave_ioctl;
ether_setup(dev);
- dev->name = priv->node.dev_name;
+ strcpy(dev->name, priv->node.dev_name)
dev->init = &netwave_init;
dev->open = &netwave_open;
dev->stop = &netwave_close;
writeb(NETWAVE_CMD_EOC, ramBase + NETWAVE_EREG_CB + 3);
/* If watchdog not already active, activate it... */
- if(priv->watchdog.prev == (struct timer_list *) NULL) {
-
+ if (!timer_pending(&priv->watchdog)) {
/* set timer to expire in WATCHDOG_JIFFIES */
priv->watchdog.expires = jiffies + WATCHDOG_JIFFIES;
add_timer(&priv->watchdog);
dev->set_config = &mace_config;
dev->get_stats = &mace_get_stats;
dev->set_multicast_list = &set_multicast_list;
+ strcpy(dev->name, lp->node.dev_name);
ether_setup(dev);
- dev->name = lp->node.dev_name;
dev->init = &nmclan_init;
dev->open = &mace_open;
dev->stop = &mace_close;
dev->get_stats = &smc91c92_get_stats;
dev->set_config = &s9k_config;
dev->set_multicast_list = &set_rx_mode;
+ strcpy(dev->name, smc->node.dev_name);
ether_setup(dev);
- dev->name = smc->node.dev_name;
dev->init = &smc91c92_init;
dev->open = &smc91c92_open;
dev->stop = &smc91c92_close;
lp->stats.tx_bytes += length;
/* If watchdog not already active, activate it... */
- if(lp->watchdog.prev == (timer_list *) NULL)
+ if (!timer_pending(&lp->watchdog))
{
/* set timer to expire in WATCHDOG_JIFFIES */
lp->watchdog.expires = jiffies + WATCHDOG_JIFFIES;
#endif
/* If watchdog was activated, kill it ! */
- if(lp->watchdog.prev != (timer_list *) NULL)
+ if (timer_pending(&lp->watchdog))
del_timer(&lp->watchdog);
lp->nresets++;
#endif
/* If watchdog was activated, kill it ! */
- if(lp->watchdog.prev != (timer_list *) NULL)
+ if(timer_pending(&lp->watchdog))
del_timer(&lp->watchdog);
/* Get transmission status */
#endif /* WAVELAN_ROAMING */
/* If watchdog was activated, kill it ! */
- if(lp->watchdog.prev != (timer_list *) NULL)
+ if(timer_pending(&lp->watchdog))
del_timer(&lp->watchdog);
link->open--;
#endif
/* Other specific data */
- /* Provide storage area for device name */
- dev->name = ((net_local *)dev->priv)->node.dev_name;
+ strcpy(dev->name, ((net_local *)dev->priv)->node.dev_name);
netif_start_queue (dev);
dev->mtu = WAVELAN_MTU;
dev->get_stats = &do_get_stats;
dev->do_ioctl = &do_ioctl;
dev->set_multicast_list = &set_multicast_list;
+ strcpy(dev->name, local->node.dev_name);
ether_setup(dev);
- dev->name = local->node.dev_name;
dev->init = &do_init;
dev->open = &do_open;
dev->stop = &do_stop;
}
/* prepare network device data space for registration */
- dev->name = chan->name;
+ strcpy(dev->name, chan->name);
dev->init = if_init;
dev->priv = chan;
}
dev->priv = (void *)lapbeth; /* pointer back */
- dev->name = buf;
+ strcpy(dev->name, buf);
dev->init = lapbeth_dev_init;
if (register_netdev(dev) != 0) {
/*
* Switch to common hdlc%d naming. We name by type not by vendor
*/
-#if LINUX_VERSION_CODE < 0x20363
- dev->name = ((char *) (dev)) + sizeof (struct ppp_device);
-#else
- dev->name = ((char *) (dev)) + sizeof (struct net_device);
-#endif
dev_alloc_name(dev, "hdlc%d");
#else
* GCOM uses LMC vendor name so that clients can know which card
* to attach to.
*/
- dev->name = ((char *) (dev)) + sizeof (struct ppp_device);
dev_alloc_name(dev, "lmc%d");
#endif
chdlc_priv_area->mc = conf->mc;
/* prepare network device data space for registration */
- dev->name = card->u.c.if_name;
+ strcpy(dev->name, card->u.c.if_name);
dev->init = &if_init;
dev->priv = chdlc_priv_area;
chan->transmit_length = 0;
/* prepare network device data space for registration */
- dev->name = chan->name;
+ strcpy(dev->name, chan->name);
dev->init = &if_init;
dev->priv = chan;
/* prepare network device data space for registration */
- dev->name = card->u.p.if_name;
+ strcpy(dev->name, card->u.p.if_name);
dev->init = &if_init;
dev->priv = ppp_priv_area;
}
/* prepare network device data space for registration */
- dev->name = chan->name;
+ strcpy(dev->name, chan->name);
dev->init = &if_init;
dev->priv = chan;
return 0;
#include "x25_asy.h"
typedef struct x25_ctrl {
- char if_name[8]; /* "xasy0\0" .. "xasy99999\0" */
struct x25_asy ctrl; /* X.25 things */
struct net_device dev; /* the device */
} x25_asy_ctrl_t;
/* Initialize channel control data */
set_bit(SLF_INUSE, &slp->ctrl.flags);
slp->ctrl.tty = NULL;
- sprintf(slp->if_name, "x25asy%d", i);
- slp->dev.name = slp->if_name;
+ sprintf(slp->dev.name, "x25asy%d", i);
slp->dev.base_addr = i;
slp->dev.priv = (void*)&(slp->ctrl);
slp->dev.next = NULL;
bool ' USB ConnectTech WhiteHEAT Serial Driver (EXPERIMENTAL)' CONFIG_USB_SERIAL_WHITEHEAT
bool ' USB FTDI Single Port Serial Driver (EXPERIMENTAL)' CONFIG_USB_SERIAL_FTDI_SIO
bool ' USB Keyspan PDA Single Port Serial Driver (EXPERIMENTAL)' CONFIG_USB_SERIAL_KEYSPAN_PDA
+ bool ' USB Digi International AccelePort USB Serial Driver (EXPERIMENTAL)' CONFIG_USB_SERIAL_DIGI_ACCELEPORT
bool ' USB ZyXEL omni.net LCD Plus Driver (EXPERIMENTAL)' CONFIG_USB_SERIAL_OMNINET
fi
bool ' USB Serial Converter verbose debug' CONFIG_USB_SERIAL_DEBUG
if(!s->opened && s->net_dev.name) {
dbg("unregistering netdev: %s",s->net_dev.name);
unregister_netdev(&s->net_dev);
- kfree(s->net_dev.name);
- s->net_dev.name=NULL;
+ s->net_dev.name[0] = '\0';
}
dbg("plusb_disconnect: finished");
return NULL;
}
- if(!s->net_dev.name) {
- s->net_dev.name=kmalloc(16, GFP_KERNEL);
-
- if(!s->net_dev.name || dev_alloc_name(&s->net_dev,"plusb%d")<0) {
- err("alloc name failed\n");
- return NULL;
- }
-
+ if(!s->net_dev.name[0]) {
+ strcpy(s->net_dev.name, "plusb%d");
s->net_dev.init=plusb_net_init;
s->net_dev.priv=s;
if(!register_netdev(&s->net_dev))
info("registered: %s", s->net_dev.name);
else {
err("register_netdev failed");
- kfree(s->net_dev.name);
- s->net_dev.name=NULL;
+ s->net_dev.name[0] = '\0';
}
}
dbg("plusb_cleanup");
for (u = 0; u < NRPLUSB; u++) {
plusb_t *s = &plusb[u];
- if(s->net_dev.name) {
+ if(s->net_dev.name[0]) {
dbg("unregistering netdev: %s",s->net_dev.name);
unregister_netdev(&s->net_dev);
- kfree(s->net_dev.name);
- s->net_dev.name=NULL;
}
}
usb_deregister (&plusb_driver);
O_TARGET := usb-serial.o
M_OBJS := usb-serial.o
-O_OBJS := usbserial.o visor.o whiteheat.o ftdi_sio.o keyspan_pda.o omninet.o
+O_OBJS := usbserial.o visor.o whiteheat.o ftdi_sio.o keyspan_pda.o omninet.o digi_acceleport.o
MOD_LIST_NAME := USB_SERIAL_MODULES
include $(TOPDIR)/Rules.make
--- /dev/null
+/*
+* Digi AccelePort USB-4 Serial Converter
+*
+* Copyright 2000 by Digi International
+*
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation; either version 2 of the License, or
+* (at your option) any later version.
+*
+* Shamelessly based on Brian Warner's keyspan_pda.c and Greg Kroah-Hartman's
+* usb-serial driver.
+*
+* Peter Berger (pberger@brimson.com)
+* Al Borchers (borchers@steinerpoint.com)
+*
+* (5/3/2000) pberger and borchers
+* First alpha version of the driver--many known limitations and bugs.
+*
+* $Id: digi_acceleport.c,v 1.28 2000/05/04 01:47:08 root Exp root $
+*/
+
+#include <linux/config.h>
+
+#ifdef CONFIG_USB_SERIAL_DIGI_ACCELEPORT
+
+#include <linux/kernel.h>
+#include <linux/sched.h>
+#include <linux/signal.h>
+#include <linux/errno.h>
+#include <linux/poll.h>
+#include <linux/init.h>
+#include <linux/malloc.h>
+#include <linux/fcntl.h>
+#include <linux/tty_driver.h>
+#include <linux/tty_flip.h>
+#include <linux/tty.h>
+#include <linux/module.h>
+#include <linux/spinlock.h>
+
+#ifdef CONFIG_USB_SERIAL_DEBUG
+ #define DEBUG
+#else
+ #undef DEBUG
+#endif
+#include <linux/usb.h>
+#include "usb-serial.h"
+
+
+/* Defines */
+
+/* port buffer length -- must be <= transfer buffer length - 2 */
+/* so we can be sure to send the full buffer in one urb */
+#define DIGI_PORT_BUF_LEN 16
+
+/* AccelePort USB Defines */
+
+/* ids */
+#define DIGI_VENDOR_ID 0x05c5
+#define DIGI_ID 0x0004
+
+/* commands */
+#define DIGI_CMD_SET_BAUD_RATE 0
+#define DIGI_CMD_SET_WORD_SIZE 1
+#define DIGI_CMD_SET_PARITY 2
+#define DIGI_CMD_SET_STOP_BITS 3
+#define DIGI_CMD_SET_INPUT_FLOW_CONTROL 4
+#define DIGI_CMD_SET_OUTPUT_FLOW_CONTROL 5
+#define DIGI_CMD_SET_DTR_SIGNAL 6
+#define DIGI_CMD_SET_RTS_SIGNAL 7
+#define DIGI_CMD_RECEIVE_ENABLE 10
+#define DIGI_CMD_BREAK_CONTROL 11
+#define DIGI_CMD_LOCAL_LOOPBACK 12
+#define DIGI_CMD_TRANSMIT_IDLE 13
+#define DIGI_CMD_WRITE_UART_REGISTER 15
+#define DIGI_CMD_AND_UART_REGISTER 16
+#define DIGI_CMD_OR_UART_REGISTER 17
+#define DIGI_CMD_SEND_DATA 18
+
+/* baud rates */
+#define DIGI_BAUD_50 0
+#define DIGI_BAUD_75 1
+#define DIGI_BAUD_110 2
+#define DIGI_BAUD_150 3
+#define DIGI_BAUD_200 4
+#define DIGI_BAUD_300 5
+#define DIGI_BAUD_600 6
+#define DIGI_BAUD_1200 7
+#define DIGI_BAUD_1800 8
+#define DIGI_BAUD_2400 9
+#define DIGI_BAUD_4800 10
+#define DIGI_BAUD_7200 11
+#define DIGI_BAUD_9600 12
+#define DIGI_BAUD_14400 13
+#define DIGI_BAUD_19200 14
+#define DIGI_BAUD_28800 15
+#define DIGI_BAUD_38400 16
+#define DIGI_BAUD_57600 17
+#define DIGI_BAUD_76800 18
+#define DIGI_BAUD_115200 19
+#define DIGI_BAUD_153600 20
+#define DIGI_BAUD_230400 21
+#define DIGI_BAUD_460800 22
+
+/* flow control arguments */
+#define DIGI_ENABLE_IXON_IXOFF_FLOW_CONTROL 1
+#define DIGI_ENABLE_RTS_CTS_FLOW_CONTROL 2
+#define DIGI_ENABLE_DTR_DSR_FLOW_CONTROL 4
+
+/* macros */
+#define MAX(a,b) (((a)>(b))?(a):(b))
+#define MIN(a,b) (((a)<(b))?(a):(b))
+
+
+/* Structures */
+
+typedef struct digi_private {
+ spinlock_t dp_port_lock;
+ int dp_buf_len;
+ char dp_buf[32];
+} digi_private_t;
+
+struct s_digiusb {
+ u8 opcode;
+ u8 length;
+ u8 val;
+ u8 pad;
+};
+
+
+/* Local Function Declarations */
+
+static void digi_send_cmd( char *mes, struct usb_serial_port *port, int opcode,
+ int length, int val );
+static void digi_send_oob( char *mes, int opcode, int linenum, int data1, int data2 );
+static void digi_rx_throttle (struct usb_serial_port *port);
+static void digi_rx_unthrottle (struct usb_serial_port *port);
+static int digi_setbaud( struct usb_serial_port *port, int baud );
+static void digi_set_termios( struct usb_serial_port *port,
+ struct termios *old_termios );
+static void digi_break_ctl( struct usb_serial_port *port, int break_state );
+static int digi_get_modem_info( struct usb_serial *serial,
+ unsigned char *value );
+static int digi_set_modem_info( struct usb_serial *serial,
+ unsigned char value );
+static int digi_ioctl( struct usb_serial_port *port, struct file *file,
+ unsigned int cmd, unsigned long arg );
+static int digi_write( struct usb_serial_port *port, int from_user,
+ const unsigned char *buf, int count );
+static void digi_write_bulk_callback( struct urb *urb );
+static int digi_write_room( struct usb_serial_port *port );
+static int digi_chars_in_buffer( struct usb_serial_port *port );
+static int digi_open( struct usb_serial_port *port, struct file *filp );
+static void digi_close( struct usb_serial_port *port, struct file *filp );
+static int digi_startup (struct usb_serial *serial);
+static void digi_shutdown( struct usb_serial *serial );
+static void digi_read_bulk_callback( struct urb *urb );
+
+
+/* Statics */
+
+/* device info needed for the Digi serial converter */
+static __u16 digi_vendor_id = DIGI_VENDOR_ID;
+static __u16 digi_product_id = DIGI_ID;
+
+/* out of band port */
+static int oob_port_num; /* index of out-of-band port */
+static struct usb_serial_port *oob_port; /* out-of-band control port */
+static int oob_read_started = 0;
+
+/* config lock -- used to protect digi statics and globals, like oob vars */
+spinlock_t config_lock;
+
+
+/* Globals */
+
+struct usb_serial_device_type digi_acceleport_device = {
+ name: "Digi USB",
+ idVendor: &digi_vendor_id,
+ idProduct: &digi_product_id,
+ needs_interrupt_in: DONT_CARE,
+ needs_bulk_in: MUST_HAVE,
+ needs_bulk_out: MUST_HAVE,
+ num_interrupt_in: 0,
+ num_bulk_in: 5,
+ num_bulk_out: 5,
+ num_ports: 4,
+ open: digi_open,
+ close: digi_close,
+ write: digi_write,
+ write_room: digi_write_room,
+ write_bulk_callback: digi_write_bulk_callback,
+ read_bulk_callback: digi_read_bulk_callback,
+ chars_in_buffer: digi_chars_in_buffer,
+ throttle: digi_rx_throttle,
+ unthrottle: digi_rx_unthrottle,
+ ioctl: digi_ioctl,
+ set_termios: digi_set_termios,
+ break_ctl: digi_break_ctl,
+ startup: digi_startup,
+ shutdown: digi_shutdown,
+};
+
+
+/* Functions */
+
+/* Send message on the out-of-Band endpoint */
+static void digi_send_oob( char *mes, int opcode, int linenum, int data1, int data2 )
+{
+ int ret;
+ struct s_digiusb digiusb;
+ digi_private_t *priv = (digi_private_t *)(oob_port->private);
+
+
+dbg( "digi_send_oob: TOP: from '%s', opcode: %d, linenum:%d, data1: %d, data2: %d", mes, opcode, linenum, data1, data2 );
+
+ digiusb.opcode = (u8)opcode;
+ digiusb.length = (u8)linenum;
+ digiusb.val = (u8)data1;
+ digiusb.pad = (u8)data2;
+
+ spin_lock( &priv->dp_port_lock );
+
+ while (oob_port->write_urb->status == -EINPROGRESS) {
+dbg( "digi_send_oob: opcode:%d already writing...", opcode );
+ spin_unlock( &priv->dp_port_lock );
+ interruptible_sleep_on(&oob_port->write_wait);
+ if (signal_pending(current)) {
+ return;
+ }
+ spin_lock( &priv->dp_port_lock );
+ }
+
+ memcpy( oob_port->write_urb->transfer_buffer, &digiusb, sizeof(digiusb) );
+ oob_port->write_urb->transfer_buffer_length = sizeof(digiusb);
+ if( (ret=usb_submit_urb(oob_port->write_urb)) != 0 ) {
+ dbg(
+ "digi_send_oob: usb_submit_urb(write bulk) failed, opcode=%d, ret=%d",
+ opcode, ret );
+ }
+
+ spin_unlock( &priv->dp_port_lock );
+
+dbg( "digi_send_oob: opcode %d done", opcode );
+
+}
+
+
+static void digi_send_cmd( char *mes, struct usb_serial_port *port, int opcode,
+ int length, int val )
+{
+
+ int ret;
+ struct s_digiusb digiusb;
+ digi_private_t *priv = (digi_private_t *)(port->private);
+
+
+dbg( "digi_send_cmd: TOP: from '%s', opcode: %d, val: %d", mes, opcode, val );
+
+ digiusb.opcode = (u8)opcode;
+ digiusb.length = (u8)length;
+ digiusb.val = (u8)val;
+ digiusb.pad = 0;
+
+ spin_lock( &priv->dp_port_lock );
+
+ while( port->write_urb->status == -EINPROGRESS ) {
+dbg( "digi_send_cmd: opcode=%d already writing...", opcode );
+ spin_unlock( &priv->dp_port_lock );
+ interruptible_sleep_on( &port->write_wait );
+ if( signal_pending(current) ) {
+ return;
+ }
+ spin_lock( &priv->dp_port_lock );
+ }
+
+ memcpy( port->write_urb->transfer_buffer, &digiusb, sizeof(digiusb) );
+ port->write_urb->transfer_buffer_length = sizeof(digiusb);
+ if( (ret=usb_submit_urb(port->write_urb)) != 0 )
+ dbg(
+ "digi_send_cmd: usb_submit_urb(write bulk) failed, opcode=%d, ret=%d",
+ opcode, ret );
+
+dbg( "digi_send_cmd: opcode %d done", opcode );
+
+ spin_unlock( &priv->dp_port_lock );
+
+}
+
+
+static void digi_rx_throttle( struct usb_serial_port *port )
+{
+
+dbg( "digi_rx_throttle: TOP: port=%d", port->number );
+
+ /* stop receiving characters. We just turn off the URB request, and
+ let chars pile up in the device. If we're doing hardware
+ flowcontrol, the device will signal the other end when its buffer
+ fills up. If we're doing XON/XOFF, this would be a good time to
+ send an XOFF, although it might make sense to foist that off
+ upon the device too. */
+
+ // usb_unlink_urb(port->interrupt_in_urb);
+
+}
+
+
+static void digi_rx_unthrottle( struct usb_serial_port *port )
+{
+
+dbg( "digi_rx_unthrottle: TOP: port=%d", port->number );
+
+ /* just restart the receive interrupt URB */
+ //if (usb_submit_urb(port->interrupt_in_urb))
+ // dbg( "digi_rx_unthrottle: usb_submit_urb(read urb) failed" );
+
+}
+
+
+static int digi_setbaud( struct usb_serial_port *port, int baud )
+{
+
+ int bindex;
+
+
+dbg( "digi_setbaud: TOP: port=%d", port->number );
+
+ switch( baud ) {
+ case 50: bindex = DIGI_BAUD_50; break;
+ case 75: bindex = DIGI_BAUD_75; break;
+ case 110: bindex = DIGI_BAUD_110; break;
+ case 150: bindex = DIGI_BAUD_150; break;
+ case 200: bindex = DIGI_BAUD_200; break;
+ case 300: bindex = DIGI_BAUD_300; break;
+ case 600: bindex = DIGI_BAUD_600; break;
+ case 1200: bindex = DIGI_BAUD_1200; break;
+ case 1800: bindex = DIGI_BAUD_1800; break;
+ case 2400: bindex = DIGI_BAUD_2400; break;
+ case 4800: bindex = DIGI_BAUD_4800; break;
+ case 7200: bindex = DIGI_BAUD_7200; break;
+ case 9600: bindex = DIGI_BAUD_9600; break;
+ case 14400: bindex = DIGI_BAUD_14400; break;
+ case 19200: bindex = DIGI_BAUD_19200; break;
+ case 28800: bindex = DIGI_BAUD_28800; break;
+ case 38400: bindex = DIGI_BAUD_38400; break;
+ case 57600: bindex = DIGI_BAUD_57600; break;
+ case 76800: bindex = DIGI_BAUD_76800; break;
+ case 115200: bindex = DIGI_BAUD_115200; break;
+ case 153600: bindex = DIGI_BAUD_153600; break;
+ case 230400: bindex = DIGI_BAUD_230400; break;
+ case 460800: bindex = DIGI_BAUD_460800; break;
+ default:
+ dbg( "digi_setbaud: can't handle requested baud rate %d", baud );
+ return( -EINVAL );
+ break;
+ }
+
+ digi_send_cmd( "digi_setbaud:", port, DIGI_CMD_SET_BAUD_RATE, 2, bindex );
+
+ return( 0 ); /* FIX -- send_cmd should return a value??, return it */
+
+}
+
+
+static void digi_set_termios( struct usb_serial_port *port,
+ struct termios *old_termios )
+{
+
+ unsigned int iflag = port->tty->termios->c_iflag;
+ unsigned int old_iflag = old_termios->c_iflag;
+ unsigned int cflag = port->tty->termios->c_cflag;
+ unsigned int old_cflag = old_termios->c_cflag;
+ int arg;
+
+
+dbg( "digi_set_termios: TOP: port=%d, iflag=0x%x, old_iflag=0x%x, cflag=0x%x, old_cflag=0x%x", port->number, iflag, old_iflag, cflag, old_cflag );
+
+ /* set baud rate */
+ /* if( (cflag&CBAUD) != (old_cflag&CBAUD) ) */ {
+ switch( (cflag&CBAUD) ) {
+ case B50: digi_setbaud(port, 50); break;
+ case B75: digi_setbaud(port, 75); break;
+ case B110: digi_setbaud(port, 110); break;
+ case B150: digi_setbaud(port, 150); break;
+ case B200: digi_setbaud(port, 200); break;
+ case B300: digi_setbaud(port, 300); break;
+ case B600: digi_setbaud(port, 600); break;
+ case B1200: digi_setbaud(port, 1200); break;
+ case B1800: digi_setbaud(port, 1800); break;
+ case B2400: digi_setbaud(port, 2400); break;
+ case B4800: digi_setbaud(port, 4800); break;
+ case B9600: digi_setbaud(port, 9600); break;
+ case B19200: digi_setbaud(port, 19200); break;
+ case B38400: digi_setbaud(port, 38400); break;
+ case B57600: digi_setbaud(port, 57600); break;
+ case B115200: digi_setbaud(port, 115200); break;
+ default:
+ dbg( "digi_set_termios: can't handle baud rate 0x%x",
+ (cflag&CBAUD) );
+ break;
+ }
+ }
+
+ /* set input flow control */
+ /* if( (iflag&IXOFF) != (old_iflag&IXOFF)
+ || (cflag&CRTSCTS) != (old_cflag&CRTSCTS) ) */ {
+
+ arg = 0;
+
+ if( (iflag&IXOFF) )
+ arg |= DIGI_ENABLE_IXON_IXOFF_FLOW_CONTROL;
+ if( (cflag&CRTSCTS) )
+ arg |= DIGI_ENABLE_RTS_CTS_FLOW_CONTROL;
+
+ digi_send_cmd( "digi_termios: set input flow control:", port,
+ DIGI_CMD_SET_INPUT_FLOW_CONTROL, 2, arg );
+
+ }
+
+ /* set output flow control */
+ /* if( (iflag&IXON) != (old_iflag&IXON)
+ || (cflag&CRTSCTS) != (old_cflag&CRTSCTS) ) */ {
+
+ arg = 0;
+
+ if( (iflag&IXON) )
+ arg |= DIGI_ENABLE_IXON_IXOFF_FLOW_CONTROL;
+ if( (cflag&CRTSCTS) )
+ arg |= DIGI_ENABLE_RTS_CTS_FLOW_CONTROL;
+
+ digi_send_cmd( "digi_set_termios: set output flow control:", port,
+ DIGI_CMD_SET_OUTPUT_FLOW_CONTROL, 2, arg );
+
+ }
+
+}
+
+
+static void digi_break_ctl( struct usb_serial_port *port, int break_state )
+{
+dbg( "digi_break_ctl: TOP: port=%d", port->number );
+}
+
+
+/* modem control pins: DTR and RTS are outputs and can be controlled;
+ DCD, RI, DSR, CTS are inputs and can be read */
+
+static int digi_get_modem_info( struct usb_serial *serial,
+ unsigned char *value )
+{
+dbg( "digi_get_modem_info: TOP" );
+ return( 0 );
+}
+
+
+static int digi_set_modem_info( struct usb_serial *serial,
+ unsigned char value )
+{
+dbg( "digi_set_modem_info: TOP" );
+ return( 0 );
+}
+
+
+static int digi_ioctl( struct usb_serial_port *port, struct file *file,
+ unsigned int cmd, unsigned long arg )
+{
+ struct usb_serial *serial = port->serial;
+ int rc;
+ unsigned int value;
+ unsigned char status, mask;
+
+dbg( "digi_ioctl: TOP: port=%d, cmd=0x%x", port->number, cmd );
+return( -ENOIOCTLCMD );
+
+ switch (cmd) {
+ case TIOCMGET: /* get modem pins state */
+ rc = digi_get_modem_info(serial, &status);
+ if (rc < 0)
+ return rc;
+ value =
+ ((status & (1<<7)) ? TIOCM_DTR : 0) |
+ ((status & (1<<6)) ? TIOCM_CAR : 0) |
+ ((status & (1<<5)) ? TIOCM_RNG : 0) |
+ ((status & (1<<4)) ? TIOCM_DSR : 0) |
+ ((status & (1<<3)) ? TIOCM_CTS : 0) |
+ ((status & (1<<2)) ? TIOCM_RTS : 0);
+ if (copy_to_user((unsigned int *)arg, &value, sizeof(int)))
+ return -EFAULT;
+ return 0;
+ case TIOCMSET: /* set a state as returned by MGET */
+ if (copy_from_user(&value, (unsigned int *)arg, sizeof(int)))
+ return -EFAULT;
+ status =
+ ((value & TIOCM_DTR) ? (1<<7) : 0) |
+ ((value & TIOCM_CAR) ? (1<<6) : 0) |
+ ((value & TIOCM_RNG) ? (1<<5) : 0) |
+ ((value & TIOCM_DSR) ? (1<<4) : 0) |
+ ((value & TIOCM_CTS) ? (1<<3) : 0) |
+ ((value & TIOCM_RTS) ? (1<<2) : 0);
+ rc = digi_set_modem_info(serial, status);
+ if (rc < 0)
+ return rc;
+ return 0;
+ case TIOCMBIS: /* set bits in bitmask <arg> */
+ case TIOCMBIC: /* clear bits from bitmask <arg> */
+ if (copy_from_user(&value, (unsigned int *)arg, sizeof(int)))
+ return -EFAULT;
+ rc = digi_get_modem_info(serial, &status);
+ if (rc < 0)
+ return rc;
+ mask =
+ ((value & TIOCM_RTS) ? (1<<2) : 0) |
+ ((value & TIOCM_DTR) ? (1<<7) : 0);
+ if (cmd == TIOCMBIS)
+ status |= mask;
+ else
+ status &= ~mask;
+ rc = digi_set_modem_info(serial, status);
+ if (rc < 0)
+ return rc;
+ return 0;
+ case TIOCMIWAIT:
+ /* wait for any of the 4 modem inputs (DCD,RI,DSR,CTS)*/
+ /* TODO */
+ case TIOCGICOUNT:
+ /* return count of modemline transitions */
+ return 0; /* TODO */
+ }
+
+ return -ENOIOCTLCMD;
+}
+
+
+static int digi_write( struct usb_serial_port *port, int from_user,
+ const unsigned char *buf, int count )
+{
+
+ int i,ret,data_len,new_len;
+ digi_private_t *priv = (digi_private_t *)(port->private);
+
+
+dbg( "digi_write: TOP: port=%d, count=%d, from_user=%d, in_interrupt=%d",
+port->number, count, from_user, in_interrupt() );
+
+ /* be sure only one write proceeds at a time */
+ /* there are races on the port private buffer */
+ /* and races to check write_urb->status */
+ spin_lock( &priv->dp_port_lock );
+
+ /* wait for urb status clear to submit another urb */
+ if( port->write_urb->status == -EINPROGRESS ) {
+
+dbg( "digi_write: -EINPROGRESS set" );
+
+ /* buffer the data if possible */
+ new_len = MIN( count, DIGI_PORT_BUF_LEN-priv->dp_buf_len );
+ memcpy( priv->dp_buf+priv->dp_buf_len, buf, new_len );
+ priv->dp_buf_len += new_len;
+
+ /* unlock and return number of bytes buffered */
+ spin_unlock( &priv->dp_port_lock );
+dbg( "digi_write: buffering, return %d", new_len );
+ return( new_len );
+
+ }
+
+ /* allow space for any buffered data and for new data, up to */
+ /* transfer buffer size - 2 (for command and length bytes) */
+ new_len = MIN( count, port->bulk_out_size-2-priv->dp_buf_len );
+ data_len = new_len + priv->dp_buf_len;
+
+dbg( "digi_write: counts: new data %d, buf data %d, total data %d (max %d)", new_len, priv->dp_buf_len, data_len, port->bulk_out_size-2 );
+
+ /* nothing to send */
+ if( data_len == 0 ) {
+ spin_unlock( &priv->dp_port_lock );
+ return( 0 );
+ }
+
+ /* set command and length bytes */
+ *((u8 *)(port->write_urb->transfer_buffer)) = (u8)DIGI_CMD_SEND_DATA;
+ *((u8 *)(port->write_urb->transfer_buffer)+1) = (u8)data_len;
+
+ /* set total transfer buffer length */
+ port->write_urb->transfer_buffer_length = data_len+2;
+
+ /* copy in buffered data first */
+ memcpy( port->write_urb->transfer_buffer+2, priv->dp_buf,
+ priv->dp_buf_len );
+
+ /* copy in new data */
+ if( from_user ) {
+ copy_from_user( port->write_urb->transfer_buffer+2+priv->dp_buf_len,
+ buf, new_len );
+ }
+ else {
+ memcpy( port->write_urb->transfer_buffer+2+priv->dp_buf_len,
+ buf, new_len );
+ }
+
+#ifdef DEBUG
+ printk( KERN_DEBUG __FILE__ ": digi_write: length=%d, data=",
+ port->write_urb->transfer_buffer_length );
+ for( i=0; i<port->write_urb->transfer_buffer_length; ++i ) {
+ printk( "%.2x ",
+ ((unsigned char *)port->write_urb->transfer_buffer)[i] );
+ }
+ printk( "\n" );
+#endif
+
+ /* submit urb */
+ if( (ret=usb_submit_urb(port->write_urb)) == 0 ) {
+ /* submit successful, return length of new data written */
+ ret = new_len;
+ /* clear buffer */
+ priv->dp_buf_len = 0;
+ }
+ else {
+ dbg( "digi_write: usb_submit_urb(write bulk) failed, ret=%d", ret );
+ /* no bytes written - should we return the error code or 0? */
+ ret = 0;
+ }
+
+ /* return length of new data written, or error */
+dbg( "digi_write: returning %d", ret );
+ spin_unlock( &priv->dp_port_lock );
+ return( ret );
+
+}
+
+
+static void digi_write_bulk_callback( struct urb *urb )
+{
+
+ struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
+ struct usb_serial *serial = port->serial;
+ struct tty_struct *tty = port->tty;
+ digi_private_t *priv = (digi_private_t *)(port->private);
+ int ret;
+
+
+dbg( "digi_write_bulk_callback: TOP: port=%d", port->number );
+
+ /* handle callback on out-of-band port */
+ if( port->number == oob_port_num ) {
+ dbg( "digi_write_bulk_callback: oob callback" );
+ wake_up_interruptible( &port->write_wait );
+ return;
+ }
+
+ /* sanity checks */
+ if( port_paranoia_check( port, "digi_write_bulk_callback" )
+ || serial_paranoia_check( serial, "digi_write_bulk_callback" ) ) {
+ return;
+ }
+
+ /* try to send any buffered data on this port */
+ spin_lock( &priv->dp_port_lock );
+ if( port->write_urb->status != -EINPROGRESS && priv->dp_buf_len > 0 ) {
+
+ /* set command and length bytes */
+ *((u8 *)(port->write_urb->transfer_buffer))
+ = (u8)DIGI_CMD_SEND_DATA;
+ *((u8 *)(port->write_urb->transfer_buffer)+1)
+ = (u8)priv->dp_buf_len;
+
+ /* set total transfer buffer length */
+ port->write_urb->transfer_buffer_length = priv->dp_buf_len+2;
+
+ /* copy in buffered data */
+ memcpy( port->write_urb->transfer_buffer+2, priv->dp_buf,
+ priv->dp_buf_len );
+
+ /* submit urb */
+dbg( "digi_write_bulk_callback: submit urb to write buffer, data len=%d",
+priv->dp_buf_len );
+ if( (ret=usb_submit_urb(port->write_urb)) == 0 ) {
+ /* successful, clear buffer */
+ priv->dp_buf_len = 0;
+ }
+ else {
+ dbg( "digi_write_bulk_callback: usb_submit_urb(write bulk) failed, ret=%d", ret );
+ }
+
+ }
+ spin_unlock( &priv->dp_port_lock );
+
+ /* wake up port processes */
+ wake_up_interruptible( &port->write_wait );
+
+ /* wake up line discipline */
+ tty = port->tty;
+ if( (tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && tty->ldisc.write_wakeup )
+ (tty->ldisc.write_wakeup)(tty);
+
+ /* wake up other tty processes */
+ wake_up_interruptible( &tty->write_wait );
+
+}
+
+
+static int digi_write_room( struct usb_serial_port *port )
+{
+
+ int room;
+ digi_private_t *priv = (digi_private_t *)(port->private);
+
+
+dbg( "digi_write_room: TOP: port=%d", port->number );
+
+ spin_lock( &priv->dp_port_lock );
+
+ if( port->write_urb->status == -EINPROGRESS )
+ room = 0;
+ else
+ room = port->bulk_out_size - 2 - priv->dp_buf_len;
+
+ spin_unlock( &priv->dp_port_lock );
+
+dbg( "digi_write_room: return room=%d", room );
+ return( room );
+
+}
+
+
+static int digi_chars_in_buffer( struct usb_serial_port *port )
+{
+
+ digi_private_t *priv = (digi_private_t *)(port->private);
+
+
+dbg( "digi_chars_in_buffer: TOP: port=%d", port->number );
+
+ if( port->write_urb->status == -EINPROGRESS ) {
+dbg( "digi_chars_in_buffer: return=%d", port->bulk_out_size );
+ return( port->bulk_out_size );
+ }
+ else {
+dbg( "digi_chars_in_buffer: return=%d", priv->dp_buf_len );
+ return( priv->dp_buf_len );
+ }
+
+}
+
+
+static int digi_open( struct usb_serial_port *port, struct file *filp )
+{
+
+ int ret;
+ digi_private_t *priv = (digi_private_t *)(port->private);
+
+
+dbg( "digi_open: TOP: port %d", port->number );
+
+ /* if port is already open, just return */
+ /* be sure exactly one open succeeds */
+ spin_lock( &priv->dp_port_lock );
+ if( port->active ) {
+ return( 0 );
+ }
+ port->active = 1;
+ spin_unlock( &priv->dp_port_lock );
+
+ /* start reading from the out-of-band port for the device */
+ /* be sure this happens exactly once */
+ spin_lock( &config_lock );
+ if( !oob_read_started ) {
+ if( (ret=usb_submit_urb(oob_port->read_urb)) != 0 ) {
+ dbg( "digi_open: usb_submit_urb(read bulk) for oob failed, ret=%d",
+ ret );
+ spin_unlock( &config_lock );
+ return( -ENXIO );
+ }
+ else {
+dbg( "digi_open: usb_submit_urb(read bulk) for oob succeeded" );
+ oob_read_started = 1;
+ }
+ }
+ spin_unlock( &config_lock );
+
+ /* initialize port */
+dbg( "digi_open: init..." );
+ /* set 9600, 8N1, DTR, RTS, RX enable, no input or output flow control */
+ digi_setbaud( port, 9600 );
+ digi_send_cmd( "digi_open: wordsize", port, DIGI_CMD_SET_WORD_SIZE, 2, 3 );
+ digi_send_cmd( "digi_open: parity", port, DIGI_CMD_SET_PARITY, 2, 0 );
+ digi_send_cmd( "digi_open: stopbits", port, DIGI_CMD_SET_STOP_BITS, 2, 0 );
+ digi_send_cmd( "digi_open: DTR on", port, DIGI_CMD_SET_DTR_SIGNAL, 2, 1 );
+ digi_send_cmd( "digi_open: RTS on", port, DIGI_CMD_SET_RTS_SIGNAL, 2, 1 );
+ digi_send_cmd( "digi_open: RX enable on", port, DIGI_CMD_RECEIVE_ENABLE, 2,
+ 1 );
+ digi_send_cmd( "digi_open: input flow control off", port,
+ DIGI_CMD_SET_INPUT_FLOW_CONTROL, 2, 0 );
+ digi_send_cmd( "digi_open: output flow control off", port,
+ DIGI_CMD_SET_OUTPUT_FLOW_CONTROL, 2, 0 );
+
+ /* start reading from the device */
+ if( (ret=usb_submit_urb(port->read_urb)) != 0 ) {
+ dbg( "digi_open: usb_submit_urb(read bulk) failed, ret=%d", ret );
+ return( -ENXIO );
+ }
+
+dbg( "digi_open: done" );
+ return( 0 );
+
+}
+
+
+static void digi_close( struct usb_serial_port *port, struct file *filp )
+{
+
+dbg( "digi_close: TOP: port %d", port->number );
+
+ /* Need to change the control lines here */
+ /* TODO */
+dbg( "digi_close: wanna clear DTR and RTS..." );
+
+//digi_send_cmd( "digi_close DTR off", port, 6, 2, 0); // clear DTR
+//digi_send_cmd( "digi_close RTS off", port, 7, 2, 0); // clear RTS
+//digi_send_cmd( "digi_close RX disable", port, 10, 2, 0); // Rx Disable
+
+digi_send_oob( "digi_close RTS off", DIGI_CMD_SET_RTS_SIGNAL,
+ port->number, 0, 0 ); // clear RTS
+digi_send_oob( "digi_close DTR off", DIGI_CMD_SET_DTR_SIGNAL,
+ port->number, 0, 0 ); // clear DTR
+
+ while( oob_port->write_urb->status == -EINPROGRESS ) {
+dbg ("digi_close: waiting for final writes to complete on oob port %d...", oob_port->number );
+ interruptible_sleep_on( &oob_port->write_wait );
+ if( signal_pending(current) ) {
+ break;
+ }
+ }
+
+ /* shutdown our bulk reads and writes */
+ usb_unlink_urb (port->write_urb);
+ usb_unlink_urb (port->read_urb);
+
+ port->active = 0;
+
+}
+
+
+static int digi_startup (struct usb_serial *serial)
+{
+
+ int i;
+ digi_private_t *priv;
+
+
+dbg( "digi_startup: TOP" );
+
+ /* initialize config lock */
+ spin_lock_init( &config_lock );
+
+ /* allocate the private data structures for all ports */
+ /* number of regular ports + 1 for the out-of-band port */
+ for( i=0; i<digi_acceleport_device.num_ports+1; i++ ) {
+
+ /* allocate private structure */
+ priv = serial->port[i].private =
+ (digi_private_t *)kmalloc( sizeof(struct digi_private),
+ GFP_KERNEL );
+ if( priv == (digi_private_t *)0 )
+ return( 1 ); /* error */
+
+ /* initialize private structure */
+ priv->dp_buf_len = 0;
+ spin_lock_init( &priv->dp_port_lock );
+
+ /* initialize write wait queue for this port */
+ init_waitqueue_head(&serial->port[i].write_wait);
+
+ }
+
+ /* initialize out of band port info */
+ oob_port_num = digi_acceleport_device.num_ports;
+ oob_port = &serial->port[oob_port_num];
+ oob_read_started = 0;
+
+ return( 0 );
+
+}
+
+
+static void digi_shutdown( struct usb_serial *serial )
+{
+
+ int i;
+
+
+dbg( "digi_shutdown: TOP" );
+
+ /* stop writing and reading from the out-of-band port */
+ usb_unlink_urb( oob_port->write_urb );
+ usb_unlink_urb( oob_port->read_urb );
+ oob_read_started = 0;
+
+ /* free the private data structures for all ports */
+ /* number of regular ports + 1 for the out-of-band port */
+ for( i=0; i<digi_acceleport_device.num_ports+1; i++ )
+ kfree( serial->port[i].private );
+
+}
+
+
+static void digi_read_bulk_callback( struct urb *urb )
+{
+
+ struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
+ struct usb_serial *serial = port->serial;
+ struct tty_struct *tty = port->tty;
+ unsigned char *data = urb->transfer_buffer;
+ int ret,i;
+
+
+dbg( "digi_read_bulk_callback: TOP: port=%d", port->number );
+
+ /* handle oob callback */
+ if( port->number == oob_port_num ) {
+dbg( "digi_read_bulk_callback: oob_port callback, opcode=%d, line=%d, status=%d, ret=%d", data[0], data[1], data[2], data[3] );
+ if( urb->status ) {
+ dbg( "digi_read_bulk_callback: nonzero read bulk status on oob: %d",
+ urb->status );
+ }
+ if( (ret=usb_submit_urb(urb)) != 0 ) {
+ dbg( "digi_read_bulk_callback: failed resubmitting oob urb, ret=%d",
+ ret );
+ }
+ return;
+ }
+
+ /* sanity checks */
+ if( port_paranoia_check( port, "digi_read_bulk_callback" )
+ || serial_paranoia_check( serial, "digi_read_bulk_callback" ) ) {
+ return;
+ }
+
+ /* check status */
+ if( urb->status ) {
+ dbg( "digi_read_bulk_callback: nonzero read bulk status: %d",
+ urb->status );
+ return;
+ }
+
+#ifdef DEBUG
+ if (urb->actual_length) {
+ printk( KERN_DEBUG __FILE__ ": digi_read_bulk_callback: length=%d, data=",
+ urb->actual_length );
+ for( i=0; i<urb->actual_length; ++i ) {
+ printk( "%.2x ", data[i] );
+ }
+ printk( "\n" );
+ }
+#endif
+
+ /* Digi read packets are: */
+ /* 0 1 2 3 4 ... 3+length-1 == 2+length*/
+ /* opcode, length, status, data[0], data[1]...data[length-2] */
+ if( urb->actual_length > 3 ) {
+ for( i=3; i<2+data[1]; ++i ) {
+ tty_insert_flip_char(tty, data[i], 0);
+ }
+ tty_flip_buffer_push(tty);
+ }
+
+ /* Continue trying to read */
+ if( (ret=usb_submit_urb(urb)) != 0 )
+ dbg( "digi_read_bulk_callback: failed resubmitting read urb, ret=%d",
+ ret );
+
+}
+
+#endif /* CONFIG_USB_SERIAL_DIGI_ACCELEPORT */
+
extern struct usb_serial_device_type keyspan_pda_fake_device;
extern struct usb_serial_device_type keyspan_pda_device;
extern struct usb_serial_device_type zyxel_omninet_device;
+extern struct usb_serial_device_type digi_acceleport_device;
/* determine if we should include the EzUSB loader functions */
*
* See Documentation/usb/usb-serial.txt for more information on using this driver
*
+ * (05/03/2000) gkh
+ * Added the Digi Acceleport driver from Al Borchers and Peter Berger.
+ *
* (04/27/2000) Ryan VanderBijl
* Put calls to *_paranoia_checks into one function.
*
#endif
#ifdef CONFIG_USB_SERIAL_OMNINET
&zyxel_omninet_device,
+#endif
+#ifdef CONFIG_USB_SERIAL_DIGI_ACCELEPORT
+ &digi_acceleport_device,
#endif
NULL
};
OK(len);
case 0x03: /* string descriptors */
len = usb_root_hub_string (wValue & 0xff,
- uhci->io_addr, "UHCI",
+ uhci->io_addr, "UHCI-alt",
data, wLength);
if (len > 0) {
OK (min (leni, len));
*/
int usb_root_hub_string (int id, int serial, char *type, __u8 *data, int len)
{
- char buf [20];
+ char buf [30];
// assert (len > (2 * (sizeof (buf) + 1)));
- // assert (strlen (type) ~== 4);
+ // assert (strlen (type) <= 8);
// language ids
if (id == 0) {
#include <linux/spinlock.h>
#define HDLCDRV_MAGIC 0x5ac6e778
-#define HDLCDRV_IFNAMELEN 6
#define HDLCDRV_HDLCBUFFER 32 /* should be a power of 2 for speed reasons */
#define HDLCDRV_BITBUFFER 256 /* should be a power of 2 for speed reasons */
#undef HDLCDRV_LOOPBACK /* define for HDLC debugging purposes */
struct hdlcdrv_state {
int magic;
- char ifname[HDLCDRV_IFNAMELEN];
-
const struct hdlcdrv_ops *ops;
struct {
queue_t q; /* Must be first */
int magic;
- char ifname[9];
struct net_device dev; /* Ethernet device structure*/
struct enet_statistics stats;
if (!zone)
BUG();
- count = nr_lru_pages >> priority;
+ count = (nr_lru_pages << 1) >> priority;
if (!count)
return ret;
goto out_failed;
}
+ /* Don't look at this page if it's in a zone that we're not interested in.. */
+ if (!page->zone->zone_wake_kswapd)
+ goto out_failed;
+
if (TryLockPage(page))
goto out_failed;
* Think of swap_cnt as a "shadow rss" - it tells us which process
* we want to page out (always try largest first).
*/
- counter = nr_threads / (priority+1);
+ counter = (nr_threads << 1) >> (priority >> 1);
if (counter < 1)
counter = 1;
*/
int kswapd(void *unused)
{
- int i;
struct task_struct *tsk = current;
- pg_data_t *pgdat;
- zone_t *zone;
tsk->session = 1;
tsk->pgrp = 1;
*/
tsk->flags |= PF_MEMALLOC;
- while (1) {
- /*
- * If we actually get into a low-memory situation,
- * the processes needing more memory will wake us
- * up on a more timely basis.
- */
+ for (;;) {
+ pg_data_t *pgdat;
+ int something_to_do = 0;
+
pgdat = pgdat_list;
- while (pgdat) {
- for (i = 0; i < MAX_NR_ZONES; i++) {
- int count = SWAP_CLUSTER_MAX;
- zone = pgdat->node_zones + i;
- if ((!zone->size) || (!zone->zone_wake_kswapd))
+ do {
+ int i;
+ for(i = 0; i < MAX_NR_ZONES; i++) {
+ zone_t *zone = pgdat->node_zones+ i;
+ if (!zone->size || !zone->zone_wake_kswapd)
continue;
- do {
- if (tsk->need_resched)
- schedule();
- do_try_to_free_pages(GFP_KSWAPD, zone);
- } while (zone->free_pages < zone->pages_low &&
- --count);
+ something_to_do = 1;
+ do_try_to_free_pages(GFP_KSWAPD, zone);
+ if (tsk->need_resched)
+ schedule();
}
+ run_task_queue(&tq_disk);
pgdat = pgdat->node_next;
+ } while (pgdat);
+
+ if (!something_to_do) {
+ tsk->state = TASK_INTERRUPTIBLE;
+ interruptible_sleep_on(&kswapd_wait);
}
- run_task_queue(&tq_disk);
- tsk->state = TASK_INTERRUPTIBLE;
- interruptible_sleep_on(&kswapd_wait);
}
}
int ax25_t1timer_running(ax25_cb *ax25)
{
- return (ax25->t1timer.prev != NULL || ax25->t1timer.next != NULL);
+ return timer_pending(&ax25->t1timer);
}
unsigned long ax25_display_timer(struct timer_list *timer)
{
- if (timer->prev == NULL && timer->next == NULL)
+ if (!timer_pending(timer))
return 0;
return timer->expires - jiffies;
b = &bridge_list;
while ((br = *b) != NULL) {
- if (!strncmp(br->name, name, IFNAMSIZ))
+ if (!strncmp(br->dev.name, name, IFNAMSIZ))
return b;
b = &(br->next);
memset(br, 0, sizeof(*br));
dev = &br->dev;
- strncpy(br->name, name, IFNAMSIZ);
+ strncpy(dev->name, name, IFNAMSIZ);
dev->priv = br;
- dev->name = br->name;
ether_setup(dev);
br_dev_setup(dev);
struct net_bridge *next;
rwlock_t lock;
struct net_bridge_port *port_list;
- char name[IFNAMSIZ];
struct net_device dev;
struct net_device_stats statistics;
rwlock_t hash_lock;
/* called under bridge lock */
void br_topology_change_detection(struct net_bridge *br)
{
- printk(KERN_INFO "%s: topology change detected, ", br->name);
+ printk(KERN_INFO "%s: topology change detected, ", br->dev.name);
if (br_is_root_bridge(br)) {
printk("propagating\n");
br_topology_change_detection(p->br);
printk(KERN_INFO "%s: port %i(%s) entering %s state\n",
- p->br->name, p->port_no, p->dev->name, "blocking");
+ p->br->dev.name, p->port_no, p->dev->name, "blocking");
p->state = BR_STATE_BLOCKING;
br_timer_clear(&p->forward_delay_timer);
{
if (p->state == BR_STATE_BLOCKING) {
printk(KERN_INFO "%s: port %i(%s) entering %s state\n",
- p->br->name, p->port_no, p->dev->name, "listening");
+ p->br->dev.name, p->port_no, p->dev->name, "listening");
p->state = BR_STATE_LISTENING;
br_timer_set(&p->forward_delay_timer, jiffies);
if (p->state != BR_STATE_DISABLED &&
br_is_designated_port(p)) {
printk(KERN_INFO "%s: received tcn bpdu on port %i(%s)\n",
- p->br->name, p->port_no, p->dev->name);
+ p->br->dev.name, p->port_no, p->dev->name);
br_topology_change_detection(p->br);
br_topology_change_acknowledge(p);
br = p->br;
printk(KERN_INFO "%s: port %i(%s) entering %s state\n",
- br->name, p->port_no, p->dev->name, "disabled");
+ br->dev.name, p->port_no, p->dev->name, "disabled");
wasroot = br_is_root_bridge(br);
br_become_designated_port(p);
int was_root;
br = p->br;
- printk(KERN_INFO "%s: ", br->name);
+ printk(KERN_INFO "%s: ", br->dev.name);
printk("neighbour ");
dump_bridge_id(&p->designated_bridge);
printk(" lost on port %i(%s)\n", p->port_no, p->dev->name);
{
if (p->state == BR_STATE_LISTENING) {
printk(KERN_INFO "%s: port %i(%s) entering %s state\n",
- p->br->name, p->port_no, p->dev->name, "learning");
+ p->br->dev.name, p->port_no, p->dev->name, "learning");
p->state = BR_STATE_LEARNING;
br_timer_set(&p->forward_delay_timer, jiffies);
} else if (p->state == BR_STATE_LEARNING) {
printk(KERN_INFO "%s: port %i(%s) entering %s state\n",
- p->br->name, p->port_no, p->dev->name, "forwarding");
+ p->br->dev.name, p->port_no, p->dev->name, "forwarding");
p->state = BR_STATE_FORWARDING;
if (br_is_designated_for_some_port(p->br))
/* called under bridge lock */
static void br_tcn_timer_expired(struct net_bridge *br)
{
- printk(KERN_INFO "%s: retransmitting tcn bpdu\n", br->name);
+ printk(KERN_INFO "%s: retransmitting tcn bpdu\n", br->dev.name);
br_transmit_tcn(br);
br_timer_set(&br->tcn_timer, jiffies);
}
static int ipgre_fb_tunnel_init(struct net_device *dev);
static struct net_device ipgre_fb_tunnel_dev = {
- NULL, 0x0, 0x0, 0x0, 0x0, 0, 0, 0, 0, 0, NULL, ipgre_fb_tunnel_init,
+ "gre%d", 0x0, 0x0, 0x0, 0x0, 0, 0, 0, 0, 0, NULL, ipgre_fb_tunnel_init,
};
static struct ip_tunnel ipgre_fb_tunnel = {
- NULL, &ipgre_fb_tunnel_dev, {0, }, 0, 0, 0, 0, 0, 0, 0, {"gre0", }
+ NULL, &ipgre_fb_tunnel_dev, {0, }, 0, 0, 0, 0, 0, 0, 0, {"gre%d", }
};
/* Tunnel hash table */
dev->priv = (void*)(dev+1);
nt = (struct ip_tunnel*)dev->priv;
nt->dev = dev;
- dev->name = nt->parms.name;
+ strcpy(dev->name, nt->parms.name);
dev->init = ipgre_tunnel_init;
dev->new_style = 1;
memcpy(&nt->parms, parms, sizeof(*parms));
printk(KERN_INFO "GRE over IPv4 tunneling driver\n");
ipgre_fb_tunnel_dev.priv = (void*)&ipgre_fb_tunnel;
- ipgre_fb_tunnel_dev.name = ipgre_fb_tunnel.parms.name;
#ifdef MODULE
register_netdev(&ipgre_fb_tunnel_dev);
#else
static int ipip_tunnel_init(struct net_device *dev);
static struct net_device ipip_fb_tunnel_dev = {
- NULL, 0x0, 0x0, 0x0, 0x0, 0, 0, 0, 0, 0, NULL, ipip_fb_tunnel_init,
+ "tunl%d", 0x0, 0x0, 0x0, 0x0, 0, 0, 0, 0, 0, NULL, ipip_fb_tunnel_init,
};
static struct ip_tunnel ipip_fb_tunnel = {
- NULL, &ipip_fb_tunnel_dev, {0, }, 0, 0, 0, 0, 0, 0, 0, {"tunl0", }
+ NULL, &ipip_fb_tunnel_dev, {0, }, 0, 0, 0, 0, 0, 0, 0, {"tunl%d", }
};
static struct ip_tunnel *tunnels_r_l[HASH_SIZE];
dev->priv = (void*)(dev+1);
nt = (struct ip_tunnel*)dev->priv;
nt->dev = dev;
- dev->name = nt->parms.name;
+ strcpy(dev->name, nt->parms.name);
dev->init = ipip_tunnel_init;
dev->new_style = 1;
memcpy(&nt->parms, parms, sizeof(*parms));
printk(KERN_INFO "IPv4 over IPv4 tunneling driver\n");
ipip_fb_tunnel_dev.priv = (void*)&ipip_fb_tunnel;
- ipip_fb_tunnel_dev.name = ipip_fb_tunnel.parms.name;
#ifdef MODULE
register_netdev(&ipip_fb_tunnel_dev);
#else
struct in_device *in_dev;
int size;
- size = sizeof(*dev) + IFNAMSIZ + sizeof(struct net_device_stats);
+ size = sizeof(*dev) + sizeof(struct net_device_stats);
dev = kmalloc(size, GFP_KERNEL);
if (!dev)
return NULL;
memset(dev, 0, size);
dev->priv = dev + 1;
- dev->name = dev->priv + sizeof(struct net_device_stats);
strcpy(dev->name, "pimreg");
* down by the user
*/
mgr_event.event = EVENT_IRLAN_START;
- sprintf(mgr_event.devname, "%s", self->ifname);
+ strcpy(mgr_event.devname, self->dev.name);
irmanager_notify(&mgr_event);
/*
IRDA_DEBUG(0, __FUNCTION__
"(), notifying irmanager to stop irlan!\n");
mgr_event.event = EVENT_IRLAN_STOP;
- sprintf(mgr_event.devname, "%s", self->ifname);
+ sprintf(mgr_event.devname, "%s", self->dev.name);
irmanager_notify(&mgr_event);
/*
if (!eth) {
/* Get the first free irlan<x> name */
do {
- sprintf(self->ifname, "%s%d", "irlan", i++);
- } while (dev_get(self->ifname));
+ sprintf(self->dev.name, "%s%d", "irlan", i++);
+ } while (dev_get(self->dev.name));
}
- self->dev.name = self->ifname;
if (register_netdev(&self->dev) != 0) {
IRDA_DEBUG(2, __FUNCTION__ "(), register_netdev() failed!\n");
ASSERT(irlan != NULL, return NULL;);
- sprintf(self->ifname, "%s", "unknown");
+ sprintf(self->dev.name, "%s", "unknown");
self->dev.priv = (void *) self;
self->dev.next = NULL;
/* Don't display the master server */
if (self->master == 0) {
len += sprintf(buf+len, "ifname: %s,\n",
- self->ifname);
+ self->dev.name);
len += sprintf(buf+len, "client state: %s, ",
irlan_state[ self->client.state]);
len += sprintf(buf+len, "provider state: %s,\n",
* it, so it can be configured with network parameters
*/
mgr_event.event = EVENT_IRLAN_START;
- sprintf(mgr_event.devname, "%s", self->ifname);
+ sprintf(mgr_event.devname, "%s", self->dev.name);
irmanager_notify(&mgr_event);
/*
parms->window = lapb->window;
parms->mode = lapb->mode;
- if (lapb->t1timer.prev == NULL && lapb->t1timer.next == NULL)
+ if (!timer_pending(&lapb->t1timer))
parms->t1timer = 0;
else
parms->t1timer = (lapb->t1timer.expires - jiffies) / HZ;
- if (lapb->t2timer.prev == NULL && lapb->t2timer.next == NULL)
+ if (!timer_pending(&lapb->t2timer))
parms->t2timer = 0;
else
parms->t2timer = (lapb->t2timer.expires - jiffies) / HZ;
int lapb_t1timer_running(lapb_cb *lapb)
{
- return (lapb->t1timer.prev != NULL || lapb->t1timer.next != NULL);
+ return timer_pending(&lapb->t1timer);
}
static void lapb_t2timer_expiry(unsigned long param)
memset(dev_nr, 0x00, nr_ndevs * sizeof(struct net_device));
for (i = 0; i < nr_ndevs; i++) {
- dev_nr[i].name = kmalloc(20, GFP_KERNEL);
- if(dev_nr[i].name==NULL)
- {
- printk(KERN_ERR "Netrom: unable to register devices.\n");
- break;
- }
sprintf(dev_nr[i].name, "nr%d", i);
dev_nr[i].init = nr_init;
register_netdev(&dev_nr[i]);
static int nr_loopback_running(void)
{
- return (loopback_timer.prev != NULL || loopback_timer.next != NULL);
+ return timer_pending(&loopback_timer);
}
int nr_loopback_queue(struct sk_buff *skb)
int nr_t1timer_running(struct sock *sk)
{
- return (sk->protinfo.nr->t1timer.prev != NULL ||
- sk->protinfo.nr->t1timer.next != NULL);
+ return timer_pending(&sk->protinfo.nr->t1timer);
}
static void nr_heartbeat_expiry(unsigned long param)
memset(dev_rose, 0x00, rose_ndevs * sizeof(struct net_device));
for (i = 0; i < rose_ndevs; i++) {
- dev_rose[i].name = kmalloc(20, GFP_KERNEL);
- if(dev_rose[i].name == NULL)
- {
- printk(KERN_ERR "Rose: unable to register ROSE devices.\n");
- break;
- }
sprintf(dev_rose[i].name, "rose%d", i);
dev_rose[i].init = rose_init;
register_netdev(&dev_rose[i]);
int rose_ftimer_running(struct rose_neigh *neigh)
{
- return (neigh->ftimer.prev != NULL || neigh->ftimer.next != NULL);
+ return timer_pending(&neigh->ftimer);
}
int rose_t0timer_running(struct rose_neigh *neigh)
{
- return (neigh->t0timer.prev != NULL || neigh->t0timer.next != NULL);
+ return timer_pending(&neigh->t0timer);
}
static void rose_ftimer_expiry(unsigned long param)
static int rose_loopback_running(void)
{
- return (loopback_timer.prev != NULL || loopback_timer.next != NULL);
+ return timer_pending(&loopback_timer);
}
int rose_loopback_queue(struct sk_buff *skb, struct rose_neigh *neigh)
struct net_device dev;
struct Qdisc *slaves;
struct net_device_stats stats;
- char name[IFNAMSIZ];
};
struct teql_sched_data
rtnl_lock();
the_master.dev.priv = (void*)&the_master;
- the_master.dev.name = (void*)&the_master.name;
err = dev_alloc_name(&the_master.dev, "teql%d");
if (err < 0)
return err;
- memcpy(the_master.qops.id, the_master.name, IFNAMSIZ);
+ memcpy(the_master.qops.id, the_master.dev.name, IFNAMSIZ);
the_master.dev.init = teql_master_init;
err = register_netdevice(&the_master.dev);
unsigned long x25_display_timer(struct sock *sk)
{
- if (sk->protinfo.x25->timer.prev == NULL &&
- sk->protinfo.x25->timer.next == NULL)
+ if (!timer_pending(&sk->protinfo.x25->timer))
return 0;
return sk->protinfo.x25->timer.expires - jiffies;