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

Commit 6cbbf2ff authored by Jamie Iles's avatar Jamie Iles Committed by David Woodhouse
Browse files

mtd: ixp: convert to mtd_device_register()



Convert to mtd_device_register() and remove the CONFIG_MTD_PARTITIONS
preprocessor conditionals as partitioning is always available.

Cc: Imre Kaloz <kaloz@openwrt.org>
Cc: Krzysztof Halasa <khc@pm.waw.pl>
Signed-off-by: default avatarJamie Iles <jamie@jamieiles.com>
Signed-off-by: default avatarArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
parent c06addd3
Loading
Loading
Loading
Loading
+0 −4
Original line number Original line Diff line number Diff line
@@ -60,7 +60,6 @@ static struct platform_device ixdp425_flash = {
#if defined(CONFIG_MTD_NAND_PLATFORM) || \
#if defined(CONFIG_MTD_NAND_PLATFORM) || \
    defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
    defined(CONFIG_MTD_NAND_PLATFORM_MODULE)


#ifdef CONFIG_MTD_PARTITIONS
const char *part_probes[] = { "cmdlinepart", NULL };
const char *part_probes[] = { "cmdlinepart", NULL };


static struct mtd_partition ixdp425_partitions[] = {
static struct mtd_partition ixdp425_partitions[] = {
@@ -74,7 +73,6 @@ static struct mtd_partition ixdp425_partitions[] = {
		.size	= MTDPART_SIZ_FULL
		.size	= MTDPART_SIZ_FULL
	},
	},
};
};
#endif


static void
static void
ixdp425_flash_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
ixdp425_flash_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
@@ -103,11 +101,9 @@ static struct platform_nand_data ixdp425_flash_nand_data = {
		.nr_chips		= 1,
		.nr_chips		= 1,
		.chip_delay		= 30,
		.chip_delay		= 30,
		.options		= NAND_NO_AUTOINCR,
		.options		= NAND_NO_AUTOINCR,
#ifdef CONFIG_MTD_PARTITIONS
		.part_probe_types 	= part_probes,
		.part_probe_types 	= part_probes,
		.partitions	 	= ixdp425_partitions,
		.partitions	 	= ixdp425_partitions,
		.nr_partitions	 	= ARRAY_SIZE(ixdp425_partitions),
		.nr_partitions	 	= ARRAY_SIZE(ixdp425_partitions),
#endif
	},
	},
	.ctrl = {
	.ctrl = {
		.cmd_ctrl 		= ixdp425_flash_nand_cmd_ctrl
		.cmd_ctrl 		= ixdp425_flash_nand_cmd_ctrl
+2 −2
Original line number Original line Diff line number Diff line
@@ -119,7 +119,7 @@ static int ixp2000_flash_remove(struct platform_device *dev)
		return 0;
		return 0;


	if (info->mtd) {
	if (info->mtd) {
		del_mtd_partitions(info->mtd);
		mtd_device_unregister(info->mtd);
		map_destroy(info->mtd);
		map_destroy(info->mtd);
	}
	}
	if (info->map.map_priv_1)
	if (info->map.map_priv_1)
@@ -230,7 +230,7 @@ static int ixp2000_flash_probe(struct platform_device *dev)


	err = parse_mtd_partitions(info->mtd, probes, &info->partitions, 0);
	err = parse_mtd_partitions(info->mtd, probes, &info->partitions, 0);
	if (err > 0) {
	if (err > 0) {
		err = add_mtd_partitions(info->mtd, info->partitions, err);
		err = mtd_device_register(info->mtd, info->partitions, err);
		if(err)
		if(err)
			dev_err(&dev->dev, "Could not parse partitions\n");
			dev_err(&dev->dev, "Could not parse partitions\n");
	}
	}
+6 −10
Original line number Original line Diff line number Diff line
@@ -162,7 +162,7 @@ static int ixp4xx_flash_remove(struct platform_device *dev)
		return 0;
		return 0;


	if (info->mtd) {
	if (info->mtd) {
		del_mtd_partitions(info->mtd);
		mtd_device_unregister(info->mtd);
		map_destroy(info->mtd);
		map_destroy(info->mtd);
	}
	}
	if (info->map.virt)
	if (info->map.virt)
@@ -252,10 +252,8 @@ static int ixp4xx_flash_probe(struct platform_device *dev)
	/* Use the fast version */
	/* Use the fast version */
	info->map.write = ixp4xx_write16;
	info->map.write = ixp4xx_write16;


#ifdef CONFIG_MTD_PARTITIONS
	nr_parts = parse_mtd_partitions(info->mtd, probes, &info->partitions,
	nr_parts = parse_mtd_partitions(info->mtd, probes, &info->partitions,
					dev->resource->start);
					dev->resource->start);
#endif
	if (nr_parts > 0) {
	if (nr_parts > 0) {
		part_type = "dynamic";
		part_type = "dynamic";
	} else {
	} else {
@@ -263,18 +261,16 @@ static int ixp4xx_flash_probe(struct platform_device *dev)
		nr_parts = plat->nr_parts;
		nr_parts = plat->nr_parts;
		part_type = "static";
		part_type = "static";
	}
	}
	if (nr_parts == 0) {
	if (nr_parts == 0)
		printk(KERN_NOTICE "IXP4xx flash: no partition info "
		printk(KERN_NOTICE "IXP4xx flash: no partition info "
			"available, registering whole flash\n");
			"available, registering whole flash\n");
		err = add_mtd_device(info->mtd);
	else
	} else {
		printk(KERN_NOTICE "IXP4xx flash: using %s partition "
		printk(KERN_NOTICE "IXP4xx flash: using %s partition "
			"definition\n", part_type);
			"definition\n", part_type);
		err = add_mtd_partitions(info->mtd, info->partitions, nr_parts);


	err = mtd_device_register(info->mtd, info->partitions, nr_parts);
	if (err)
	if (err)
		printk(KERN_ERR "Could not parse partitions\n");
		printk(KERN_ERR "Could not parse partitions\n");
	}


	if (err)
	if (err)
		goto Error;
		goto Error;