mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
[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 <[email protected]>
Signed-off-by: Dominik Brodowski <[email protected]>
This commit is contained in:
parent
a9606fd390
commit
af2b3b503a
45 changed files with 47 additions and 614 deletions
|
|
@ -219,35 +219,15 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
|
|||
static int pdacf_config(struct pcmcia_device *link)
|
||||
{
|
||||
struct snd_pdacf *pdacf = link->priv;
|
||||
tuple_t tuple;
|
||||
cisparse_t *parse = NULL;
|
||||
u_short buf[32];
|
||||
int last_fn, last_ret;
|
||||
|
||||
snd_printdd(KERN_DEBUG "pdacf_config called\n");
|
||||
parse = kmalloc(sizeof(*parse), GFP_KERNEL);
|
||||
if (! parse) {
|
||||
snd_printk(KERN_ERR "pdacf_config: cannot allocate\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
|
||||
tuple.Attributes = 0;
|
||||
tuple.TupleData = (cisdata_t *)buf;
|
||||
tuple.TupleDataMax = sizeof(buf);
|
||||
tuple.TupleOffset = 0;
|
||||
tuple.DesiredTuple = CISTPL_CONFIG;
|
||||
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
|
||||
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
|
||||
CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, parse));
|
||||
link->conf.ConfigBase = parse->config.base;
|
||||
link->conf.ConfigIndex = 0x5;
|
||||
|
||||
CS_CHECK(RequestIO, pcmcia_request_io(link, &link->io));
|
||||
CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
|
||||
CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
|
||||
|
||||
kfree(parse);
|
||||
|
||||
if (snd_pdacf_assign_resources(pdacf, link->io.BasePort1, link->irq.AssignedIRQ) < 0)
|
||||
goto failed;
|
||||
|
||||
|
|
@ -255,7 +235,6 @@ static int pdacf_config(struct pcmcia_device *link)
|
|||
return 0;
|
||||
|
||||
cs_failed:
|
||||
kfree(parse);
|
||||
cs_error(link, last_fn, last_ret);
|
||||
failed:
|
||||
pcmcia_disable_device(link);
|
||||
|
|
|
|||
|
|
@ -217,34 +217,12 @@ static int vxpocket_config(struct pcmcia_device *link)
|
|||
{
|
||||
struct vx_core *chip = link->priv;
|
||||
struct snd_vxpocket *vxp = (struct snd_vxpocket *)chip;
|
||||
tuple_t tuple;
|
||||
cisparse_t *parse;
|
||||
u_short buf[32];
|
||||
int last_fn, last_ret;
|
||||
|
||||
snd_printdd(KERN_DEBUG "vxpocket_config called\n");
|
||||
parse = kmalloc(sizeof(*parse), GFP_KERNEL);
|
||||
if (! parse) {
|
||||
snd_printk(KERN_ERR "vx: cannot allocate\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
tuple.Attributes = 0;
|
||||
tuple.TupleData = (cisdata_t *)buf;
|
||||
tuple.TupleDataMax = sizeof(buf);
|
||||
tuple.TupleOffset = 0;
|
||||
tuple.DesiredTuple = CISTPL_CONFIG;
|
||||
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
|
||||
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
|
||||
CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, parse));
|
||||
link->conf.ConfigBase = parse->config.base;
|
||||
link->conf.Present = parse->config.rmask[0];
|
||||
|
||||
/* redefine hardware record according to the VERSION1 string */
|
||||
tuple.DesiredTuple = CISTPL_VERS_1;
|
||||
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
|
||||
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
|
||||
CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, parse));
|
||||
if (! strcmp(parse->version_1.str + parse->version_1.ofs[1], "VX-POCKET")) {
|
||||
if (!strcmp(link->prod_id[1], "VX-POCKET")) {
|
||||
snd_printdd("VX-pocket is detected\n");
|
||||
} else {
|
||||
snd_printdd("VX-pocket 440 is detected\n");
|
||||
|
|
@ -265,14 +243,12 @@ static int vxpocket_config(struct pcmcia_device *link)
|
|||
goto failed;
|
||||
|
||||
link->dev_node = &vxp->node;
|
||||
kfree(parse);
|
||||
return 0;
|
||||
|
||||
cs_failed:
|
||||
cs_error(link, last_fn, last_ret);
|
||||
failed:
|
||||
pcmcia_disable_device(link);
|
||||
kfree(parse);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue