diff options
Diffstat (limited to 'drivers/mtd/mtdraw.c')
-rw-r--r-- | drivers/mtd/mtdraw.c | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/drivers/mtd/mtdraw.c b/drivers/mtd/mtdraw.c index f63da7b3b2..b284d92ed3 100644 --- a/drivers/mtd/mtdraw.c +++ b/drivers/mtd/mtdraw.c @@ -1,18 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0-or-later /* * MTD raw device * * Copyright (C) 2011 Robert Jarzmik * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * * Adds a character devices : * - mtdraw<N> * @@ -247,12 +238,11 @@ static int mtdraw_erase(struct cdev *cdev, loff_t count, loff_t offset) count = mtdraw_raw_to_mtd_offset(mtdraw, count); memset(&erase, 0, sizeof(erase)); - erase.mtd = mtd; erase.addr = offset; erase.len = mtd->erasesize; while (count > 0) { - dev_dbg(&mtd->class_dev, "erase 0x%08llx len: 0x%08llx\n", + dev_dbg(&mtd->dev, "erase 0x%08llx len: 0x%08llx\n", erase.addr, erase.len); if (!mtd->allow_erasebad) @@ -261,7 +251,7 @@ static int mtdraw_erase(struct cdev *cdev, loff_t count, loff_t offset) ret = 0; if (ret > 0) { - dev_info(&mtd->class_dev, "Skipping bad block at 0x%08llx\n", + dev_info(&mtd->dev, "Skipping bad block at 0x%08llx\n", erase.addr); } else { ret = mtd_erase(mtd, &erase); @@ -297,7 +287,7 @@ static int add_mtdraw_device(struct mtd_info *mtd, const char *devname, void **p { struct mtdraw *mtdraw; - if (mtd->master || mtd->oobsize == 0) + if (mtd->parent || mtd->oobsize == 0) return 0; mtdraw = xzalloc(sizeof(*mtdraw)); @@ -306,10 +296,10 @@ static int add_mtdraw_device(struct mtd_info *mtd, const char *devname, void **p mtdraw->mtd = mtd; mtdraw->cdev.ops = (struct cdev_operations *)&mtd_raw_fops; - mtdraw->cdev.size = mtd_div_by_wb(mtd->size, mtd) * mtdraw->rps; + mtdraw->cdev.size = (loff_t)mtd_div_by_wb(mtd->size, mtd) * mtdraw->rps; mtdraw->cdev.name = basprintf("%s.raw", mtd->cdev.name); mtdraw->cdev.priv = mtdraw; - mtdraw->cdev.dev = &mtd->class_dev; + mtdraw->cdev.dev = &mtd->dev; mtdraw->cdev.mtd = mtd; *priv = mtdraw; devfs_create(&mtdraw->cdev); @@ -321,7 +311,7 @@ static int del_mtdraw_device(struct mtd_info *mtd, void **priv) { struct mtdraw *mtdraw; - if (mtd->master || mtd->oobsize == 0) + if (mtd->parent || mtd->oobsize == 0) return 0; mtdraw = *priv; |