Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a9606fd3 authored by Dominik Brodowski's avatar Dominik Brodowski
Browse files

[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: default avatarDominik Brodowski <linux@dominikbrodowski.net>
parent efd50585
Loading
Loading
Loading
Loading
+3 −11
Original line number Original line Diff line number Diff line
@@ -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
         */
         */
+3 −11
Original line number Original line Diff line number Diff line
@@ -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
         */
         */
+3 −6
Original line number Original line Diff line number Diff line
@@ -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";


	{
	{
+8 −19
Original line number Original line Diff line number Diff line
@@ -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:
+4 −15
Original line number Original line Diff line number Diff line
@@ -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;
}
}


Loading