diff options
Diffstat (limited to 'arch/powerpc/kernel/nvram_64.c')
-rw-r--r-- | arch/powerpc/kernel/nvram_64.c | 56 |
1 files changed, 17 insertions, 39 deletions
diff --git a/arch/powerpc/kernel/nvram_64.c b/arch/powerpc/kernel/nvram_64.c index 0ed31f220482..ad461e735aec 100644 --- a/arch/powerpc/kernel/nvram_64.c +++ b/arch/powerpc/kernel/nvram_64.c | |||
@@ -139,8 +139,8 @@ out: | |||
139 | 139 | ||
140 | } | 140 | } |
141 | 141 | ||
142 | static int dev_nvram_ioctl(struct inode *inode, struct file *file, | 142 | static long dev_nvram_ioctl(struct file *file, unsigned int cmd, |
143 | unsigned int cmd, unsigned long arg) | 143 | unsigned long arg) |
144 | { | 144 | { |
145 | switch(cmd) { | 145 | switch(cmd) { |
146 | #ifdef CONFIG_PPC_PMAC | 146 | #ifdef CONFIG_PPC_PMAC |
@@ -169,11 +169,11 @@ static int dev_nvram_ioctl(struct inode *inode, struct file *file, | |||
169 | } | 169 | } |
170 | 170 | ||
171 | const struct file_operations nvram_fops = { | 171 | const struct file_operations nvram_fops = { |
172 | .owner = THIS_MODULE, | 172 | .owner = THIS_MODULE, |
173 | .llseek = dev_nvram_llseek, | 173 | .llseek = dev_nvram_llseek, |
174 | .read = dev_nvram_read, | 174 | .read = dev_nvram_read, |
175 | .write = dev_nvram_write, | 175 | .write = dev_nvram_write, |
176 | .ioctl = dev_nvram_ioctl, | 176 | .unlocked_ioctl = dev_nvram_ioctl, |
177 | }; | 177 | }; |
178 | 178 | ||
179 | static struct miscdevice nvram_dev = { | 179 | static struct miscdevice nvram_dev = { |
@@ -184,7 +184,7 @@ static struct miscdevice nvram_dev = { | |||
184 | 184 | ||
185 | 185 | ||
186 | #ifdef DEBUG_NVRAM | 186 | #ifdef DEBUG_NVRAM |
187 | static void nvram_print_partitions(char * label) | 187 | static void __init nvram_print_partitions(char * label) |
188 | { | 188 | { |
189 | struct list_head * p; | 189 | struct list_head * p; |
190 | struct nvram_partition * tmp_part; | 190 | struct nvram_partition * tmp_part; |
@@ -202,7 +202,7 @@ static void nvram_print_partitions(char * label) | |||
202 | #endif | 202 | #endif |
203 | 203 | ||
204 | 204 | ||
205 | static int nvram_write_header(struct nvram_partition * part) | 205 | static int __init nvram_write_header(struct nvram_partition * part) |
206 | { | 206 | { |
207 | loff_t tmp_index; | 207 | loff_t tmp_index; |
208 | int rc; | 208 | int rc; |
@@ -214,7 +214,7 @@ static int nvram_write_header(struct nvram_partition * part) | |||
214 | } | 214 | } |
215 | 215 | ||
216 | 216 | ||
217 | static unsigned char nvram_checksum(struct nvram_header *p) | 217 | static unsigned char __init nvram_checksum(struct nvram_header *p) |
218 | { | 218 | { |
219 | unsigned int c_sum, c_sum2; | 219 | unsigned int c_sum, c_sum2; |
220 | unsigned short *sp = (unsigned short *)p->name; /* assume 6 shorts */ | 220 | unsigned short *sp = (unsigned short *)p->name; /* assume 6 shorts */ |
@@ -228,32 +228,7 @@ static unsigned char nvram_checksum(struct nvram_header *p) | |||
228 | return c_sum; | 228 | return c_sum; |
229 | } | 229 | } |
230 | 230 | ||
231 | 231 | static int __init nvram_remove_os_partition(void) | |
232 | /* | ||
233 | * Find an nvram partition, sig can be 0 for any | ||
234 | * partition or name can be NULL for any name, else | ||
235 | * tries to match both | ||
236 | */ | ||
237 | struct nvram_partition *nvram_find_partition(int sig, const char *name) | ||
238 | { | ||
239 | struct nvram_partition * part; | ||
240 | struct list_head * p; | ||
241 | |||
242 | list_for_each(p, &nvram_part->partition) { | ||
243 | part = list_entry(p, struct nvram_partition, partition); | ||
244 | |||
245 | if (sig && part->header.signature != sig) | ||
246 | continue; | ||
247 | if (name && 0 != strncmp(name, part->header.name, 12)) | ||
248 | continue; | ||
249 | return part; | ||
250 | } | ||
251 | return NULL; | ||
252 | } | ||
253 | EXPORT_SYMBOL(nvram_find_partition); | ||
254 | |||
255 | |||
256 | static int nvram_remove_os_partition(void) | ||
257 | { | 232 | { |
258 | struct list_head *i; | 233 | struct list_head *i; |
259 | struct list_head *j; | 234 | struct list_head *j; |
@@ -319,7 +294,7 @@ static int nvram_remove_os_partition(void) | |||
319 | * Will create a partition starting at the first free | 294 | * Will create a partition starting at the first free |
320 | * space found if space has enough room. | 295 | * space found if space has enough room. |
321 | */ | 296 | */ |
322 | static int nvram_create_os_partition(void) | 297 | static int __init nvram_create_os_partition(void) |
323 | { | 298 | { |
324 | struct nvram_partition *part; | 299 | struct nvram_partition *part; |
325 | struct nvram_partition *new_part; | 300 | struct nvram_partition *new_part; |
@@ -422,7 +397,7 @@ static int nvram_create_os_partition(void) | |||
422 | * 5.) If the max chunk cannot be allocated then try finding a chunk | 397 | * 5.) If the max chunk cannot be allocated then try finding a chunk |
423 | * that will satisfy the minum needed (NVRAM_MIN_REQ). | 398 | * that will satisfy the minum needed (NVRAM_MIN_REQ). |
424 | */ | 399 | */ |
425 | static int nvram_setup_partition(void) | 400 | static int __init nvram_setup_partition(void) |
426 | { | 401 | { |
427 | struct list_head * p; | 402 | struct list_head * p; |
428 | struct nvram_partition * part; | 403 | struct nvram_partition * part; |
@@ -480,7 +455,7 @@ static int nvram_setup_partition(void) | |||
480 | } | 455 | } |
481 | 456 | ||
482 | 457 | ||
483 | static int nvram_scan_partitions(void) | 458 | static int __init nvram_scan_partitions(void) |
484 | { | 459 | { |
485 | loff_t cur_index = 0; | 460 | loff_t cur_index = 0; |
486 | struct nvram_header phead; | 461 | struct nvram_header phead; |
@@ -706,6 +681,9 @@ int nvram_clear_error_log(void) | |||
706 | int clear_word = ERR_FLAG_ALREADY_LOGGED; | 681 | int clear_word = ERR_FLAG_ALREADY_LOGGED; |
707 | int rc; | 682 | int rc; |
708 | 683 | ||
684 | if (nvram_error_log_index == -1) | ||
685 | return -1; | ||
686 | |||
709 | tmp_index = nvram_error_log_index; | 687 | tmp_index = nvram_error_log_index; |
710 | 688 | ||
711 | rc = ppc_md.nvram_write((char *)&clear_word, sizeof(int), &tmp_index); | 689 | rc = ppc_md.nvram_write((char *)&clear_word, sizeof(int), &tmp_index); |