aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/pcmcia
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2006-10-25 21:49:27 -0400
committerDominik Brodowski <linux@dominikbrodowski.net>2006-12-04 20:12:02 -0500
commitaf2b3b503ad1b071b66e1531caae252b4b95c847 (patch)
tree600785af3af4a79978f688fa35e19ab900db264b /drivers/net/pcmcia
parenta9606fd39083478bef313c0e3b77bc065e39e36e (diff)
[PATCH] pcmcia: conf.ConfigBase and conf.Present consolidation
struct pcmcia_device *p_dev->conf.ConfigBase and .Present are set in almost all PCMICA driver right at the beginning, using the same calls but slightly different implementations. Unfiy this in the PCMCIA core. Includes a small bugfix ("drivers/net/pcmcia/xirc2ps_cs.c: remove unused label") from and Signed-off-by Adrian Bunk <bunk@stusta.de> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/net/pcmcia')
-rw-r--r--drivers/net/pcmcia/3c574_cs.c16
-rw-r--r--drivers/net/pcmcia/3c589_cs.c7
-rw-r--r--drivers/net/pcmcia/axnet_cs.c6
-rw-r--r--drivers/net/pcmcia/com20020_cs.c13
-rw-r--r--drivers/net/pcmcia/fmvj18x_cs.c14
-rw-r--r--drivers/net/pcmcia/ibmtr_cs.c12
-rw-r--r--drivers/net/pcmcia/nmclan_cs.c12
-rw-r--r--drivers/net/pcmcia/pcnet_cs.c8
-rw-r--r--drivers/net/pcmcia/smc91c92_cs.c24
-rw-r--r--drivers/net/pcmcia/xirc2ps_cs.c9
10 files changed, 7 insertions, 114 deletions
diff --git a/drivers/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c
index 420f70b6b88a..794cc61819dd 100644
--- a/drivers/net/pcmcia/3c574_cs.c
+++ b/drivers/net/pcmcia/3c574_cs.c
@@ -338,7 +338,6 @@ static int tc574_config(struct pcmcia_device *link)
338 struct net_device *dev = link->priv; 338 struct net_device *dev = link->priv;
339 struct el3_private *lp = netdev_priv(dev); 339 struct el3_private *lp = netdev_priv(dev);
340 tuple_t tuple; 340 tuple_t tuple;
341 cisparse_t parse;
342 unsigned short buf[32]; 341 unsigned short buf[32];
343 int last_fn, last_ret, i, j; 342 int last_fn, last_ret, i, j;
344 kio_addr_t ioaddr; 343 kio_addr_t ioaddr;
@@ -350,17 +349,6 @@ static int tc574_config(struct pcmcia_device *link)
350 349
351 DEBUG(0, "3c574_config(0x%p)\n", link); 350 DEBUG(0, "3c574_config(0x%p)\n", link);
352 351
353 tuple.Attributes = 0;
354 tuple.DesiredTuple = CISTPL_CONFIG;
355 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
356 tuple.TupleData = (cisdata_t *)buf;
357 tuple.TupleDataMax = 64;
358 tuple.TupleOffset = 0;
359 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
360 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
361 link->conf.ConfigBase = parse.config.base;
362 link->conf.Present = parse.config.rmask[0];
363
364 link->io.IOAddrLines = 16; 352 link->io.IOAddrLines = 16;
365 for (i = j = 0; j < 0x400; j += 0x20) { 353 for (i = j = 0; j < 0x400; j += 0x20) {
366 link->io.BasePort1 = j ^ 0x300; 354 link->io.BasePort1 = j ^ 0x300;
@@ -382,6 +370,10 @@ static int tc574_config(struct pcmcia_device *link)
382 /* The 3c574 normally uses an EEPROM for configuration info, including 370 /* The 3c574 normally uses an EEPROM for configuration info, including
383 the hardware address. The future products may include a modem chip 371 the hardware address. The future products may include a modem chip
384 and put the address in the CIS. */ 372 and put the address in the CIS. */
373 tuple.Attributes = 0;
374 tuple.TupleData = (cisdata_t *)buf;
375 tuple.TupleDataMax = 64;
376 tuple.TupleOffset = 0;
385 tuple.DesiredTuple = 0x88; 377 tuple.DesiredTuple = 0x88;
386 if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) { 378 if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) {
387 pcmcia_get_tuple_data(link, &tuple); 379 pcmcia_get_tuple_data(link, &tuple);
diff --git a/drivers/net/pcmcia/3c589_cs.c b/drivers/net/pcmcia/3c589_cs.c
index eb5783294489..1e73ff7d5d8e 100644
--- a/drivers/net/pcmcia/3c589_cs.c
+++ b/drivers/net/pcmcia/3c589_cs.c
@@ -253,7 +253,6 @@ static int tc589_config(struct pcmcia_device *link)
253 struct net_device *dev = link->priv; 253 struct net_device *dev = link->priv;
254 struct el3_private *lp = netdev_priv(dev); 254 struct el3_private *lp = netdev_priv(dev);
255 tuple_t tuple; 255 tuple_t tuple;
256 cisparse_t parse;
257 u16 buf[32], *phys_addr; 256 u16 buf[32], *phys_addr;
258 int last_fn, last_ret, i, j, multi = 0, fifo; 257 int last_fn, last_ret, i, j, multi = 0, fifo;
259 kio_addr_t ioaddr; 258 kio_addr_t ioaddr;
@@ -263,15 +262,9 @@ static int tc589_config(struct pcmcia_device *link)
263 262
264 phys_addr = (u16 *)dev->dev_addr; 263 phys_addr = (u16 *)dev->dev_addr;
265 tuple.Attributes = 0; 264 tuple.Attributes = 0;
266 tuple.DesiredTuple = CISTPL_CONFIG;
267 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
268 tuple.TupleData = (cisdata_t *)buf; 265 tuple.TupleData = (cisdata_t *)buf;
269 tuple.TupleDataMax = sizeof(buf); 266 tuple.TupleDataMax = sizeof(buf);
270 tuple.TupleOffset = 0; 267 tuple.TupleOffset = 0;
271 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
272 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
273 link->conf.ConfigBase = parse.config.base;
274 link->conf.Present = parse.config.rmask[0];
275 tuple.Attributes = TUPLE_RETURN_COMMON; 268 tuple.Attributes = TUPLE_RETURN_COMMON;
276 269
277 /* Is this a 3c562? */ 270 /* Is this a 3c562? */
diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c
index 5ddd5742f779..6139048f8117 100644
--- a/drivers/net/pcmcia/axnet_cs.c
+++ b/drivers/net/pcmcia/axnet_cs.c
@@ -299,11 +299,7 @@ static int axnet_config(struct pcmcia_device *link)
299 tuple.TupleData = (cisdata_t *)buf; 299 tuple.TupleData = (cisdata_t *)buf;
300 tuple.TupleDataMax = sizeof(buf); 300 tuple.TupleDataMax = sizeof(buf);
301 tuple.TupleOffset = 0; 301 tuple.TupleOffset = 0;
302 tuple.DesiredTuple = CISTPL_CONFIG; 302
303 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
304 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
305 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
306 link->conf.ConfigBase = parse.config.base;
307 /* don't trust the CIS on this; Linksys got it wrong */ 303 /* don't trust the CIS on this; Linksys got it wrong */
308 link->conf.Present = 0x63; 304 link->conf.Present = 0x63;
309 305
diff --git a/drivers/net/pcmcia/com20020_cs.c b/drivers/net/pcmcia/com20020_cs.c
index 48434d7924eb..91f65e91cd5f 100644
--- a/drivers/net/pcmcia/com20020_cs.c
+++ b/drivers/net/pcmcia/com20020_cs.c
@@ -249,12 +249,9 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
249static int com20020_config(struct pcmcia_device *link) 249static int com20020_config(struct pcmcia_device *link)
250{ 250{
251 struct arcnet_local *lp; 251 struct arcnet_local *lp;
252 tuple_t tuple;
253 cisparse_t parse;
254 com20020_dev_t *info; 252 com20020_dev_t *info;
255 struct net_device *dev; 253 struct net_device *dev;
256 int i, last_ret, last_fn; 254 int i, last_ret, last_fn;
257 u_char buf[64];
258 int ioaddr; 255 int ioaddr;
259 256
260 info = link->priv; 257 info = link->priv;
@@ -264,16 +261,6 @@ static int com20020_config(struct pcmcia_device *link)
264 261
265 DEBUG(0, "com20020_config(0x%p)\n", link); 262 DEBUG(0, "com20020_config(0x%p)\n", link);
266 263
267 tuple.Attributes = 0;
268 tuple.TupleData = buf;
269 tuple.TupleDataMax = 64;
270 tuple.TupleOffset = 0;
271 tuple.DesiredTuple = CISTPL_CONFIG;
272 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
273 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
274 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
275 link->conf.ConfigBase = parse.config.base;
276
277 DEBUG(1,"arcnet: baseport1 is %Xh\n", link->io.BasePort1); 264 DEBUG(1,"arcnet: baseport1 is %Xh\n", link->io.BasePort1);
278 i = !CS_SUCCESS; 265 i = !CS_SUCCESS;
279 if (!link->io.BasePort1) 266 if (!link->io.BasePort1)
diff --git a/drivers/net/pcmcia/fmvj18x_cs.c b/drivers/net/pcmcia/fmvj18x_cs.c
index e3731fd15606..0d7de617e535 100644
--- a/drivers/net/pcmcia/fmvj18x_cs.c
+++ b/drivers/net/pcmcia/fmvj18x_cs.c
@@ -342,7 +342,7 @@ static int fmvj18x_config(struct pcmcia_device *link)
342 tuple_t tuple; 342 tuple_t tuple;
343 cisparse_t parse; 343 cisparse_t parse;
344 u_short buf[32]; 344 u_short buf[32];
345 int i, last_fn, last_ret, ret; 345 int i, last_fn = 0, last_ret = 0, ret;
346 kio_addr_t ioaddr; 346 kio_addr_t ioaddr;
347 cardtype_t cardtype; 347 cardtype_t cardtype;
348 char *card_name = "unknown"; 348 char *card_name = "unknown";
@@ -350,21 +350,9 @@ static int fmvj18x_config(struct pcmcia_device *link)
350 350
351 DEBUG(0, "fmvj18x_config(0x%p)\n", link); 351 DEBUG(0, "fmvj18x_config(0x%p)\n", link);
352 352
353 /*
354 This reads the card's CONFIG tuple to find its configuration
355 registers.
356 */
357 tuple.DesiredTuple = CISTPL_CONFIG;
358 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
359 tuple.TupleData = (u_char *)buf; 353 tuple.TupleData = (u_char *)buf;
360 tuple.TupleDataMax = 64; 354 tuple.TupleDataMax = 64;
361 tuple.TupleOffset = 0; 355 tuple.TupleOffset = 0;
362 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
363 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
364
365 link->conf.ConfigBase = parse.config.base;
366 link->conf.Present = parse.config.rmask[0];
367
368 tuple.DesiredTuple = CISTPL_FUNCE; 356 tuple.DesiredTuple = CISTPL_FUNCE;
369 tuple.TupleOffset = 0; 357 tuple.TupleOffset = 0;
370 if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) { 358 if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) {
diff --git a/drivers/net/pcmcia/ibmtr_cs.c b/drivers/net/pcmcia/ibmtr_cs.c
index bc0ca41a0542..a956a51d284f 100644
--- a/drivers/net/pcmcia/ibmtr_cs.c
+++ b/drivers/net/pcmcia/ibmtr_cs.c
@@ -222,24 +222,12 @@ static int ibmtr_config(struct pcmcia_device *link)
222 ibmtr_dev_t *info = link->priv; 222 ibmtr_dev_t *info = link->priv;
223 struct net_device *dev = info->dev; 223 struct net_device *dev = info->dev;
224 struct tok_info *ti = netdev_priv(dev); 224 struct tok_info *ti = netdev_priv(dev);
225 tuple_t tuple;
226 cisparse_t parse;
227 win_req_t req; 225 win_req_t req;
228 memreq_t mem; 226 memreq_t mem;
229 int i, last_ret, last_fn; 227 int i, last_ret, last_fn;
230 u_char buf[64];
231 228
232 DEBUG(0, "ibmtr_config(0x%p)\n", link); 229 DEBUG(0, "ibmtr_config(0x%p)\n", link);
233 230
234 tuple.Attributes = 0;
235 tuple.TupleData = buf;
236 tuple.TupleDataMax = 64;
237 tuple.TupleOffset = 0;
238 tuple.DesiredTuple = CISTPL_CONFIG;
239 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
240 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
241 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
242 link->conf.ConfigBase = parse.config.base;
243 link->conf.ConfigIndex = 0x61; 231 link->conf.ConfigIndex = 0x61;
244 232
245 /* Determine if this is PRIMARY or ALTERNATE. */ 233 /* Determine if this is PRIMARY or ALTERNATE. */
diff --git a/drivers/net/pcmcia/nmclan_cs.c b/drivers/net/pcmcia/nmclan_cs.c
index e77110e4c288..3b707747a811 100644
--- a/drivers/net/pcmcia/nmclan_cs.c
+++ b/drivers/net/pcmcia/nmclan_cs.c
@@ -656,23 +656,12 @@ static int nmclan_config(struct pcmcia_device *link)
656 struct net_device *dev = link->priv; 656 struct net_device *dev = link->priv;
657 mace_private *lp = netdev_priv(dev); 657 mace_private *lp = netdev_priv(dev);
658 tuple_t tuple; 658 tuple_t tuple;
659 cisparse_t parse;
660 u_char buf[64]; 659 u_char buf[64];
661 int i, last_ret, last_fn; 660 int i, last_ret, last_fn;
662 kio_addr_t ioaddr; 661 kio_addr_t ioaddr;
663 662
664 DEBUG(0, "nmclan_config(0x%p)\n", link); 663 DEBUG(0, "nmclan_config(0x%p)\n", link);
665 664
666 tuple.Attributes = 0;
667 tuple.TupleData = buf;
668 tuple.TupleDataMax = 64;
669 tuple.TupleOffset = 0;
670 tuple.DesiredTuple = CISTPL_CONFIG;
671 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
672 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
673 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
674 link->conf.ConfigBase = parse.config.base;
675
676 CS_CHECK(RequestIO, pcmcia_request_io(link, &link->io)); 665 CS_CHECK(RequestIO, pcmcia_request_io(link, &link->io));
677 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); 666 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
678 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); 667 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
@@ -686,6 +675,7 @@ static int nmclan_config(struct pcmcia_device *link)
686 tuple.TupleData = buf; 675 tuple.TupleData = buf;
687 tuple.TupleDataMax = 64; 676 tuple.TupleDataMax = 64;
688 tuple.TupleOffset = 0; 677 tuple.TupleOffset = 0;
678 tuple.Attributes = 0;
689 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); 679 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
690 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); 680 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
691 memcpy(dev->dev_addr, tuple.TupleData, ETHER_ADDR_LEN); 681 memcpy(dev->dev_addr, tuple.TupleData, ETHER_ADDR_LEN);
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c
index 430a41e7b686..2b1238e2dbdb 100644
--- a/drivers/net/pcmcia/pcnet_cs.c
+++ b/drivers/net/pcmcia/pcnet_cs.c
@@ -525,17 +525,9 @@ static int pcnet_config(struct pcmcia_device *link)
525 525
526 DEBUG(0, "pcnet_config(0x%p)\n", link); 526 DEBUG(0, "pcnet_config(0x%p)\n", link);
527 527
528 tuple.Attributes = 0;
529 tuple.TupleData = (cisdata_t *)buf; 528 tuple.TupleData = (cisdata_t *)buf;
530 tuple.TupleDataMax = sizeof(buf); 529 tuple.TupleDataMax = sizeof(buf);
531 tuple.TupleOffset = 0; 530 tuple.TupleOffset = 0;
532 tuple.DesiredTuple = CISTPL_CONFIG;
533 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
534 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
535 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
536 link->conf.ConfigBase = parse.config.base;
537 link->conf.Present = parse.config.rmask[0];
538
539 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; 531 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
540 tuple.Attributes = 0; 532 tuple.Attributes = 0;
541 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); 533 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c
index bf408482443e..530df8883fe5 100644
--- a/drivers/net/pcmcia/smc91c92_cs.c
+++ b/drivers/net/pcmcia/smc91c92_cs.c
@@ -959,10 +959,6 @@ static int smc91c92_config(struct pcmcia_device *link)
959{ 959{
960 struct net_device *dev = link->priv; 960 struct net_device *dev = link->priv;
961 struct smc_private *smc = netdev_priv(dev); 961 struct smc_private *smc = netdev_priv(dev);
962 struct smc_cfg_mem *cfg_mem;
963 tuple_t *tuple;
964 cisparse_t *parse;
965 u_char *buf;
966 char *name; 962 char *name;
967 int i, j, rev; 963 int i, j, rev;
968 kio_addr_t ioaddr; 964 kio_addr_t ioaddr;
@@ -970,24 +966,6 @@ static int smc91c92_config(struct pcmcia_device *link)
970 966
971 DEBUG(0, "smc91c92_config(0x%p)\n", link); 967 DEBUG(0, "smc91c92_config(0x%p)\n", link);
972 968
973 cfg_mem = kmalloc(sizeof(struct smc_cfg_mem), GFP_KERNEL);
974 if (!cfg_mem)
975 goto config_failed;
976
977 tuple = &cfg_mem->tuple;
978 parse = &cfg_mem->parse;
979 buf = cfg_mem->buf;
980
981 tuple->Attributes = tuple->TupleOffset = 0;
982 tuple->TupleData = (cisdata_t *)buf;
983 tuple->TupleDataMax = 64;
984
985 tuple->DesiredTuple = CISTPL_CONFIG;
986 i = first_tuple(link, tuple, parse);
987 CS_EXIT_TEST(i, ParseTuple, config_failed);
988 link->conf.ConfigBase = parse->config.base;
989 link->conf.Present = parse->config.rmask[0];
990
991 smc->manfid = link->manf_id; 969 smc->manfid = link->manf_id;
992 smc->cardid = link->card_id; 970 smc->cardid = link->card_id;
993 971
@@ -1119,14 +1097,12 @@ static int smc91c92_config(struct pcmcia_device *link)
1119 printk(KERN_NOTICE " No MII transceivers found!\n"); 1097 printk(KERN_NOTICE " No MII transceivers found!\n");
1120 } 1098 }
1121 } 1099 }
1122 kfree(cfg_mem);
1123 return 0; 1100 return 0;
1124 1101
1125config_undo: 1102config_undo:
1126 unregister_netdev(dev); 1103 unregister_netdev(dev);
1127config_failed: /* CS_EXIT_TEST() calls jump to here... */ 1104config_failed: /* CS_EXIT_TEST() calls jump to here... */
1128 smc91c92_release(link); 1105 smc91c92_release(link);
1129 kfree(cfg_mem);
1130 return -ENODEV; 1106 return -ENODEV;
1131} /* smc91c92_config */ 1107} /* smc91c92_config */
1132 1108
diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c
index d6273619686a..69813406782d 100644
--- a/drivers/net/pcmcia/xirc2ps_cs.c
+++ b/drivers/net/pcmcia/xirc2ps_cs.c
@@ -781,13 +781,6 @@ xirc2ps_config(struct pcmcia_device * link)
781 goto failure; 781 goto failure;
782 } 782 }
783 783
784 /* get configuration stuff */
785 tuple.DesiredTuple = CISTPL_CONFIG;
786 if ((err=first_tuple(link, &tuple, &parse)))
787 goto cis_error;
788 link->conf.ConfigBase = parse.config.base;
789 link->conf.Present = parse.config.rmask[0];
790
791 /* get the ethernet address from the CIS */ 784 /* get the ethernet address from the CIS */
792 tuple.DesiredTuple = CISTPL_FUNCE; 785 tuple.DesiredTuple = CISTPL_FUNCE;
793 for (err = first_tuple(link, &tuple, &parse); !err; 786 for (err = first_tuple(link, &tuple, &parse); !err;
@@ -1051,8 +1044,6 @@ xirc2ps_config(struct pcmcia_device * link)
1051 xirc2ps_release(link); 1044 xirc2ps_release(link);
1052 return -ENODEV; 1045 return -ENODEV;
1053 1046
1054 cis_error:
1055 printk(KNOT_XIRC "unable to parse CIS\n");
1056 failure: 1047 failure:
1057 return -ENODEV; 1048 return -ENODEV;
1058} /* xirc2ps_config */ 1049} /* xirc2ps_config */