diff options
author | Bjorn Helgaas <bjorn.helgaas@hp.com> | 2007-07-26 13:41:20 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-26 14:35:20 -0400 |
commit | 9dd78466c956ac4b4f38e12032dc4249ccf57ad1 (patch) | |
tree | 57ee3822b79049d38c1df952fe77e72a97c718f3 /drivers/pnp/interface.c | |
parent | 8ec3cf7d29aef773eee5bc6cd9b0fa4d3fb42480 (diff) |
PNP: Lindent all source files
Run Lindent on all PNP source files.
Produced by:
$ quilt new pnp-lindent
$ find drivers/pnp -name \*.[ch] | xargs quilt add
$ quilt add include/linux/{pnp.h,pnpbios.h}
$ scripts/Lindent drivers/pnp/*.c drivers/pnp/*/*.c include/linux/pnp*.h
$ quilt refresh --sort
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Cc: Len Brown <lenb@kernel.org>
Cc: Adam Belay <ambx1@neo.rr.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/pnp/interface.c')
-rw-r--r-- | drivers/pnp/interface.c | 215 |
1 files changed, 122 insertions, 93 deletions
diff --git a/drivers/pnp/interface.c b/drivers/pnp/interface.c index ac9fcd499f3f..b6beb8a36da7 100644 --- a/drivers/pnp/interface.c +++ b/drivers/pnp/interface.c | |||
@@ -29,7 +29,7 @@ struct pnp_info_buffer { | |||
29 | 29 | ||
30 | typedef struct pnp_info_buffer pnp_info_buffer_t; | 30 | typedef struct pnp_info_buffer pnp_info_buffer_t; |
31 | 31 | ||
32 | static int pnp_printf(pnp_info_buffer_t * buffer, char *fmt,...) | 32 | static int pnp_printf(pnp_info_buffer_t * buffer, char *fmt, ...) |
33 | { | 33 | { |
34 | va_list args; | 34 | va_list args; |
35 | int res; | 35 | int res; |
@@ -48,14 +48,18 @@ static int pnp_printf(pnp_info_buffer_t * buffer, char *fmt,...) | |||
48 | return res; | 48 | return res; |
49 | } | 49 | } |
50 | 50 | ||
51 | static void pnp_print_port(pnp_info_buffer_t *buffer, char *space, struct pnp_port *port) | 51 | static void pnp_print_port(pnp_info_buffer_t * buffer, char *space, |
52 | struct pnp_port *port) | ||
52 | { | 53 | { |
53 | pnp_printf(buffer, "%sport 0x%x-0x%x, align 0x%x, size 0x%x, %i-bit address decoding\n", | 54 | pnp_printf(buffer, |
54 | space, port->min, port->max, port->align ? (port->align-1) : 0, port->size, | 55 | "%sport 0x%x-0x%x, align 0x%x, size 0x%x, %i-bit address decoding\n", |
55 | port->flags & PNP_PORT_FLAG_16BITADDR ? 16 : 10); | 56 | space, port->min, port->max, |
57 | port->align ? (port->align - 1) : 0, port->size, | ||
58 | port->flags & PNP_PORT_FLAG_16BITADDR ? 16 : 10); | ||
56 | } | 59 | } |
57 | 60 | ||
58 | static void pnp_print_irq(pnp_info_buffer_t *buffer, char *space, struct pnp_irq *irq) | 61 | static void pnp_print_irq(pnp_info_buffer_t * buffer, char *space, |
62 | struct pnp_irq *irq) | ||
59 | { | 63 | { |
60 | int first = 1, i; | 64 | int first = 1, i; |
61 | 65 | ||
@@ -85,14 +89,15 @@ static void pnp_print_irq(pnp_info_buffer_t *buffer, char *space, struct pnp_irq | |||
85 | pnp_printf(buffer, "\n"); | 89 | pnp_printf(buffer, "\n"); |
86 | } | 90 | } |
87 | 91 | ||
88 | static void pnp_print_dma(pnp_info_buffer_t *buffer, char *space, struct pnp_dma *dma) | 92 | static void pnp_print_dma(pnp_info_buffer_t * buffer, char *space, |
93 | struct pnp_dma *dma) | ||
89 | { | 94 | { |
90 | int first = 1, i; | 95 | int first = 1, i; |
91 | char *s; | 96 | char *s; |
92 | 97 | ||
93 | pnp_printf(buffer, "%sdma ", space); | 98 | pnp_printf(buffer, "%sdma ", space); |
94 | for (i = 0; i < 8; i++) | 99 | for (i = 0; i < 8; i++) |
95 | if (dma->map & (1<<i)) { | 100 | if (dma->map & (1 << i)) { |
96 | if (!first) { | 101 | if (!first) { |
97 | pnp_printf(buffer, ","); | 102 | pnp_printf(buffer, ","); |
98 | } else { | 103 | } else { |
@@ -136,12 +141,13 @@ static void pnp_print_dma(pnp_info_buffer_t *buffer, char *space, struct pnp_dma | |||
136 | pnp_printf(buffer, " %s\n", s); | 141 | pnp_printf(buffer, " %s\n", s); |
137 | } | 142 | } |
138 | 143 | ||
139 | static void pnp_print_mem(pnp_info_buffer_t *buffer, char *space, struct pnp_mem *mem) | 144 | static void pnp_print_mem(pnp_info_buffer_t * buffer, char *space, |
145 | struct pnp_mem *mem) | ||
140 | { | 146 | { |
141 | char *s; | 147 | char *s; |
142 | 148 | ||
143 | pnp_printf(buffer, "%sMemory 0x%x-0x%x, align 0x%x, size 0x%x", | 149 | pnp_printf(buffer, "%sMemory 0x%x-0x%x, align 0x%x, size 0x%x", |
144 | space, mem->min, mem->max, mem->align, mem->size); | 150 | space, mem->min, mem->max, mem->align, mem->size); |
145 | if (mem->flags & IORESOURCE_MEM_WRITEABLE) | 151 | if (mem->flags & IORESOURCE_MEM_WRITEABLE) |
146 | pnp_printf(buffer, ", writeable"); | 152 | pnp_printf(buffer, ", writeable"); |
147 | if (mem->flags & IORESOURCE_MEM_CACHEABLE) | 153 | if (mem->flags & IORESOURCE_MEM_CACHEABLE) |
@@ -168,7 +174,7 @@ static void pnp_print_mem(pnp_info_buffer_t *buffer, char *space, struct pnp_mem | |||
168 | pnp_printf(buffer, ", %s\n", s); | 174 | pnp_printf(buffer, ", %s\n", s); |
169 | } | 175 | } |
170 | 176 | ||
171 | static void pnp_print_option(pnp_info_buffer_t *buffer, char *space, | 177 | static void pnp_print_option(pnp_info_buffer_t * buffer, char *space, |
172 | struct pnp_option *option, int dep) | 178 | struct pnp_option *option, int dep) |
173 | { | 179 | { |
174 | char *s; | 180 | char *s; |
@@ -179,19 +185,19 @@ static void pnp_print_option(pnp_info_buffer_t *buffer, char *space, | |||
179 | 185 | ||
180 | if (dep) { | 186 | if (dep) { |
181 | switch (option->priority) { | 187 | switch (option->priority) { |
182 | case PNP_RES_PRIORITY_PREFERRED: | 188 | case PNP_RES_PRIORITY_PREFERRED: |
183 | s = "preferred"; | 189 | s = "preferred"; |
184 | break; | 190 | break; |
185 | case PNP_RES_PRIORITY_ACCEPTABLE: | 191 | case PNP_RES_PRIORITY_ACCEPTABLE: |
186 | s = "acceptable"; | 192 | s = "acceptable"; |
187 | break; | 193 | break; |
188 | case PNP_RES_PRIORITY_FUNCTIONAL: | 194 | case PNP_RES_PRIORITY_FUNCTIONAL: |
189 | s = "functional"; | 195 | s = "functional"; |
190 | break; | 196 | break; |
191 | default: | 197 | default: |
192 | s = "invalid"; | 198 | s = "invalid"; |
193 | } | 199 | } |
194 | pnp_printf(buffer, "Dependent: %02i - Priority %s\n",dep, s); | 200 | pnp_printf(buffer, "Dependent: %02i - Priority %s\n", dep, s); |
195 | } | 201 | } |
196 | 202 | ||
197 | for (port = option->port; port; port = port->next) | 203 | for (port = option->port; port; port = port->next) |
@@ -204,16 +210,16 @@ static void pnp_print_option(pnp_info_buffer_t *buffer, char *space, | |||
204 | pnp_print_mem(buffer, space, mem); | 210 | pnp_print_mem(buffer, space, mem); |
205 | } | 211 | } |
206 | 212 | ||
207 | 213 | static ssize_t pnp_show_options(struct device *dmdev, | |
208 | static ssize_t pnp_show_options(struct device *dmdev, struct device_attribute *attr, char *buf) | 214 | struct device_attribute *attr, char *buf) |
209 | { | 215 | { |
210 | struct pnp_dev *dev = to_pnp_dev(dmdev); | 216 | struct pnp_dev *dev = to_pnp_dev(dmdev); |
211 | struct pnp_option * independent = dev->independent; | 217 | struct pnp_option *independent = dev->independent; |
212 | struct pnp_option * dependent = dev->dependent; | 218 | struct pnp_option *dependent = dev->dependent; |
213 | int ret, dep = 1; | 219 | int ret, dep = 1; |
214 | 220 | ||
215 | pnp_info_buffer_t *buffer = (pnp_info_buffer_t *) | 221 | pnp_info_buffer_t *buffer = (pnp_info_buffer_t *) |
216 | pnp_alloc(sizeof(pnp_info_buffer_t)); | 222 | pnp_alloc(sizeof(pnp_info_buffer_t)); |
217 | if (!buffer) | 223 | if (!buffer) |
218 | return -ENOMEM; | 224 | return -ENOMEM; |
219 | 225 | ||
@@ -223,7 +229,7 @@ static ssize_t pnp_show_options(struct device *dmdev, struct device_attribute *a | |||
223 | if (independent) | 229 | if (independent) |
224 | pnp_print_option(buffer, "", independent, 0); | 230 | pnp_print_option(buffer, "", independent, 0); |
225 | 231 | ||
226 | while (dependent){ | 232 | while (dependent) { |
227 | pnp_print_option(buffer, " ", dependent, dep); | 233 | pnp_print_option(buffer, " ", dependent, dep); |
228 | dependent = dependent->next; | 234 | dependent = dependent->next; |
229 | dep++; | 235 | dep++; |
@@ -233,10 +239,11 @@ static ssize_t pnp_show_options(struct device *dmdev, struct device_attribute *a | |||
233 | return ret; | 239 | return ret; |
234 | } | 240 | } |
235 | 241 | ||
236 | static DEVICE_ATTR(options,S_IRUGO,pnp_show_options,NULL); | 242 | static DEVICE_ATTR(options, S_IRUGO, pnp_show_options, NULL); |
237 | |||
238 | 243 | ||
239 | static ssize_t pnp_show_current_resources(struct device *dmdev, struct device_attribute *attr, char *buf) | 244 | static ssize_t pnp_show_current_resources(struct device *dmdev, |
245 | struct device_attribute *attr, | ||
246 | char *buf) | ||
240 | { | 247 | { |
241 | struct pnp_dev *dev = to_pnp_dev(dmdev); | 248 | struct pnp_dev *dev = to_pnp_dev(dmdev); |
242 | int i, ret; | 249 | int i, ret; |
@@ -252,52 +259,56 @@ static ssize_t pnp_show_current_resources(struct device *dmdev, struct device_at | |||
252 | buffer->buffer = buf; | 259 | buffer->buffer = buf; |
253 | buffer->curr = buffer->buffer; | 260 | buffer->curr = buffer->buffer; |
254 | 261 | ||
255 | pnp_printf(buffer,"state = "); | 262 | pnp_printf(buffer, "state = "); |
256 | if (dev->active) | 263 | if (dev->active) |
257 | pnp_printf(buffer,"active\n"); | 264 | pnp_printf(buffer, "active\n"); |
258 | else | 265 | else |
259 | pnp_printf(buffer,"disabled\n"); | 266 | pnp_printf(buffer, "disabled\n"); |
260 | 267 | ||
261 | for (i = 0; i < PNP_MAX_PORT; i++) { | 268 | for (i = 0; i < PNP_MAX_PORT; i++) { |
262 | if (pnp_port_valid(dev, i)) { | 269 | if (pnp_port_valid(dev, i)) { |
263 | pnp_printf(buffer,"io"); | 270 | pnp_printf(buffer, "io"); |
264 | if (pnp_port_flags(dev, i) & IORESOURCE_DISABLED) | 271 | if (pnp_port_flags(dev, i) & IORESOURCE_DISABLED) |
265 | pnp_printf(buffer," disabled\n"); | 272 | pnp_printf(buffer, " disabled\n"); |
266 | else | 273 | else |
267 | pnp_printf(buffer," 0x%llx-0x%llx\n", | 274 | pnp_printf(buffer, " 0x%llx-0x%llx\n", |
268 | (unsigned long long)pnp_port_start(dev, i), | 275 | (unsigned long long) |
269 | (unsigned long long)pnp_port_end(dev, i)); | 276 | pnp_port_start(dev, i), |
277 | (unsigned long long)pnp_port_end(dev, | ||
278 | i)); | ||
270 | } | 279 | } |
271 | } | 280 | } |
272 | for (i = 0; i < PNP_MAX_MEM; i++) { | 281 | for (i = 0; i < PNP_MAX_MEM; i++) { |
273 | if (pnp_mem_valid(dev, i)) { | 282 | if (pnp_mem_valid(dev, i)) { |
274 | pnp_printf(buffer,"mem"); | 283 | pnp_printf(buffer, "mem"); |
275 | if (pnp_mem_flags(dev, i) & IORESOURCE_DISABLED) | 284 | if (pnp_mem_flags(dev, i) & IORESOURCE_DISABLED) |
276 | pnp_printf(buffer," disabled\n"); | 285 | pnp_printf(buffer, " disabled\n"); |
277 | else | 286 | else |
278 | pnp_printf(buffer," 0x%llx-0x%llx\n", | 287 | pnp_printf(buffer, " 0x%llx-0x%llx\n", |
279 | (unsigned long long)pnp_mem_start(dev, i), | 288 | (unsigned long long) |
280 | (unsigned long long)pnp_mem_end(dev, i)); | 289 | pnp_mem_start(dev, i), |
290 | (unsigned long long)pnp_mem_end(dev, | ||
291 | i)); | ||
281 | } | 292 | } |
282 | } | 293 | } |
283 | for (i = 0; i < PNP_MAX_IRQ; i++) { | 294 | for (i = 0; i < PNP_MAX_IRQ; i++) { |
284 | if (pnp_irq_valid(dev, i)) { | 295 | if (pnp_irq_valid(dev, i)) { |
285 | pnp_printf(buffer,"irq"); | 296 | pnp_printf(buffer, "irq"); |
286 | if (pnp_irq_flags(dev, i) & IORESOURCE_DISABLED) | 297 | if (pnp_irq_flags(dev, i) & IORESOURCE_DISABLED) |
287 | pnp_printf(buffer," disabled\n"); | 298 | pnp_printf(buffer, " disabled\n"); |
288 | else | 299 | else |
289 | pnp_printf(buffer," %lld\n", | 300 | pnp_printf(buffer, " %lld\n", |
290 | (unsigned long long)pnp_irq(dev, i)); | 301 | (unsigned long long)pnp_irq(dev, i)); |
291 | } | 302 | } |
292 | } | 303 | } |
293 | for (i = 0; i < PNP_MAX_DMA; i++) { | 304 | for (i = 0; i < PNP_MAX_DMA; i++) { |
294 | if (pnp_dma_valid(dev, i)) { | 305 | if (pnp_dma_valid(dev, i)) { |
295 | pnp_printf(buffer,"dma"); | 306 | pnp_printf(buffer, "dma"); |
296 | if (pnp_dma_flags(dev, i) & IORESOURCE_DISABLED) | 307 | if (pnp_dma_flags(dev, i) & IORESOURCE_DISABLED) |
297 | pnp_printf(buffer," disabled\n"); | 308 | pnp_printf(buffer, " disabled\n"); |
298 | else | 309 | else |
299 | pnp_printf(buffer," %lld\n", | 310 | pnp_printf(buffer, " %lld\n", |
300 | (unsigned long long)pnp_dma(dev, i)); | 311 | (unsigned long long)pnp_dma(dev, i)); |
301 | } | 312 | } |
302 | } | 313 | } |
303 | ret = (buffer->curr - buf); | 314 | ret = (buffer->curr - buf); |
@@ -308,55 +319,57 @@ static ssize_t pnp_show_current_resources(struct device *dmdev, struct device_at | |||
308 | extern struct semaphore pnp_res_mutex; | 319 | extern struct semaphore pnp_res_mutex; |
309 | 320 | ||
310 | static ssize_t | 321 | static ssize_t |
311 | pnp_set_current_resources(struct device * dmdev, struct device_attribute *attr, const char * ubuf, size_t count) | 322 | pnp_set_current_resources(struct device *dmdev, struct device_attribute *attr, |
323 | const char *ubuf, size_t count) | ||
312 | { | 324 | { |
313 | struct pnp_dev *dev = to_pnp_dev(dmdev); | 325 | struct pnp_dev *dev = to_pnp_dev(dmdev); |
314 | char *buf = (void *)ubuf; | 326 | char *buf = (void *)ubuf; |
315 | int retval = 0; | 327 | int retval = 0; |
316 | 328 | ||
317 | if (dev->status & PNP_ATTACHED) { | 329 | if (dev->status & PNP_ATTACHED) { |
318 | retval = -EBUSY; | 330 | retval = -EBUSY; |
319 | pnp_info("Device %s cannot be configured because it is in use.", dev->dev.bus_id); | 331 | pnp_info("Device %s cannot be configured because it is in use.", |
332 | dev->dev.bus_id); | ||
320 | goto done; | 333 | goto done; |
321 | } | 334 | } |
322 | 335 | ||
323 | while (isspace(*buf)) | 336 | while (isspace(*buf)) |
324 | ++buf; | 337 | ++buf; |
325 | if (!strnicmp(buf,"disable",7)) { | 338 | if (!strnicmp(buf, "disable", 7)) { |
326 | retval = pnp_disable_dev(dev); | 339 | retval = pnp_disable_dev(dev); |
327 | goto done; | 340 | goto done; |
328 | } | 341 | } |
329 | if (!strnicmp(buf,"activate",8)) { | 342 | if (!strnicmp(buf, "activate", 8)) { |
330 | retval = pnp_activate_dev(dev); | 343 | retval = pnp_activate_dev(dev); |
331 | goto done; | 344 | goto done; |
332 | } | 345 | } |
333 | if (!strnicmp(buf,"fill",4)) { | 346 | if (!strnicmp(buf, "fill", 4)) { |
334 | if (dev->active) | 347 | if (dev->active) |
335 | goto done; | 348 | goto done; |
336 | retval = pnp_auto_config_dev(dev); | 349 | retval = pnp_auto_config_dev(dev); |
337 | goto done; | 350 | goto done; |
338 | } | 351 | } |
339 | if (!strnicmp(buf,"auto",4)) { | 352 | if (!strnicmp(buf, "auto", 4)) { |
340 | if (dev->active) | 353 | if (dev->active) |
341 | goto done; | 354 | goto done; |
342 | pnp_init_resource_table(&dev->res); | 355 | pnp_init_resource_table(&dev->res); |
343 | retval = pnp_auto_config_dev(dev); | 356 | retval = pnp_auto_config_dev(dev); |
344 | goto done; | 357 | goto done; |
345 | } | 358 | } |
346 | if (!strnicmp(buf,"clear",5)) { | 359 | if (!strnicmp(buf, "clear", 5)) { |
347 | if (dev->active) | 360 | if (dev->active) |
348 | goto done; | 361 | goto done; |
349 | pnp_init_resource_table(&dev->res); | 362 | pnp_init_resource_table(&dev->res); |
350 | goto done; | 363 | goto done; |
351 | } | 364 | } |
352 | if (!strnicmp(buf,"get",3)) { | 365 | if (!strnicmp(buf, "get", 3)) { |
353 | down(&pnp_res_mutex); | 366 | down(&pnp_res_mutex); |
354 | if (pnp_can_read(dev)) | 367 | if (pnp_can_read(dev)) |
355 | dev->protocol->get(dev, &dev->res); | 368 | dev->protocol->get(dev, &dev->res); |
356 | up(&pnp_res_mutex); | 369 | up(&pnp_res_mutex); |
357 | goto done; | 370 | goto done; |
358 | } | 371 | } |
359 | if (!strnicmp(buf,"set",3)) { | 372 | if (!strnicmp(buf, "set", 3)) { |
360 | int nport = 0, nmem = 0, nirq = 0, ndma = 0; | 373 | int nport = 0, nmem = 0, nirq = 0, ndma = 0; |
361 | if (dev->active) | 374 | if (dev->active) |
362 | goto done; | 375 | goto done; |
@@ -366,65 +379,77 @@ pnp_set_current_resources(struct device * dmdev, struct device_attribute *attr, | |||
366 | while (1) { | 379 | while (1) { |
367 | while (isspace(*buf)) | 380 | while (isspace(*buf)) |
368 | ++buf; | 381 | ++buf; |
369 | if (!strnicmp(buf,"io",2)) { | 382 | if (!strnicmp(buf, "io", 2)) { |
370 | buf += 2; | 383 | buf += 2; |
371 | while (isspace(*buf)) | 384 | while (isspace(*buf)) |
372 | ++buf; | 385 | ++buf; |
373 | dev->res.port_resource[nport].start = simple_strtoul(buf,&buf,0); | 386 | dev->res.port_resource[nport].start = |
387 | simple_strtoul(buf, &buf, 0); | ||
374 | while (isspace(*buf)) | 388 | while (isspace(*buf)) |
375 | ++buf; | 389 | ++buf; |
376 | if(*buf == '-') { | 390 | if (*buf == '-') { |
377 | buf += 1; | 391 | buf += 1; |
378 | while (isspace(*buf)) | 392 | while (isspace(*buf)) |
379 | ++buf; | 393 | ++buf; |
380 | dev->res.port_resource[nport].end = simple_strtoul(buf,&buf,0); | 394 | dev->res.port_resource[nport].end = |
395 | simple_strtoul(buf, &buf, 0); | ||
381 | } else | 396 | } else |
382 | dev->res.port_resource[nport].end = dev->res.port_resource[nport].start; | 397 | dev->res.port_resource[nport].end = |
383 | dev->res.port_resource[nport].flags = IORESOURCE_IO; | 398 | dev->res.port_resource[nport].start; |
399 | dev->res.port_resource[nport].flags = | ||
400 | IORESOURCE_IO; | ||
384 | nport++; | 401 | nport++; |
385 | if (nport >= PNP_MAX_PORT) | 402 | if (nport >= PNP_MAX_PORT) |
386 | break; | 403 | break; |
387 | continue; | 404 | continue; |
388 | } | 405 | } |
389 | if (!strnicmp(buf,"mem",3)) { | 406 | if (!strnicmp(buf, "mem", 3)) { |
390 | buf += 3; | 407 | buf += 3; |
391 | while (isspace(*buf)) | 408 | while (isspace(*buf)) |
392 | ++buf; | 409 | ++buf; |
393 | dev->res.mem_resource[nmem].start = simple_strtoul(buf,&buf,0); | 410 | dev->res.mem_resource[nmem].start = |
411 | simple_strtoul(buf, &buf, 0); | ||
394 | while (isspace(*buf)) | 412 | while (isspace(*buf)) |
395 | ++buf; | 413 | ++buf; |
396 | if(*buf == '-') { | 414 | if (*buf == '-') { |
397 | buf += 1; | 415 | buf += 1; |
398 | while (isspace(*buf)) | 416 | while (isspace(*buf)) |
399 | ++buf; | 417 | ++buf; |
400 | dev->res.mem_resource[nmem].end = simple_strtoul(buf,&buf,0); | 418 | dev->res.mem_resource[nmem].end = |
419 | simple_strtoul(buf, &buf, 0); | ||
401 | } else | 420 | } else |
402 | dev->res.mem_resource[nmem].end = dev->res.mem_resource[nmem].start; | 421 | dev->res.mem_resource[nmem].end = |
403 | dev->res.mem_resource[nmem].flags = IORESOURCE_MEM; | 422 | dev->res.mem_resource[nmem].start; |
423 | dev->res.mem_resource[nmem].flags = | ||
424 | IORESOURCE_MEM; | ||
404 | nmem++; | 425 | nmem++; |
405 | if (nmem >= PNP_MAX_MEM) | 426 | if (nmem >= PNP_MAX_MEM) |
406 | break; | 427 | break; |
407 | continue; | 428 | continue; |
408 | } | 429 | } |
409 | if (!strnicmp(buf,"irq",3)) { | 430 | if (!strnicmp(buf, "irq", 3)) { |
410 | buf += 3; | 431 | buf += 3; |
411 | while (isspace(*buf)) | 432 | while (isspace(*buf)) |
412 | ++buf; | 433 | ++buf; |
413 | dev->res.irq_resource[nirq].start = | 434 | dev->res.irq_resource[nirq].start = |
414 | dev->res.irq_resource[nirq].end = simple_strtoul(buf,&buf,0); | 435 | dev->res.irq_resource[nirq].end = |
415 | dev->res.irq_resource[nirq].flags = IORESOURCE_IRQ; | 436 | simple_strtoul(buf, &buf, 0); |
437 | dev->res.irq_resource[nirq].flags = | ||
438 | IORESOURCE_IRQ; | ||
416 | nirq++; | 439 | nirq++; |
417 | if (nirq >= PNP_MAX_IRQ) | 440 | if (nirq >= PNP_MAX_IRQ) |
418 | break; | 441 | break; |
419 | continue; | 442 | continue; |
420 | } | 443 | } |
421 | if (!strnicmp(buf,"dma",3)) { | 444 | if (!strnicmp(buf, "dma", 3)) { |
422 | buf += 3; | 445 | buf += 3; |
423 | while (isspace(*buf)) | 446 | while (isspace(*buf)) |
424 | ++buf; | 447 | ++buf; |
425 | dev->res.dma_resource[ndma].start = | 448 | dev->res.dma_resource[ndma].start = |
426 | dev->res.dma_resource[ndma].end = simple_strtoul(buf,&buf,0); | 449 | dev->res.dma_resource[ndma].end = |
427 | dev->res.dma_resource[ndma].flags = IORESOURCE_DMA; | 450 | simple_strtoul(buf, &buf, 0); |
451 | dev->res.dma_resource[ndma].flags = | ||
452 | IORESOURCE_DMA; | ||
428 | ndma++; | 453 | ndma++; |
429 | if (ndma >= PNP_MAX_DMA) | 454 | if (ndma >= PNP_MAX_DMA) |
430 | break; | 455 | break; |
@@ -435,45 +460,49 @@ pnp_set_current_resources(struct device * dmdev, struct device_attribute *attr, | |||
435 | up(&pnp_res_mutex); | 460 | up(&pnp_res_mutex); |
436 | goto done; | 461 | goto done; |
437 | } | 462 | } |
438 | done: | 463 | done: |
439 | if (retval < 0) | 464 | if (retval < 0) |
440 | return retval; | 465 | return retval; |
441 | return count; | 466 | return count; |
442 | } | 467 | } |
443 | 468 | ||
444 | static DEVICE_ATTR(resources,S_IRUGO | S_IWUSR, | 469 | static DEVICE_ATTR(resources, S_IRUGO | S_IWUSR, |
445 | pnp_show_current_resources,pnp_set_current_resources); | 470 | pnp_show_current_resources, pnp_set_current_resources); |
446 | 471 | ||
447 | static ssize_t pnp_show_current_ids(struct device *dmdev, struct device_attribute *attr, char *buf) | 472 | static ssize_t pnp_show_current_ids(struct device *dmdev, |
473 | struct device_attribute *attr, char *buf) | ||
448 | { | 474 | { |
449 | char *str = buf; | 475 | char *str = buf; |
450 | struct pnp_dev *dev = to_pnp_dev(dmdev); | 476 | struct pnp_dev *dev = to_pnp_dev(dmdev); |
451 | struct pnp_id * pos = dev->id; | 477 | struct pnp_id *pos = dev->id; |
452 | 478 | ||
453 | while (pos) { | 479 | while (pos) { |
454 | str += sprintf(str,"%s\n", pos->id); | 480 | str += sprintf(str, "%s\n", pos->id); |
455 | pos = pos->next; | 481 | pos = pos->next; |
456 | } | 482 | } |
457 | return (str - buf); | 483 | return (str - buf); |
458 | } | 484 | } |
459 | 485 | ||
460 | static DEVICE_ATTR(id,S_IRUGO,pnp_show_current_ids,NULL); | 486 | static DEVICE_ATTR(id, S_IRUGO, pnp_show_current_ids, NULL); |
461 | 487 | ||
462 | int pnp_interface_attach_device(struct pnp_dev *dev) | 488 | int pnp_interface_attach_device(struct pnp_dev *dev) |
463 | { | 489 | { |
464 | int rc = device_create_file(&dev->dev,&dev_attr_options); | 490 | int rc = device_create_file(&dev->dev, &dev_attr_options); |
465 | if (rc) goto err; | 491 | if (rc) |
466 | rc = device_create_file(&dev->dev,&dev_attr_resources); | 492 | goto err; |
467 | if (rc) goto err_opt; | 493 | rc = device_create_file(&dev->dev, &dev_attr_resources); |
468 | rc = device_create_file(&dev->dev,&dev_attr_id); | 494 | if (rc) |
469 | if (rc) goto err_res; | 495 | goto err_opt; |
496 | rc = device_create_file(&dev->dev, &dev_attr_id); | ||
497 | if (rc) | ||
498 | goto err_res; | ||
470 | 499 | ||
471 | return 0; | 500 | return 0; |
472 | 501 | ||
473 | err_res: | 502 | err_res: |
474 | device_remove_file(&dev->dev,&dev_attr_resources); | 503 | device_remove_file(&dev->dev, &dev_attr_resources); |
475 | err_opt: | 504 | err_opt: |
476 | device_remove_file(&dev->dev,&dev_attr_options); | 505 | device_remove_file(&dev->dev, &dev_attr_options); |
477 | err: | 506 | err: |
478 | return rc; | 507 | return rc; |
479 | } | 508 | } |