Merge branch 'core/topology' of git://git.kernel.org/pub/scm/linux/kernel/git/tip...
[pandora-kernel.git] / drivers / acpi / system.c
index 4749f37..5bd2dec 100644 (file)
@@ -77,7 +77,6 @@ static ssize_t acpi_table_show(struct kobject *kobj,
            container_of(bin_attr, struct acpi_table_attr, attr);
        struct acpi_table_header *table_header = NULL;
        acpi_status status;
-       ssize_t ret_count = count;
 
        status =
            acpi_get_table(table_attr->name, table_attr->instance,
@@ -85,18 +84,8 @@ static ssize_t acpi_table_show(struct kobject *kobj,
        if (ACPI_FAILURE(status))
                return -ENODEV;
 
-       if (offset >= table_header->length) {
-               ret_count = 0;
-               goto end;
-       }
-
-       if (offset + ret_count > table_header->length)
-               ret_count = table_header->length - offset;
-
-       memcpy(buf, ((char *)table_header) + offset, ret_count);
-
-      end:
-       return ret_count;
+       return memory_read_from_buffer(buf, count, &offset,
+                                       table_header, table_header->length);
 }
 
 static void acpi_table_attr_init(struct acpi_table_attr *table_attr,
@@ -396,6 +385,7 @@ static int acpi_system_info_open_fs(struct inode *inode, struct file *file)
 }
 
 static const struct file_operations acpi_system_info_ops = {
+       .owner = THIS_MODULE,
        .open = acpi_system_info_open_fs,
        .read = seq_read,
        .llseek = seq_lseek,
@@ -406,6 +396,7 @@ static ssize_t acpi_system_read_dsdt(struct file *, char __user *, size_t,
                                     loff_t *);
 
 static const struct file_operations acpi_system_dsdt_ops = {
+       .owner = THIS_MODULE,
        .read = acpi_system_read_dsdt,
 };
 
@@ -430,6 +421,7 @@ static ssize_t acpi_system_read_fadt(struct file *, char __user *, size_t,
                                     loff_t *);
 
 static const struct file_operations acpi_system_fadt_ops = {
+       .owner = THIS_MODULE,
        .read = acpi_system_read_fadt,
 };
 
@@ -454,31 +446,23 @@ static int acpi_system_procfs_init(void)
 {
        struct proc_dir_entry *entry;
        int error = 0;
-       char *name;
 
        /* 'info' [R] */
-       name = ACPI_SYSTEM_FILE_INFO;
-       entry = create_proc_entry(name, S_IRUGO, acpi_root_dir);
+       entry = proc_create(ACPI_SYSTEM_FILE_INFO, S_IRUGO, acpi_root_dir,
+                           &acpi_system_info_ops);
        if (!entry)
                goto Error;
-       else {
-               entry->proc_fops = &acpi_system_info_ops;
-       }
 
        /* 'dsdt' [R] */
-       name = ACPI_SYSTEM_FILE_DSDT;
-       entry = create_proc_entry(name, S_IRUSR, acpi_root_dir);
-       if (entry)
-               entry->proc_fops = &acpi_system_dsdt_ops;
-       else
+       entry = proc_create(ACPI_SYSTEM_FILE_DSDT, S_IRUSR, acpi_root_dir,
+                           &acpi_system_dsdt_ops);
+       if (!entry)
                goto Error;
 
        /* 'fadt' [R] */
-       name = ACPI_SYSTEM_FILE_FADT;
-       entry = create_proc_entry(name, S_IRUSR, acpi_root_dir);
-       if (entry)
-               entry->proc_fops = &acpi_system_fadt_ops;
-       else
+       entry = proc_create(ACPI_SYSTEM_FILE_FADT, S_IRUSR, acpi_root_dir,
+                           &acpi_system_fadt_ops);
+       if (!entry)
                goto Error;
 
       Done: