aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/mips/mips-boards/sim/Makefile3
-rw-r--r--arch/mips/mips-boards/sim/sim_platform.c35
-rw-r--r--drivers/net/Kconfig4
-rw-r--r--drivers/net/mipsnet.c53
4 files changed, 41 insertions, 54 deletions
diff --git a/arch/mips/mips-boards/sim/Makefile b/arch/mips/mips-boards/sim/Makefile
index 6aeebc9122f2..dc0bfda11427 100644
--- a/arch/mips/mips-boards/sim/Makefile
+++ b/arch/mips/mips-boards/sim/Makefile
@@ -17,7 +17,8 @@
17# 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. 17# 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
18# 18#
19 19
20obj-y := sim_setup.o sim_mem.o sim_time.o sim_int.o sim_cmdline.o 20obj-y := sim_platform.o sim_setup.o sim_mem.o sim_time.o sim_int.o \
21 sim_cmdline.o
21 22
22obj-$(CONFIG_EARLY_PRINTK) += sim_console.o 23obj-$(CONFIG_EARLY_PRINTK) += sim_console.o
23obj-$(CONFIG_SMP) += sim_smp.o 24obj-$(CONFIG_SMP) += sim_smp.o
diff --git a/arch/mips/mips-boards/sim/sim_platform.c b/arch/mips/mips-boards/sim/sim_platform.c
new file mode 100644
index 000000000000..53210a8c5dec
--- /dev/null
+++ b/arch/mips/mips-boards/sim/sim_platform.c
@@ -0,0 +1,35 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2007 by Ralf Baechle (ralf@linux-mips.org)
7 */
8#include <linux/init.h>
9#include <linux/if_ether.h>
10#include <linux/kernel.h>
11#include <linux/platform_device.h>
12
13static char mipsnet_string[] = "mipsnet";
14
15static struct platform_device eth1_device = {
16 .name = mipsnet_string,
17 .id = 0,
18};
19
20/*
21 * Create a platform device for the GPI port that receives the
22 * image data from the embedded camera.
23 */
24static int __init mipsnet_devinit(void)
25{
26 int err;
27
28 err = platform_device_register(&eth1_device);
29 if (err)
30 printk(KERN_ERR "%s: registration failed\n", mipsnet_string);
31
32 return err;
33}
34
35device_initcall(mipsnet_devinit);
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 3e9b37055ea4..ee920ad1a5f5 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -486,8 +486,8 @@ config SGI_IOC3_ETH_HW_TX_CSUM
486 enables offloading for checksums on transmit. If unsure, say Y. 486 enables offloading for checksums on transmit. If unsure, say Y.
487 487
488config MIPS_SIM_NET 488config MIPS_SIM_NET
489 tristate "MIPS simulator Network device (EXPERIMENTAL)" 489 tristate "MIPS simulator Network device"
490 depends on MIPS_SIM && EXPERIMENTAL 490 depends on NET_ETHERNET && MIPS_SIM
491 help 491 help
492 The MIPSNET device is a simple Ethernet network device which is 492 The MIPSNET device is a simple Ethernet network device which is
493 emulated by the MIPS Simulator. 493 emulated by the MIPS Simulator.
diff --git a/drivers/net/mipsnet.c b/drivers/net/mipsnet.c
index 403f63afd201..638a279ec505 100644
--- a/drivers/net/mipsnet.c
+++ b/drivers/net/mipsnet.c
@@ -26,8 +26,6 @@ struct mipsnet_priv {
26 struct net_device_stats stats; 26 struct net_device_stats stats;
27}; 27};
28 28
29static struct platform_device *mips_plat_dev;
30
31static char mipsnet_string[] = "mipsnet"; 29static char mipsnet_string[] = "mipsnet";
32 30
33/* 31/*
@@ -297,64 +295,17 @@ static struct device_driver mipsnet_driver = {
297 .remove = __devexit_p(mipsnet_device_remove), 295 .remove = __devexit_p(mipsnet_device_remove),
298}; 296};
299 297
300static void mipsnet_platform_release(struct device *device)
301{
302 struct platform_device *pldev;
303
304 /* free device */
305 pldev = to_platform_device(device);
306 kfree(pldev);
307}
308
309static int __init mipsnet_init_module(void) 298static int __init mipsnet_init_module(void)
310{ 299{
311 struct platform_device *pldev;
312 int err; 300 int err;
313 301
314 printk(KERN_INFO "MIPSNet Ethernet driver. Version: %s. " 302 printk(KERN_INFO "MIPSNet Ethernet driver. Version: %s. "
315 "(c)2005 MIPS Technologies, Inc.\n", MIPSNET_VERSION); 303 "(c)2005 MIPS Technologies, Inc.\n", MIPSNET_VERSION);
316 304
317 if (driver_register(&mipsnet_driver)) { 305 err = driver_register(&mipsnet_driver);
306 if (err)
318 printk(KERN_ERR "Driver registration failed\n"); 307 printk(KERN_ERR "Driver registration failed\n");
319 err = -ENODEV;
320 goto out;
321 }
322
323 if (!(pldev = kmalloc (sizeof (*pldev), GFP_KERNEL))) {
324 err = -ENOMEM;
325 goto out_unregister_driver;
326 }
327
328 memset (pldev, 0, sizeof (*pldev));
329 pldev->name = mipsnet_string;
330 pldev->id = 0;
331 pldev->dev.release = mipsnet_platform_release;
332 308
333 if (platform_device_register(pldev)) {
334 err = -ENODEV;
335 goto out_free_pldev;
336 }
337
338 if (!pldev->dev.driver) {
339 /*
340 * The driver was not bound to this device, there was
341 * no hardware at this address. Unregister it, as the
342 * release fuction will take care of freeing the
343 * allocated structure
344 */
345 platform_device_unregister (pldev);
346 }
347
348 mips_plat_dev = pldev;
349
350 return 0;
351
352out_free_pldev:
353 kfree(pldev);
354
355out_unregister_driver:
356 driver_unregister(&mipsnet_driver);
357out:
358 return err; 309 return err;
359} 310}
360 311