mtd: rawnand: ams-delta: Fix various coding style issues

Most of them were reported by checkpatch:

* s/u_char/u8/
* remove unneeded blank lines
* don't print warning messages when devm_kzalloc() fails
* Use ! instead of == NULL
* Remove invalid comment

Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Tested-by: Janusz Krzysztofik <jmkrzyszt@gmail.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
This commit is contained in:
Boris Brezillon 2018-11-11 08:55:10 +01:00 коммит произвёл Miquel Raynal
Родитель 4857393d56
Коммит d54445d664
1 изменённых файлов: 8 добавлений и 15 удалений

Просмотреть файл

@ -28,7 +28,6 @@
/* /*
* MTD structure for E3 (Delta) * MTD structure for E3 (Delta)
*/ */
struct ams_delta_nand { struct ams_delta_nand {
struct nand_chip nand_chip; struct nand_chip nand_chip;
struct gpio_desc *gpiod_rdy; struct gpio_desc *gpiod_rdy;
@ -67,7 +66,7 @@ static const struct mtd_partition partition_info[] = {
.size = 3 * SZ_256K }, .size = 3 * SZ_256K },
}; };
static void ams_delta_io_write(struct ams_delta_nand *priv, u_char byte) static void ams_delta_io_write(struct ams_delta_nand *priv, u8 byte)
{ {
writew(byte, priv->io_base + OMAP_MPUIO_OUTPUT); writew(byte, priv->io_base + OMAP_MPUIO_OUTPUT);
gpiod_set_value(priv->gpiod_nwe, 0); gpiod_set_value(priv->gpiod_nwe, 0);
@ -75,9 +74,9 @@ static void ams_delta_io_write(struct ams_delta_nand *priv, u_char byte)
gpiod_set_value(priv->gpiod_nwe, 1); gpiod_set_value(priv->gpiod_nwe, 1);
} }
static u_char ams_delta_io_read(struct ams_delta_nand *priv) static u8 ams_delta_io_read(struct ams_delta_nand *priv)
{ {
u_char res; u8 res;
gpiod_set_value(priv->gpiod_nre, 0); gpiod_set_value(priv->gpiod_nre, 0);
ndelay(40); ndelay(40);
@ -93,7 +92,7 @@ static void ams_delta_dir_input(struct ams_delta_nand *priv, bool in)
priv->data_in = in; priv->data_in = in;
} }
static void ams_delta_write_buf(struct ams_delta_nand *priv, const u_char *buf, static void ams_delta_write_buf(struct ams_delta_nand *priv, const u8 *buf,
int len) int len)
{ {
int i; int i;
@ -105,8 +104,7 @@ static void ams_delta_write_buf(struct ams_delta_nand *priv, const u_char *buf,
ams_delta_io_write(priv, buf[i]); ams_delta_io_write(priv, buf[i]);
} }
static void ams_delta_read_buf(struct ams_delta_nand *priv, u_char *buf, static void ams_delta_read_buf(struct ams_delta_nand *priv, u8 *buf, int len)
int len)
{ {
int i; int i;
@ -138,7 +136,6 @@ static int ams_delta_exec_op(struct nand_chip *this,
return 0; return 0;
for (instr = op->instrs; instr < op->instrs + op->ninstrs; instr++) { for (instr = op->instrs; instr < op->instrs + op->ninstrs; instr++) {
switch (instr->type) { switch (instr->type) {
case NAND_OP_CMD_INSTR: case NAND_OP_CMD_INSTR:
gpiod_set_value(priv->gpiod_cle, 1); gpiod_set_value(priv->gpiod_cle, 1);
@ -179,7 +176,6 @@ static int ams_delta_exec_op(struct nand_chip *this,
return ret; return ret;
} }
/* /*
* Main initialization routine * Main initialization routine
*/ */
@ -198,10 +194,9 @@ static int ams_delta_init(struct platform_device *pdev)
/* Allocate memory for MTD device structure and private data */ /* Allocate memory for MTD device structure and private data */
priv = devm_kzalloc(&pdev->dev, sizeof(struct ams_delta_nand), priv = devm_kzalloc(&pdev->dev, sizeof(struct ams_delta_nand),
GFP_KERNEL); GFP_KERNEL);
if (!priv) { if (!priv)
pr_warn("Unable to allocate E3 NAND MTD device structure.\n");
return -ENOMEM; return -ENOMEM;
}
this = &priv->nand_chip; this = &priv->nand_chip;
mtd = nand_to_mtd(this); mtd = nand_to_mtd(this);
@ -212,9 +207,8 @@ static int ams_delta_init(struct platform_device *pdev)
* it should have been already requested from the * it should have been already requested from the
* gpio-omap driver and requesting it again would fail. * gpio-omap driver and requesting it again would fail.
*/ */
io_base = ioremap(res->start, resource_size(res)); io_base = ioremap(res->start, resource_size(res));
if (io_base == NULL) { if (!io_base) {
dev_err(&pdev->dev, "ioremap failed\n"); dev_err(&pdev->dev, "ioremap failed\n");
err = -EIO; err = -EIO;
goto out_free; goto out_free;
@ -223,7 +217,6 @@ static int ams_delta_init(struct platform_device *pdev)
priv->io_base = io_base; priv->io_base = io_base;
nand_set_controller_data(this, priv); nand_set_controller_data(this, priv);
/* Set address of NAND IO lines */
this->select_chip = ams_delta_select_chip; this->select_chip = ams_delta_select_chip;
this->exec_op = ams_delta_exec_op; this->exec_op = ams_delta_exec_op;