diff options
author | Ulf Hansson <ulf.hansson@linaro.org> | 2014-10-17 05:48:23 -0400 |
---|---|---|
committer | Ulf Hansson <ulf.hansson@linaro.org> | 2014-11-10 06:40:44 -0500 |
commit | b2cada73a8ff2ee9129557c724f7e53bf55e48f8 (patch) | |
tree | ce7635c42deb4bccc58e33e071359ad9c8ecc6d5 | |
parent | 86817ffb492b509b87b20be4a4f1afc74f04dccf (diff) |
mmc: core: Use mmc_get_ext_csd() instead of mmc_send_ext_csd()
By using mmc_get_ext_csd() in favor of mmc_send_ext_csd, we decrease
code duplication.
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
-rw-r--r-- | drivers/mmc/core/core.c | 17 | ||||
-rw-r--r-- | drivers/mmc/core/debugfs.c | 9 |
2 files changed, 4 insertions, 22 deletions
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 953f17c5fcde..943f9051ec6d 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c | |||
@@ -731,27 +731,16 @@ int mmc_read_bkops_status(struct mmc_card *card) | |||
731 | int err; | 731 | int err; |
732 | u8 *ext_csd; | 732 | u8 *ext_csd; |
733 | 733 | ||
734 | /* | ||
735 | * In future work, we should consider storing the entire ext_csd. | ||
736 | */ | ||
737 | ext_csd = kmalloc(512, GFP_KERNEL); | ||
738 | if (!ext_csd) { | ||
739 | pr_err("%s: could not allocate buffer to receive the ext_csd.\n", | ||
740 | mmc_hostname(card->host)); | ||
741 | return -ENOMEM; | ||
742 | } | ||
743 | |||
744 | mmc_claim_host(card->host); | 734 | mmc_claim_host(card->host); |
745 | err = mmc_send_ext_csd(card, ext_csd); | 735 | err = mmc_get_ext_csd(card, &ext_csd); |
746 | mmc_release_host(card->host); | 736 | mmc_release_host(card->host); |
747 | if (err) | 737 | if (err) |
748 | goto out; | 738 | return err; |
749 | 739 | ||
750 | card->ext_csd.raw_bkops_status = ext_csd[EXT_CSD_BKOPS_STATUS]; | 740 | card->ext_csd.raw_bkops_status = ext_csd[EXT_CSD_BKOPS_STATUS]; |
751 | card->ext_csd.raw_exception_status = ext_csd[EXT_CSD_EXP_EVENTS_STATUS]; | 741 | card->ext_csd.raw_exception_status = ext_csd[EXT_CSD_EXP_EVENTS_STATUS]; |
752 | out: | ||
753 | kfree(ext_csd); | 742 | kfree(ext_csd); |
754 | return err; | 743 | return 0; |
755 | } | 744 | } |
756 | EXPORT_SYMBOL(mmc_read_bkops_status); | 745 | EXPORT_SYMBOL(mmc_read_bkops_status); |
757 | 746 | ||
diff --git a/drivers/mmc/core/debugfs.c b/drivers/mmc/core/debugfs.c index 91eb16223246..e9142108a6c6 100644 --- a/drivers/mmc/core/debugfs.c +++ b/drivers/mmc/core/debugfs.c | |||
@@ -291,14 +291,8 @@ static int mmc_ext_csd_open(struct inode *inode, struct file *filp) | |||
291 | if (!buf) | 291 | if (!buf) |
292 | return -ENOMEM; | 292 | return -ENOMEM; |
293 | 293 | ||
294 | ext_csd = kmalloc(512, GFP_KERNEL); | ||
295 | if (!ext_csd) { | ||
296 | err = -ENOMEM; | ||
297 | goto out_free; | ||
298 | } | ||
299 | |||
300 | mmc_get_card(card); | 294 | mmc_get_card(card); |
301 | err = mmc_send_ext_csd(card, ext_csd); | 295 | err = mmc_get_ext_csd(card, &ext_csd); |
302 | mmc_put_card(card); | 296 | mmc_put_card(card); |
303 | if (err) | 297 | if (err) |
304 | goto out_free; | 298 | goto out_free; |
@@ -314,7 +308,6 @@ static int mmc_ext_csd_open(struct inode *inode, struct file *filp) | |||
314 | 308 | ||
315 | out_free: | 309 | out_free: |
316 | kfree(buf); | 310 | kfree(buf); |
317 | kfree(ext_csd); | ||
318 | return err; | 311 | return err; |
319 | } | 312 | } |
320 | 313 | ||