提交 e47bf32a 编写于 作者: G Guennadi Liakhovetski 提交者: Paul Mundt

mmc: sh_mmcif: cosmetic clean up

Replace pr_* with respective dev_*, sort headers alphabetically, remove an
unused struct member, superfluous variable initialisations and type-casts.
Signed-off-by: NGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: NPaul Mundt <lethal@linux-sh.org>
上级 6d11dc14
...@@ -18,15 +18,15 @@ ...@@ -18,15 +18,15 @@
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/completion.h> #include <linux/completion.h>
#include <linux/delay.h>
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/mmc/host.h>
#include <linux/mmc/card.h> #include <linux/mmc/card.h>
#include <linux/mmc/core.h> #include <linux/mmc/core.h>
#include <linux/mmc/host.h>
#include <linux/mmc/mmc.h> #include <linux/mmc/mmc.h>
#include <linux/mmc/sdio.h> #include <linux/mmc/sdio.h>
#include <linux/delay.h>
#include <linux/platform_device.h>
#include <linux/mmc/sh_mmcif.h> #include <linux/mmc/sh_mmcif.h>
#include <linux/platform_device.h>
#define DRIVER_NAME "sh_mmcif" #define DRIVER_NAME "sh_mmcif"
#define DRIVER_VERSION "2010-04-28" #define DRIVER_VERSION "2010-04-28"
...@@ -154,7 +154,6 @@ ...@@ -154,7 +154,6 @@
struct sh_mmcif_host { struct sh_mmcif_host {
struct mmc_host *mmc; struct mmc_host *mmc;
struct mmc_data *data; struct mmc_data *data;
struct mmc_command *cmd;
struct platform_device *pd; struct platform_device *pd;
struct clk *hclk; struct clk *hclk;
unsigned int clk; unsigned int clk;
...@@ -220,8 +219,8 @@ static int sh_mmcif_error_manage(struct sh_mmcif_host *host) ...@@ -220,8 +219,8 @@ static int sh_mmcif_error_manage(struct sh_mmcif_host *host)
state1 = sh_mmcif_readl(host->addr, MMCIF_CE_HOST_STS1); state1 = sh_mmcif_readl(host->addr, MMCIF_CE_HOST_STS1);
state2 = sh_mmcif_readl(host->addr, MMCIF_CE_HOST_STS2); state2 = sh_mmcif_readl(host->addr, MMCIF_CE_HOST_STS2);
pr_debug("%s: ERR HOST_STS1 = %08x\n", DRIVER_NAME, state1); dev_dbg(&host->pd->dev, "ERR HOST_STS1 = %08x\n", state1);
pr_debug("%s: ERR HOST_STS2 = %08x\n", DRIVER_NAME, state2); dev_dbg(&host->pd->dev, "ERR HOST_STS2 = %08x\n", state2);
if (state1 & STS1_CMDSEQ) { if (state1 & STS1_CMDSEQ) {
sh_mmcif_bitset(host, MMCIF_CE_CMD_CTRL, CMD_CTRL_BREAK); sh_mmcif_bitset(host, MMCIF_CE_CMD_CTRL, CMD_CTRL_BREAK);
...@@ -229,8 +228,8 @@ static int sh_mmcif_error_manage(struct sh_mmcif_host *host) ...@@ -229,8 +228,8 @@ static int sh_mmcif_error_manage(struct sh_mmcif_host *host)
while (1) { while (1) {
timeout--; timeout--;
if (timeout < 0) { if (timeout < 0) {
pr_err(DRIVER_NAME": Forceed end of " \ dev_err(&host->pd->dev,
"command sequence timeout err\n"); "Forceed end of command sequence timeout err\n");
return -EIO; return -EIO;
} }
if (!(sh_mmcif_readl(host->addr, MMCIF_CE_HOST_STS1) if (!(sh_mmcif_readl(host->addr, MMCIF_CE_HOST_STS1)
...@@ -239,18 +238,18 @@ static int sh_mmcif_error_manage(struct sh_mmcif_host *host) ...@@ -239,18 +238,18 @@ static int sh_mmcif_error_manage(struct sh_mmcif_host *host)
mdelay(1); mdelay(1);
} }
sh_mmcif_sync_reset(host); sh_mmcif_sync_reset(host);
pr_debug(DRIVER_NAME": Forced end of command sequence\n"); dev_dbg(&host->pd->dev, "Forced end of command sequence\n");
return -EIO; return -EIO;
} }
if (state2 & STS2_CRC_ERR) { if (state2 & STS2_CRC_ERR) {
pr_debug(DRIVER_NAME": Happened CRC error\n"); dev_dbg(&host->pd->dev, ": Happened CRC error\n");
ret = -EIO; ret = -EIO;
} else if (state2 & STS2_TIMEOUT_ERR) { } else if (state2 & STS2_TIMEOUT_ERR) {
pr_debug(DRIVER_NAME": Happened Timeout error\n"); dev_dbg(&host->pd->dev, ": Happened Timeout error\n");
ret = -ETIMEDOUT; ret = -ETIMEDOUT;
} else { } else {
pr_debug(DRIVER_NAME": Happened End/Index error\n"); dev_dbg(&host->pd->dev, ": Happened End/Index error\n");
ret = -EIO; ret = -EIO;
} }
return ret; return ret;
...@@ -414,7 +413,7 @@ static u32 sh_mmcif_set_cmd(struct sh_mmcif_host *host, ...@@ -414,7 +413,7 @@ static u32 sh_mmcif_set_cmd(struct sh_mmcif_host *host,
tmp |= CMD_SET_RTYP_17B; tmp |= CMD_SET_RTYP_17B;
break; break;
default: default:
pr_err(DRIVER_NAME": Not support type response.\n"); dev_err(&host->pd->dev, "Unsupported response type.\n");
break; break;
} }
switch (opc) { switch (opc) {
...@@ -442,7 +441,7 @@ static u32 sh_mmcif_set_cmd(struct sh_mmcif_host *host, ...@@ -442,7 +441,7 @@ static u32 sh_mmcif_set_cmd(struct sh_mmcif_host *host,
tmp |= CMD_SET_DATW_8; tmp |= CMD_SET_DATW_8;
break; break;
default: default:
pr_err(DRIVER_NAME": Not support bus width.\n"); dev_err(&host->pd->dev, "Unsupported bus width.\n");
break; break;
} }
} }
...@@ -470,10 +469,10 @@ static u32 sh_mmcif_set_cmd(struct sh_mmcif_host *host, ...@@ -470,10 +469,10 @@ static u32 sh_mmcif_set_cmd(struct sh_mmcif_host *host,
return opc = ((opc << 24) | tmp); return opc = ((opc << 24) | tmp);
} }
static u32 sh_mmcif_data_trans(struct sh_mmcif_host *host, static int sh_mmcif_data_trans(struct sh_mmcif_host *host,
struct mmc_request *mrq, u32 opc) struct mmc_request *mrq, u32 opc)
{ {
u32 ret; int ret;
switch (opc) { switch (opc) {
case MMC_READ_MULTIPLE_BLOCK: case MMC_READ_MULTIPLE_BLOCK:
...@@ -490,7 +489,7 @@ static u32 sh_mmcif_data_trans(struct sh_mmcif_host *host, ...@@ -490,7 +489,7 @@ static u32 sh_mmcif_data_trans(struct sh_mmcif_host *host,
ret = sh_mmcif_single_read(host, mrq); ret = sh_mmcif_single_read(host, mrq);
break; break;
default: default:
pr_err(DRIVER_NAME": NOT SUPPORT CMD = d'%08d\n", opc); dev_err(&host->pd->dev, "UNSUPPORTED CMD = d'%08d\n", opc);
ret = -EINVAL; ret = -EINVAL;
break; break;
} }
...@@ -504,8 +503,6 @@ static void sh_mmcif_start_cmd(struct sh_mmcif_host *host, ...@@ -504,8 +503,6 @@ static void sh_mmcif_start_cmd(struct sh_mmcif_host *host,
int ret = 0, mask = 0; int ret = 0, mask = 0;
u32 opc = cmd->opcode; u32 opc = cmd->opcode;
host->cmd = cmd;
switch (opc) { switch (opc) {
/* respons busy check */ /* respons busy check */
case MMC_SWITCH: case MMC_SWITCH:
...@@ -553,8 +550,8 @@ static void sh_mmcif_start_cmd(struct sh_mmcif_host *host, ...@@ -553,8 +550,8 @@ static void sh_mmcif_start_cmd(struct sh_mmcif_host *host,
cmd->error = -ETIMEDOUT; cmd->error = -ETIMEDOUT;
break; break;
default: default:
pr_debug("%s: Cmd(d'%d) err\n", dev_dbg(&host->pd->dev, "Cmd(d'%d) err\n",
DRIVER_NAME, cmd->opcode); cmd->opcode);
cmd->error = sh_mmcif_error_manage(host); cmd->error = sh_mmcif_error_manage(host);
break; break;
} }
...@@ -562,7 +559,7 @@ static void sh_mmcif_start_cmd(struct sh_mmcif_host *host, ...@@ -562,7 +559,7 @@ static void sh_mmcif_start_cmd(struct sh_mmcif_host *host,
return; return;
} }
if (!(cmd->flags & MMC_RSP_PRESENT)) { if (!(cmd->flags & MMC_RSP_PRESENT)) {
cmd->error = ret; cmd->error = 0;
return; return;
} }
sh_mmcif_get_response(host, cmd); sh_mmcif_get_response(host, cmd);
...@@ -587,7 +584,7 @@ static void sh_mmcif_stop_cmd(struct sh_mmcif_host *host, ...@@ -587,7 +584,7 @@ static void sh_mmcif_stop_cmd(struct sh_mmcif_host *host,
else if (mrq->cmd->opcode == MMC_WRITE_MULTIPLE_BLOCK) else if (mrq->cmd->opcode == MMC_WRITE_MULTIPLE_BLOCK)
sh_mmcif_bitset(host, MMCIF_CE_INT_MASK, MASK_MCMD12RBE); sh_mmcif_bitset(host, MMCIF_CE_INT_MASK, MASK_MCMD12RBE);
else { else {
pr_err(DRIVER_NAME": not support stop cmd\n"); dev_err(&host->pd->dev, "unsupported stop cmd\n");
cmd->error = sh_mmcif_error_manage(host); cmd->error = sh_mmcif_error_manage(host);
return; return;
} }
...@@ -723,14 +720,14 @@ static irqreturn_t sh_mmcif_intr(int irq, void *dev_id) ...@@ -723,14 +720,14 @@ static irqreturn_t sh_mmcif_intr(int irq, void *dev_id)
sh_mmcif_bitclr(host, MMCIF_CE_INT_MASK, state); sh_mmcif_bitclr(host, MMCIF_CE_INT_MASK, state);
err = 1; err = 1;
} else { } else {
pr_debug("%s: Not support int\n", DRIVER_NAME); dev_dbg(&host->pd->dev, "Not support int\n");
sh_mmcif_writel(host->addr, MMCIF_CE_INT, ~state); sh_mmcif_writel(host->addr, MMCIF_CE_INT, ~state);
sh_mmcif_bitclr(host, MMCIF_CE_INT_MASK, state); sh_mmcif_bitclr(host, MMCIF_CE_INT_MASK, state);
err = 1; err = 1;
} }
if (err) { if (err) {
host->sd_error = true; host->sd_error = true;
pr_debug("%s: int err state = %08x\n", DRIVER_NAME, state); dev_dbg(&host->pd->dev, "int err state = %08x\n", state);
} }
if (state & ~(INT_CMD12RBE | INT_CMD12CRE)) if (state & ~(INT_CMD12RBE | INT_CMD12CRE))
complete(&host->intr_wait); complete(&host->intr_wait);
...@@ -744,8 +741,8 @@ static int __devinit sh_mmcif_probe(struct platform_device *pdev) ...@@ -744,8 +741,8 @@ static int __devinit sh_mmcif_probe(struct platform_device *pdev)
{ {
int ret = 0, irq[2]; int ret = 0, irq[2];
struct mmc_host *mmc; struct mmc_host *mmc;
struct sh_mmcif_host *host = NULL; struct sh_mmcif_host *host;
struct sh_mmcif_plat_data *pd = NULL; struct sh_mmcif_plat_data *pd;
struct resource *res; struct resource *res;
void __iomem *reg; void __iomem *reg;
char clk_name[8]; char clk_name[8];
...@@ -753,7 +750,7 @@ static int __devinit sh_mmcif_probe(struct platform_device *pdev) ...@@ -753,7 +750,7 @@ static int __devinit sh_mmcif_probe(struct platform_device *pdev)
irq[0] = platform_get_irq(pdev, 0); irq[0] = platform_get_irq(pdev, 0);
irq[1] = platform_get_irq(pdev, 1); irq[1] = platform_get_irq(pdev, 1);
if (irq[0] < 0 || irq[1] < 0) { if (irq[0] < 0 || irq[1] < 0) {
pr_err(DRIVER_NAME": Get irq error\n"); dev_err(&pdev->dev, "Get irq error\n");
return -ENXIO; return -ENXIO;
} }
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
...@@ -766,7 +763,7 @@ static int __devinit sh_mmcif_probe(struct platform_device *pdev) ...@@ -766,7 +763,7 @@ static int __devinit sh_mmcif_probe(struct platform_device *pdev)
dev_err(&pdev->dev, "ioremap error.\n"); dev_err(&pdev->dev, "ioremap error.\n");
return -ENOMEM; return -ENOMEM;
} }
pd = (struct sh_mmcif_plat_data *)(pdev->dev.platform_data); pd = pdev->dev.platform_data;
if (!pd) { if (!pd) {
dev_err(&pdev->dev, "sh_mmcif plat data error.\n"); dev_err(&pdev->dev, "sh_mmcif plat data error.\n");
ret = -ENXIO; ret = -ENXIO;
...@@ -821,21 +818,21 @@ static int __devinit sh_mmcif_probe(struct platform_device *pdev) ...@@ -821,21 +818,21 @@ static int __devinit sh_mmcif_probe(struct platform_device *pdev)
ret = request_irq(irq[0], sh_mmcif_intr, 0, "sh_mmc:error", host); ret = request_irq(irq[0], sh_mmcif_intr, 0, "sh_mmc:error", host);
if (ret) { if (ret) {
pr_err(DRIVER_NAME": request_irq error (sh_mmc:error)\n"); dev_err(&pdev->dev, "request_irq error (sh_mmc:error)\n");
goto clean_up2; goto clean_up2;
} }
ret = request_irq(irq[1], sh_mmcif_intr, 0, "sh_mmc:int", host); ret = request_irq(irq[1], sh_mmcif_intr, 0, "sh_mmc:int", host);
if (ret) { if (ret) {
free_irq(irq[0], host); free_irq(irq[0], host);
pr_err(DRIVER_NAME": request_irq error (sh_mmc:int)\n"); dev_err(&pdev->dev, "request_irq error (sh_mmc:int)\n");
goto clean_up2; goto clean_up2;
} }
sh_mmcif_writel(host->addr, MMCIF_CE_INT_MASK, MASK_ALL); sh_mmcif_writel(host->addr, MMCIF_CE_INT_MASK, MASK_ALL);
sh_mmcif_detect(host->mmc); sh_mmcif_detect(host->mmc);
pr_info("%s: driver version %s\n", DRIVER_NAME, DRIVER_VERSION); dev_info(&pdev->dev, "driver version %s\n", DRIVER_VERSION);
pr_debug("%s: chip ver H'%04x\n", DRIVER_NAME, dev_dbg(&pdev->dev, "chip ver H'%04x\n",
sh_mmcif_readl(host->addr, MMCIF_CE_VERSION) & 0x0000ffff); sh_mmcif_readl(host->addr, MMCIF_CE_VERSION) & 0x0000ffff);
return ret; return ret;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册