aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2006-06-04 12:06:13 -0400
committerDominik Brodowski <linux@dominikbrodowski.net>2006-12-04 20:09:21 -0500
commita9606fd39083478bef313c0e3b77bc065e39e36e (patch)
treed9ee62f811e557671fad5cecf669f93300b6c57a /drivers
parentefd50585e2ff9bd60e044fda7764d323010a7fe4 (diff)
[PATCH] pcmcia: remove prod_id indirection
As we read out the product information strings (VERS_1) from the PCMCIA device in the PCMCIA core, and device drivers can access those reliably in struct pcmcia_device's fields prod_id[], remove additional product information string detection logic from PCMCIA device drivers. Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/isdn/hardware/avm/avm_cs.c14
-rw-r--r--drivers/isdn/hisax/avma1_cs.c14
-rw-r--r--drivers/net/pcmcia/3c574_cs.c9
-rw-r--r--drivers/net/pcmcia/smc91c92_cs.c27
-rw-r--r--drivers/net/pcmcia/xirc2ps_cs.c19
-rw-r--r--drivers/net/wireless/ray_cs.c15
-rw-r--r--drivers/telephony/ixj_pcmcia.c30
7 files changed, 40 insertions, 88 deletions
diff --git a/drivers/isdn/hardware/avm/avm_cs.c b/drivers/isdn/hardware/avm/avm_cs.c
index 7bbfd85ab793..db3755b28f53 100644
--- a/drivers/isdn/hardware/avm/avm_cs.c
+++ b/drivers/isdn/hardware/avm/avm_cs.c
@@ -217,18 +217,10 @@ static int avmcs_config(struct pcmcia_device *link)
217 } 217 }
218 218
219 do { 219 do {
220
221 tuple.Attributes = 0;
222 tuple.TupleData = buf;
223 tuple.TupleDataMax = 254;
224 tuple.TupleOffset = 0;
225 tuple.DesiredTuple = CISTPL_VERS_1;
226
227 devname[0] = 0; 220 devname[0] = 0;
228 if( !first_tuple(link, &tuple, &parse) && parse.version_1.ns > 1 ) { 221 if (link->prod_id[1])
229 strlcpy(devname,parse.version_1.str + parse.version_1.ofs[1], 222 strlcpy(devname, link->prod_id[1], sizeof(devname));
230 sizeof(devname)); 223
231 }
232 /* 224 /*
233 * find IO port 225 * find IO port
234 */ 226 */
diff --git a/drivers/isdn/hisax/avma1_cs.c b/drivers/isdn/hisax/avma1_cs.c
index ac28e3278ad9..40c9b026729c 100644
--- a/drivers/isdn/hisax/avma1_cs.c
+++ b/drivers/isdn/hisax/avma1_cs.c
@@ -239,18 +239,10 @@ static int avma1cs_config(struct pcmcia_device *link)
239 } 239 }
240 240
241 do { 241 do {
242
243 tuple.Attributes = 0;
244 tuple.TupleData = buf;
245 tuple.TupleDataMax = 254;
246 tuple.TupleOffset = 0;
247 tuple.DesiredTuple = CISTPL_VERS_1;
248
249 devname[0] = 0; 242 devname[0] = 0;
250 if( !first_tuple(link, &tuple, &parse) && parse.version_1.ns > 1 ) { 243 if (link->prod_id[1])
251 strlcpy(devname,parse.version_1.str + parse.version_1.ofs[1], 244 strlcpy(devname, link->prod_id[1], sizeof(devname));
252 sizeof(devname)); 245
253 }
254 /* 246 /*
255 * find IO port 247 * find IO port
256 */ 248 */
diff --git a/drivers/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c
index 046009928526..420f70b6b88a 100644
--- a/drivers/net/pcmcia/3c574_cs.c
+++ b/drivers/net/pcmcia/3c574_cs.c
@@ -397,12 +397,9 @@ static int tc574_config(struct pcmcia_device *link)
397 goto failed; 397 goto failed;
398 } 398 }
399 } 399 }
400 tuple.DesiredTuple = CISTPL_VERS_1; 400 if (link->prod_id[1])
401 if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS && 401 cardname = link->prod_id[1];
402 pcmcia_get_tuple_data(link, &tuple) == CS_SUCCESS && 402 else
403 pcmcia_parse_tuple(link, &tuple, &parse) == CS_SUCCESS) {
404 cardname = parse.version_1.str + parse.version_1.ofs[1];
405 } else
406 cardname = "3Com 3c574"; 403 cardname = "3Com 3c574";
407 404
408 { 405 {
diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c
index ae024bfc1ae4..bf408482443e 100644
--- a/drivers/net/pcmcia/smc91c92_cs.c
+++ b/drivers/net/pcmcia/smc91c92_cs.c
@@ -560,16 +560,8 @@ static int mhz_setup(struct pcmcia_device *link)
560 560
561 /* Read the station address from the CIS. It is stored as the last 561 /* Read the station address from the CIS. It is stored as the last
562 (fourth) string in the Version 1 Version/ID tuple. */ 562 (fourth) string in the Version 1 Version/ID tuple. */
563 tuple->DesiredTuple = CISTPL_VERS_1; 563 if (link->prod_id[3]) {
564 if (first_tuple(link, tuple, parse) != CS_SUCCESS) { 564 station_addr = link->prod_id[3];
565 rc = -1;
566 goto free_cfg_mem;
567 }
568 /* Ugh -- the EM1144 card has two VERS_1 tuples!?! */
569 if (next_tuple(link, tuple, parse) != CS_SUCCESS)
570 first_tuple(link, tuple, parse);
571 if (parse->version_1.ns > 3) {
572 station_addr = parse->version_1.str + parse->version_1.ofs[3];
573 if (cvt_ascii_address(dev, station_addr) == 0) { 565 if (cvt_ascii_address(dev, station_addr) == 0) {
574 rc = 0; 566 rc = 0;
575 goto free_cfg_mem; 567 goto free_cfg_mem;
@@ -744,15 +736,12 @@ static int smc_setup(struct pcmcia_device *link)
744 } 736 }
745 } 737 }
746 /* Try the third string in the Version 1 Version/ID tuple. */ 738 /* Try the third string in the Version 1 Version/ID tuple. */
747 tuple->DesiredTuple = CISTPL_VERS_1; 739 if (link->prod_id[2]) {
748 if (first_tuple(link, tuple, parse) != CS_SUCCESS) { 740 station_addr = link->prod_id[2];
749 rc = -1; 741 if (cvt_ascii_address(dev, station_addr) == 0) {
750 goto free_cfg_mem; 742 rc = 0;
751 } 743 goto free_cfg_mem;
752 station_addr = parse->version_1.str + parse->version_1.ofs[2]; 744 }
753 if (cvt_ascii_address(dev, station_addr) == 0) {
754 rc = 0;
755 goto free_cfg_mem;
756 } 745 }
757 746
758 rc = -1; 747 rc = -1;
diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c
index f3914f58d67f..d6273619686a 100644
--- a/drivers/net/pcmcia/xirc2ps_cs.c
+++ b/drivers/net/pcmcia/xirc2ps_cs.c
@@ -707,22 +707,11 @@ set_card_type(struct pcmcia_device *link, const void *s)
707 * Returns: true if this is a CE2 707 * Returns: true if this is a CE2
708 */ 708 */
709static int 709static int
710has_ce2_string(struct pcmcia_device * link) 710has_ce2_string(struct pcmcia_device * p_dev)
711{ 711{
712 tuple_t tuple; 712 if (p_dev->prod_id[2] && strstr(p_dev->prod_id[2], "CE2"))
713 cisparse_t parse; 713 return 1;
714 u_char buf[256]; 714 return 0;
715
716 tuple.Attributes = 0;
717 tuple.TupleData = buf;
718 tuple.TupleDataMax = 254;
719 tuple.TupleOffset = 0;
720 tuple.DesiredTuple = CISTPL_VERS_1;
721 if (!first_tuple(link, &tuple, &parse) && parse.version_1.ns > 2) {
722 if (strstr(parse.version_1.str + parse.version_1.ofs[2], "CE2"))
723 return 1;
724 }
725 return 0;
726} 715}
727 716
728/**************** 717/****************
diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c
index 7fbfc9e41d07..75cdc3e5852a 100644
--- a/drivers/net/wireless/ray_cs.c
+++ b/drivers/net/wireless/ray_cs.c
@@ -433,16 +433,11 @@ static int ray_config(struct pcmcia_device *link)
433 433
434 /* Determine card type and firmware version */ 434 /* Determine card type and firmware version */
435 buf[0] = buf[MAX_TUPLE_SIZE - 1] = 0; 435 buf[0] = buf[MAX_TUPLE_SIZE - 1] = 0;
436 tuple.DesiredTuple = CISTPL_VERS_1; 436 printk(KERN_INFO "ray_cs Detected: %s%s%s%s\n",
437 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); 437 link->prod_id[0] ? link->prod_id[0] : " ",
438 tuple.TupleData = buf; 438 link->prod_id[1] ? link->prod_id[1] : " ",
439 tuple.TupleDataMax = MAX_TUPLE_SIZE; 439 link->prod_id[2] ? link->prod_id[2] : " ",
440 tuple.TupleOffset = 2; 440 link->prod_id[3] ? link->prod_id[3] : " ");
441 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
442
443 for (i=0; i<tuple.TupleDataLen - 4; i++)
444 if (buf[i] == 0) buf[i] = ' ';
445 printk(KERN_INFO "ray_cs Detected: %s\n",buf);
446 441
447 /* Now allocate an interrupt line. Note that this does not 442 /* Now allocate an interrupt line. Note that this does not
448 actually assign a handler to the interrupt. 443 actually assign a handler to the interrupt.
diff --git a/drivers/telephony/ixj_pcmcia.c b/drivers/telephony/ixj_pcmcia.c
index dda0ca45d904..3f88978d5aee 100644
--- a/drivers/telephony/ixj_pcmcia.c
+++ b/drivers/telephony/ixj_pcmcia.c
@@ -69,25 +69,21 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
69 69
70static void ixj_get_serial(struct pcmcia_device * link, IXJ * j) 70static void ixj_get_serial(struct pcmcia_device * link, IXJ * j)
71{ 71{
72 tuple_t tuple;
73 u_short buf[128];
74 char *str; 72 char *str;
75 int last_ret, last_fn, i, place; 73 int i, place;
76 DEBUG(0, "ixj_get_serial(0x%p)\n", link); 74 DEBUG(0, "ixj_get_serial(0x%p)\n", link);
77 tuple.TupleData = (cisdata_t *) buf; 75
78 tuple.TupleOffset = 0; 76 str = link->prod_id[0];
79 tuple.TupleDataMax = 80; 77 if (!str)
80 tuple.Attributes = 0; 78 goto cs_failed;
81 tuple.DesiredTuple = CISTPL_VERS_1;
82 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
83 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
84 str = (char *) buf;
85 printk("PCMCIA Version %d.%d\n", str[0], str[1]);
86 str += 2;
87 printk("%s", str); 79 printk("%s", str);
88 str = str + strlen(str) + 1; 80 str = link->prod_id[1];
81 if (!str)
82 goto cs_failed;
89 printk(" %s", str); 83 printk(" %s", str);
90 str = str + strlen(str) + 1; 84 str = link->prod_id[2];
85 if (!str)
86 goto cs_failed;
91 place = 1; 87 place = 1;
92 for (i = strlen(str) - 1; i >= 0; i--) { 88 for (i = strlen(str) - 1; i >= 0; i--) {
93 switch (str[i]) { 89 switch (str[i]) {
@@ -122,7 +118,9 @@ static void ixj_get_serial(struct pcmcia_device * link, IXJ * j)
122 } 118 }
123 place = place * 0x10; 119 place = place * 0x10;
124 } 120 }
125 str = str + strlen(str) + 1; 121 str = link->prod_id[3];
122 if (!str)
123 goto cs_failed;
126 printk(" version %s\n", str); 124 printk(" version %s\n", str);
127 cs_failed: 125 cs_failed:
128 return; 126 return;