diff options
author | Len Brown <len.brown@intel.com> | 2008-02-06 19:49:54 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2008-02-07 04:00:46 -0500 |
commit | 04d94886b47b5133915021dcfb1108a8576f6ea7 (patch) | |
tree | fbbe9b29a46c12130f396cd050d7b3c750d572fb /drivers/acpi/osl.c | |
parent | d89e9d6b4930c6505ac3ed35f57ab7f4311d6cf6 (diff) |
ACPI: update intrd DSDT override console messages
also, address some checkpatch.pl violations
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/osl.c')
-rw-r--r-- | drivers/acpi/osl.c | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 2b41bdddbeb6..2a400e08e74c 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
@@ -326,49 +326,50 @@ struct acpi_table_header *acpi_find_dsdt_initrd(void) | |||
326 | struct kstat stat; | 326 | struct kstat stat; |
327 | char *ramfs_dsdt_name = "/DSDT.aml"; | 327 | char *ramfs_dsdt_name = "/DSDT.aml"; |
328 | 328 | ||
329 | printk(KERN_INFO PREFIX "Looking for DSDT in initramfs... "); | 329 | printk(KERN_INFO PREFIX "Checking initramfs for custom DSDT"); |
330 | 330 | ||
331 | /* | 331 | /* |
332 | * Never do this at home, only the user-space is allowed to open a file. | 332 | * Never do this at home, only the user-space is allowed to open a file. |
333 | * The clean way would be to use the firmware loader. But this code must be run | 333 | * The clean way would be to use the firmware loader. |
334 | * before there is any userspace available. So we need a static/init firmware | 334 | * But this code must be run before there is any userspace available. |
335 | * infrastructure, which doesn't exist yet... | 335 | * A static/init firmware infrastructure doesn't exist yet... |
336 | */ | 336 | */ |
337 | if (vfs_stat(ramfs_dsdt_name, &stat) < 0) { | 337 | if (vfs_stat(ramfs_dsdt_name, &stat) < 0) |
338 | printk("not found.\n"); | ||
339 | return ret; | 338 | return ret; |
340 | } | ||
341 | 339 | ||
342 | len = stat.size; | 340 | len = stat.size; |
343 | /* check especially against empty files */ | 341 | /* check especially against empty files */ |
344 | if (len <= 4) { | 342 | if (len <= 4) { |
345 | printk("error, file is too small: only %lu bytes.\n", len); | 343 | printk(KERN_ERR PREFIX "Failed: DSDT only %lu bytes.\n", len); |
346 | return ret; | 344 | return ret; |
347 | } | 345 | } |
348 | 346 | ||
349 | firmware_file = filp_open(ramfs_dsdt_name, O_RDONLY, 0); | 347 | firmware_file = filp_open(ramfs_dsdt_name, O_RDONLY, 0); |
350 | if (IS_ERR(firmware_file)) { | 348 | if (IS_ERR(firmware_file)) { |
351 | printk("error, could not open file %s.\n", ramfs_dsdt_name); | 349 | printk(KERN_ERR PREFIX "Failed to open %s.\n", ramfs_dsdt_name); |
352 | return ret; | 350 | return ret; |
353 | } | 351 | } |
354 | 352 | ||
355 | dsdt_buffer = ACPI_ALLOCATE(len); | 353 | dsdt_buffer = kmalloc(len, GFP_ATOMIC); |
356 | if (!dsdt_buffer) { | 354 | if (!dsdt_buffer) { |
357 | printk("error when allocating %lu bytes of memory.\n", len); | 355 | printk(KERN_ERR PREFIX "Failed to allocate %lu bytes.\n", len); |
358 | goto err; | 356 | goto err; |
359 | } | 357 | } |
360 | 358 | ||
361 | oldfs = get_fs(); | 359 | oldfs = get_fs(); |
362 | set_fs(KERNEL_DS); | 360 | set_fs(KERNEL_DS); |
363 | len2 = vfs_read(firmware_file, (char __user *)dsdt_buffer, len, &firmware_file->f_pos); | 361 | len2 = vfs_read(firmware_file, (char __user *)dsdt_buffer, len, |
362 | &firmware_file->f_pos); | ||
364 | set_fs(oldfs); | 363 | set_fs(oldfs); |
365 | if (len2 < len) { | 364 | if (len2 < len) { |
366 | printk("error trying to read %lu bytes from %s.\n", len, ramfs_dsdt_name); | 365 | printk(KERN_ERR PREFIX "Failed to read %lu bytes from %s.\n", |
366 | len, ramfs_dsdt_name); | ||
367 | ACPI_FREE(dsdt_buffer); | 367 | ACPI_FREE(dsdt_buffer); |
368 | goto err; | 368 | goto err; |
369 | } | 369 | } |
370 | 370 | ||
371 | printk("successfully read %lu bytes from %s.\n", len, ramfs_dsdt_name); | 371 | printk(KERN_INFO PREFIX "Found %lu byte DSDT in %s.\n", |
372 | len, ramfs_dsdt_name); | ||
372 | ret = dsdt_buffer; | 373 | ret = dsdt_buffer; |
373 | err: | 374 | err: |
374 | filp_close(firmware_file, NULL); | 375 | filp_close(firmware_file, NULL); |
@@ -392,7 +393,9 @@ acpi_os_table_override(struct acpi_table_header * existing_table, | |||
392 | #ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD | 393 | #ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD |
393 | if ((strncmp(existing_table->signature, "DSDT", 4) == 0) && | 394 | if ((strncmp(existing_table->signature, "DSDT", 4) == 0) && |
394 | !acpi_no_initrd_override) { | 395 | !acpi_no_initrd_override) { |
395 | struct acpi_table_header *initrd_table = acpi_find_dsdt_initrd(); | 396 | struct acpi_table_header *initrd_table; |
397 | |||
398 | initrd_table = acpi_find_dsdt_initrd(); | ||
396 | if (initrd_table) | 399 | if (initrd_table) |
397 | *new_table = initrd_table; | 400 | *new_table = initrd_table; |
398 | } | 401 | } |