[PATCH] pcmcia: embed dev_link_t into struct pcmcia_device
Embed dev_link_t into struct pcmcia_device(), as they basically address the
same entity. The actual contents of dev_link_t will be cleaned up step by step.
This patch includes a bugfix from and signed-off-by Andrew Morton.
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
diff --git a/sound/pcmcia/vx/vxpocket.c b/sound/pcmcia/vx/vxpocket.c
index ff2f927..87ec48c 100644
--- a/sound/pcmcia/vx/vxpocket.c
+++ b/sound/pcmcia/vx/vxpocket.c
@@ -126,7 +126,8 @@
/*
* create vxpocket instance
*/
-static struct snd_vxpocket *snd_vxpocket_new(struct snd_card *card, int ibl)
+static struct snd_vxpocket *snd_vxpocket_new(struct snd_card *card, int ibl,
+ struct pcmcia_device *p_dev)
{
dev_link_t *link; /* Info for cardmgr */
struct vx_core *chip;
@@ -135,6 +136,8 @@
.dev_free = snd_vxpocket_dev_free,
};
+ link = dev_to_instance(p_dev);
+
chip = snd_vx_create(card, &vxpocket_hw, &snd_vxpocket_ops,
sizeof(struct snd_vxpocket) - sizeof(struct vx_core));
if (! chip)
@@ -148,7 +151,7 @@
vxp = (struct snd_vxpocket *)chip;
- link = &vxp->link;
+ vxp->p_dev = p_dev;
link->priv = chip;
link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
@@ -263,7 +266,7 @@
if (snd_vxpocket_assign_resources(chip, link->io.BasePort1, link->irq.AssignedIRQ) < 0)
goto failed;
- link->dev = &vxp->node;
+ link->dev_node = &vxp->node;
link->state &= ~DEV_CONFIG_PENDING;
kfree(parse);
return;
@@ -339,7 +342,7 @@
return -ENOMEM;
}
- vxp = snd_vxpocket_new(card, ibl[i]);
+ vxp = snd_vxpocket_new(card, ibl[i], p_dev);
if (! vxp) {
snd_card_free(card);
return -ENODEV;
@@ -349,13 +352,10 @@
vxp->index = i;
card_alloc |= 1 << i;
- /* Chain drivers */
- vxp->link.next = NULL;
+ vxp->p_dev = p_dev;
+ vxp->p_dev->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
- vxp->link.handle = p_dev;
- vxp->link.state |= DEV_PRESENT | DEV_CONFIG_PENDING;
- p_dev->instance = &vxp->link;
- vxpocket_config(&vxp->link);
+ vxpocket_config(p_dev);
return 0;
}