diff options
author | Denis Karpov <ext-denis.2.karpov@nokia.com> | 2009-09-22 19:44:55 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-09-23 10:39:35 -0400 |
commit | 191d1f1de158cf4dee3a5595e845a498364c061f (patch) | |
tree | e4382de211ab4769232dee01a489b04c3d2c7e1f /drivers/mmc/host | |
parent | 0a40e64786933fb04be37af0a19aa320bc3414a8 (diff) |
omap_hsmmc: cleanup macro usage
Use macro mmc_slot() in omap_hsmmc.
Signed-off-by: Denis Karpov <ext-denis.2.karpov@nokia.com>
Signed-off-by: Adrian Hunter <adrian.hunter@nokia.com>
Acked-by: Matt Fleming <matt@console-pimps.org>
Cc: Ian Molton <ian@mnementh.co.uk>
Cc: "Roberto A. Foglietta" <roberto.foglietta@gmail.com>
Cc: Jarkko Lavinen <jarkko.lavinen@nokia.com>
Cc: Denis Karpov <ext-denis.2.karpov@nokia.com>
Cc: Pierre Ossman <pierre@ossman.eu>
Cc: Philip Langdale <philipl@overt.org>
Cc: "Madhusudhan" <madhu.cr@ti.com>
Cc: <linux-mmc@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/mmc/host')
-rw-r--r-- | drivers/mmc/host/omap_hsmmc.c | 42 |
1 files changed, 19 insertions, 23 deletions
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index 9519964ecb2a..305e5d26d7e7 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c | |||
@@ -368,9 +368,8 @@ int mmc_omap_cover_is_closed(struct mmc_omap_host *host) | |||
368 | { | 368 | { |
369 | int r = 1; | 369 | int r = 1; |
370 | 370 | ||
371 | if (host->pdata->slots[host->slot_id].get_cover_state) | 371 | if (mmc_slot(host).get_cover_state) |
372 | r = host->pdata->slots[host->slot_id].get_cover_state(host->dev, | 372 | r = mmc_slot(host).get_cover_state(host->dev, host->slot_id); |
373 | host->slot_id); | ||
374 | return r; | 373 | return r; |
375 | } | 374 | } |
376 | 375 | ||
@@ -393,9 +392,8 @@ mmc_omap_show_slot_name(struct device *dev, struct device_attribute *attr, | |||
393 | { | 392 | { |
394 | struct mmc_host *mmc = container_of(dev, struct mmc_host, class_dev); | 393 | struct mmc_host *mmc = container_of(dev, struct mmc_host, class_dev); |
395 | struct mmc_omap_host *host = mmc_priv(mmc); | 394 | struct mmc_omap_host *host = mmc_priv(mmc); |
396 | struct omap_mmc_slot_data slot = host->pdata->slots[host->slot_id]; | ||
397 | 395 | ||
398 | return sprintf(buf, "%s\n", slot.name); | 396 | return sprintf(buf, "%s\n", mmc_slot(host).name); |
399 | } | 397 | } |
400 | 398 | ||
401 | static DEVICE_ATTR(slot_name, S_IRUGO, mmc_omap_show_slot_name, NULL); | 399 | static DEVICE_ATTR(slot_name, S_IRUGO, mmc_omap_show_slot_name, NULL); |
@@ -632,7 +630,8 @@ static irqreturn_t mmc_omap_irq(int irq, void *dev_id) | |||
632 | (status & CMD_CRC)) { | 630 | (status & CMD_CRC)) { |
633 | if (host->cmd) { | 631 | if (host->cmd) { |
634 | if (status & CMD_TIMEOUT) { | 632 | if (status & CMD_TIMEOUT) { |
635 | mmc_omap_reset_controller_fsm(host, SRC); | 633 | mmc_omap_reset_controller_fsm(host, |
634 | SRC); | ||
636 | host->cmd->error = -ETIMEDOUT; | 635 | host->cmd->error = -ETIMEDOUT; |
637 | } else { | 636 | } else { |
638 | host->cmd->error = -EILSEQ; | 637 | host->cmd->error = -EILSEQ; |
@@ -775,7 +774,7 @@ static void mmc_omap_detect(struct work_struct *work) | |||
775 | 774 | ||
776 | sysfs_notify(&host->mmc->class_dev.kobj, NULL, "cover_switch"); | 775 | sysfs_notify(&host->mmc->class_dev.kobj, NULL, "cover_switch"); |
777 | 776 | ||
778 | if (mmc_slot(host).card_detect) | 777 | if (slot->card_detect) |
779 | carddetect = slot->card_detect(slot->card_detect_irq); | 778 | carddetect = slot->card_detect(slot->card_detect_irq); |
780 | else | 779 | else |
781 | carddetect = -ENOSYS; | 780 | carddetect = -ENOSYS; |
@@ -830,7 +829,7 @@ static void mmc_omap_config_dma_params(struct mmc_omap_host *host, | |||
830 | sg_dma_address(sgl), 0, 0); | 829 | sg_dma_address(sgl), 0, 0); |
831 | } else { | 830 | } else { |
832 | omap_set_dma_src_params(dma_ch, 0, OMAP_DMA_AMODE_CONSTANT, | 831 | omap_set_dma_src_params(dma_ch, 0, OMAP_DMA_AMODE_CONSTANT, |
833 | (host->mapbase + OMAP_HSMMC_DATA), 0, 0); | 832 | (host->mapbase + OMAP_HSMMC_DATA), 0, 0); |
834 | omap_set_dma_dest_params(dma_ch, 0, OMAP_DMA_AMODE_POST_INC, | 833 | omap_set_dma_dest_params(dma_ch, 0, OMAP_DMA_AMODE_POST_INC, |
835 | sg_dma_address(sgl), 0, 0); | 834 | sg_dma_address(sgl), 0, 0); |
836 | } | 835 | } |
@@ -918,7 +917,7 @@ mmc_omap_start_dma_transfer(struct mmc_omap_host *host, struct mmc_request *req) | |||
918 | } | 917 | } |
919 | 918 | ||
920 | ret = omap_request_dma(mmc_omap_get_dma_sync_dev(host, data), "MMC/SD", | 919 | ret = omap_request_dma(mmc_omap_get_dma_sync_dev(host, data), "MMC/SD", |
921 | mmc_omap_dma_cb,host, &dma_ch); | 920 | mmc_omap_dma_cb, host, &dma_ch); |
922 | if (ret != 0) { | 921 | if (ret != 0) { |
923 | dev_err(mmc_dev(host->mmc), | 922 | dev_err(mmc_dev(host->mmc), |
924 | "%s: omap_request_dma() failed with %d\n", | 923 | "%s: omap_request_dma() failed with %d\n", |
@@ -1138,21 +1137,19 @@ static void omap_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | |||
1138 | static int omap_hsmmc_get_cd(struct mmc_host *mmc) | 1137 | static int omap_hsmmc_get_cd(struct mmc_host *mmc) |
1139 | { | 1138 | { |
1140 | struct mmc_omap_host *host = mmc_priv(mmc); | 1139 | struct mmc_omap_host *host = mmc_priv(mmc); |
1141 | struct omap_mmc_platform_data *pdata = host->pdata; | ||
1142 | 1140 | ||
1143 | if (!pdata->slots[0].card_detect) | 1141 | if (!mmc_slot(host).card_detect) |
1144 | return -ENOSYS; | 1142 | return -ENOSYS; |
1145 | return pdata->slots[0].card_detect(pdata->slots[0].card_detect_irq); | 1143 | return mmc_slot(host).card_detect(mmc_slot(host).card_detect_irq); |
1146 | } | 1144 | } |
1147 | 1145 | ||
1148 | static int omap_hsmmc_get_ro(struct mmc_host *mmc) | 1146 | static int omap_hsmmc_get_ro(struct mmc_host *mmc) |
1149 | { | 1147 | { |
1150 | struct mmc_omap_host *host = mmc_priv(mmc); | 1148 | struct mmc_omap_host *host = mmc_priv(mmc); |
1151 | struct omap_mmc_platform_data *pdata = host->pdata; | ||
1152 | 1149 | ||
1153 | if (!pdata->slots[0].get_ro) | 1150 | if (!mmc_slot(host).get_ro) |
1154 | return -ENOSYS; | 1151 | return -ENOSYS; |
1155 | return pdata->slots[0].get_ro(host->dev, 0); | 1152 | return mmc_slot(host).get_ro(host->dev, 0); |
1156 | } | 1153 | } |
1157 | 1154 | ||
1158 | static void omap_hsmmc_init(struct mmc_omap_host *host) | 1155 | static void omap_hsmmc_init(struct mmc_omap_host *host) |
@@ -1563,7 +1560,7 @@ static int __init omap_mmc_probe(struct platform_device *pdev) | |||
1563 | platform_set_drvdata(pdev, host); | 1560 | platform_set_drvdata(pdev, host); |
1564 | INIT_WORK(&host->mmc_carddetect_work, mmc_omap_detect); | 1561 | INIT_WORK(&host->mmc_carddetect_work, mmc_omap_detect); |
1565 | 1562 | ||
1566 | if (pdata->slots[host->slot_id].power_saving) | 1563 | if (mmc_slot(host).power_saving) |
1567 | mmc->ops = &mmc_omap_ps_ops; | 1564 | mmc->ops = &mmc_omap_ps_ops; |
1568 | else | 1565 | else |
1569 | mmc->ops = &mmc_omap_ops; | 1566 | mmc->ops = &mmc_omap_ops; |
@@ -1633,12 +1630,12 @@ static int __init omap_mmc_probe(struct platform_device *pdev) | |||
1633 | mmc->caps |= MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED | | 1630 | mmc->caps |= MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED | |
1634 | MMC_CAP_WAIT_WHILE_BUSY; | 1631 | MMC_CAP_WAIT_WHILE_BUSY; |
1635 | 1632 | ||
1636 | if (pdata->slots[host->slot_id].wires >= 8) | 1633 | if (mmc_slot(host).wires >= 8) |
1637 | mmc->caps |= MMC_CAP_8_BIT_DATA; | 1634 | mmc->caps |= MMC_CAP_8_BIT_DATA; |
1638 | else if (pdata->slots[host->slot_id].wires >= 4) | 1635 | else if (mmc_slot(host).wires >= 4) |
1639 | mmc->caps |= MMC_CAP_4_BIT_DATA; | 1636 | mmc->caps |= MMC_CAP_4_BIT_DATA; |
1640 | 1637 | ||
1641 | if (pdata->slots[host->slot_id].nonremovable) | 1638 | if (mmc_slot(host).nonremovable) |
1642 | mmc->caps |= MMC_CAP_NONREMOVABLE; | 1639 | mmc->caps |= MMC_CAP_NONREMOVABLE; |
1643 | 1640 | ||
1644 | omap_hsmmc_init(host); | 1641 | omap_hsmmc_init(host); |
@@ -1700,13 +1697,12 @@ static int __init omap_mmc_probe(struct platform_device *pdev) | |||
1700 | 1697 | ||
1701 | mmc_add_host(mmc); | 1698 | mmc_add_host(mmc); |
1702 | 1699 | ||
1703 | if (host->pdata->slots[host->slot_id].name != NULL) { | 1700 | if (mmc_slot(host).name != NULL) { |
1704 | ret = device_create_file(&mmc->class_dev, &dev_attr_slot_name); | 1701 | ret = device_create_file(&mmc->class_dev, &dev_attr_slot_name); |
1705 | if (ret < 0) | 1702 | if (ret < 0) |
1706 | goto err_slot_name; | 1703 | goto err_slot_name; |
1707 | } | 1704 | } |
1708 | if (mmc_slot(host).card_detect_irq && | 1705 | if (mmc_slot(host).card_detect_irq && mmc_slot(host).get_cover_state) { |
1709 | host->pdata->slots[host->slot_id].get_cover_state) { | ||
1710 | ret = device_create_file(&mmc->class_dev, | 1706 | ret = device_create_file(&mmc->class_dev, |
1711 | &dev_attr_cover_switch); | 1707 | &dev_attr_cover_switch); |
1712 | if (ret < 0) | 1708 | if (ret < 0) |
@@ -1812,7 +1808,7 @@ static int omap_mmc_suspend(struct platform_device *pdev, pm_message_t state) | |||
1812 | 1808 | ||
1813 | 1809 | ||
1814 | OMAP_HSMMC_WRITE(host->base, HCTL, | 1810 | OMAP_HSMMC_WRITE(host->base, HCTL, |
1815 | OMAP_HSMMC_READ(host->base, HCTL) & ~SDBP); | 1811 | OMAP_HSMMC_READ(host->base, HCTL) & ~SDBP); |
1816 | mmc_host_disable(host->mmc); | 1812 | mmc_host_disable(host->mmc); |
1817 | clk_disable(host->iclk); | 1813 | clk_disable(host->iclk); |
1818 | clk_disable(host->dbclk); | 1814 | clk_disable(host->dbclk); |