[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>
This commit is contained in:
parent
efd50585e2
commit
a9606fd390
7 changed files with 40 additions and 88 deletions
|
@ -217,18 +217,10 @@ static int avmcs_config(struct pcmcia_device *link)
|
||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
|
||||||
tuple.Attributes = 0;
|
|
||||||
tuple.TupleData = buf;
|
|
||||||
tuple.TupleDataMax = 254;
|
|
||||||
tuple.TupleOffset = 0;
|
|
||||||
tuple.DesiredTuple = CISTPL_VERS_1;
|
|
||||||
|
|
||||||
devname[0] = 0;
|
devname[0] = 0;
|
||||||
if( !first_tuple(link, &tuple, &parse) && parse.version_1.ns > 1 ) {
|
if (link->prod_id[1])
|
||||||
strlcpy(devname,parse.version_1.str + parse.version_1.ofs[1],
|
strlcpy(devname, link->prod_id[1], sizeof(devname));
|
||||||
sizeof(devname));
|
|
||||||
}
|
|
||||||
/*
|
/*
|
||||||
* find IO port
|
* find IO port
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -239,18 +239,10 @@ static int avma1cs_config(struct pcmcia_device *link)
|
||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
|
||||||
tuple.Attributes = 0;
|
|
||||||
tuple.TupleData = buf;
|
|
||||||
tuple.TupleDataMax = 254;
|
|
||||||
tuple.TupleOffset = 0;
|
|
||||||
tuple.DesiredTuple = CISTPL_VERS_1;
|
|
||||||
|
|
||||||
devname[0] = 0;
|
devname[0] = 0;
|
||||||
if( !first_tuple(link, &tuple, &parse) && parse.version_1.ns > 1 ) {
|
if (link->prod_id[1])
|
||||||
strlcpy(devname,parse.version_1.str + parse.version_1.ofs[1],
|
strlcpy(devname, link->prod_id[1], sizeof(devname));
|
||||||
sizeof(devname));
|
|
||||||
}
|
|
||||||
/*
|
/*
|
||||||
* find IO port
|
* find IO port
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -397,12 +397,9 @@ static int tc574_config(struct pcmcia_device *link)
|
||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tuple.DesiredTuple = CISTPL_VERS_1;
|
if (link->prod_id[1])
|
||||||
if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS &&
|
cardname = link->prod_id[1];
|
||||||
pcmcia_get_tuple_data(link, &tuple) == CS_SUCCESS &&
|
else
|
||||||
pcmcia_parse_tuple(link, &tuple, &parse) == CS_SUCCESS) {
|
|
||||||
cardname = parse.version_1.str + parse.version_1.ofs[1];
|
|
||||||
} else
|
|
||||||
cardname = "3Com 3c574";
|
cardname = "3Com 3c574";
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
|
@ -560,16 +560,8 @@ static int mhz_setup(struct pcmcia_device *link)
|
||||||
|
|
||||||
/* Read the station address from the CIS. It is stored as the last
|
/* Read the station address from the CIS. It is stored as the last
|
||||||
(fourth) string in the Version 1 Version/ID tuple. */
|
(fourth) string in the Version 1 Version/ID tuple. */
|
||||||
tuple->DesiredTuple = CISTPL_VERS_1;
|
if (link->prod_id[3]) {
|
||||||
if (first_tuple(link, tuple, parse) != CS_SUCCESS) {
|
station_addr = link->prod_id[3];
|
||||||
rc = -1;
|
|
||||||
goto free_cfg_mem;
|
|
||||||
}
|
|
||||||
/* Ugh -- the EM1144 card has two VERS_1 tuples!?! */
|
|
||||||
if (next_tuple(link, tuple, parse) != CS_SUCCESS)
|
|
||||||
first_tuple(link, tuple, parse);
|
|
||||||
if (parse->version_1.ns > 3) {
|
|
||||||
station_addr = parse->version_1.str + parse->version_1.ofs[3];
|
|
||||||
if (cvt_ascii_address(dev, station_addr) == 0) {
|
if (cvt_ascii_address(dev, station_addr) == 0) {
|
||||||
rc = 0;
|
rc = 0;
|
||||||
goto free_cfg_mem;
|
goto free_cfg_mem;
|
||||||
|
@ -744,16 +736,13 @@ static int smc_setup(struct pcmcia_device *link)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Try the third string in the Version 1 Version/ID tuple. */
|
/* Try the third string in the Version 1 Version/ID tuple. */
|
||||||
tuple->DesiredTuple = CISTPL_VERS_1;
|
if (link->prod_id[2]) {
|
||||||
if (first_tuple(link, tuple, parse) != CS_SUCCESS) {
|
station_addr = link->prod_id[2];
|
||||||
rc = -1;
|
|
||||||
goto free_cfg_mem;
|
|
||||||
}
|
|
||||||
station_addr = parse->version_1.str + parse->version_1.ofs[2];
|
|
||||||
if (cvt_ascii_address(dev, station_addr) == 0) {
|
if (cvt_ascii_address(dev, station_addr) == 0) {
|
||||||
rc = 0;
|
rc = 0;
|
||||||
goto free_cfg_mem;
|
goto free_cfg_mem;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
rc = -1;
|
rc = -1;
|
||||||
free_cfg_mem:
|
free_cfg_mem:
|
||||||
|
|
|
@ -707,21 +707,10 @@ set_card_type(struct pcmcia_device *link, const void *s)
|
||||||
* Returns: true if this is a CE2
|
* Returns: true if this is a CE2
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
has_ce2_string(struct pcmcia_device * link)
|
has_ce2_string(struct pcmcia_device * p_dev)
|
||||||
{
|
{
|
||||||
tuple_t tuple;
|
if (p_dev->prod_id[2] && strstr(p_dev->prod_id[2], "CE2"))
|
||||||
cisparse_t parse;
|
|
||||||
u_char buf[256];
|
|
||||||
|
|
||||||
tuple.Attributes = 0;
|
|
||||||
tuple.TupleData = buf;
|
|
||||||
tuple.TupleDataMax = 254;
|
|
||||||
tuple.TupleOffset = 0;
|
|
||||||
tuple.DesiredTuple = CISTPL_VERS_1;
|
|
||||||
if (!first_tuple(link, &tuple, &parse) && parse.version_1.ns > 2) {
|
|
||||||
if (strstr(parse.version_1.str + parse.version_1.ofs[2], "CE2"))
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -433,16 +433,11 @@ static int ray_config(struct pcmcia_device *link)
|
||||||
|
|
||||||
/* Determine card type and firmware version */
|
/* Determine card type and firmware version */
|
||||||
buf[0] = buf[MAX_TUPLE_SIZE - 1] = 0;
|
buf[0] = buf[MAX_TUPLE_SIZE - 1] = 0;
|
||||||
tuple.DesiredTuple = CISTPL_VERS_1;
|
printk(KERN_INFO "ray_cs Detected: %s%s%s%s\n",
|
||||||
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
|
link->prod_id[0] ? link->prod_id[0] : " ",
|
||||||
tuple.TupleData = buf;
|
link->prod_id[1] ? link->prod_id[1] : " ",
|
||||||
tuple.TupleDataMax = MAX_TUPLE_SIZE;
|
link->prod_id[2] ? link->prod_id[2] : " ",
|
||||||
tuple.TupleOffset = 2;
|
link->prod_id[3] ? link->prod_id[3] : " ");
|
||||||
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
|
|
||||||
|
|
||||||
for (i=0; i<tuple.TupleDataLen - 4; i++)
|
|
||||||
if (buf[i] == 0) buf[i] = ' ';
|
|
||||||
printk(KERN_INFO "ray_cs Detected: %s\n",buf);
|
|
||||||
|
|
||||||
/* Now allocate an interrupt line. Note that this does not
|
/* Now allocate an interrupt line. Note that this does not
|
||||||
actually assign a handler to the interrupt.
|
actually assign a handler to the interrupt.
|
||||||
|
|
|
@ -69,25 +69,21 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
|
||||||
|
|
||||||
static void ixj_get_serial(struct pcmcia_device * link, IXJ * j)
|
static void ixj_get_serial(struct pcmcia_device * link, IXJ * j)
|
||||||
{
|
{
|
||||||
tuple_t tuple;
|
|
||||||
u_short buf[128];
|
|
||||||
char *str;
|
char *str;
|
||||||
int last_ret, last_fn, i, place;
|
int i, place;
|
||||||
DEBUG(0, "ixj_get_serial(0x%p)\n", link);
|
DEBUG(0, "ixj_get_serial(0x%p)\n", link);
|
||||||
tuple.TupleData = (cisdata_t *) buf;
|
|
||||||
tuple.TupleOffset = 0;
|
str = link->prod_id[0];
|
||||||
tuple.TupleDataMax = 80;
|
if (!str)
|
||||||
tuple.Attributes = 0;
|
goto cs_failed;
|
||||||
tuple.DesiredTuple = CISTPL_VERS_1;
|
|
||||||
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
|
|
||||||
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
|
|
||||||
str = (char *) buf;
|
|
||||||
printk("PCMCIA Version %d.%d\n", str[0], str[1]);
|
|
||||||
str += 2;
|
|
||||||
printk("%s", str);
|
printk("%s", str);
|
||||||
str = str + strlen(str) + 1;
|
str = link->prod_id[1];
|
||||||
|
if (!str)
|
||||||
|
goto cs_failed;
|
||||||
printk(" %s", str);
|
printk(" %s", str);
|
||||||
str = str + strlen(str) + 1;
|
str = link->prod_id[2];
|
||||||
|
if (!str)
|
||||||
|
goto cs_failed;
|
||||||
place = 1;
|
place = 1;
|
||||||
for (i = strlen(str) - 1; i >= 0; i--) {
|
for (i = strlen(str) - 1; i >= 0; i--) {
|
||||||
switch (str[i]) {
|
switch (str[i]) {
|
||||||
|
@ -122,7 +118,9 @@ static void ixj_get_serial(struct pcmcia_device * link, IXJ * j)
|
||||||
}
|
}
|
||||||
place = place * 0x10;
|
place = place * 0x10;
|
||||||
}
|
}
|
||||||
str = str + strlen(str) + 1;
|
str = link->prod_id[3];
|
||||||
|
if (!str)
|
||||||
|
goto cs_failed;
|
||||||
printk(" version %s\n", str);
|
printk(" version %s\n", str);
|
||||||
cs_failed:
|
cs_failed:
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue