Commit 7e85ed71 authored by Chas Williams's avatar Chas Williams Committed by David S. Miller

[ATM]: HE and IPHASE driver fixes.

parent ad6d8606
...@@ -362,43 +362,56 @@ he_find_vcc(struct he_dev *he_dev, unsigned cid) ...@@ -362,43 +362,56 @@ he_find_vcc(struct he_dev *he_dev, unsigned cid)
static int __devinit static int __devinit
he_init_one(struct pci_dev *pci_dev, const struct pci_device_id *pci_ent) he_init_one(struct pci_dev *pci_dev, const struct pci_device_id *pci_ent)
{ {
struct atm_dev *atm_dev; struct atm_dev *atm_dev = NULL;
struct he_dev *he_dev; struct he_dev *he_dev = NULL;
int err = 0;
printk(KERN_INFO "he: %s\n", version); printk(KERN_INFO "he: %s\n", version);
if (pci_enable_device(pci_dev)) return -EIO; if (pci_enable_device(pci_dev)) return -EIO;
if (pci_set_dma_mask(pci_dev, HE_DMA_MASK) != 0) if (pci_set_dma_mask(pci_dev, HE_DMA_MASK) != 0) {
{
printk(KERN_WARNING "he: no suitable dma available\n"); printk(KERN_WARNING "he: no suitable dma available\n");
return -EIO; err = -EIO;
goto init_one_failure;
} }
atm_dev = atm_dev_register(DEV_LABEL, &he_ops, -1, 0); atm_dev = atm_dev_register(DEV_LABEL, &he_ops, -1, 0);
if (!atm_dev) return -ENODEV; if (!atm_dev) {
err = -ENODEV;
goto init_one_failure;
}
pci_set_drvdata(pci_dev, atm_dev); pci_set_drvdata(pci_dev, atm_dev);
he_dev = (struct he_dev *) kmalloc(sizeof(struct he_dev), he_dev = (struct he_dev *) kmalloc(sizeof(struct he_dev),
GFP_KERNEL); GFP_KERNEL);
if (!he_dev) return -ENOMEM; if (!he_dev) {
err = -ENOMEM;
goto init_one_failure;
}
memset(he_dev, 0, sizeof(struct he_dev)); memset(he_dev, 0, sizeof(struct he_dev));
he_dev->pci_dev = pci_dev; he_dev->pci_dev = pci_dev;
he_dev->atm_dev = atm_dev; he_dev->atm_dev = atm_dev;
he_dev->atm_dev->dev_data = he_dev; he_dev->atm_dev->dev_data = he_dev;
HE_DEV(atm_dev) = he_dev; HE_DEV(atm_dev) = he_dev;
he_dev->number = atm_dev->number; /* was devs */ he_dev->number = atm_dev->number;
if (he_start(atm_dev)) { if (he_start(atm_dev)) {
atm_dev_deregister(atm_dev);
he_stop(he_dev); he_stop(he_dev);
kfree(he_dev); err = -ENODEV;
return -ENODEV; goto init_one_failure;
} }
he_dev->next = NULL; he_dev->next = NULL;
if (he_devs) he_dev->next = he_devs; if (he_devs) he_dev->next = he_devs;
he_devs = he_dev; he_devs = he_dev;
return 0; return 0;
init_one_failure:
if (atm_dev)
atm_dev_deregister(atm_dev);
if (he_dev)
kfree(he_dev);
pci_disable_device(pci_dev);
return err;
} }
static void __devexit static void __devexit
...@@ -417,6 +430,7 @@ he_remove_one (struct pci_dev *pci_dev) ...@@ -417,6 +430,7 @@ he_remove_one (struct pci_dev *pci_dev)
kfree(he_dev); kfree(he_dev);
pci_set_drvdata(pci_dev, NULL); pci_set_drvdata(pci_dev, NULL);
pci_disable_device(pci_dev);
} }
......
...@@ -2777,7 +2777,7 @@ static int ia_ioctl(struct atm_dev *dev, unsigned int cmd, void *arg) ...@@ -2777,7 +2777,7 @@ static int ia_ioctl(struct atm_dev *dev, unsigned int cmd, void *arg)
if (!capable(CAP_NET_ADMIN)) return -EPERM; if (!capable(CAP_NET_ADMIN)) return -EPERM;
tmps = (u16 *)ia_cmds.buf; tmps = (u16 *)ia_cmds.buf;
for(i=0; i<0x80; i+=2, tmps++) for(i=0; i<0x80; i+=2, tmps++)
if(put_user(*(u16*)(iadev->seg_reg+i), tmps)) return -EFAULT; if(put_user((u16)(readl(iadev->seg_reg+i) & 0xffff), tmps)) return -EFAULT;
ia_cmds.status = 0; ia_cmds.status = 0;
ia_cmds.len = 0x80; ia_cmds.len = 0x80;
break; break;
...@@ -2785,7 +2785,7 @@ static int ia_ioctl(struct atm_dev *dev, unsigned int cmd, void *arg) ...@@ -2785,7 +2785,7 @@ static int ia_ioctl(struct atm_dev *dev, unsigned int cmd, void *arg)
if (!capable(CAP_NET_ADMIN)) return -EPERM; if (!capable(CAP_NET_ADMIN)) return -EPERM;
tmps = (u16 *)ia_cmds.buf; tmps = (u16 *)ia_cmds.buf;
for(i=0; i<0x80; i+=2, tmps++) for(i=0; i<0x80; i+=2, tmps++)
if(put_user(*(u16*)(iadev->reass_reg+i), tmps)) return -EFAULT; if(put_user((u16)(readl(iadev->reass_reg+i) & 0xffff), tmps)) return -EFAULT;
ia_cmds.status = 0; ia_cmds.status = 0;
ia_cmds.len = 0x80; ia_cmds.len = 0x80;
break; break;
...@@ -2802,10 +2802,10 @@ static int ia_ioctl(struct atm_dev *dev, unsigned int cmd, void *arg) ...@@ -2802,10 +2802,10 @@ static int ia_ioctl(struct atm_dev *dev, unsigned int cmd, void *arg)
rfL = &regs_local->rfredn; rfL = &regs_local->rfredn;
/* Copy real rfred registers into the local copy */ /* Copy real rfred registers into the local copy */
for (i=0; i<(sizeof (rfredn_t))/4; i++) for (i=0; i<(sizeof (rfredn_t))/4; i++)
((u_int *)rfL)[i] = ((u_int *)iadev->reass_reg)[i] & 0xffff; ((u_int *)rfL)[i] = readl(iadev->reass_reg + i) & 0xffff;
/* Copy real ffred registers into the local copy */ /* Copy real ffred registers into the local copy */
for (i=0; i<(sizeof (ffredn_t))/4; i++) for (i=0; i<(sizeof (ffredn_t))/4; i++)
((u_int *)ffL)[i] = ((u_int *)iadev->seg_reg)[i] & 0xffff; ((u_int *)ffL)[i] = readl(iadev->seg_reg + i) & 0xffff;
if (copy_to_user(ia_cmds.buf, regs_local,sizeof(ia_regs_t))) { if (copy_to_user(ia_cmds.buf, regs_local,sizeof(ia_regs_t))) {
kfree(regs_local); kfree(regs_local);
......
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