|
28 | 28 | #include <asm/uaccess.h> |
29 | 29 | #include <asm/prom.h> |
30 | 30 |
|
31 | | -static loff_t page_map_seek( struct file *file, loff_t off, int whence); |
32 | | -static ssize_t page_map_read( struct file *file, char __user *buf, size_t nbytes, |
33 | | - loff_t *ppos); |
34 | | -static int page_map_mmap( struct file *file, struct vm_area_struct *vma ); |
35 | | - |
36 | | -static const struct file_operations page_map_fops = { |
37 | | - .llseek = page_map_seek, |
38 | | - .read = page_map_read, |
39 | | - .mmap = page_map_mmap |
40 | | -}; |
41 | | - |
42 | | -/* |
43 | | - * Create the ppc64 and ppc64/rtas directories early. This allows us to |
44 | | - * assume that they have been previously created in drivers. |
45 | | - */ |
46 | | -static int __init proc_ppc64_create(void) |
47 | | -{ |
48 | | - struct proc_dir_entry *root; |
49 | | - |
50 | | - root = proc_mkdir("ppc64", NULL); |
51 | | - if (!root) |
52 | | - return 1; |
53 | | - |
54 | | - if (!of_find_node_by_path("/rtas")) |
55 | | - return 0; |
56 | | - |
57 | | - if (!proc_mkdir("rtas", root)) |
58 | | - return 1; |
59 | | - |
60 | | - if (!proc_symlink("rtas", NULL, "ppc64/rtas")) |
61 | | - return 1; |
62 | | - |
63 | | - return 0; |
64 | | -} |
65 | | -core_initcall(proc_ppc64_create); |
66 | | - |
67 | | -static int __init proc_ppc64_init(void) |
68 | | -{ |
69 | | - struct proc_dir_entry *pde; |
70 | | - |
71 | | - pde = proc_create_data("ppc64/systemcfg", S_IFREG|S_IRUGO, NULL, |
72 | | - &page_map_fops, vdso_data); |
73 | | - if (!pde) |
74 | | - return 1; |
75 | | - pde->size = PAGE_SIZE; |
76 | | - |
77 | | - return 0; |
78 | | -} |
79 | | -__initcall(proc_ppc64_init); |
| 31 | +#ifdef CONFIG_PPC64 |
80 | 32 |
|
81 | 33 | static loff_t page_map_seek( struct file *file, loff_t off, int whence) |
82 | 34 | { |
@@ -120,3 +72,55 @@ static int page_map_mmap( struct file *file, struct vm_area_struct *vma ) |
120 | 72 | return 0; |
121 | 73 | } |
122 | 74 |
|
| 75 | +static const struct file_operations page_map_fops = { |
| 76 | + .llseek = page_map_seek, |
| 77 | + .read = page_map_read, |
| 78 | + .mmap = page_map_mmap |
| 79 | +}; |
| 80 | + |
| 81 | + |
| 82 | +static int __init proc_ppc64_init(void) |
| 83 | +{ |
| 84 | + struct proc_dir_entry *pde; |
| 85 | + |
| 86 | + pde = proc_create_data("powerpc/systemcfg", S_IFREG|S_IRUGO, NULL, |
| 87 | + &page_map_fops, vdso_data); |
| 88 | + if (!pde) |
| 89 | + return 1; |
| 90 | + pde->size = PAGE_SIZE; |
| 91 | + |
| 92 | + return 0; |
| 93 | +} |
| 94 | +__initcall(proc_ppc64_init); |
| 95 | + |
| 96 | +#endif /* CONFIG_PPC64 */ |
| 97 | + |
| 98 | +/* |
| 99 | + * Create the ppc64 and ppc64/rtas directories early. This allows us to |
| 100 | + * assume that they have been previously created in drivers. |
| 101 | + */ |
| 102 | +static int __init proc_ppc64_create(void) |
| 103 | +{ |
| 104 | + struct proc_dir_entry *root; |
| 105 | + |
| 106 | + root = proc_mkdir("powerpc", NULL); |
| 107 | + if (!root) |
| 108 | + return 1; |
| 109 | + |
| 110 | +#ifdef CONFIG_PPC64 |
| 111 | + if (!proc_symlink("ppc64", NULL, "powerpc")) |
| 112 | + pr_err("Failed to create link /proc/ppc64 -> /proc/powerpc\n"); |
| 113 | +#endif |
| 114 | + |
| 115 | + if (!of_find_node_by_path("/rtas")) |
| 116 | + return 0; |
| 117 | + |
| 118 | + if (!proc_mkdir("rtas", root)) |
| 119 | + return 1; |
| 120 | + |
| 121 | + if (!proc_symlink("rtas", NULL, "powerpc/rtas")) |
| 122 | + return 1; |
| 123 | + |
| 124 | + return 0; |
| 125 | +} |
| 126 | +core_initcall(proc_ppc64_create); |
0 commit comments