linux-next: manual merge of the mtd tree with Linus' tree

From: Stephen Rothwell
Date: Mon Jan 28 2019 - 19:17:11 EST


Hi all,

Today's linux-next merge of the mtd tree got a conflict in:

drivers/mtd/mtdpart.c

between commit:

2b6f0090a333 ("mtd: Check add_mtd_device() ret code")

from Linus' tree and commit:

2c24c9af0f38 ("mtd: rework partitions handling")

from the mtd tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging. You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

--
Cheers,
Stephen Rothwell

diff --cc drivers/mtd/mtdpart.c
index 60104e1079c5,089095b3c50d..000000000000
--- a/drivers/mtd/mtdpart.c
+++ b/drivers/mtd/mtdpart.c
@@@ -610,30 -265,18 +265,30 @@@ int mtd_add_partition(struct mtd_info *
part.size = length;
part.offset = offset;

- new = allocate_partition(parent, &part, -1, offset);
- if (IS_ERR(new))
- return PTR_ERR(new);
+ child = allocate_partition(parent, &part, -1, offset);
+ if (IS_ERR(child))
+ return PTR_ERR(child);

- mutex_lock(&mtd_partitions_mutex);
- list_add(&new->list, &mtd_partitions);
- mutex_unlock(&mtd_partitions_mutex);
+ mutex_lock(&master->props.master.partitions_lock);
+ list_add_tail(&child->props.part.node, &parent->partitions);
+ mutex_unlock(&master->props.master.partitions_lock);

- ret = add_mtd_device(&new->mtd);
- add_mtd_device(child);
++ ret = add_mtd_device(child);
+ if (ret)
+ goto err_remove_part;

- mtd_add_partition_attrs(new);
+ mtd_add_partition_attrs(child);

+ return 0;
+
+err_remove_part:
- mutex_lock(&mtd_partitions_mutex);
- list_del(&new->list);
- mutex_unlock(&mtd_partitions_mutex);
++ mutex_lock(&master->props.master.partitions_lock);
++ list_del(&child->props.part.node);
++ mutex_unlock(&master->props.master.partitions_lock);
+
- free_partition(new);
++ free_partition(child);
+ pr_info("%s:%i\n", __func__, __LINE__);
+
return ret;
}
EXPORT_SYMBOL_GPL(mtd_add_partition);
@@@ -722,46 -386,33 +398,47 @@@ int add_mtd_partitions(struct mtd_info
const struct mtd_partition *parts,
int nbparts)
{
- struct mtd_part *slave;
+ struct mtd_info *child, *master = mtd_get_master(parent);
uint64_t cur_offset = 0;
- int i;
+ int i, ret;

- printk(KERN_NOTICE "Creating %d MTD partitions on \"%s\":\n", nbparts, master->name);
+ printk(KERN_NOTICE "Creating %d MTD partitions on \"%s\":\n",
+ nbparts, parent->name);

for (i = 0; i < nbparts; i++) {
- slave = allocate_partition(master, parts + i, i, cur_offset);
- if (IS_ERR(slave)) {
- ret = PTR_ERR(slave);
+ child = allocate_partition(parent, parts + i, i, cur_offset);
+ if (IS_ERR(child)) {
- del_mtd_partitions(parent);
- return PTR_ERR(child);
++ ret = PTR_ERR(child);
+ goto err_del_partitions;
}

- mutex_lock(&mtd_partitions_mutex);
- list_add(&slave->list, &mtd_partitions);
- mutex_unlock(&mtd_partitions_mutex);
+ mutex_lock(&master->props.master.partitions_lock);
+ list_add_tail(&child->props.part.node, &parent->partitions);
+ mutex_unlock(&master->props.master.partitions_lock);

- add_mtd_device(child);
+ ret = add_mtd_device(child);
+ if (ret) {
- mutex_lock(&mtd_partitions_mutex);
- list_del(&slave->list);
- mutex_unlock(&mtd_partitions_mutex);
++ mutex_lock(&master->props.master.partitions_lock);
++ list_del(&child->props.part.node);
++ mutex_unlock(&master->props.master.partitions_lock);
+
- free_partition(slave);
++ free_partition(child);
+ goto err_del_partitions;
+ }
+
- mtd_add_partition_attrs(slave);
+ mtd_add_partition_attrs(child);
/* Look for subpartitions */
- parse_mtd_partitions(&slave->mtd, parts[i].types, NULL);
+ parse_mtd_partitions(child, parts[i].types, NULL);

- cur_offset = slave->offset + slave->mtd.size;
+ cur_offset = child->props.part.offset + child->size;
}

return 0;
+
+err_del_partitions:
- del_mtd_partitions(master);
++ del_mtd_partitions(parent);
+
+ return ret;
}

static DEFINE_SPINLOCK(part_parser_lock);

Attachment: pgpWN4mkvqljq.pgp
Description: OpenPGP digital signature