aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia/soc_common.c
diff options
context:
space:
mode:
authorMarcelo Roberto Jimenez <mroberto@cpti.cetuc.puc-rio.br>2010-10-18 17:39:05 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2010-12-21 09:53:44 -0500
commit17b38ebb6a32250a220d6af77293f7e3f9c62a6e (patch)
tree5e04b2fc35f1c3cbd5f39cdbf3fdf24f17ec6fd2 /drivers/pcmcia/soc_common.c
parentd2ccb52d88dcb7eb3539d0e0c77a7028b8d46037 (diff)
ARM: 6457/1: pcmcia: Fix checkpatch.pl issues in drivers/pcmcia/soc_common.c.
This patch fixes checkpatch.pl issues in drivers/pcmcia/soc_common.c. Signed-off-by: Marcelo Roberto Jimenez <mroberto@cpti.cetuc.puc-rio.br> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/pcmcia/soc_common.c')
-rw-r--r--drivers/pcmcia/soc_common.c128
1 files changed, 68 insertions, 60 deletions
diff --git a/drivers/pcmcia/soc_common.c b/drivers/pcmcia/soc_common.c
index 689e3c02edb8..b42e129b7673 100644
--- a/drivers/pcmcia/soc_common.c
+++ b/drivers/pcmcia/soc_common.c
@@ -31,20 +31,20 @@
31======================================================================*/ 31======================================================================*/
32 32
33 33
34#include <linux/module.h> 34#include <linux/cpufreq.h>
35#include <linux/moduleparam.h>
36#include <linux/init.h> 35#include <linux/init.h>
36#include <linux/interrupt.h>
37#include <linux/io.h>
38#include <linux/irq.h>
37#include <linux/kernel.h> 39#include <linux/kernel.h>
38#include <linux/timer.h>
39#include <linux/mm.h> 40#include <linux/mm.h>
41#include <linux/module.h>
42#include <linux/moduleparam.h>
40#include <linux/mutex.h> 43#include <linux/mutex.h>
41#include <linux/interrupt.h>
42#include <linux/irq.h>
43#include <linux/spinlock.h> 44#include <linux/spinlock.h>
44#include <linux/cpufreq.h> 45#include <linux/timer.h>
45 46
46#include <mach/hardware.h> 47#include <mach/hardware.h>
47#include <asm/io.h>
48#include <asm/system.h> 48#include <asm/system.h>
49 49
50#include "soc_common.h" 50#include "soc_common.h"
@@ -68,7 +68,8 @@ void soc_pcmcia_debug(struct soc_pcmcia_socket *skt, const char *func,
68 68
69#endif 69#endif
70 70
71#define to_soc_pcmcia_socket(x) container_of(x, struct soc_pcmcia_socket, socket) 71#define to_soc_pcmcia_socket(x) \
72 container_of(x, struct soc_pcmcia_socket, socket)
72 73
73static unsigned short 74static unsigned short
74calc_speed(unsigned short *spds, int num, unsigned short dflt) 75calc_speed(unsigned short *spds, int num, unsigned short dflt)
@@ -85,11 +86,15 @@ calc_speed(unsigned short *spds, int num, unsigned short dflt)
85 return speed; 86 return speed;
86} 87}
87 88
88void soc_common_pcmcia_get_timing(struct soc_pcmcia_socket *skt, struct soc_pcmcia_timing *timing) 89void soc_common_pcmcia_get_timing(struct soc_pcmcia_socket *skt,
90 struct soc_pcmcia_timing *timing)
89{ 91{
90 timing->io = calc_speed(skt->spd_io, MAX_IO_WIN, SOC_PCMCIA_IO_ACCESS); 92 timing->io =
91 timing->mem = calc_speed(skt->spd_mem, MAX_WIN, SOC_PCMCIA_3V_MEM_ACCESS); 93 calc_speed(skt->spd_io, MAX_IO_WIN, SOC_PCMCIA_IO_ACCESS);
92 timing->attr = calc_speed(skt->spd_attr, MAX_WIN, SOC_PCMCIA_3V_MEM_ACCESS); 94 timing->mem =
95 calc_speed(skt->spd_mem, MAX_WIN, SOC_PCMCIA_3V_MEM_ACCESS);
96 timing->attr =
97 calc_speed(skt->spd_attr, MAX_WIN, SOC_PCMCIA_3V_MEM_ACCESS);
93} 98}
94EXPORT_SYMBOL(soc_common_pcmcia_get_timing); 99EXPORT_SYMBOL(soc_common_pcmcia_get_timing);
95 100
@@ -131,8 +136,8 @@ static unsigned int soc_common_pcmcia_skt_state(struct soc_pcmcia_socket *skt)
131 * 136 *
132 * Convert PCMCIA socket state to our socket configure structure. 137 * Convert PCMCIA socket state to our socket configure structure.
133 */ 138 */
134static int 139static int soc_common_pcmcia_config_skt(
135soc_common_pcmcia_config_skt(struct soc_pcmcia_socket *skt, socket_state_t *state) 140 struct soc_pcmcia_socket *skt, socket_state_t *state)
136{ 141{
137 int ret; 142 int ret;
138 143
@@ -144,7 +149,8 @@ soc_common_pcmcia_config_skt(struct soc_pcmcia_socket *skt, socket_state_t *stat
144 */ 149 */
145 if (skt->irq_state != 1 && state->io_irq) { 150 if (skt->irq_state != 1 && state->io_irq) {
146 skt->irq_state = 1; 151 skt->irq_state = 1;
147 set_irq_type(skt->socket.pci_irq, IRQ_TYPE_EDGE_FALLING); 152 set_irq_type(skt->socket.pci_irq,
153 IRQ_TYPE_EDGE_FALLING);
148 } else if (skt->irq_state == 1 && state->io_irq == 0) { 154 } else if (skt->irq_state == 1 && state->io_irq == 0) {
149 skt->irq_state = 0; 155 skt->irq_state = 0;
150 set_irq_type(skt->socket.pci_irq, IRQ_TYPE_NONE); 156 set_irq_type(skt->socket.pci_irq, IRQ_TYPE_NONE);
@@ -298,24 +304,24 @@ soc_common_pcmcia_get_status(struct pcmcia_socket *sock, unsigned int *status)
298 * of power configuration, reset, &c. We also record the value of 304 * of power configuration, reset, &c. We also record the value of
299 * `state' in order to regurgitate it to the PCMCIA core later. 305 * `state' in order to regurgitate it to the PCMCIA core later.
300 */ 306 */
301static int 307static int soc_common_pcmcia_set_socket(
302soc_common_pcmcia_set_socket(struct pcmcia_socket *sock, socket_state_t *state) 308 struct pcmcia_socket *sock, socket_state_t *state)
303{ 309{
304 struct soc_pcmcia_socket *skt = to_soc_pcmcia_socket(sock); 310 struct soc_pcmcia_socket *skt = to_soc_pcmcia_socket(sock);
305 311
306 debug(skt, 2, "mask: %s%s%s%s%s%sflags: %s%s%s%s%s%sVcc %d Vpp %d irq %d\n", 312 debug(skt, 2, "mask: %s%s%s%s%s%s flags: %s%s%s%s%s%s Vcc %d Vpp %d irq %d\n",
307 (state->csc_mask==0)?"<NONE> ":"", 313 (state->csc_mask == 0) ? "<NONE> " : "",
308 (state->csc_mask&SS_DETECT)?"DETECT ":"", 314 (state->csc_mask & SS_DETECT) ? "DETECT " : "",
309 (state->csc_mask&SS_READY)?"READY ":"", 315 (state->csc_mask & SS_READY) ? "READY " : "",
310 (state->csc_mask&SS_BATDEAD)?"BATDEAD ":"", 316 (state->csc_mask & SS_BATDEAD) ? "BATDEAD " : "",
311 (state->csc_mask&SS_BATWARN)?"BATWARN ":"", 317 (state->csc_mask & SS_BATWARN) ? "BATWARN " : "",
312 (state->csc_mask&SS_STSCHG)?"STSCHG ":"", 318 (state->csc_mask & SS_STSCHG) ? "STSCHG " : "",
313 (state->flags==0)?"<NONE> ":"", 319 (state->flags == 0) ? "<NONE> " : "",
314 (state->flags&SS_PWR_AUTO)?"PWR_AUTO ":"", 320 (state->flags & SS_PWR_AUTO) ? "PWR_AUTO " : "",
315 (state->flags&SS_IOCARD)?"IOCARD ":"", 321 (state->flags & SS_IOCARD) ? "IOCARD " : "",
316 (state->flags&SS_RESET)?"RESET ":"", 322 (state->flags & SS_RESET) ? "RESET " : "",
317 (state->flags&SS_SPKR_ENA)?"SPKR_ENA ":"", 323 (state->flags & SS_SPKR_ENA) ? "SPKR_ENA " : "",
318 (state->flags&SS_OUTPUT_ENA)?"OUTPUT_ENA ":"", 324 (state->flags & SS_OUTPUT_ENA) ? "OUTPUT_ENA " : "",
319 state->Vcc, state->Vpp, state->io_irq); 325 state->Vcc, state->Vpp, state->io_irq);
320 326
321 return soc_common_pcmcia_config_skt(skt, state); 327 return soc_common_pcmcia_config_skt(skt, state);
@@ -330,8 +336,8 @@ soc_common_pcmcia_set_socket(struct pcmcia_socket *sock, socket_state_t *state)
330 * 336 *
331 * Returns: 0 on success, -1 on error 337 * Returns: 0 on success, -1 on error
332 */ 338 */
333static int 339static int soc_common_pcmcia_set_io_map(
334soc_common_pcmcia_set_io_map(struct pcmcia_socket *sock, struct pccard_io_map *map) 340 struct pcmcia_socket *sock, struct pccard_io_map *map)
335{ 341{
336 struct soc_pcmcia_socket *skt = to_soc_pcmcia_socket(sock); 342 struct soc_pcmcia_socket *skt = to_soc_pcmcia_socket(sock);
337 unsigned short speed = map->speed; 343 unsigned short speed = map->speed;
@@ -340,14 +346,14 @@ soc_common_pcmcia_set_io_map(struct pcmcia_socket *sock, struct pccard_io_map *m
340 map->map, map->speed, (unsigned long long)map->start, 346 map->map, map->speed, (unsigned long long)map->start,
341 (unsigned long long)map->stop); 347 (unsigned long long)map->stop);
342 debug(skt, 2, "flags: %s%s%s%s%s%s%s%s\n", 348 debug(skt, 2, "flags: %s%s%s%s%s%s%s%s\n",
343 (map->flags==0)?"<NONE>":"", 349 (map->flags == 0) ? "<NONE>" : "",
344 (map->flags&MAP_ACTIVE)?"ACTIVE ":"", 350 (map->flags & MAP_ACTIVE) ? "ACTIVE " : "",
345 (map->flags&MAP_16BIT)?"16BIT ":"", 351 (map->flags & MAP_16BIT) ? "16BIT " : "",
346 (map->flags&MAP_AUTOSZ)?"AUTOSZ ":"", 352 (map->flags & MAP_AUTOSZ) ? "AUTOSZ " : "",
347 (map->flags&MAP_0WS)?"0WS ":"", 353 (map->flags & MAP_0WS) ? "0WS " : "",
348 (map->flags&MAP_WRPROT)?"WRPROT ":"", 354 (map->flags & MAP_WRPROT) ? "WRPROT " : "",
349 (map->flags&MAP_USE_WAIT)?"USE_WAIT ":"", 355 (map->flags & MAP_USE_WAIT) ? "USE_WAIT " : "",
350 (map->flags&MAP_PREFETCH)?"PREFETCH ":""); 356 (map->flags & MAP_PREFETCH) ? "PREFETCH " : "");
351 357
352 if (map->map >= MAX_IO_WIN) { 358 if (map->map >= MAX_IO_WIN) {
353 printk(KERN_ERR "%s(): map (%d) out of range\n", __func__, 359 printk(KERN_ERR "%s(): map (%d) out of range\n", __func__,
@@ -384,8 +390,8 @@ soc_common_pcmcia_set_io_map(struct pcmcia_socket *sock, struct pccard_io_map *m
384 * 390 *
385 * Returns: 0 on success, -ERRNO on error 391 * Returns: 0 on success, -ERRNO on error
386 */ 392 */
387static int 393static int soc_common_pcmcia_set_mem_map(
388soc_common_pcmcia_set_mem_map(struct pcmcia_socket *sock, struct pccard_mem_map *map) 394 struct pcmcia_socket *sock, struct pccard_mem_map *map)
389{ 395{
390 struct soc_pcmcia_socket *skt = to_soc_pcmcia_socket(sock); 396 struct soc_pcmcia_socket *skt = to_soc_pcmcia_socket(sock);
391 struct resource *res; 397 struct resource *res;
@@ -394,14 +400,14 @@ soc_common_pcmcia_set_mem_map(struct pcmcia_socket *sock, struct pccard_mem_map
394 debug(skt, 2, "map %u speed %u card_start %08x\n", 400 debug(skt, 2, "map %u speed %u card_start %08x\n",
395 map->map, map->speed, map->card_start); 401 map->map, map->speed, map->card_start);
396 debug(skt, 2, "flags: %s%s%s%s%s%s%s%s\n", 402 debug(skt, 2, "flags: %s%s%s%s%s%s%s%s\n",
397 (map->flags==0)?"<NONE>":"", 403 (map->flags == 0) ? "<NONE>" : "",
398 (map->flags&MAP_ACTIVE)?"ACTIVE ":"", 404 (map->flags & MAP_ACTIVE) ? "ACTIVE " : "",
399 (map->flags&MAP_16BIT)?"16BIT ":"", 405 (map->flags & MAP_16BIT) ? "16BIT " : "",
400 (map->flags&MAP_AUTOSZ)?"AUTOSZ ":"", 406 (map->flags & MAP_AUTOSZ) ? "AUTOSZ " : "",
401 (map->flags&MAP_0WS)?"0WS ":"", 407 (map->flags & MAP_0WS) ? "0WS " : "",
402 (map->flags&MAP_WRPROT)?"WRPROT ":"", 408 (map->flags & MAP_WRPROT) ? "WRPROT " : "",
403 (map->flags&MAP_ATTRIB)?"ATTRIB ":"", 409 (map->flags & MAP_ATTRIB) ? "ATTRIB " : "",
404 (map->flags&MAP_USE_WAIT)?"USE_WAIT ":""); 410 (map->flags & MAP_USE_WAIT) ? "USE_WAIT " : "");
405 411
406 if (map->map >= MAX_WIN) 412 if (map->map >= MAX_WIN)
407 return -EINVAL; 413 return -EINVAL;
@@ -456,8 +462,8 @@ static struct bittbl conf_bits[] = {
456 { SS_OUTPUT_ENA, "SS_OUTPUT_ENA" }, 462 { SS_OUTPUT_ENA, "SS_OUTPUT_ENA" },
457}; 463};
458 464
459static void 465static void dump_bits(char **p, const char *prefix,
460dump_bits(char **p, const char *prefix, unsigned int val, struct bittbl *bits, int sz) 466 unsigned int val, struct bittbl *bits, int sz)
461{ 467{
462 char *b = *p; 468 char *b = *p;
463 int i; 469 int i;
@@ -475,13 +481,14 @@ dump_bits(char **p, const char *prefix, unsigned int val, struct bittbl *bits, i
475 * 481 *
476 * Returns: the number of characters added to the buffer 482 * Returns: the number of characters added to the buffer
477 */ 483 */
478static ssize_t show_status(struct device *dev, struct device_attribute *attr, char *buf) 484static ssize_t show_status(
485 struct device *dev, struct device_attribute *attr, char *buf)
479{ 486{
480 struct soc_pcmcia_socket *skt = 487 struct soc_pcmcia_socket *skt =
481 container_of(dev, struct soc_pcmcia_socket, socket.dev); 488 container_of(dev, struct soc_pcmcia_socket, socket.dev);
482 char *p = buf; 489 char *p = buf;
483 490
484 p+=sprintf(p, "slot : %d\n", skt->nr); 491 p += sprintf(p, "slot : %d\n", skt->nr);
485 492
486 dump_bits(&p, "status", skt->status, 493 dump_bits(&p, "status", skt->status,
487 status_bits, ARRAY_SIZE(status_bits)); 494 status_bits, ARRAY_SIZE(status_bits));
@@ -490,12 +497,12 @@ static ssize_t show_status(struct device *dev, struct device_attribute *attr, ch
490 dump_bits(&p, "cs_flags", skt->cs_state.flags, 497 dump_bits(&p, "cs_flags", skt->cs_state.flags,
491 conf_bits, ARRAY_SIZE(conf_bits)); 498 conf_bits, ARRAY_SIZE(conf_bits));
492 499
493 p+=sprintf(p, "Vcc : %d\n", skt->cs_state.Vcc); 500 p += sprintf(p, "Vcc : %d\n", skt->cs_state.Vcc);
494 p+=sprintf(p, "Vpp : %d\n", skt->cs_state.Vpp); 501 p += sprintf(p, "Vpp : %d\n", skt->cs_state.Vpp);
495 p+=sprintf(p, "IRQ : %d (%d)\n", skt->cs_state.io_irq, 502 p += sprintf(p, "IRQ : %d (%d)\n", skt->cs_state.io_irq,
496 skt->socket.pci_irq); 503 skt->socket.pci_irq);
497 if (skt->ops->show_timing) 504 if (skt->ops->show_timing)
498 p+=skt->ops->show_timing(skt, p); 505 p += skt->ops->show_timing(skt, p);
499 506
500 return p-buf; 507 return p-buf;
501} 508}
@@ -588,7 +595,7 @@ soc_pcmcia_notifier(struct notifier_block *nb, unsigned long val, void *data)
588 595
589 mutex_lock(&soc_pcmcia_sockets_lock); 596 mutex_lock(&soc_pcmcia_sockets_lock);
590 list_for_each_entry(skt, &soc_pcmcia_sockets, node) 597 list_for_each_entry(skt, &soc_pcmcia_sockets, node)
591 if ( skt->ops->frequency_change ) 598 if (skt->ops->frequency_change)
592 ret += skt->ops->frequency_change(skt, val, freqs); 599 ret += skt->ops->frequency_change(skt, val, freqs);
593 mutex_unlock(&soc_pcmcia_sockets_lock); 600 mutex_unlock(&soc_pcmcia_sockets_lock);
594 601
@@ -614,7 +621,8 @@ fs_initcall(soc_pcmcia_cpufreq_register);
614 621
615static void soc_pcmcia_cpufreq_unregister(void) 622static void soc_pcmcia_cpufreq_unregister(void)
616{ 623{
617 cpufreq_unregister_notifier(&soc_pcmcia_notifier_block, CPUFREQ_TRANSITION_NOTIFIER); 624 cpufreq_unregister_notifier(&soc_pcmcia_notifier_block,
625 CPUFREQ_TRANSITION_NOTIFIER);
618} 626}
619module_exit(soc_pcmcia_cpufreq_unregister); 627module_exit(soc_pcmcia_cpufreq_unregister);
620 628