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/pcmcia/pdaudiocf/pdaudiocf.c | |
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/pdaudiocf/pdaudiocf.c')
-rw-r--r-- | sound/pcmcia/pdaudiocf/pdaudiocf.c | 17 |
1 files changed, 8 insertions, 9 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 |