mtd: nand: s3c2410: use the mtd instance embedded in struct nand_chip
struct nand_chip now embeds an mtd device. Make use of this mtd instance. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
This commit is contained in:
parent
3eb064e4b0
commit
7208b997b7
|
@ -104,7 +104,6 @@ struct s3c2410_nand_info;
|
||||||
* @scan_res: The result from calling nand_scan_ident().
|
* @scan_res: The result from calling nand_scan_ident().
|
||||||
*/
|
*/
|
||||||
struct s3c2410_nand_mtd {
|
struct s3c2410_nand_mtd {
|
||||||
struct mtd_info mtd;
|
|
||||||
struct nand_chip chip;
|
struct nand_chip chip;
|
||||||
struct s3c2410_nand_set *set;
|
struct s3c2410_nand_set *set;
|
||||||
struct s3c2410_nand_info *info;
|
struct s3c2410_nand_info *info;
|
||||||
|
@ -168,7 +167,8 @@ struct s3c2410_nand_info {
|
||||||
|
|
||||||
static struct s3c2410_nand_mtd *s3c2410_nand_mtd_toours(struct mtd_info *mtd)
|
static struct s3c2410_nand_mtd *s3c2410_nand_mtd_toours(struct mtd_info *mtd)
|
||||||
{
|
{
|
||||||
return container_of(mtd, struct s3c2410_nand_mtd, mtd);
|
return container_of(mtd_to_nand(mtd), struct s3c2410_nand_mtd,
|
||||||
|
chip);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct s3c2410_nand_info *s3c2410_nand_mtd_toinfo(struct mtd_info *mtd)
|
static struct s3c2410_nand_info *s3c2410_nand_mtd_toinfo(struct mtd_info *mtd)
|
||||||
|
@ -745,7 +745,7 @@ static int s3c24xx_nand_remove(struct platform_device *pdev)
|
||||||
|
|
||||||
for (mtdno = 0; mtdno < info->mtd_count; mtdno++, ptr++) {
|
for (mtdno = 0; mtdno < info->mtd_count; mtdno++, ptr++) {
|
||||||
pr_debug("releasing mtd %d (%p)\n", mtdno, ptr);
|
pr_debug("releasing mtd %d (%p)\n", mtdno, ptr);
|
||||||
nand_release(&ptr->mtd);
|
nand_release(nand_to_mtd(&ptr->chip));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -762,9 +762,11 @@ static int s3c2410_nand_add_partition(struct s3c2410_nand_info *info,
|
||||||
struct s3c2410_nand_set *set)
|
struct s3c2410_nand_set *set)
|
||||||
{
|
{
|
||||||
if (set) {
|
if (set) {
|
||||||
mtd->mtd.name = set->name;
|
struct mtd_info *mtdinfo = nand_to_mtd(&mtd->chip);
|
||||||
|
|
||||||
return mtd_device_parse_register(&mtd->mtd, NULL, NULL,
|
mtdinfo->name = set->name;
|
||||||
|
|
||||||
|
return mtd_device_parse_register(mtdinfo, NULL, NULL,
|
||||||
set->partitions, set->nr_partitions);
|
set->partitions, set->nr_partitions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -786,6 +788,7 @@ static void s3c2410_nand_init_chip(struct s3c2410_nand_info *info,
|
||||||
struct s3c2410_nand_set *set)
|
struct s3c2410_nand_set *set)
|
||||||
{
|
{
|
||||||
struct nand_chip *chip = &nmtd->chip;
|
struct nand_chip *chip = &nmtd->chip;
|
||||||
|
struct mtd_info *mtd = nand_to_mtd(chip);
|
||||||
void __iomem *regs = info->regs;
|
void __iomem *regs = info->regs;
|
||||||
|
|
||||||
chip->write_buf = s3c2410_nand_write_buf;
|
chip->write_buf = s3c2410_nand_write_buf;
|
||||||
|
@ -831,7 +834,7 @@ static void s3c2410_nand_init_chip(struct s3c2410_nand_info *info,
|
||||||
chip->IO_ADDR_R = chip->IO_ADDR_W;
|
chip->IO_ADDR_R = chip->IO_ADDR_W;
|
||||||
|
|
||||||
nmtd->info = info;
|
nmtd->info = info;
|
||||||
nmtd->mtd.priv = chip;
|
mtd->priv = chip;
|
||||||
nmtd->set = set;
|
nmtd->set = set;
|
||||||
|
|
||||||
#ifdef CONFIG_MTD_NAND_S3C2410_HWECC
|
#ifdef CONFIG_MTD_NAND_S3C2410_HWECC
|
||||||
|
@ -1012,19 +1015,21 @@ static int s3c24xx_nand_probe(struct platform_device *pdev)
|
||||||
nmtd = info->mtds;
|
nmtd = info->mtds;
|
||||||
|
|
||||||
for (setno = 0; setno < nr_sets; setno++, nmtd++) {
|
for (setno = 0; setno < nr_sets; setno++, nmtd++) {
|
||||||
|
struct mtd_info *mtd = nand_to_mtd(&nmtd->chip);
|
||||||
|
|
||||||
pr_debug("initialising set %d (%p, info %p)\n",
|
pr_debug("initialising set %d (%p, info %p)\n",
|
||||||
setno, nmtd, info);
|
setno, nmtd, info);
|
||||||
|
|
||||||
nmtd->mtd.dev.parent = &pdev->dev;
|
mtd->dev.parent = &pdev->dev;
|
||||||
s3c2410_nand_init_chip(info, nmtd, sets);
|
s3c2410_nand_init_chip(info, nmtd, sets);
|
||||||
|
|
||||||
nmtd->scan_res = nand_scan_ident(&nmtd->mtd,
|
nmtd->scan_res = nand_scan_ident(mtd,
|
||||||
(sets) ? sets->nr_chips : 1,
|
(sets) ? sets->nr_chips : 1,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
if (nmtd->scan_res == 0) {
|
if (nmtd->scan_res == 0) {
|
||||||
s3c2410_nand_update_chip(info, nmtd);
|
s3c2410_nand_update_chip(info, nmtd);
|
||||||
nand_scan_tail(&nmtd->mtd);
|
nand_scan_tail(mtd);
|
||||||
s3c2410_nand_add_partition(info, nmtd, sets);
|
s3c2410_nand_add_partition(info, nmtd, sets);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue