Re: [PATCH 1/2] mtd: mtdconcat: Judge callback function existence getting from master for each partition

From: Miquel Raynal
Date: Sat Aug 07 2021 - 06:32:50 EST


Hi Zhihao,

Zhihao Cheng <chengzhihao1@xxxxxxxxxx> wrote on Sat, 7 Aug 2021
10:15:46 +0800:

> 在 2021/8/7 3:28, Miquel Raynal 写道:
> Hi Miquel,
> > Hi Zhihao,
> >
> > Zhihao Cheng <chengzhihao1@xxxxxxxxxx> wrote on Sat, 31 Jul 2021
> > 10:32:42 +0800:
> > @@ -721,14 +724,15 @@ struct mtd_info *mtd_concat_create(struct mtd_info *subdev[], /* subdevices to c
> > subdev[i]->flags & MTD_WRITEABLE;
> > }
> > > + subdev_master = mtd_get_master(subdev[i]);
> > concat->mtd.size += subdev[i]->size;
> > concat->mtd.ecc_stats.badblocks +=
> > subdev[i]->ecc_stats.badblocks;
> > if (concat->mtd.writesize != subdev[i]->writesize ||
> > concat->mtd.subpage_sft != subdev[i]->subpage_sft ||
> > concat->mtd.oobsize != subdev[i]->oobsize ||
> > - !concat->mtd._read_oob != !subdev[i]->_read_oob ||
> > - !concat->mtd._write_oob != !subdev[i]->_write_oob) {
> > + !concat->mtd._read_oob != !subdev_master->_read_oob ||
> > + !concat->mtd._write_oob != !subdev_master->_write_oob) {
> > Do you really need this change?
>
> I think both "!concat->mtd._read_oob != !subdev[i]->_read_oob" and "!concat->mtd._write_oob != !subdev[i]->_write_oob" need to be modified otherwise concatenating goes failure.
>
> I thought there exists two problems:
>
>   1. Wrong callback fetching in mtd partition device
>
>   2. Warning for existence of _read and _read_oob at the same time
>
> so I solved them in two steps to make history commit logs a bit clear.
>
> Though these two patches can be combined to one.

No please keep the split.

What I mean here is that I don't think your fix is valid. Maybe we
should propagate these callbacks as well instead of trying to hack into
this condition. I don't see why you should check against subdev[i] for
half of the callbacks and check for subdev_master for the last two.


Thanks,
Miquèl