提交 04d94886 编写于 作者: L Len Brown

ACPI: update intrd DSDT override console messages

also, address some checkpatch.pl violations
Signed-off-by: NLen Brown <len.brown@intel.com>
上级 d89e9d6b
...@@ -326,49 +326,50 @@ struct acpi_table_header *acpi_find_dsdt_initrd(void) ...@@ -326,49 +326,50 @@ struct acpi_table_header *acpi_find_dsdt_initrd(void)
struct kstat stat; struct kstat stat;
char *ramfs_dsdt_name = "/DSDT.aml"; char *ramfs_dsdt_name = "/DSDT.aml";
printk(KERN_INFO PREFIX "Looking for DSDT in initramfs... "); printk(KERN_INFO PREFIX "Checking initramfs for custom DSDT");
/* /*
* Never do this at home, only the user-space is allowed to open a file. * Never do this at home, only the user-space is allowed to open a file.
* The clean way would be to use the firmware loader. But this code must be run * The clean way would be to use the firmware loader.
* before there is any userspace available. So we need a static/init firmware * But this code must be run before there is any userspace available.
* infrastructure, which doesn't exist yet... * A static/init firmware infrastructure doesn't exist yet...
*/ */
if (vfs_stat(ramfs_dsdt_name, &stat) < 0) { if (vfs_stat(ramfs_dsdt_name, &stat) < 0)
printk("not found.\n");
return ret; return ret;
}
len = stat.size; len = stat.size;
/* check especially against empty files */ /* check especially against empty files */
if (len <= 4) { if (len <= 4) {
printk("error, file is too small: only %lu bytes.\n", len); printk(KERN_ERR PREFIX "Failed: DSDT only %lu bytes.\n", len);
return ret; return ret;
} }
firmware_file = filp_open(ramfs_dsdt_name, O_RDONLY, 0); firmware_file = filp_open(ramfs_dsdt_name, O_RDONLY, 0);
if (IS_ERR(firmware_file)) { if (IS_ERR(firmware_file)) {
printk("error, could not open file %s.\n", ramfs_dsdt_name); printk(KERN_ERR PREFIX "Failed to open %s.\n", ramfs_dsdt_name);
return ret; return ret;
} }
dsdt_buffer = ACPI_ALLOCATE(len); dsdt_buffer = kmalloc(len, GFP_ATOMIC);
if (!dsdt_buffer) { if (!dsdt_buffer) {
printk("error when allocating %lu bytes of memory.\n", len); printk(KERN_ERR PREFIX "Failed to allocate %lu bytes.\n", len);
goto err; goto err;
} }
oldfs = get_fs(); oldfs = get_fs();
set_fs(KERNEL_DS); set_fs(KERNEL_DS);
len2 = vfs_read(firmware_file, (char __user *)dsdt_buffer, len, &firmware_file->f_pos); len2 = vfs_read(firmware_file, (char __user *)dsdt_buffer, len,
&firmware_file->f_pos);
set_fs(oldfs); set_fs(oldfs);
if (len2 < len) { if (len2 < len) {
printk("error trying to read %lu bytes from %s.\n", len, ramfs_dsdt_name); printk(KERN_ERR PREFIX "Failed to read %lu bytes from %s.\n",
len, ramfs_dsdt_name);
ACPI_FREE(dsdt_buffer); ACPI_FREE(dsdt_buffer);
goto err; goto err;
} }
printk("successfully read %lu bytes from %s.\n", len, ramfs_dsdt_name); printk(KERN_INFO PREFIX "Found %lu byte DSDT in %s.\n",
len, ramfs_dsdt_name);
ret = dsdt_buffer; ret = dsdt_buffer;
err: err:
filp_close(firmware_file, NULL); filp_close(firmware_file, NULL);
...@@ -392,7 +393,9 @@ acpi_os_table_override(struct acpi_table_header * existing_table, ...@@ -392,7 +393,9 @@ acpi_os_table_override(struct acpi_table_header * existing_table,
#ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD #ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD
if ((strncmp(existing_table->signature, "DSDT", 4) == 0) && if ((strncmp(existing_table->signature, "DSDT", 4) == 0) &&
!acpi_no_initrd_override) { !acpi_no_initrd_override) {
struct acpi_table_header *initrd_table = acpi_find_dsdt_initrd(); struct acpi_table_header *initrd_table;
initrd_table = acpi_find_dsdt_initrd();
if (initrd_table) if (initrd_table)
*new_table = initrd_table; *new_table = initrd_table;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册