diff options
author | Pierre Ossman <drzeus@drzeus.cx> | 2007-07-22 16:18:46 -0400 |
---|---|---|
committer | Pierre Ossman <drzeus@drzeus.cx> | 2007-09-23 02:46:48 -0400 |
commit | 17b0429dde9ab60f9cee8e07ab28c7dc6cfe6efd (patch) | |
tree | 9f87df1ffbeca4c6f828b7979f2e45ef898a3ef0 /drivers/mmc/core/mmc.c | |
parent | b7e113dc9d52c4a37d2da6fafe77959f3a28eccf (diff) |
mmc: remove custom error codes
Convert the MMC layer to use standard error codes and not its own,
incompatible values.
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Diffstat (limited to 'drivers/mmc/core/mmc.c')
-rw-r--r-- | drivers/mmc/core/mmc.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 21d7f48e1d4e..fe483d5af744 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c | |||
@@ -164,10 +164,10 @@ static int mmc_read_ext_csd(struct mmc_card *card) | |||
164 | 164 | ||
165 | BUG_ON(!card); | 165 | BUG_ON(!card); |
166 | 166 | ||
167 | err = MMC_ERR_FAILED; | 167 | err = -EIO; |
168 | 168 | ||
169 | if (card->csd.mmca_vsn < CSD_SPEC_VER_4) | 169 | if (card->csd.mmca_vsn < CSD_SPEC_VER_4) |
170 | return MMC_ERR_NONE; | 170 | return 0; |
171 | 171 | ||
172 | /* | 172 | /* |
173 | * As the ext_csd is so large and mostly unused, we don't store the | 173 | * As the ext_csd is so large and mostly unused, we don't store the |
@@ -178,11 +178,11 @@ static int mmc_read_ext_csd(struct mmc_card *card) | |||
178 | printk(KERN_ERR "%s: could not allocate a buffer to " | 178 | printk(KERN_ERR "%s: could not allocate a buffer to " |
179 | "receive the ext_csd. mmc v4 cards will be " | 179 | "receive the ext_csd. mmc v4 cards will be " |
180 | "treated as v3.\n", mmc_hostname(card->host)); | 180 | "treated as v3.\n", mmc_hostname(card->host)); |
181 | return MMC_ERR_FAILED; | 181 | return -ENOMEM; |
182 | } | 182 | } |
183 | 183 | ||
184 | err = mmc_send_ext_csd(card, ext_csd); | 184 | err = mmc_send_ext_csd(card, ext_csd); |
185 | if (err != MMC_ERR_NONE) { | 185 | if (err) { |
186 | /* | 186 | /* |
187 | * High capacity cards should have this "magic" size | 187 | * High capacity cards should have this "magic" size |
188 | * stored in their CSD. | 188 | * stored in their CSD. |
@@ -197,7 +197,7 @@ static int mmc_read_ext_csd(struct mmc_card *card) | |||
197 | "EXT_CSD, performance might " | 197 | "EXT_CSD, performance might " |
198 | "suffer.\n", | 198 | "suffer.\n", |
199 | mmc_hostname(card->host)); | 199 | mmc_hostname(card->host)); |
200 | err = MMC_ERR_NONE; | 200 | err = 0; |
201 | } | 201 | } |
202 | goto out; | 202 | goto out; |
203 | } | 203 | } |
@@ -258,14 +258,14 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, | |||
258 | 258 | ||
259 | /* The extra bit indicates that we support high capacity */ | 259 | /* The extra bit indicates that we support high capacity */ |
260 | err = mmc_send_op_cond(host, ocr | (1 << 30), NULL); | 260 | err = mmc_send_op_cond(host, ocr | (1 << 30), NULL); |
261 | if (err != MMC_ERR_NONE) | 261 | if (err) |
262 | goto err; | 262 | goto err; |
263 | 263 | ||
264 | /* | 264 | /* |
265 | * Fetch CID from card. | 265 | * Fetch CID from card. |
266 | */ | 266 | */ |
267 | err = mmc_all_send_cid(host, cid); | 267 | err = mmc_all_send_cid(host, cid); |
268 | if (err != MMC_ERR_NONE) | 268 | if (err) |
269 | goto err; | 269 | goto err; |
270 | 270 | ||
271 | if (oldcard) { | 271 | if (oldcard) { |
@@ -290,7 +290,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, | |||
290 | * Set card RCA. | 290 | * Set card RCA. |
291 | */ | 291 | */ |
292 | err = mmc_set_relative_addr(card); | 292 | err = mmc_set_relative_addr(card); |
293 | if (err != MMC_ERR_NONE) | 293 | if (err) |
294 | goto free_card; | 294 | goto free_card; |
295 | 295 | ||
296 | mmc_set_bus_mode(host, MMC_BUSMODE_PUSHPULL); | 296 | mmc_set_bus_mode(host, MMC_BUSMODE_PUSHPULL); |
@@ -300,7 +300,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, | |||
300 | * Fetch CSD from card. | 300 | * Fetch CSD from card. |
301 | */ | 301 | */ |
302 | err = mmc_send_csd(card, card->raw_csd); | 302 | err = mmc_send_csd(card, card->raw_csd); |
303 | if (err != MMC_ERR_NONE) | 303 | if (err) |
304 | goto free_card; | 304 | goto free_card; |
305 | 305 | ||
306 | err = mmc_decode_csd(card); | 306 | err = mmc_decode_csd(card); |
@@ -315,7 +315,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, | |||
315 | * Select card, as all following commands rely on that. | 315 | * Select card, as all following commands rely on that. |
316 | */ | 316 | */ |
317 | err = mmc_select_card(card); | 317 | err = mmc_select_card(card); |
318 | if (err != MMC_ERR_NONE) | 318 | if (err) |
319 | goto free_card; | 319 | goto free_card; |
320 | 320 | ||
321 | if (!oldcard) { | 321 | if (!oldcard) { |
@@ -323,7 +323,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, | |||
323 | * Fetch and process extened CSD. | 323 | * Fetch and process extened CSD. |
324 | */ | 324 | */ |
325 | err = mmc_read_ext_csd(card); | 325 | err = mmc_read_ext_csd(card); |
326 | if (err != MMC_ERR_NONE) | 326 | if (err) |
327 | goto free_card; | 327 | goto free_card; |
328 | } | 328 | } |
329 | 329 | ||
@@ -334,7 +334,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, | |||
334 | (host->caps & MMC_CAP_MMC_HIGHSPEED)) { | 334 | (host->caps & MMC_CAP_MMC_HIGHSPEED)) { |
335 | err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, | 335 | err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, |
336 | EXT_CSD_HS_TIMING, 1); | 336 | EXT_CSD_HS_TIMING, 1); |
337 | if (err != MMC_ERR_NONE) | 337 | if (err) |
338 | goto free_card; | 338 | goto free_card; |
339 | 339 | ||
340 | mmc_card_set_highspeed(card); | 340 | mmc_card_set_highspeed(card); |
@@ -363,7 +363,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, | |||
363 | (host->caps & MMC_CAP_4_BIT_DATA)) { | 363 | (host->caps & MMC_CAP_4_BIT_DATA)) { |
364 | err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, | 364 | err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, |
365 | EXT_CSD_BUS_WIDTH, EXT_CSD_BUS_WIDTH_4); | 365 | EXT_CSD_BUS_WIDTH, EXT_CSD_BUS_WIDTH_4); |
366 | if (err != MMC_ERR_NONE) | 366 | if (err) |
367 | goto free_card; | 367 | goto free_card; |
368 | 368 | ||
369 | mmc_set_bus_width(card->host, MMC_BUS_WIDTH_4); | 369 | mmc_set_bus_width(card->host, MMC_BUS_WIDTH_4); |
@@ -372,14 +372,14 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, | |||
372 | if (!oldcard) | 372 | if (!oldcard) |
373 | host->card = card; | 373 | host->card = card; |
374 | 374 | ||
375 | return MMC_ERR_NONE; | 375 | return 0; |
376 | 376 | ||
377 | free_card: | 377 | free_card: |
378 | if (!oldcard) | 378 | if (!oldcard) |
379 | mmc_remove_card(card); | 379 | mmc_remove_card(card); |
380 | err: | 380 | err: |
381 | 381 | ||
382 | return MMC_ERR_FAILED; | 382 | return -EIO; |
383 | } | 383 | } |
384 | 384 | ||
385 | /* | 385 | /* |
@@ -413,7 +413,7 @@ static void mmc_detect(struct mmc_host *host) | |||
413 | 413 | ||
414 | mmc_release_host(host); | 414 | mmc_release_host(host); |
415 | 415 | ||
416 | if (err != MMC_ERR_NONE) { | 416 | if (err) { |
417 | mmc_remove(host); | 417 | mmc_remove(host); |
418 | 418 | ||
419 | mmc_claim_host(host); | 419 | mmc_claim_host(host); |
@@ -502,7 +502,7 @@ static void mmc_resume(struct mmc_host *host) | |||
502 | err = mmc_init_card(host, host->ocr, host->card); | 502 | err = mmc_init_card(host, host->ocr, host->card); |
503 | mmc_release_host(host); | 503 | mmc_release_host(host); |
504 | 504 | ||
505 | if (err != MMC_ERR_NONE) { | 505 | if (err) { |
506 | mmc_remove(host); | 506 | mmc_remove(host); |
507 | 507 | ||
508 | mmc_claim_host(host); | 508 | mmc_claim_host(host); |
@@ -565,7 +565,7 @@ int mmc_attach_mmc(struct mmc_host *host, u32 ocr) | |||
565 | * Detect and init the card. | 565 | * Detect and init the card. |
566 | */ | 566 | */ |
567 | err = mmc_init_card(host, host->ocr, NULL); | 567 | err = mmc_init_card(host, host->ocr, NULL); |
568 | if (err != MMC_ERR_NONE) | 568 | if (err) |
569 | goto err; | 569 | goto err; |
570 | 570 | ||
571 | mmc_release_host(host); | 571 | mmc_release_host(host); |