diff options
author | Dominik Brodowski <linux@dominikbrodowski.net> | 2006-03-31 10:26:06 -0500 |
---|---|---|
committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2006-03-31 10:26:06 -0500 |
commit | 15b99ac1729503db9e6dc642a50b9b6cb3bf51f9 (patch) | |
tree | cfb8897487beba502aac2b28bc35066a87e34299 /sound | |
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')
-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 0431b8b0c1f5..923b1d0c2f1b 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]; | |||
57 | /* | 57 | /* |
58 | * prototypes | 58 | * prototypes |
59 | */ | 59 | */ |
60 | static void pdacf_config(struct pcmcia_device *link); | 60 | static int pdacf_config(struct pcmcia_device *link); |
61 | static void snd_pdacf_detach(struct pcmcia_device *p_dev); | 61 | static void snd_pdacf_detach(struct pcmcia_device *p_dev); |
62 | 62 | ||
63 | static void pdacf_release(struct pcmcia_device *link) | 63 | static void pdacf_release(struct pcmcia_device *link) |
@@ -90,7 +90,7 @@ static int snd_pdacf_dev_free(struct snd_device *device) | |||
90 | /* | 90 | /* |
91 | * snd_pdacf_attach - attach callback for cs | 91 | * snd_pdacf_attach - attach callback for cs |
92 | */ | 92 | */ |
93 | static int snd_pdacf_attach(struct pcmcia_device *link) | 93 | static int snd_pdacf_probe(struct pcmcia_device *link) |
94 | { | 94 | { |
95 | int i; | 95 | int i; |
96 | struct snd_pdacf *pdacf; | 96 | struct snd_pdacf *pdacf; |
@@ -149,9 +149,7 @@ static int snd_pdacf_attach(struct pcmcia_device *link) | |||
149 | link->conf.ConfigIndex = 1; | 149 | link->conf.ConfigIndex = 1; |
150 | link->conf.Present = PRESENT_OPTION; | 150 | link->conf.Present = PRESENT_OPTION; |
151 | 151 | ||
152 | pdacf_config(link); | 152 | return pdacf_config(link); |
153 | |||
154 | return 0; | ||
155 | } | 153 | } |
156 | 154 | ||
157 | 155 | ||
@@ -218,7 +216,7 @@ static void snd_pdacf_detach(struct pcmcia_device *link) | |||
218 | #define CS_CHECK(fn, ret) \ | 216 | #define CS_CHECK(fn, ret) \ |
219 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | 217 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) |
220 | 218 | ||
221 | static void pdacf_config(struct pcmcia_device *link) | 219 | static int pdacf_config(struct pcmcia_device *link) |
222 | { | 220 | { |
223 | struct snd_pdacf *pdacf = link->priv; | 221 | struct snd_pdacf *pdacf = link->priv; |
224 | tuple_t tuple; | 222 | tuple_t tuple; |
@@ -230,7 +228,7 @@ static void pdacf_config(struct pcmcia_device *link) | |||
230 | parse = kmalloc(sizeof(*parse), GFP_KERNEL); | 228 | parse = kmalloc(sizeof(*parse), GFP_KERNEL); |
231 | if (! parse) { | 229 | if (! parse) { |
232 | snd_printk(KERN_ERR "pdacf_config: cannot allocate\n"); | 230 | snd_printk(KERN_ERR "pdacf_config: cannot allocate\n"); |
233 | return; | 231 | return -ENOMEM; |
234 | } | 232 | } |
235 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | 233 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; |
236 | tuple.Attributes = 0; | 234 | tuple.Attributes = 0; |
@@ -257,12 +255,13 @@ static void pdacf_config(struct pcmcia_device *link) | |||
257 | 255 | ||
258 | link->dev_node = &pdacf->node; | 256 | link->dev_node = &pdacf->node; |
259 | link->state &= ~DEV_CONFIG_PENDING; | 257 | link->state &= ~DEV_CONFIG_PENDING; |
260 | return; | 258 | return 0; |
261 | 259 | ||
262 | cs_failed: | 260 | cs_failed: |
263 | cs_error(link, last_fn, last_ret); | 261 | cs_error(link, last_fn, last_ret); |
264 | failed: | 262 | failed: |
265 | pcmcia_disable_device(link); | 263 | pcmcia_disable_device(link); |
264 | return -ENODEV; | ||
266 | } | 265 | } |
267 | 266 | ||
268 | #ifdef CONFIG_PM | 267 | #ifdef CONFIG_PM |
@@ -312,7 +311,7 @@ static struct pcmcia_driver pdacf_cs_driver = { | |||
312 | .drv = { | 311 | .drv = { |
313 | .name = "snd-pdaudiocf", | 312 | .name = "snd-pdaudiocf", |
314 | }, | 313 | }, |
315 | .probe = snd_pdacf_attach, | 314 | .probe = snd_pdacf_probe, |
316 | .remove = snd_pdacf_detach, | 315 | .remove = snd_pdacf_detach, |
317 | .id_table = snd_pdacf_ids, | 316 | .id_table = snd_pdacf_ids, |
318 | #ifdef CONFIG_PM | 317 | #ifdef CONFIG_PM |
diff --git a/sound/pcmcia/vx/vxpocket.c b/sound/pcmcia/vx/vxpocket.c index f6eed4259d17..4004b35e8af5 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 | |||
208 | #define CS_CHECK(fn, ret) \ | 208 | #define CS_CHECK(fn, ret) \ |
209 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | 209 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) |
210 | 210 | ||
211 | static void vxpocket_config(struct pcmcia_device *link) | 211 | static int vxpocket_config(struct pcmcia_device *link) |
212 | { | 212 | { |
213 | struct vx_core *chip = link->priv; | 213 | struct vx_core *chip = link->priv; |
214 | struct snd_vxpocket *vxp = (struct snd_vxpocket *)chip; | 214 | struct snd_vxpocket *vxp = (struct snd_vxpocket *)chip; |
@@ -221,7 +221,7 @@ static void vxpocket_config(struct pcmcia_device *link) | |||
221 | parse = kmalloc(sizeof(*parse), GFP_KERNEL); | 221 | parse = kmalloc(sizeof(*parse), GFP_KERNEL); |
222 | if (! parse) { | 222 | if (! parse) { |
223 | snd_printk(KERN_ERR "vx: cannot allocate\n"); | 223 | snd_printk(KERN_ERR "vx: cannot allocate\n"); |
224 | return; | 224 | return -ENOMEM; |
225 | } | 225 | } |
226 | tuple.Attributes = 0; | 226 | tuple.Attributes = 0; |
227 | tuple.TupleData = (cisdata_t *)buf; | 227 | tuple.TupleData = (cisdata_t *)buf; |
@@ -265,13 +265,14 @@ static void vxpocket_config(struct pcmcia_device *link) | |||
265 | link->dev_node = &vxp->node; | 265 | link->dev_node = &vxp->node; |
266 | link->state &= ~DEV_CONFIG_PENDING; | 266 | link->state &= ~DEV_CONFIG_PENDING; |
267 | kfree(parse); | 267 | kfree(parse); |
268 | return; | 268 | return 9; |
269 | 269 | ||
270 | cs_failed: | 270 | cs_failed: |
271 | cs_error(link, last_fn, last_ret); | 271 | cs_error(link, last_fn, last_ret); |
272 | failed: | 272 | failed: |
273 | pcmcia_disable_device(link); | 273 | pcmcia_disable_device(link); |
274 | kfree(parse); | 274 | kfree(parse); |
275 | return -ENODEV; | ||
275 | } | 276 | } |
276 | 277 | ||
277 | #ifdef CONFIG_PM | 278 | #ifdef CONFIG_PM |
@@ -311,7 +312,7 @@ static int vxp_resume(struct pcmcia_device *link) | |||
311 | 312 | ||
312 | /* | 313 | /* |
313 | */ | 314 | */ |
314 | static int vxpocket_attach(struct pcmcia_device *p_dev) | 315 | static int vxpocket_probe(struct pcmcia_device *p_dev) |
315 | { | 316 | { |
316 | struct snd_card *card; | 317 | struct snd_card *card; |
317 | struct snd_vxpocket *vxp; | 318 | struct snd_vxpocket *vxp; |
@@ -349,9 +350,7 @@ static int vxpocket_attach(struct pcmcia_device *p_dev) | |||
349 | vxp->p_dev = p_dev; | 350 | vxp->p_dev = p_dev; |
350 | vxp->p_dev->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | 351 | vxp->p_dev->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
351 | 352 | ||
352 | vxpocket_config(p_dev); | 353 | return vxpocket_config(p_dev); |
353 | |||
354 | return 0; | ||
355 | } | 354 | } |
356 | 355 | ||
357 | static void vxpocket_detach(struct pcmcia_device *link) | 356 | static void vxpocket_detach(struct pcmcia_device *link) |
@@ -387,7 +386,7 @@ static struct pcmcia_driver vxp_cs_driver = { | |||
387 | .drv = { | 386 | .drv = { |
388 | .name = "snd-vxpocket", | 387 | .name = "snd-vxpocket", |
389 | }, | 388 | }, |
390 | .probe = vxpocket_attach, | 389 | .probe = vxpocket_probe, |
391 | .remove = vxpocket_detach, | 390 | .remove = vxpocket_detach, |
392 | .id_table = vxp_ids, | 391 | .id_table = vxp_ids, |
393 | #ifdef CONFIG_PM | 392 | #ifdef CONFIG_PM |