Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 56952
b: refs/heads/master
c: e971290
h: refs/heads/master
v: v3
  • Loading branch information
Ralf Baechle authored and Jeff Garzik committed May 24, 2007
1 parent 3f01368 commit 7a90e75
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 25 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 73815538e642de66a5607cc16d13004ecb1a3062
refs/heads/master: e971290133d8151c468cd70206fedc92648feb58
2 changes: 1 addition & 1 deletion trunk/arch/mips/sgi-ip32/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
# under Linux.
#

obj-y += ip32-berr.o ip32-irq.o ip32-setup.o ip32-reset.o \
obj-y += ip32-berr.o ip32-irq.o ip32-platform.o ip32-setup.o ip32-reset.o \
crime.o ip32-memory.o
20 changes: 20 additions & 0 deletions trunk/arch/mips/sgi-ip32/ip32-platform.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include <linux/init.h>
#include <linux/platform_device.h>

static __init int meth_devinit(void)
{
struct platform_device *pd;
int ret;

pd = platform_device_alloc("meth", -1);
if (!pd)
return -ENOMEM;

ret = platform_device_add(pd);
if (ret)
platform_device_put(pd);

return ret;
}

device_initcall(meth_devinit);
68 changes: 45 additions & 23 deletions trunk/drivers/net/meth.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*/
#include <linux/module.h>
#include <linux/init.h>

#include <linux/kernel.h> /* printk() */
#include <linux/delay.h>
#include <linux/dma-mapping.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <linux/errno.h> /* error codes */
#include <linux/types.h> /* size_t */
#include <linux/interrupt.h> /* mark_bh */
#include <linux/errno.h>
#include <linux/types.h>
#include <linux/interrupt.h>

#include <linux/in.h>
#include <linux/in6.h>
Expand All @@ -33,7 +34,6 @@

#include <asm/io.h>
#include <asm/scatterlist.h>
#include <linux/dma-mapping.h>

#include "meth.h"

Expand All @@ -51,8 +51,6 @@


static const char *meth_str="SGI O2 Fast Ethernet";
MODULE_AUTHOR("Ilya Volynets <ilya@theIlya.com>");
MODULE_DESCRIPTION("SGI O2 Builtin Fast Ethernet driver");

#define HAVE_TX_TIMEOUT
/* The maximum time waited (in jiffies) before assuming a Tx failed. (400ms) */
Expand Down Expand Up @@ -784,15 +782,15 @@ static struct net_device_stats *meth_stats(struct net_device *dev)
/*
* The init function.
*/
static struct net_device *meth_init(void)
static int __init meth_probe(struct platform_device *pdev)
{
struct net_device *dev;
struct meth_private *priv;
int ret;
int err;

dev = alloc_etherdev(sizeof(struct meth_private));
if (!dev)
return ERR_PTR(-ENOMEM);
return -ENOMEM;

dev->open = meth_open;
dev->stop = meth_release;
Expand All @@ -808,33 +806,57 @@ static struct net_device *meth_init(void)

priv = netdev_priv(dev);
spin_lock_init(&priv->meth_lock);
SET_NETDEV_DEV(dev, &pdev->dev);

ret = register_netdev(dev);
if (ret) {
err = register_netdev(dev);
if (err) {
free_netdev(dev);
return ERR_PTR(ret);
return err;
}

printk(KERN_INFO "%s: SGI MACE Ethernet rev. %d\n",
dev->name, (unsigned int)(mace->eth.mac_ctrl >> 29));
return 0;
}

static struct net_device *meth_dev;
static int __exit meth_remove(struct platform_device *pdev)
{
struct net_device *dev = platform_get_drvdata(pdev);

unregister_netdev(dev);
free_netdev(dev);
platform_set_drvdata(pdev, NULL);

return 0;
}

static struct platform_driver meth_driver = {
.probe = meth_probe,
.remove = __devexit_p(meth_remove),
.driver = {
.name = "meth",
}
};

static int __init meth_init_module(void)
{
meth_dev = meth_init();
if (IS_ERR(meth_dev))
return PTR_ERR(meth_dev);
return 0;
int err;

err = platform_driver_register(&meth_driver);
if (err)
printk(KERN_ERR "Driver registration failed\n");

return err;
}

static void __exit meth_exit_module(void)
{
unregister_netdev(meth_dev);
free_netdev(meth_dev);
platform_driver_unregister(&meth_driver);
}

module_init(meth_init_module);
module_exit(meth_exit_module);

MODULE_AUTHOR("Ilya Volynets <ilya@theIlya.com>");
MODULE_DESCRIPTION("SGI O2 Builtin Fast Ethernet driver");
MODULE_LICENSE("GPL");

0 comments on commit 7a90e75

Please sign in to comment.