X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=drivers%2Fpcmcia%2Fcistpl.c;h=912c03e5eb0a3d66448da64a26416d3d8a546dcf;hb=84eb8d0608af1576175307ed8fb3c8fde329e579;hp=3afb682255a04d112dfa1a34f5bc4aac4d4e4b5f;hpb=975f957dc408925805dd8f5aa4217b7eeea2d005;p=powerpc.git diff --git a/drivers/pcmcia/cistpl.c b/drivers/pcmcia/cistpl.c index 3afb682255..912c03e5eb 100644 --- a/drivers/pcmcia/cistpl.c +++ b/drivers/pcmcia/cistpl.c @@ -12,7 +12,6 @@ * (C) 1999 David A. Hinds */ -#include #include #include #include @@ -60,9 +59,9 @@ static const u_int exponent[] = { /* Parameters that can be set with 'insmod' */ -#define INT_MODULE_PARM(n, v) static int n = v; module_param(n, int, 0444) - -INT_MODULE_PARM(cis_width, 0); /* 16-bit CIS? */ +/* 16-bit CIS? */ +static int cis_width; +module_param(cis_width, int, 0444); void release_cis_mem(struct pcmcia_socket *s) { @@ -334,10 +333,8 @@ void destroy_cis_cache(struct pcmcia_socket *s) /* * If there was a fake CIS, destroy that as well. */ - if (s->fake_cis) { - kfree(s->fake_cis); - s->fake_cis = NULL; - } + kfree(s->fake_cis); + s->fake_cis = NULL; } EXPORT_SYMBOL(destroy_cis_cache); @@ -386,10 +383,8 @@ int verify_cis_cache(struct pcmcia_socket *s) int pcmcia_replace_cis(struct pcmcia_socket *s, cisdump_t *cis) { - if (s->fake_cis != NULL) { - kfree(s->fake_cis); - s->fake_cis = NULL; - } + kfree(s->fake_cis); + s->fake_cis = NULL; if (cis->Length > CISTPL_MAX_CIS_SIZE) return CS_BAD_SIZE; s->fake_cis = kmalloc(cis->Length, GFP_KERNEL); @@ -467,7 +462,7 @@ static int follow_link(struct pcmcia_socket *s, tuple_t *tuple) /* Get indirect link from the MFC tuple */ read_cis_cache(s, LINK_SPACE(tuple->Flags), tuple->LinkOffset, 5, link); - ofs = le32_to_cpu(*(u_int *)(link+1)); + ofs = le32_to_cpu(*(__le32 *)(link+1)); SPACE(tuple->Flags) = (link[0] == CISTPL_MFC_ATTR); /* Move to the next indirect link */ tuple->LinkOffset += 5; @@ -675,8 +670,8 @@ static int parse_checksum(tuple_t *tuple, cistpl_checksum_t *csum) if (tuple->TupleDataLen < 5) return CS_BAD_TUPLE; p = (u_char *)tuple->TupleData; - csum->addr = tuple->CISOffset+(short)le16_to_cpu(*(u_short *)p)-2; - csum->len = le16_to_cpu(*(u_short *)(p + 2)); + csum->addr = tuple->CISOffset+(short)le16_to_cpu(*(__le16 *)p)-2; + csum->len = le16_to_cpu(*(__le16 *)(p + 2)); csum->sum = *(p+4); return CS_SUCCESS; } @@ -687,7 +682,7 @@ static int parse_longlink(tuple_t *tuple, cistpl_longlink_t *link) { if (tuple->TupleDataLen < 4) return CS_BAD_TUPLE; - link->addr = le32_to_cpu(*(u_int *)tuple->TupleData); + link->addr = le32_to_cpu(*(__le32 *)tuple->TupleData); return CS_SUCCESS; } @@ -706,7 +701,7 @@ static int parse_longlink_mfc(tuple_t *tuple, return CS_BAD_TUPLE; for (i = 0; i < link->nfn; i++) { link->fn[i].space = *p; p++; - link->fn[i].addr = le32_to_cpu(*(u_int *)p); p += 4; + link->fn[i].addr = le32_to_cpu(*(__le32 *)p); p += 4; } return CS_SUCCESS; } @@ -793,10 +788,10 @@ static int parse_jedec(tuple_t *tuple, cistpl_jedec_t *jedec) static int parse_manfid(tuple_t *tuple, cistpl_manfid_t *m) { - u_short *p; + __le16 *p; if (tuple->TupleDataLen < 4) return CS_BAD_TUPLE; - p = (u_short *)tuple->TupleData; + p = (__le16 *)tuple->TupleData; m->manf = le16_to_cpu(p[0]); m->card = le16_to_cpu(p[1]); return CS_SUCCESS; @@ -1097,7 +1092,7 @@ static int parse_cftable_entry(tuple_t *tuple, break; case 0x20: entry->mem.nwin = 1; - entry->mem.win[0].len = le16_to_cpu(*(u_short *)p) << 8; + entry->mem.win[0].len = le16_to_cpu(*(__le16 *)p) << 8; entry->mem.win[0].card_addr = 0; entry->mem.win[0].host_addr = 0; p += 2; @@ -1105,9 +1100,9 @@ static int parse_cftable_entry(tuple_t *tuple, break; case 0x40: entry->mem.nwin = 1; - entry->mem.win[0].len = le16_to_cpu(*(u_short *)p) << 8; + entry->mem.win[0].len = le16_to_cpu(*(__le16 *)p) << 8; entry->mem.win[0].card_addr = - le16_to_cpu(*(u_short *)(p+2)) << 8; + le16_to_cpu(*(__le16 *)(p+2)) << 8; entry->mem.win[0].host_addr = 0; p += 4; if (p > q) return CS_BAD_TUPLE; @@ -1144,7 +1139,7 @@ static int parse_bar(tuple_t *tuple, cistpl_bar_t *bar) p = (u_char *)tuple->TupleData; bar->attr = *p; p += 2; - bar->size = le32_to_cpu(*(u_int *)p); + bar->size = le32_to_cpu(*(__le32 *)p); return CS_SUCCESS; } @@ -1157,7 +1152,7 @@ static int parse_config_cb(tuple_t *tuple, cistpl_config_t *config) return CS_BAD_TUPLE; config->last_idx = *(++p); p++; - config->base = le32_to_cpu(*(u_int *)p); + config->base = le32_to_cpu(*(__le32 *)p); config->subtuples = tuple->TupleDataLen - 6; return CS_SUCCESS; } @@ -1273,7 +1268,7 @@ static int parse_vers_2(tuple_t *tuple, cistpl_vers_2_t *v2) v2->vers = p[0]; v2->comply = p[1]; - v2->dindex = le16_to_cpu(*(u_short *)(p+2)); + v2->dindex = le16_to_cpu(*(__le16 *)(p+2)); v2->vspec8 = p[6]; v2->vspec9 = p[7]; v2->nhdr = p[8]; @@ -1314,8 +1309,8 @@ static int parse_format(tuple_t *tuple, cistpl_format_t *fmt) fmt->type = p[0]; fmt->edc = p[1]; - fmt->offset = le32_to_cpu(*(u_int *)(p+2)); - fmt->length = le32_to_cpu(*(u_int *)(p+6)); + fmt->offset = le32_to_cpu(*(__le32 *)(p+2)); + fmt->length = le32_to_cpu(*(__le32 *)(p+6)); return CS_SUCCESS; }