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.c52
1 files changed, 39 insertions, 13 deletions
diff --git a/drivers/misc/hdpuftrs/hdpu_nexus.c b/drivers/misc/hdpuftrs/hdpu_nexus.c
index cc818532c7ec..2887b2147980 100644
--- a/drivers/misc/hdpuftrs/hdpu_nexus.c
+++ b/drivers/misc/hdpuftrs/hdpu_nexus.c
@@ -18,18 +18,38 @@
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/proc_fs.h> 19#include <linux/proc_fs.h>
20#include <linux/hdpu_features.h> 20#include <linux/hdpu_features.h>
21
22#include <linux/platform_device.h> 21#include <linux/platform_device.h>
22#include <linux/seq_file.h>
23#include <asm/io.h> 23#include <asm/io.h>
24 24
25static int hdpu_nexus_probe(struct platform_device *pdev); 25static int hdpu_nexus_probe(struct platform_device *pdev);
26static int hdpu_nexus_remove(struct platform_device *pdev); 26static int hdpu_nexus_remove(struct platform_device *pdev);
27static int hdpu_slot_id_open(struct inode *inode, struct file *file);
28static int hdpu_slot_id_read(struct seq_file *seq, void *offset);
29static int hdpu_chassis_id_open(struct inode *inode, struct file *file);
30static int hdpu_chassis_id_read(struct seq_file *seq, void *offset);
27 31
28static struct proc_dir_entry *hdpu_slot_id; 32static struct proc_dir_entry *hdpu_slot_id;
29static struct proc_dir_entry *hdpu_chassis_id; 33static struct proc_dir_entry *hdpu_chassis_id;
30static int slot_id = -1; 34static int slot_id = -1;
31static int chassis_id = -1; 35static int chassis_id = -1;
32 36
37static const struct file_operations proc_slot_id = {
38 .open = hdpu_slot_id_open,
39 .read = seq_read,
40 .llseek = seq_lseek,
41 .release = single_release,
42 .owner = THIS_MODULE,
43};
44
45static const struct file_operations proc_chassis_id = {
46 .open = hdpu_chassis_id_open,
47 .read = seq_read,
48 .llseek = seq_lseek,
49 .release = single_release,
50 .owner = THIS_MODULE,
51};
52
33static struct platform_driver hdpu_nexus_driver = { 53static struct platform_driver hdpu_nexus_driver = {
34 .probe = hdpu_nexus_probe, 54 .probe = hdpu_nexus_probe,
35 .remove = hdpu_nexus_remove, 55 .remove = hdpu_nexus_remove,
@@ -38,22 +58,26 @@ static struct platform_driver hdpu_nexus_driver = {
38 }, 58 },
39}; 59};
40 60
41int hdpu_slot_id_read(char *buffer, char **buffer_location, off_t offset, 61static int hdpu_slot_id_open(struct inode *inode, struct file *file)
42 int buffer_length, int *zero, void *ptr)
43{ 62{
44 if (offset > 0) 63 return single_open(file, hdpu_slot_id_read, NULL);
45 return 0; 64}
46 65
47 return sprintf(buffer, "%d\n", slot_id); 66static int hdpu_slot_id_read(struct seq_file *seq, void *offset)
67{
68 seq_printf(seq, "%d\n", slot_id);
69 return 0;
48} 70}
49 71
50int hdpu_chassis_id_read(char *buffer, char **buffer_location, off_t offset, 72static int hdpu_chassis_id_open(struct inode *inode, struct file *file)
51 int buffer_length, int *zero, void *ptr)
52{ 73{
53 if (offset > 0) 74 return single_open(file, hdpu_chassis_id_read, NULL);
54 return 0; 75}
55 76
56 return sprintf(buffer, "%d\n", chassis_id); 77static int hdpu_chassis_id_read(struct seq_file *seq, void *offset)
78{
79 seq_printf(seq, "%d\n", chassis_id);
80 return 0;
57} 81}
58 82
59static int hdpu_nexus_probe(struct platform_device *pdev) 83static int hdpu_nexus_probe(struct platform_device *pdev)
@@ -82,7 +106,8 @@ static int hdpu_nexus_probe(struct platform_device *pdev)
82 printk(KERN_WARNING "sky_nexus: " 106 printk(KERN_WARNING "sky_nexus: "
83 "Unable to create proc dir entry: sky_slot_id\n"); 107 "Unable to create proc dir entry: sky_slot_id\n");
84 } else { 108 } else {
85 hdpu_slot_id->read_proc = hdpu_slot_id_read; 109 hdpu_slot_id->proc_fops = &proc_slot_id;
110 hdpu_slot_id->owner = THIS_MODULE;
86 } 111 }
87 112
88 hdpu_chassis_id = create_proc_entry("sky_chassis_id", 0666, &proc_root); 113 hdpu_chassis_id = create_proc_entry("sky_chassis_id", 0666, &proc_root);
@@ -90,7 +115,8 @@ static int hdpu_nexus_probe(struct platform_device *pdev)
90 printk(KERN_WARNING "sky_nexus: " 115 printk(KERN_WARNING "sky_nexus: "
91 "Unable to create proc dir entry: sky_chassis_id\n"); 116 "Unable to create proc dir entry: sky_chassis_id\n");
92 } else { 117 } else {
93 hdpu_chassis_id->read_proc = hdpu_chassis_id_read; 118 hdpu_chassis_id->proc_fops = &proc_chassis_id;
119 hdpu_chassis_id->owner = THIS_MODULE;
94 } 120 }
95 121
96 return 0; 122 return 0;