.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * ec_sys.c |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright (C) 2010 SUSE Products GmbH/Novell |
---|
5 | 6 | * Author: |
---|
6 | 7 | * Thomas Renninger <trenn@suse.de> |
---|
7 | | - * |
---|
8 | | - * This work is licensed under the terms of the GNU GPL, version 2. |
---|
9 | 8 | */ |
---|
10 | 9 | |
---|
11 | 10 | #include <linux/kernel.h> |
---|
.. | .. |
---|
108 | 107 | .llseek = default_llseek, |
---|
109 | 108 | }; |
---|
110 | 109 | |
---|
111 | | -static int acpi_ec_add_debugfs(struct acpi_ec *ec, unsigned int ec_device_count) |
---|
| 110 | +static void acpi_ec_add_debugfs(struct acpi_ec *ec, unsigned int ec_device_count) |
---|
112 | 111 | { |
---|
113 | 112 | struct dentry *dev_dir; |
---|
114 | 113 | char name[64]; |
---|
115 | 114 | umode_t mode = 0400; |
---|
116 | 115 | |
---|
117 | | - if (ec_device_count == 0) { |
---|
| 116 | + if (ec_device_count == 0) |
---|
118 | 117 | acpi_ec_debugfs_dir = debugfs_create_dir("ec", NULL); |
---|
119 | | - if (!acpi_ec_debugfs_dir) |
---|
120 | | - return -ENOMEM; |
---|
121 | | - } |
---|
122 | 118 | |
---|
123 | 119 | sprintf(name, "ec%u", ec_device_count); |
---|
124 | 120 | dev_dir = debugfs_create_dir(name, acpi_ec_debugfs_dir); |
---|
125 | | - if (!dev_dir) { |
---|
126 | | - if (ec_device_count != 0) |
---|
127 | | - goto error; |
---|
128 | | - return -ENOMEM; |
---|
129 | | - } |
---|
130 | 121 | |
---|
131 | | - if (!debugfs_create_x32("gpe", 0444, dev_dir, &first_ec->gpe)) |
---|
132 | | - goto error; |
---|
133 | | - if (!debugfs_create_bool("use_global_lock", 0444, dev_dir, |
---|
134 | | - &first_ec->global_lock)) |
---|
135 | | - goto error; |
---|
| 122 | + debugfs_create_x32("gpe", 0444, dev_dir, &first_ec->gpe); |
---|
| 123 | + debugfs_create_bool("use_global_lock", 0444, dev_dir, |
---|
| 124 | + &first_ec->global_lock); |
---|
136 | 125 | |
---|
137 | 126 | if (write_support) |
---|
138 | 127 | mode = 0600; |
---|
139 | | - if (!debugfs_create_file("io", mode, dev_dir, ec, &acpi_ec_io_ops)) |
---|
140 | | - goto error; |
---|
141 | | - |
---|
142 | | - return 0; |
---|
143 | | - |
---|
144 | | -error: |
---|
145 | | - debugfs_remove_recursive(acpi_ec_debugfs_dir); |
---|
146 | | - return -ENOMEM; |
---|
| 128 | + debugfs_create_file("io", mode, dev_dir, ec, &acpi_ec_io_ops); |
---|
147 | 129 | } |
---|
148 | 130 | |
---|
149 | 131 | static int __init acpi_ec_sys_init(void) |
---|
150 | 132 | { |
---|
151 | | - int err = 0; |
---|
152 | 133 | if (first_ec) |
---|
153 | | - err = acpi_ec_add_debugfs(first_ec, 0); |
---|
154 | | - else |
---|
155 | | - err = -ENODEV; |
---|
156 | | - return err; |
---|
| 134 | + acpi_ec_add_debugfs(first_ec, 0); |
---|
| 135 | + return 0; |
---|
157 | 136 | } |
---|
158 | 137 | |
---|
159 | 138 | static void __exit acpi_ec_sys_exit(void) |
---|