diff options
author | Len Brown <len.brown@intel.com> | 2005-08-05 00:44:28 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2005-08-05 00:45:14 -0400 |
commit | 4be44fcd3bf648b782f4460fd06dfae6c42ded4b (patch) | |
tree | 5b5b7d296ea58786f53b95e5eac9565ff66890b0 /drivers/acpi/fan.c | |
parent | c65ade4dc8b486e8c8b9b0a6399789a5428e2039 (diff) |
[ACPI] Lindent all ACPI files
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/fan.c')
-rw-r--r-- | drivers/acpi/fan.c | 125 |
1 files changed, 54 insertions, 71 deletions
diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c index 2ee1d061013f..e8165c4f162a 100644 --- a/drivers/acpi/fan.c +++ b/drivers/acpi/fan.c | |||
@@ -34,49 +34,45 @@ | |||
34 | #include <acpi/acpi_bus.h> | 34 | #include <acpi/acpi_bus.h> |
35 | #include <acpi/acpi_drivers.h> | 35 | #include <acpi/acpi_drivers.h> |
36 | 36 | ||
37 | |||
38 | #define ACPI_FAN_COMPONENT 0x00200000 | 37 | #define ACPI_FAN_COMPONENT 0x00200000 |
39 | #define ACPI_FAN_CLASS "fan" | 38 | #define ACPI_FAN_CLASS "fan" |
40 | #define ACPI_FAN_DRIVER_NAME "ACPI Fan Driver" | 39 | #define ACPI_FAN_DRIVER_NAME "ACPI Fan Driver" |
41 | #define ACPI_FAN_FILE_STATE "state" | 40 | #define ACPI_FAN_FILE_STATE "state" |
42 | 41 | ||
43 | #define _COMPONENT ACPI_FAN_COMPONENT | 42 | #define _COMPONENT ACPI_FAN_COMPONENT |
44 | ACPI_MODULE_NAME ("acpi_fan") | 43 | ACPI_MODULE_NAME("acpi_fan") |
45 | 44 | ||
46 | MODULE_AUTHOR("Paul Diefenbaugh"); | 45 | MODULE_AUTHOR("Paul Diefenbaugh"); |
47 | MODULE_DESCRIPTION(ACPI_FAN_DRIVER_NAME); | 46 | MODULE_DESCRIPTION(ACPI_FAN_DRIVER_NAME); |
48 | MODULE_LICENSE("GPL"); | 47 | MODULE_LICENSE("GPL"); |
49 | 48 | ||
50 | static int acpi_fan_add (struct acpi_device *device); | 49 | static int acpi_fan_add(struct acpi_device *device); |
51 | static int acpi_fan_remove (struct acpi_device *device, int type); | 50 | static int acpi_fan_remove(struct acpi_device *device, int type); |
52 | 51 | ||
53 | static struct acpi_driver acpi_fan_driver = { | 52 | static struct acpi_driver acpi_fan_driver = { |
54 | .name = ACPI_FAN_DRIVER_NAME, | 53 | .name = ACPI_FAN_DRIVER_NAME, |
55 | .class = ACPI_FAN_CLASS, | 54 | .class = ACPI_FAN_CLASS, |
56 | .ids = "PNP0C0B", | 55 | .ids = "PNP0C0B", |
57 | .ops = { | 56 | .ops = { |
58 | .add = acpi_fan_add, | 57 | .add = acpi_fan_add, |
59 | .remove = acpi_fan_remove, | 58 | .remove = acpi_fan_remove, |
60 | }, | 59 | }, |
61 | }; | 60 | }; |
62 | 61 | ||
63 | struct acpi_fan { | 62 | struct acpi_fan { |
64 | acpi_handle handle; | 63 | acpi_handle handle; |
65 | }; | 64 | }; |
66 | 65 | ||
67 | |||
68 | /* -------------------------------------------------------------------------- | 66 | /* -------------------------------------------------------------------------- |
69 | FS Interface (/proc) | 67 | FS Interface (/proc) |
70 | -------------------------------------------------------------------------- */ | 68 | -------------------------------------------------------------------------- */ |
71 | 69 | ||
72 | static struct proc_dir_entry *acpi_fan_dir; | 70 | static struct proc_dir_entry *acpi_fan_dir; |
73 | |||
74 | 71 | ||
75 | static int | 72 | static int acpi_fan_read_state(struct seq_file *seq, void *offset) |
76 | acpi_fan_read_state(struct seq_file *seq, void *offset) | ||
77 | { | 73 | { |
78 | struct acpi_fan *fan = seq->private; | 74 | struct acpi_fan *fan = seq->private; |
79 | int state = 0; | 75 | int state = 0; |
80 | 76 | ||
81 | ACPI_FUNCTION_TRACE("acpi_fan_read_state"); | 77 | ACPI_FUNCTION_TRACE("acpi_fan_read_state"); |
82 | 78 | ||
@@ -85,7 +81,7 @@ acpi_fan_read_state(struct seq_file *seq, void *offset) | |||
85 | seq_printf(seq, "status: ERROR\n"); | 81 | seq_printf(seq, "status: ERROR\n"); |
86 | else | 82 | else |
87 | seq_printf(seq, "status: %s\n", | 83 | seq_printf(seq, "status: %s\n", |
88 | !state?"on":"off"); | 84 | !state ? "on" : "off"); |
89 | } | 85 | } |
90 | return_VALUE(0); | 86 | return_VALUE(0); |
91 | } | 87 | } |
@@ -96,26 +92,26 @@ static int acpi_fan_state_open_fs(struct inode *inode, struct file *file) | |||
96 | } | 92 | } |
97 | 93 | ||
98 | static ssize_t | 94 | static ssize_t |
99 | acpi_fan_write_state(struct file *file, const char __user *buffer, | 95 | acpi_fan_write_state(struct file *file, const char __user * buffer, |
100 | size_t count, loff_t *ppos) | 96 | size_t count, loff_t * ppos) |
101 | { | 97 | { |
102 | int result = 0; | 98 | int result = 0; |
103 | struct seq_file *m = (struct seq_file *)file->private_data; | 99 | struct seq_file *m = (struct seq_file *)file->private_data; |
104 | struct acpi_fan *fan = (struct acpi_fan *) m->private; | 100 | struct acpi_fan *fan = (struct acpi_fan *)m->private; |
105 | char state_string[12] = {'\0'}; | 101 | char state_string[12] = { '\0' }; |
106 | 102 | ||
107 | ACPI_FUNCTION_TRACE("acpi_fan_write_state"); | 103 | ACPI_FUNCTION_TRACE("acpi_fan_write_state"); |
108 | 104 | ||
109 | if (!fan || (count > sizeof(state_string) - 1)) | 105 | if (!fan || (count > sizeof(state_string) - 1)) |
110 | return_VALUE(-EINVAL); | 106 | return_VALUE(-EINVAL); |
111 | 107 | ||
112 | if (copy_from_user(state_string, buffer, count)) | 108 | if (copy_from_user(state_string, buffer, count)) |
113 | return_VALUE(-EFAULT); | 109 | return_VALUE(-EFAULT); |
114 | 110 | ||
115 | state_string[count] = '\0'; | 111 | state_string[count] = '\0'; |
116 | 112 | ||
117 | result = acpi_bus_set_power(fan->handle, | 113 | result = acpi_bus_set_power(fan->handle, |
118 | simple_strtoul(state_string, NULL, 0)); | 114 | simple_strtoul(state_string, NULL, 0)); |
119 | if (result) | 115 | if (result) |
120 | return_VALUE(result); | 116 | return_VALUE(result); |
121 | 117 | ||
@@ -123,18 +119,17 @@ acpi_fan_write_state(struct file *file, const char __user *buffer, | |||
123 | } | 119 | } |
124 | 120 | ||
125 | static struct file_operations acpi_fan_state_ops = { | 121 | static struct file_operations acpi_fan_state_ops = { |
126 | .open = acpi_fan_state_open_fs, | 122 | .open = acpi_fan_state_open_fs, |
127 | .read = seq_read, | 123 | .read = seq_read, |
128 | .write = acpi_fan_write_state, | 124 | .write = acpi_fan_write_state, |
129 | .llseek = seq_lseek, | 125 | .llseek = seq_lseek, |
130 | .release = single_release, | 126 | .release = single_release, |
131 | .owner = THIS_MODULE, | 127 | .owner = THIS_MODULE, |
132 | }; | 128 | }; |
133 | 129 | ||
134 | static int | 130 | static int acpi_fan_add_fs(struct acpi_device *device) |
135 | acpi_fan_add_fs(struct acpi_device *device) | ||
136 | { | 131 | { |
137 | struct proc_dir_entry *entry = NULL; | 132 | struct proc_dir_entry *entry = NULL; |
138 | 133 | ||
139 | ACPI_FUNCTION_TRACE("acpi_fan_add_fs"); | 134 | ACPI_FUNCTION_TRACE("acpi_fan_add_fs"); |
140 | 135 | ||
@@ -143,7 +138,7 @@ acpi_fan_add_fs(struct acpi_device *device) | |||
143 | 138 | ||
144 | if (!acpi_device_dir(device)) { | 139 | if (!acpi_device_dir(device)) { |
145 | acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), | 140 | acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), |
146 | acpi_fan_dir); | 141 | acpi_fan_dir); |
147 | if (!acpi_device_dir(device)) | 142 | if (!acpi_device_dir(device)) |
148 | return_VALUE(-ENODEV); | 143 | return_VALUE(-ENODEV); |
149 | acpi_device_dir(device)->owner = THIS_MODULE; | 144 | acpi_device_dir(device)->owner = THIS_MODULE; |
@@ -151,11 +146,12 @@ acpi_fan_add_fs(struct acpi_device *device) | |||
151 | 146 | ||
152 | /* 'status' [R/W] */ | 147 | /* 'status' [R/W] */ |
153 | entry = create_proc_entry(ACPI_FAN_FILE_STATE, | 148 | entry = create_proc_entry(ACPI_FAN_FILE_STATE, |
154 | S_IFREG|S_IRUGO|S_IWUSR, acpi_device_dir(device)); | 149 | S_IFREG | S_IRUGO | S_IWUSR, |
150 | acpi_device_dir(device)); | ||
155 | if (!entry) | 151 | if (!entry) |
156 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 152 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
157 | "Unable to create '%s' fs entry\n", | 153 | "Unable to create '%s' fs entry\n", |
158 | ACPI_FAN_FILE_STATE)); | 154 | ACPI_FAN_FILE_STATE)); |
159 | else { | 155 | else { |
160 | entry->proc_fops = &acpi_fan_state_ops; | 156 | entry->proc_fops = &acpi_fan_state_ops; |
161 | entry->data = acpi_driver_data(device); | 157 | entry->data = acpi_driver_data(device); |
@@ -165,15 +161,12 @@ acpi_fan_add_fs(struct acpi_device *device) | |||
165 | return_VALUE(0); | 161 | return_VALUE(0); |
166 | } | 162 | } |
167 | 163 | ||
168 | 164 | static int acpi_fan_remove_fs(struct acpi_device *device) | |
169 | static int | ||
170 | acpi_fan_remove_fs(struct acpi_device *device) | ||
171 | { | 165 | { |
172 | ACPI_FUNCTION_TRACE("acpi_fan_remove_fs"); | 166 | ACPI_FUNCTION_TRACE("acpi_fan_remove_fs"); |
173 | 167 | ||
174 | if (acpi_device_dir(device)) { | 168 | if (acpi_device_dir(device)) { |
175 | remove_proc_entry(ACPI_FAN_FILE_STATE, | 169 | remove_proc_entry(ACPI_FAN_FILE_STATE, acpi_device_dir(device)); |
176 | acpi_device_dir(device)); | ||
177 | remove_proc_entry(acpi_device_bid(device), acpi_fan_dir); | 170 | remove_proc_entry(acpi_device_bid(device), acpi_fan_dir); |
178 | acpi_device_dir(device) = NULL; | 171 | acpi_device_dir(device) = NULL; |
179 | } | 172 | } |
@@ -181,17 +174,15 @@ acpi_fan_remove_fs(struct acpi_device *device) | |||
181 | return_VALUE(0); | 174 | return_VALUE(0); |
182 | } | 175 | } |
183 | 176 | ||
184 | |||
185 | /* -------------------------------------------------------------------------- | 177 | /* -------------------------------------------------------------------------- |
186 | Driver Interface | 178 | Driver Interface |
187 | -------------------------------------------------------------------------- */ | 179 | -------------------------------------------------------------------------- */ |
188 | 180 | ||
189 | static int | 181 | static int acpi_fan_add(struct acpi_device *device) |
190 | acpi_fan_add(struct acpi_device *device) | ||
191 | { | 182 | { |
192 | int result = 0; | 183 | int result = 0; |
193 | struct acpi_fan *fan = NULL; | 184 | struct acpi_fan *fan = NULL; |
194 | int state = 0; | 185 | int state = 0; |
195 | 186 | ||
196 | ACPI_FUNCTION_TRACE("acpi_fan_add"); | 187 | ACPI_FUNCTION_TRACE("acpi_fan_add"); |
197 | 188 | ||
@@ -211,7 +202,7 @@ acpi_fan_add(struct acpi_device *device) | |||
211 | result = acpi_bus_get_power(fan->handle, &state); | 202 | result = acpi_bus_get_power(fan->handle, &state); |
212 | if (result) { | 203 | if (result) { |
213 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 204 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
214 | "Error reading power state\n")); | 205 | "Error reading power state\n")); |
215 | goto end; | 206 | goto end; |
216 | } | 207 | } |
217 | 208 | ||
@@ -220,19 +211,17 @@ acpi_fan_add(struct acpi_device *device) | |||
220 | goto end; | 211 | goto end; |
221 | 212 | ||
222 | printk(KERN_INFO PREFIX "%s [%s] (%s)\n", | 213 | printk(KERN_INFO PREFIX "%s [%s] (%s)\n", |
223 | acpi_device_name(device), acpi_device_bid(device), | 214 | acpi_device_name(device), acpi_device_bid(device), |
224 | !device->power.state?"on":"off"); | 215 | !device->power.state ? "on" : "off"); |
225 | 216 | ||
226 | end: | 217 | end: |
227 | if (result) | 218 | if (result) |
228 | kfree(fan); | 219 | kfree(fan); |
229 | 220 | ||
230 | return_VALUE(result); | 221 | return_VALUE(result); |
231 | } | 222 | } |
232 | 223 | ||
233 | 224 | static int acpi_fan_remove(struct acpi_device *device, int type) | |
234 | static int | ||
235 | acpi_fan_remove(struct acpi_device *device, int type) | ||
236 | { | 225 | { |
237 | struct acpi_fan *fan = NULL; | 226 | struct acpi_fan *fan = NULL; |
238 | 227 | ||
@@ -241,7 +230,7 @@ acpi_fan_remove(struct acpi_device *device, int type) | |||
241 | if (!device || !acpi_driver_data(device)) | 230 | if (!device || !acpi_driver_data(device)) |
242 | return_VALUE(-EINVAL); | 231 | return_VALUE(-EINVAL); |
243 | 232 | ||
244 | fan = (struct acpi_fan *) acpi_driver_data(device); | 233 | fan = (struct acpi_fan *)acpi_driver_data(device); |
245 | 234 | ||
246 | acpi_fan_remove_fs(device); | 235 | acpi_fan_remove_fs(device); |
247 | 236 | ||
@@ -250,9 +239,7 @@ acpi_fan_remove(struct acpi_device *device, int type) | |||
250 | return_VALUE(0); | 239 | return_VALUE(0); |
251 | } | 240 | } |
252 | 241 | ||
253 | 242 | static int __init acpi_fan_init(void) | |
254 | static int __init | ||
255 | acpi_fan_init(void) | ||
256 | { | 243 | { |
257 | int result = 0; | 244 | int result = 0; |
258 | 245 | ||
@@ -272,9 +259,7 @@ acpi_fan_init(void) | |||
272 | return_VALUE(0); | 259 | return_VALUE(0); |
273 | } | 260 | } |
274 | 261 | ||
275 | 262 | static void __exit acpi_fan_exit(void) | |
276 | static void __exit | ||
277 | acpi_fan_exit(void) | ||
278 | { | 263 | { |
279 | ACPI_FUNCTION_TRACE("acpi_fan_exit"); | 264 | ACPI_FUNCTION_TRACE("acpi_fan_exit"); |
280 | 265 | ||
@@ -285,7 +270,5 @@ acpi_fan_exit(void) | |||
285 | return_VOID; | 270 | return_VOID; |
286 | } | 271 | } |
287 | 272 | ||
288 | |||
289 | module_init(acpi_fan_init); | 273 | module_init(acpi_fan_init); |
290 | module_exit(acpi_fan_exit); | 274 | module_exit(acpi_fan_exit); |
291 | |||