aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/hdpuftrs/hdpu_nexus.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/misc/hdpuftrs/hdpu_nexus.c')
-rw-r--r--drivers/misc/hdpuftrs/hdpu_nexus.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/drivers/misc/hdpuftrs/hdpu_nexus.c b/drivers/misc/hdpuftrs/hdpu_nexus.c
index 60c8b26f0678..fd3f3c22115f 100644
--- a/drivers/misc/hdpuftrs/hdpu_nexus.c
+++ b/drivers/misc/hdpuftrs/hdpu_nexus.c
@@ -40,40 +40,43 @@ static struct platform_driver hdpu_nexus_driver = {
40int hdpu_slot_id_read(char *buffer, char **buffer_location, off_t offset, 40int hdpu_slot_id_read(char *buffer, char **buffer_location, off_t offset,
41 int buffer_length, int *zero, void *ptr) 41 int buffer_length, int *zero, void *ptr)
42{ 42{
43
44 if (offset > 0) 43 if (offset > 0)
45 return 0; 44 return 0;
45
46 return sprintf(buffer, "%d\n", slot_id); 46 return sprintf(buffer, "%d\n", slot_id);
47} 47}
48 48
49int hdpu_chassis_id_read(char *buffer, char **buffer_location, off_t offset, 49int hdpu_chassis_id_read(char *buffer, char **buffer_location, off_t offset,
50 int buffer_length, int *zero, void *ptr) 50 int buffer_length, int *zero, void *ptr)
51{ 51{
52
53 if (offset > 0) 52 if (offset > 0)
54 return 0; 53 return 0;
54
55 return sprintf(buffer, "%d\n", chassis_id); 55 return sprintf(buffer, "%d\n", chassis_id);
56} 56}
57 57
58static int hdpu_nexus_probe(struct platform_device *pdev) 58static int hdpu_nexus_probe(struct platform_device *pdev)
59{ 59{
60 struct resource *res; 60 struct resource *res;
61 int *nexus_id_addr;
61 62
62 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 63 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
63 int *nexus_id_addr; 64 nexus_id_addr = ioremap(res->start,
64 nexus_id_addr = 65 (unsigned long)(res->end - res->start));
65 ioremap(res->start, (unsigned long)(res->end - res->start));
66 if (nexus_id_addr) { 66 if (nexus_id_addr) {
67 slot_id = (*nexus_id_addr >> 8) & 0x1f; 67 slot_id = (*nexus_id_addr >> 8) & 0x1f;
68 chassis_id = *nexus_id_addr & 0xff; 68 chassis_id = *nexus_id_addr & 0xff;
69 iounmap(nexus_id_addr); 69 iounmap(nexus_id_addr);
70 } else 70 } else {
71 printk("Could not map slot id\n"); 71 printk(KERN_ERR "Could not map slot id\n");
72 }
73
72 hdpu_slot_id = create_proc_entry("sky_slot_id", 0666, &proc_root); 74 hdpu_slot_id = create_proc_entry("sky_slot_id", 0666, &proc_root);
73 hdpu_slot_id->read_proc = hdpu_slot_id_read; 75 hdpu_slot_id->read_proc = hdpu_slot_id_read;
74 76
75 hdpu_chassis_id = create_proc_entry("sky_chassis_id", 0666, &proc_root); 77 hdpu_chassis_id = create_proc_entry("sky_chassis_id", 0666, &proc_root);
76 hdpu_chassis_id->read_proc = hdpu_chassis_id_read; 78 hdpu_chassis_id->read_proc = hdpu_chassis_id_read;
79
77 return 0; 80 return 0;
78} 81}
79 82
@@ -81,18 +84,19 @@ static int hdpu_nexus_remove(struct platform_device *pdev)
81{ 84{
82 slot_id = -1; 85 slot_id = -1;
83 chassis_id = -1; 86 chassis_id = -1;
87
84 remove_proc_entry("sky_slot_id", &proc_root); 88 remove_proc_entry("sky_slot_id", &proc_root);
85 remove_proc_entry("sky_chassis_id", &proc_root); 89 remove_proc_entry("sky_chassis_id", &proc_root);
90
86 hdpu_slot_id = 0; 91 hdpu_slot_id = 0;
87 hdpu_chassis_id = 0; 92 hdpu_chassis_id = 0;
93
88 return 0; 94 return 0;
89} 95}
90 96
91static int __init nexus_init(void) 97static int __init nexus_init(void)
92{ 98{
93 int rc; 99 return platform_driver_register(&hdpu_nexus_driver);
94 rc = platform_driver_register(&hdpu_nexus_driver);
95 return rc;
96} 100}
97 101
98static void __exit nexus_exit(void) 102static void __exit nexus_exit(void)