packages/kernel/mtd-rw/patches/0001-mtd-disabled.patch
David Bauer c6b3d94929 mtd-rw: fix build failure with kernel 5.10
When building mtd-rw for a target based on Kernel 5.10 which has
CONFIG_MTD disabled the build fails with

ERROR: "put_mtd_device" [../mtd-rw.ko] undefined!
ERROR: "get_mtd_device" [../mtd-rw.ko] undefined!

Omit building the package for such a target.

Signed-off-by: David Bauer <mail@david-bauer.net>
2021-03-06 22:28:55 +01:00

24 lines
440 B
Diff

--- a/mtd-rw.c
+++ b/mtd-rw.c
@@ -54,7 +54,11 @@ MODULE_PARM_DESC(i_want_a_brick, "Make a
static int set_writeable(unsigned n, bool w)
{
+#ifndef CONFIG_MTD
+ struct mtd_info *mtd = -ENOSYS;
+#else
struct mtd_info *mtd = get_mtd_device(NULL, n);
+#endif
int err;
if (IS_ERR(mtd)) {
@@ -76,7 +80,9 @@ static int set_writeable(unsigned n, boo
err = 0;
}
+#ifdef CONFIG_MTD
put_mtd_device(mtd);
+#endif
return err;
}