mtd_concat + m25p80 fails
Hi all
I successfully merged two m25p80 flash devices into a single 'virtual' device. Thanks for your efforts.
There is one problem though, when running flash_erase. Actually at the end of it, the kernel crashes in concat_sync. Since m25p80 does not define the 'sync' method concat_sync crashes while dereferencing the NULL pointer.
static void concat_sync(struct mtd_info *mtd)
{
struct mtd_concat *concat = CONCAT(mtd);
int i;
for (i = 0; i < concat->num_subdev; i++) {
struct mtd_info *subdev = concat->subdev[i];
subdev->sync(subdev);
}
}My question is, if the following the 'hack' is valid or whether I run into troubles, by not defining sync/lock/unlock when the subdevices do not define them.
drivers/mtd/mtdconcat.c +8 -3
@@ -793,11 +793,16 @@ struct mtd_info *mtd_concat_create(struct mtd_info *subdev[], /* subdevices to c concat->mtd.erase = concat_erase; concat->mtd.read = concat_read; concat->mtd.write = concat_write; - concat->mtd.sync = concat_sync; +if (subdev[0 ]->sync) + concat->mtd.sync = concat_sync; +if (subdev[0 ]->lock) concat->mtd.lock = concat_lock; +if (subdev[0 ]->unlock) concat->mtd.unlock = concat_unlock; - concat->mtd.suspend = concat_suspend; - concat->mtd.resume = concat_resume; +if (subdev[0 ]->suspend) + concat->mtd.suspend = concat_suspend; +if (subdev[0 ]->resume) + concat->mtd.resume = concat_resume;
thank you
Andi