Commit efd50585 authored by Dominik Brodowski's avatar Dominik Brodowski

[PATCH] pcmcia: remove manf_id and card_id indirection

As we read out the manufactor and card_id from the PCMCIA device in the
PCMCIA core, and device drivers can access those reliably in struct
pcmcia_device's fields manf_id and card_id, remove additional (and partly
broken) manf_id and card_id detection logic from PCMCIA device drivers.
Signed-off-by: default avatarDominik Brodowski <linux@dominikbrodowski.net>
parent 44e5e33e
...@@ -164,9 +164,9 @@ static int pcmcia_init_one(struct pcmcia_device *pdev) ...@@ -164,9 +164,9 @@ static int pcmcia_init_one(struct pcmcia_device *pdev)
/* See if we have a manufacturer identifier. Use it to set is_kme for /* See if we have a manufacturer identifier. Use it to set is_kme for
vendor quirks */ vendor quirks */
tuple.DesiredTuple = CISTPL_MANFID; is_kme = ((pdev->manf_id == MANFID_KME) &&
if (!pcmcia_get_first_tuple(pdev, &tuple) && !pcmcia_get_tuple_data(pdev, &tuple) && !pcmcia_parse_tuple(pdev, &tuple, &stk->parse)) ((pdev->card_id == PRODID_KME_KXLC005_A) ||
is_kme = ((stk->parse.manfid.manf == MANFID_KME) && ((stk->parse.manfid.card == PRODID_KME_KXLC005_A) || (stk->parse.manfid.card == PRODID_KME_KXLC005_B))); (pdev->card_id == PRODID_KME_KXLC005_B)));
/* Not sure if this is right... look up the current Vcc */ /* Not sure if this is right... look up the current Vcc */
CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(pdev, &stk->conf)); CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(pdev, &stk->conf));
......
...@@ -199,13 +199,9 @@ static int ide_config(struct pcmcia_device *link) ...@@ -199,13 +199,9 @@ static int ide_config(struct pcmcia_device *link)
link->conf.ConfigBase = stk->parse.config.base; link->conf.ConfigBase = stk->parse.config.base;
link->conf.Present = stk->parse.config.rmask[0]; link->conf.Present = stk->parse.config.rmask[0];
tuple.DesiredTuple = CISTPL_MANFID; is_kme = ((link->manf_id == MANFID_KME) &&
if (!pcmcia_get_first_tuple(link, &tuple) && ((link->card_id == PRODID_KME_KXLC005_A) ||
!pcmcia_get_tuple_data(link, &tuple) && (link->card_id == PRODID_KME_KXLC005_B)));
!pcmcia_parse_tuple(link, &tuple, &stk->parse))
is_kme = ((stk->parse.manfid.manf == MANFID_KME) &&
((stk->parse.manfid.card == PRODID_KME_KXLC005_A) ||
(stk->parse.manfid.card == PRODID_KME_KXLC005_B)));
/* Not sure if this is right... look up the current Vcc */ /* Not sure if this is right... look up the current Vcc */
CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(link, &stk->conf)); CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(link, &stk->conf));
......
...@@ -272,17 +272,13 @@ static int tc589_config(struct pcmcia_device *link) ...@@ -272,17 +272,13 @@ static int tc589_config(struct pcmcia_device *link)
CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
link->conf.ConfigBase = parse.config.base; link->conf.ConfigBase = parse.config.base;
link->conf.Present = parse.config.rmask[0]; link->conf.Present = parse.config.rmask[0];
/* Is this a 3c562? */
tuple.DesiredTuple = CISTPL_MANFID;
tuple.Attributes = TUPLE_RETURN_COMMON; tuple.Attributes = TUPLE_RETURN_COMMON;
if ((pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) &&
(pcmcia_get_tuple_data(link, &tuple) == CS_SUCCESS)) { /* Is this a 3c562? */
if (le16_to_cpu(buf[0]) != MANFID_3COM) if (link->manf_id != MANFID_3COM)
printk(KERN_INFO "3c589_cs: hmmm, is this really a " printk(KERN_INFO "3c589_cs: hmmm, is this really a "
"3Com card??\n"); "3Com card??\n");
multi = (le16_to_cpu(buf[1]) == PRODID_3COM_3C562); multi = (link->card_id == PRODID_3COM_3C562);
}
/* For the 3c562, the base address must be xx00-xx7f */ /* For the 3c562, the base address must be xx00-xx7f */
link->io.IOAddrLines = 16; link->io.IOAddrLines = 16;
......
...@@ -374,17 +374,12 @@ static int fmvj18x_config(struct pcmcia_device *link) ...@@ -374,17 +374,12 @@ static int fmvj18x_config(struct pcmcia_device *link)
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
link->conf.ConfigIndex = parse.cftable_entry.index; link->conf.ConfigIndex = parse.cftable_entry.index;
tuple.DesiredTuple = CISTPL_MANFID; switch (link->manf_id) {
if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS)
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
else
buf[0] = 0xffff;
switch (le16_to_cpu(buf[0])) {
case MANFID_TDK: case MANFID_TDK:
cardtype = TDK; cardtype = TDK;
if (le16_to_cpu(buf[1]) == PRODID_TDK_GN3410 if (link->card_id == PRODID_TDK_GN3410
|| le16_to_cpu(buf[1]) == PRODID_TDK_NP9610 || link->card_id == PRODID_TDK_NP9610
|| le16_to_cpu(buf[1]) == PRODID_TDK_MN3200) { || link->card_id == PRODID_TDK_MN3200) {
/* MultiFunction Card */ /* MultiFunction Card */
link->conf.ConfigBase = 0x800; link->conf.ConfigBase = 0x800;
link->conf.ConfigIndex = 0x47; link->conf.ConfigIndex = 0x47;
...@@ -395,11 +390,11 @@ static int fmvj18x_config(struct pcmcia_device *link) ...@@ -395,11 +390,11 @@ static int fmvj18x_config(struct pcmcia_device *link)
cardtype = CONTEC; cardtype = CONTEC;
break; break;
case MANFID_FUJITSU: case MANFID_FUJITSU:
if (le16_to_cpu(buf[1]) == PRODID_FUJITSU_MBH10302) if (link->card_id == PRODID_FUJITSU_MBH10302)
/* RATOC REX-5588/9822/4886's PRODID are 0004(=MBH10302), /* RATOC REX-5588/9822/4886's PRODID are 0004(=MBH10302),
but these are MBH10304 based card. */ but these are MBH10304 based card. */
cardtype = MBH10304; cardtype = MBH10304;
else if (le16_to_cpu(buf[1]) == PRODID_FUJITSU_MBH10304) else if (link->card_id == PRODID_FUJITSU_MBH10304)
cardtype = MBH10304; cardtype = MBH10304;
else else
cardtype = LA501; cardtype = LA501;
...@@ -409,14 +404,9 @@ static int fmvj18x_config(struct pcmcia_device *link) ...@@ -409,14 +404,9 @@ static int fmvj18x_config(struct pcmcia_device *link)
} }
} else { } else {
/* old type card */ /* old type card */
tuple.DesiredTuple = CISTPL_MANFID; switch (link->manf_id) {
if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS)
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
else
buf[0] = 0xffff;
switch (le16_to_cpu(buf[0])) {
case MANFID_FUJITSU: case MANFID_FUJITSU:
if (le16_to_cpu(buf[1]) == PRODID_FUJITSU_MBH10304) { if (link->card_id == PRODID_FUJITSU_MBH10304) {
cardtype = XXX10304; /* MBH10304 with buggy CIS */ cardtype = XXX10304; /* MBH10304 with buggy CIS */
link->conf.ConfigIndex = 0x20; link->conf.ConfigIndex = 0x20;
} else { } else {
......
...@@ -519,7 +519,7 @@ static int pcnet_config(struct pcmcia_device *link) ...@@ -519,7 +519,7 @@ static int pcnet_config(struct pcmcia_device *link)
tuple_t tuple; tuple_t tuple;
cisparse_t parse; cisparse_t parse;
int i, last_ret, last_fn, start_pg, stop_pg, cm_offset; int i, last_ret, last_fn, start_pg, stop_pg, cm_offset;
int manfid = 0, prodid = 0, has_shmem = 0; int has_shmem = 0;
u_short buf[64]; u_short buf[64];
hw_info_t *hw_info; hw_info_t *hw_info;
...@@ -536,14 +536,6 @@ static int pcnet_config(struct pcmcia_device *link) ...@@ -536,14 +536,6 @@ static int pcnet_config(struct pcmcia_device *link)
link->conf.ConfigBase = parse.config.base; link->conf.ConfigBase = parse.config.base;
link->conf.Present = parse.config.rmask[0]; link->conf.Present = parse.config.rmask[0];
tuple.DesiredTuple = CISTPL_MANFID;
tuple.Attributes = TUPLE_RETURN_COMMON;
if ((pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) &&
(pcmcia_get_tuple_data(link, &tuple) == CS_SUCCESS)) {
manfid = le16_to_cpu(buf[0]);
prodid = le16_to_cpu(buf[1]);
}
tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
tuple.Attributes = 0; tuple.Attributes = 0;
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
...@@ -589,8 +581,8 @@ static int pcnet_config(struct pcmcia_device *link) ...@@ -589,8 +581,8 @@ static int pcnet_config(struct pcmcia_device *link)
link->conf.Attributes |= CONF_ENABLE_SPKR; link->conf.Attributes |= CONF_ENABLE_SPKR;
link->conf.Status = CCSR_AUDIO_ENA; link->conf.Status = CCSR_AUDIO_ENA;
} }
if ((manfid == MANFID_IBM) && if ((link->manf_id == MANFID_IBM) &&
(prodid == PRODID_IBM_HOME_AND_AWAY)) (link->card_id == PRODID_IBM_HOME_AND_AWAY))
link->conf.ConfigIndex |= 0x10; link->conf.ConfigIndex |= 0x10;
CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
...@@ -624,10 +616,10 @@ static int pcnet_config(struct pcmcia_device *link) ...@@ -624,10 +616,10 @@ static int pcnet_config(struct pcmcia_device *link)
info->flags = hw_info->flags; info->flags = hw_info->flags;
/* Check for user overrides */ /* Check for user overrides */
info->flags |= (delay_output) ? DELAY_OUTPUT : 0; info->flags |= (delay_output) ? DELAY_OUTPUT : 0;
if ((manfid == MANFID_SOCKET) && if ((link->manf_id == MANFID_SOCKET) &&
((prodid == PRODID_SOCKET_LPE) || ((link->card_id == PRODID_SOCKET_LPE) ||
(prodid == PRODID_SOCKET_LPE_CF) || (link->card_id == PRODID_SOCKET_LPE_CF) ||
(prodid == PRODID_SOCKET_EIO))) (link->card_id == PRODID_SOCKET_EIO)))
info->flags &= ~USE_BIG_BUF; info->flags &= ~USE_BIG_BUF;
if (!use_big_buf) if (!use_big_buf)
info->flags &= ~USE_BIG_BUF; info->flags &= ~USE_BIG_BUF;
......
...@@ -999,12 +999,8 @@ static int smc91c92_config(struct pcmcia_device *link) ...@@ -999,12 +999,8 @@ static int smc91c92_config(struct pcmcia_device *link)
link->conf.ConfigBase = parse->config.base; link->conf.ConfigBase = parse->config.base;
link->conf.Present = parse->config.rmask[0]; link->conf.Present = parse->config.rmask[0];
tuple->DesiredTuple = CISTPL_MANFID; smc->manfid = link->manf_id;
tuple->Attributes = TUPLE_RETURN_COMMON; smc->cardid = link->card_id;
if (first_tuple(link, tuple, parse) == CS_SUCCESS) {
smc->manfid = parse->manfid.manf;
smc->cardid = parse->manfid.card;
}
if ((smc->manfid == MANFID_OSITECH) && if ((smc->manfid == MANFID_OSITECH) &&
(smc->cardid != PRODID_OSITECH_SEVEN)) { (smc->cardid != PRODID_OSITECH_SEVEN)) {
......
...@@ -293,15 +293,12 @@ static int sandisk_enable_wireless(struct net_device *dev) ...@@ -293,15 +293,12 @@ static int sandisk_enable_wireless(struct net_device *dev)
goto done; goto done;
} }
tuple.DesiredTuple = CISTPL_MANFID;
tuple.Attributes = TUPLE_RETURN_COMMON; tuple.Attributes = TUPLE_RETURN_COMMON;
tuple.TupleData = buf; tuple.TupleData = buf;
tuple.TupleDataMax = sizeof(buf); tuple.TupleDataMax = sizeof(buf);
tuple.TupleOffset = 0; tuple.TupleOffset = 0;
if (pcmcia_get_first_tuple(hw_priv->link, &tuple) ||
pcmcia_get_tuple_data(hw_priv->link, &tuple) || if (hw_priv->link->manf_id != 0xd601 || hw_priv->link->card_id != 0x0101) {
pcmcia_parse_tuple(hw_priv->link, &tuple, parse) ||
parse->manfid.manf != 0xd601 || parse->manfid.card != 0x0101) {
/* No SanDisk manfid found */ /* No SanDisk manfid found */
ret = -ENODEV; ret = -ENODEV;
goto done; goto done;
......
...@@ -217,9 +217,7 @@ static int qlogic_config(struct pcmcia_device * link) ...@@ -217,9 +217,7 @@ static int qlogic_config(struct pcmcia_device * link)
CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
link->conf.ConfigBase = parse.config.base; link->conf.ConfigBase = parse.config.base;
tuple.DesiredTuple = CISTPL_MANFID; info->manf_id = link->manf_id;
if ((pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) && (pcmcia_get_tuple_data(link, &tuple) == CS_SUCCESS))
info->manf_id = le16_to_cpu(tuple.TupleData[0]);
tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
......
...@@ -731,10 +731,7 @@ SYM53C500_config(struct pcmcia_device *link) ...@@ -731,10 +731,7 @@ SYM53C500_config(struct pcmcia_device *link)
CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
link->conf.ConfigBase = parse.config.base; link->conf.ConfigBase = parse.config.base;
tuple.DesiredTuple = CISTPL_MANFID; info->manf_id = link->manf_id;
if ((pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) &&
(pcmcia_get_tuple_data(link, &tuple) == CS_SUCCESS))
info->manf_id = le16_to_cpu(tuple.TupleData[0]);
tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
......
...@@ -757,27 +757,25 @@ static int serial_config(struct pcmcia_device * link) ...@@ -757,27 +757,25 @@ static int serial_config(struct pcmcia_device * link)
/* Is this a multiport card? */ /* Is this a multiport card? */
tuple->DesiredTuple = CISTPL_MANFID; tuple->DesiredTuple = CISTPL_MANFID;
if (first_tuple(link, tuple, parse) == CS_SUCCESS) { info->manfid = link->manf_id;
info->manfid = parse->manfid.manf; info->prodid = link->card_id;
info->prodid = parse->manfid.card;
for (i = 0; i < ARRAY_SIZE(quirks); i++)
for (i = 0; i < ARRAY_SIZE(quirks); i++) if ((quirks[i].manfid == ~0 ||
if ((quirks[i].manfid == ~0 || quirks[i].manfid == info->manfid) &&
quirks[i].manfid == info->manfid) && (quirks[i].prodid == ~0 ||
(quirks[i].prodid == ~0 || quirks[i].prodid == info->prodid)) {
quirks[i].prodid == info->prodid)) { info->quirk = &quirks[i];
info->quirk = &quirks[i]; break;
break; }
}
}
/* Another check for dual-serial cards: look for either serial or /* Another check for dual-serial cards: look for either serial or
multifunction cards that ask for appropriate IO port ranges */ multifunction cards that ask for appropriate IO port ranges */
tuple->DesiredTuple = CISTPL_FUNCID; tuple->DesiredTuple = CISTPL_FUNCID;
if ((info->multi == 0) && if ((info->multi == 0) &&
((first_tuple(link, tuple, parse) != CS_SUCCESS) || (link->has_func_id) &&
(parse->funcid.func == CISTPL_FUNCID_MULTI) || ((link->func_id == CISTPL_FUNCID_MULTI) ||
(parse->funcid.func == CISTPL_FUNCID_SERIAL))) { (link->func_id == CISTPL_FUNCID_SERIAL))) {
tuple->DesiredTuple = CISTPL_CFTABLE_ENTRY; tuple->DesiredTuple = CISTPL_CFTABLE_ENTRY;
if (first_tuple(link, tuple, parse) == CS_SUCCESS) { if (first_tuple(link, tuple, parse) == CS_SUCCESS) {
if ((cf->io.nwin == 1) && (cf->io.win[0].len % 8 == 0)) if ((cf->io.nwin == 1) && (cf->io.win[0].len % 8 == 0))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment