diff options
author | Dominik Brodowski <linux@dominikbrodowski.net> | 2006-03-31 17:26:06 +0200 |
---|---|---|
committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2006-03-31 17:26:06 +0200 |
commit | 15b99ac1729503db9e6dc642a50b9b6cb3bf51f9 (patch) | |
tree | cfb8897487beba502aac2b28bc35066a87e34299 /sound/pcmcia | |
parent | fba395eee7d3f342ca739c20f5b3ee635d0420a0 (diff) |
[PATCH] pcmcia: add return value to _config() functions
Most of the driver initialization isn't done in the .probe function, but in
the internal _config() functions. Make them return a value, so that .probe
can properly report whether the probing of the device succeeded or not.
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'sound/pcmcia')
-rw-r--r-- | sound/pcmcia/pdaudiocf/pdaudiocf.c | 17 | ||||
-rw-r--r-- | sound/pcmcia/vx/vxpocket.c | 15 |
2 files changed, 15 insertions, 17 deletions
diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf.c b/sound/pcmcia/pdaudiocf/pdaudiocf.c index 0431b8b0c1f..923b1d0c2f1 100644 --- a/sound/pcmcia/pdaudiocf/pdaudiocf.c +++ b/sound/pcmcia/pdaudiocf/pdaudiocf.c @@ -57,7 +57,7 @@ static struct snd_card *card_list[SNDRV_CARDS]; /* * prototypes */ -static void pdacf_config(struct pcmcia_device *link); +static int pdacf_config(struct pcmcia_device *link); static void snd_pdacf_detach(struct pcmcia_device *p_dev); static void pdacf_release(struct pcmcia_device *link) @@ -90,7 +90,7 @@ static int snd_pdacf_dev_free(struct snd_device *device) /* * snd_pdacf_attach - attach callback for cs */ -static int snd_pdacf_attach(struct pcmcia_device *link) +static int snd_pdacf_probe(struct pcmcia_device *link) { int i; struct snd_pdacf *pdacf; @@ -149,9 +149,7 @@ static int snd_pdacf_attach(struct pcmcia_device *link) link->conf.ConfigIndex = 1; link->conf.Present = PRESENT_OPTION; - pdacf_config(link); - - return 0; + return pdacf_config(link); } @@ -218,7 +216,7 @@ static void snd_pdacf_detach(struct pcmcia_device *link) #define CS_CHECK(fn, ret) \ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) -static void pdacf_config(struct pcmcia_device *link) +static int pdacf_config(struct pcmcia_device *link) { struct snd_pdacf *pdacf = link->priv; tuple_t tuple; @@ -230,7 +228,7 @@ static void pdacf_config(struct pcmcia_device *link) parse = kmalloc(sizeof(*parse), GFP_KERNEL); if (! parse) { snd_printk(KERN_ERR "pdacf_config: cannot allocate\n"); - return; + return -ENOMEM; } tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; tuple.Attributes = 0; @@ -257,12 +255,13 @@ static void pdacf_config(struct pcmcia_device *link) link->dev_node = &pdacf->node; link->state &= ~DEV_CONFIG_PENDING; - return; + return 0; cs_failed: cs_error(link, last_fn, last_ret); failed: pcmcia_disable_device(link); + return -ENODEV; } #ifdef CONFIG_PM @@ -312,7 +311,7 @@ static struct pcmcia_driver pdacf_cs_driver = { .drv = { .name = "snd-pdaudiocf", }, - .probe = snd_pdacf_attach, + .probe = snd_pdacf_probe, .remove = snd_pdacf_detach, .id_table = snd_pdacf_ids, #ifdef CONFIG_PM diff --git a/sound/pcmcia/vx/vxpocket.c b/sound/pcmcia/vx/vxpocket.c index f6eed4259d1..4004b35e8af 100644 --- a/sound/pcmcia/vx/vxpocket.c +++ b/sound/pcmcia/vx/vxpocket.c @@ -208,7 +208,7 @@ static int snd_vxpocket_assign_resources(struct vx_core *chip, int port, int irq #define CS_CHECK(fn, ret) \ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) -static void vxpocket_config(struct pcmcia_device *link) +static int vxpocket_config(struct pcmcia_device *link) { struct vx_core *chip = link->priv; struct snd_vxpocket *vxp = (struct snd_vxpocket *)chip; @@ -221,7 +221,7 @@ static void vxpocket_config(struct pcmcia_device *link) parse = kmalloc(sizeof(*parse), GFP_KERNEL); if (! parse) { snd_printk(KERN_ERR "vx: cannot allocate\n"); - return; + return -ENOMEM; } tuple.Attributes = 0; tuple.TupleData = (cisdata_t *)buf; @@ -265,13 +265,14 @@ static void vxpocket_config(struct pcmcia_device *link) link->dev_node = &vxp->node; link->state &= ~DEV_CONFIG_PENDING; kfree(parse); - return; + return 9; cs_failed: cs_error(link, last_fn, last_ret); failed: pcmcia_disable_device(link); kfree(parse); + return -ENODEV; } #ifdef CONFIG_PM @@ -311,7 +312,7 @@ static int vxp_resume(struct pcmcia_device *link) /* */ -static int vxpocket_attach(struct pcmcia_device *p_dev) +static int vxpocket_probe(struct pcmcia_device *p_dev) { struct snd_card *card; struct snd_vxpocket *vxp; @@ -349,9 +350,7 @@ static int vxpocket_attach(struct pcmcia_device *p_dev) vxp->p_dev = p_dev; vxp->p_dev->state |= DEV_PRESENT | DEV_CONFIG_PENDING; - vxpocket_config(p_dev); - - return 0; + return vxpocket_config(p_dev); } static void vxpocket_detach(struct pcmcia_device *link) @@ -387,7 +386,7 @@ static struct pcmcia_driver vxp_cs_driver = { .drv = { .name = "snd-vxpocket", }, - .probe = vxpocket_attach, + .probe = vxpocket_probe, .remove = vxpocket_detach, .id_table = vxp_ids, #ifdef CONFIG_PM |