Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 00142d6f authored by Boris Brezillon's avatar Boris Brezillon
Browse files

mtd: maps: physmap: Rename ->map and ->mtd into ->maps and ->mtds



The ->map and ->mtd fields are actually arrays of map and mtd objects.
Rename those fields into ->maps and ->mtds to make it obvious.

Signed-off-by: default avatarBoris Brezillon <boris.brezillon@bootlin.com>
Reviewed-by: default avatarRicardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Acked-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 18d54e55
Loading
Loading
Loading
Loading
+28 −27
Original line number Original line Diff line number Diff line
@@ -25,9 +25,9 @@
#define MAX_RESOURCES		4
#define MAX_RESOURCES		4


struct physmap_flash_info {
struct physmap_flash_info {
	struct mtd_info		*mtd[MAX_RESOURCES];
	struct mtd_info		*mtds[MAX_RESOURCES];
	struct mtd_info		*cmtd;
	struct mtd_info		*cmtd;
	struct map_info		map[MAX_RESOURCES];
	struct map_info		maps[MAX_RESOURCES];
	spinlock_t		vpp_lock;
	spinlock_t		vpp_lock;
	int			vpp_refcnt;
	int			vpp_refcnt;
};
};
@@ -46,13 +46,13 @@ static int physmap_flash_remove(struct platform_device *dev)


	if (info->cmtd) {
	if (info->cmtd) {
		mtd_device_unregister(info->cmtd);
		mtd_device_unregister(info->cmtd);
		if (info->cmtd != info->mtd[0])
		if (info->cmtd != info->mtds[0])
			mtd_concat_destroy(info->cmtd);
			mtd_concat_destroy(info->cmtd);
	}
	}


	for (i = 0; i < MAX_RESOURCES; i++) {
	for (i = 0; i < MAX_RESOURCES; i++) {
		if (info->mtd[i] != NULL)
		if (info->mtds[i] != NULL)
			map_destroy(info->mtd[i]);
			map_destroy(info->mtds[i]);
	}
	}


	if (physmap_data->exit)
	if (physmap_data->exit)
@@ -136,48 +136,49 @@ static int physmap_flash_probe(struct platform_device *dev)
			goto err_out;
			goto err_out;
		}
		}


		info->map[i].name = dev_name(&dev->dev);
		info->maps[i].name = dev_name(&dev->dev);
		info->map[i].phys = dev->resource[i].start;
		info->maps[i].phys = dev->resource[i].start;
		info->map[i].size = resource_size(&dev->resource[i]);
		info->maps[i].size = resource_size(&dev->resource[i]);
		info->map[i].bankwidth = physmap_data->width;
		info->maps[i].bankwidth = physmap_data->width;
		info->map[i].set_vpp = physmap_set_vpp;
		info->maps[i].set_vpp = physmap_set_vpp;
		info->map[i].pfow_base = physmap_data->pfow_base;
		info->maps[i].pfow_base = physmap_data->pfow_base;
		info->map[i].map_priv_1 = (unsigned long)dev;
		info->maps[i].map_priv_1 = (unsigned long)dev;


		info->map[i].virt = devm_ioremap(&dev->dev, info->map[i].phys,
		info->maps[i].virt = devm_ioremap(&dev->dev,
						 info->map[i].size);
						  info->maps[i].phys,
		if (info->map[i].virt == NULL) {
						  info->maps[i].size);
		if (info->maps[i].virt == NULL) {
			dev_err(&dev->dev, "Failed to ioremap flash region\n");
			dev_err(&dev->dev, "Failed to ioremap flash region\n");
			err = -EIO;
			err = -EIO;
			goto err_out;
			goto err_out;
		}
		}


		simple_map_init(&info->map[i]);
		simple_map_init(&info->maps[i]);


		probe_type = rom_probe_types;
		probe_type = rom_probe_types;
		if (physmap_data->probe_type == NULL) {
		if (physmap_data->probe_type == NULL) {
			for (; info->mtd[i] == NULL && *probe_type != NULL; probe_type++)
			for (; info->mtds[i] == NULL && *probe_type != NULL; probe_type++)
				info->mtd[i] = do_map_probe(*probe_type, &info->map[i]);
				info->mtds[i] = do_map_probe(*probe_type, &info->maps[i]);
		} else
		} else
			info->mtd[i] = do_map_probe(physmap_data->probe_type, &info->map[i]);
			info->mtds[i] = do_map_probe(physmap_data->probe_type, &info->maps[i]);


		if (info->mtd[i] == NULL) {
		if (info->mtds[i] == NULL) {
			dev_err(&dev->dev, "map_probe failed\n");
			dev_err(&dev->dev, "map_probe failed\n");
			err = -ENXIO;
			err = -ENXIO;
			goto err_out;
			goto err_out;
		} else {
		} else {
			devices_found++;
			devices_found++;
		}
		}
		info->mtd[i]->dev.parent = &dev->dev;
		info->mtds[i]->dev.parent = &dev->dev;
	}
	}


	if (devices_found == 1) {
	if (devices_found == 1) {
		info->cmtd = info->mtd[0];
		info->cmtd = info->mtds[0];
	} else if (devices_found > 1) {
	} else if (devices_found > 1) {
		/*
		/*
		 * We detected multiple devices. Concatenate them together.
		 * We detected multiple devices. Concatenate them together.
		 */
		 */
		info->cmtd = mtd_concat_create(info->mtd, devices_found, dev_name(&dev->dev));
		info->cmtd = mtd_concat_create(info->mtds, devices_found, dev_name(&dev->dev));
		if (info->cmtd == NULL)
		if (info->cmtd == NULL)
			err = -ENXIO;
			err = -ENXIO;
	}
	}
@@ -203,9 +204,9 @@ static void physmap_flash_shutdown(struct platform_device *dev)
	struct physmap_flash_info *info = platform_get_drvdata(dev);
	struct physmap_flash_info *info = platform_get_drvdata(dev);
	int i;
	int i;


	for (i = 0; i < MAX_RESOURCES && info->mtd[i]; i++)
	for (i = 0; i < MAX_RESOURCES && info->mtds[i]; i++)
		if (mtd_suspend(info->mtd[i]) == 0)
		if (mtd_suspend(info->mtds[i]) == 0)
			mtd_resume(info->mtd[i]);
			mtd_resume(info->mtds[i]);
}
}
#else
#else
#define physmap_flash_shutdown NULL
#define physmap_flash_shutdown NULL