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