Commit 5d572ab0 authored by Alexander Viro's avatar Alexander Viro Committed by Stephen Hemminger

[arcnet] create and use alloc_arcdev helper

parent 4295b2bc
......@@ -307,9 +307,7 @@ static int __init arc_rimi_init(void)
{
struct net_device *dev;
dev = alloc_netdev(sizeof(struct arcnet_local),
device[0] ? device : "arc%d",
arcdev_setup);
dev = alloc_arcdev(device);
if (!dev)
return -ENOMEM;
......
......@@ -92,6 +92,7 @@ EXPORT_SYMBOL(arc_proto_null);
EXPORT_SYMBOL(arcnet_unregister_proto);
EXPORT_SYMBOL(arcnet_debug);
EXPORT_SYMBOL(arcdev_setup);
EXPORT_SYMBOL(alloc_arcdev);
EXPORT_SYMBOL(arcnet_interrupt);
/* Internal function prototypes */
......@@ -331,6 +332,11 @@ void arcdev_setup(struct net_device *dev)
dev->rebuild_header = arcnet_rebuild_header;
}
struct net_device *alloc_arcdev(char *name)
{
return alloc_netdev(sizeof(struct arcnet_local),
name && *name ? name : "arc%d", arcdev_setup);
}
/*
* Open/initialize the board. This is called sometime after booting when
......
......@@ -145,9 +145,7 @@ static int __init com20020_init(void)
struct net_device *dev;
struct arcnet_local *lp;
dev = alloc_netdev(sizeof(struct arcnet_local),
device[0] ? device : "arc%d",
arcdev_setup);
dev = alloc_arcdev(device);
if (!dev)
return -ENOMEM;
......
......@@ -69,9 +69,7 @@ static int __devinit com20020pci_probe(struct pci_dev *pdev, const struct pci_de
if (pci_enable_device(pdev))
return -EIO;
dev = alloc_netdev(sizeof(struct arcnet_local),
device[0] ? device : "arc%d",
arcdev_setup);
dev = alloc_arcdev(device);
if (!dev)
return -ENOMEM;
lp = dev->priv;
......
......@@ -394,9 +394,7 @@ static int __init com90io_init(void)
struct net_device *dev;
int err;
dev = alloc_netdev(sizeof(struct arcnet_local),
device[0] ? device : "arc%d",
arcdev_setup);
dev = alloc_arcdev(device);
if (!dev)
return -ENOMEM;
......
......@@ -408,10 +408,8 @@ static int __init com90xx_found(int ioaddr, int airq, u_long shmem)
u_long first_mirror, last_mirror;
int mirror_size;
/* allocate struct net_device if we don't have one yet */
dev = alloc_netdev(sizeof(struct arcnet_local),
device[0] ? device : "arc%d",
arcdev_setup);
/* allocate struct net_device */
dev = alloc_arcdev(device);
if (!dev) {
BUGMSG2(D_NORMAL, "com90xx: Can't allocate device!\n");
release_mem_region(shmem, BUFFER_SIZE);
......
......@@ -173,8 +173,7 @@ static dev_link_t *com20020_attach(void)
if (!info)
goto fail_alloc_info;
dev = alloc_netdev(sizeof(struct arcnet_local), "arc%d",
arcdev_setup);
dev = alloc_arcdev("");
if (!dev)
goto fail_alloc_dev;
......
......@@ -331,6 +331,7 @@ void arcnet_dump_packet(struct net_device *dev, int bufnum, char *desc);
void arcnet_unregister_proto(struct ArcProto *proto);
irqreturn_t arcnet_interrupt(int irq, void *dev_id, struct pt_regs *regs);
void arcdev_setup(struct net_device *dev);
struct net_device *alloc_arcdev(char *name);
void arcnet_rx(struct net_device *dev, int bufnum);
#endif /* __KERNEL__ */
......
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