diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2007-02-07 08:48:59 -0500 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2007-02-10 17:38:42 -0500 |
commit | 27a3bbaf4b1e23a3afbae4d9f72b51a36859f74a (patch) | |
tree | c6cf2b25d02ee2ad1cf290e9ac9719b301cbc77b /arch/mips/kernel/vpe.c | |
parent | 66efc5a7e3061c3597ac43a8bb1026488d57e66b (diff) |
[MIPS] VPE: Sprinkle device model code into code to make udev happier.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/kernel/vpe.c')
-rw-r--r-- | arch/mips/kernel/vpe.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/arch/mips/kernel/vpe.c b/arch/mips/kernel/vpe.c index 459624969c99..4e832da48c69 100644 --- a/arch/mips/kernel/vpe.c +++ b/arch/mips/kernel/vpe.c | |||
@@ -29,6 +29,7 @@ | |||
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include <linux/kernel.h> | 31 | #include <linux/kernel.h> |
32 | #include <linux/device.h> | ||
32 | #include <linux/module.h> | 33 | #include <linux/module.h> |
33 | #include <linux/fs.h> | 34 | #include <linux/fs.h> |
34 | #include <linux/init.h> | 35 | #include <linux/init.h> |
@@ -48,6 +49,7 @@ | |||
48 | #include <asm/cacheflush.h> | 49 | #include <asm/cacheflush.h> |
49 | #include <asm/atomic.h> | 50 | #include <asm/atomic.h> |
50 | #include <asm/cpu.h> | 51 | #include <asm/cpu.h> |
52 | #include <asm/mips_mt.h> | ||
51 | #include <asm/processor.h> | 53 | #include <asm/processor.h> |
52 | #include <asm/system.h> | 54 | #include <asm/system.h> |
53 | #include <asm/vpe.h> | 55 | #include <asm/vpe.h> |
@@ -64,6 +66,7 @@ typedef void *vpe_handle; | |||
64 | 66 | ||
65 | static char module_name[] = "vpe"; | 67 | static char module_name[] = "vpe"; |
66 | static int major; | 68 | static int major; |
69 | static const int minor = 1; /* fixed for now */ | ||
67 | 70 | ||
68 | #ifdef CONFIG_MIPS_APSP_KSPD | 71 | #ifdef CONFIG_MIPS_APSP_KSPD |
69 | static struct kspd_notifications kspd_events; | 72 | static struct kspd_notifications kspd_events; |
@@ -1365,12 +1368,15 @@ static void kspd_sp_exit( int sp_id) | |||
1365 | } | 1368 | } |
1366 | #endif | 1369 | #endif |
1367 | 1370 | ||
1371 | static struct device *vpe_dev; | ||
1372 | |||
1368 | static int __init vpe_module_init(void) | 1373 | static int __init vpe_module_init(void) |
1369 | { | 1374 | { |
1370 | struct vpe *v = NULL; | 1375 | struct vpe *v = NULL; |
1376 | struct device *dev; | ||
1371 | struct tc *t; | 1377 | struct tc *t; |
1372 | unsigned long val; | 1378 | unsigned long val; |
1373 | int i; | 1379 | int i, err; |
1374 | 1380 | ||
1375 | if (!cpu_has_mipsmt) { | 1381 | if (!cpu_has_mipsmt) { |
1376 | printk("VPE loader: not a MIPS MT capable processor\n"); | 1382 | printk("VPE loader: not a MIPS MT capable processor\n"); |
@@ -1383,6 +1389,14 @@ static int __init vpe_module_init(void) | |||
1383 | return major; | 1389 | return major; |
1384 | } | 1390 | } |
1385 | 1391 | ||
1392 | dev = device_create(mt_class, NULL, MKDEV(major, minor), | ||
1393 | "tc%d", minor); | ||
1394 | if (IS_ERR(dev)) { | ||
1395 | err = PTR_ERR(dev); | ||
1396 | goto out_chrdev; | ||
1397 | } | ||
1398 | vpe_dev = dev; | ||
1399 | |||
1386 | dmt(); | 1400 | dmt(); |
1387 | dvpe(); | 1401 | dvpe(); |
1388 | 1402 | ||
@@ -1478,6 +1492,11 @@ static int __init vpe_module_init(void) | |||
1478 | kspd_events.kspd_sp_exit = kspd_sp_exit; | 1492 | kspd_events.kspd_sp_exit = kspd_sp_exit; |
1479 | #endif | 1493 | #endif |
1480 | return 0; | 1494 | return 0; |
1495 | |||
1496 | out_chrdev: | ||
1497 | unregister_chrdev(major, module_name); | ||
1498 | |||
1499 | return err; | ||
1481 | } | 1500 | } |
1482 | 1501 | ||
1483 | static void __exit vpe_module_exit(void) | 1502 | static void __exit vpe_module_exit(void) |
@@ -1490,6 +1509,7 @@ static void __exit vpe_module_exit(void) | |||
1490 | } | 1509 | } |
1491 | } | 1510 | } |
1492 | 1511 | ||
1512 | device_destroy(mt_class, MKDEV(major, minor)); | ||
1493 | unregister_chrdev(major, module_name); | 1513 | unregister_chrdev(major, module_name); |
1494 | } | 1514 | } |
1495 | 1515 | ||