From fd238232cd0ff4840ae6946bb338502154096d88 Mon Sep 17 00:00:00 2001 From: Dominik Brodowski Date: Sun, 5 Mar 2006 10:45:09 +0100 Subject: [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 --- sound/pcmcia/pdaudiocf/pdaudiocf.c | 12 +++++------- sound/pcmcia/pdaudiocf/pdaudiocf.h | 2 +- sound/pcmcia/vx/vxpocket.c | 20 ++++++++++---------- sound/pcmcia/vx/vxpocket.h | 2 +- 4 files changed, 17 insertions(+), 19 deletions(-) (limited to 'sound') diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf.c b/sound/pcmcia/pdaudiocf/pdaudiocf.c index 7c4091a57b69..b4158201e9e6 100644 --- a/sound/pcmcia/pdaudiocf/pdaudiocf.c +++ b/sound/pcmcia/pdaudiocf/pdaudiocf.c @@ -70,7 +70,7 @@ static void pdacf_release(dev_link_t *link) */ static int snd_pdacf_free(struct snd_pdacf *pdacf) { - dev_link_t *link = &pdacf->link; + dev_link_t *link = pdacf->p_dev; pdacf_release(link); @@ -100,6 +100,8 @@ static int snd_pdacf_attach(struct pcmcia_device *p_dev) .dev_free = snd_pdacf_dev_free, }; + link = dev_to_instance(p_dev); + snd_printdd(KERN_DEBUG "pdacf_attach called\n"); /* find an empty slot from the card list */ for (i = 0; i < SNDRV_CARDS; i++) { @@ -133,7 +135,7 @@ static int snd_pdacf_attach(struct pcmcia_device *p_dev) pdacf->index = i; card_list[i] = card; - link = &pdacf->link; + pdacf->p_dev = p_dev; link->priv = pdacf; link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; @@ -150,10 +152,6 @@ static int snd_pdacf_attach(struct pcmcia_device *p_dev) link->conf.ConfigIndex = 1; link->conf.Present = PRESENT_OPTION; - /* Chain drivers */ - link->next = NULL; - - link->handle = p_dev; pdacf_config(link); return 0; @@ -262,7 +260,7 @@ static void pdacf_config(dev_link_t *link) if (snd_pdacf_assign_resources(pdacf, link->io.BasePort1, link->irq.AssignedIRQ) < 0) goto failed; - link->dev = &pdacf->node; + link->dev_node = &pdacf->node; link->state &= ~DEV_CONFIG_PENDING; return; diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf.h b/sound/pcmcia/pdaudiocf/pdaudiocf.h index 2744f189a613..9a14a4f64bd3 100644 --- a/sound/pcmcia/pdaudiocf/pdaudiocf.h +++ b/sound/pcmcia/pdaudiocf/pdaudiocf.h @@ -116,7 +116,7 @@ struct snd_pdacf { void *pcm_area; /* pcmcia stuff */ - dev_link_t link; + struct pcmcia_device *p_dev; dev_node_t node; }; diff --git a/sound/pcmcia/vx/vxpocket.c b/sound/pcmcia/vx/vxpocket.c index ff2f927559fc..87ec48c6af28 100644 --- a/sound/pcmcia/vx/vxpocket.c +++ b/sound/pcmcia/vx/vxpocket.c @@ -126,7 +126,8 @@ static struct snd_vx_hardware vxp440_hw = { /* * 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 @@ static struct snd_vxpocket *snd_vxpocket_new(struct snd_card *card, int ibl) .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 @@ static struct snd_vxpocket *snd_vxpocket_new(struct snd_card *card, int ibl) 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 @@ static void vxpocket_config(dev_link_t *link) 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 @@ static int vxpocket_attach(struct pcmcia_device *p_dev) 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 @@ static int vxpocket_attach(struct pcmcia_device *p_dev) 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; } diff --git a/sound/pcmcia/vx/vxpocket.h b/sound/pcmcia/vx/vxpocket.h index 67efae3f6c8d..27ea002294c0 100644 --- a/sound/pcmcia/vx/vxpocket.h +++ b/sound/pcmcia/vx/vxpocket.h @@ -42,7 +42,7 @@ struct snd_vxpocket { int index; /* card index */ /* pcmcia stuff */ - dev_link_t link; + struct pcmcia_device *p_dev; dev_node_t node; }; -- cgit v1.2.2