aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/generic/files
diff options
context:
space:
mode:
authorDaniel Golle <daniel@makrotopia.org>2022-01-07 17:39:42 +0000
committerDaniel Golle <daniel@makrotopia.org>2022-03-27 04:51:31 +0100
commit30a5e073906ab671c31063cb0deed00686369277 (patch)
treeee92c7f7711c8bc98451f93bf333a7bf6ed7bc73 /target/linux/generic/files
parent71efd34700e59f553367abb1b5de28c01f4c2d12 (diff)
downloadupstream-30a5e073906ab671c31063cb0deed00686369277.tar.gz
upstream-30a5e073906ab671c31063cb0deed00686369277.tar.bz2
upstream-30a5e073906ab671c31063cb0deed00686369277.zip
generic: 5.15: get uImage.FIT partition parser ready
Prepare uImage.FIT partition parser for Linux 5.15 Signed-off-by: Daniel Golle <daniel@makrotopia.org> Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
Diffstat (limited to 'target/linux/generic/files')
-rw-r--r--target/linux/generic/files/block/partitions/fit.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/target/linux/generic/files/block/partitions/fit.c b/target/linux/generic/files/block/partitions/fit.c
index 75516af493..46ccef62ee 100644
--- a/target/linux/generic/files/block/partitions/fit.c
+++ b/target/linux/generic/files/block/partitions/fit.c
@@ -20,6 +20,7 @@
#include <linux/of_device.h>
#include <linux/of_fdt.h>
#include <linux/libfdt.h>
+#include <linux/version.h>
#include "check.h"
@@ -72,7 +73,12 @@
int parse_fit_partitions(struct parsed_partitions *state, u64 fit_start_sector, u64 sectors, int *slot, int add_remain)
{
- struct address_space *mapping = state->bdev->bd_inode->i_mapping;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 11, 0)
+ struct block_device *bdev = state->disk->part0;
+#else
+ struct block_device *bdev = state->bdev;
+#endif
+ struct address_space *mapping = bdev->bd_inode->i_mapping;
struct page *page;
void *fit, *init_fit;
struct partition_meta_info *info;
@@ -116,7 +122,7 @@ int parse_fit_partitions(struct parsed_partitions *state, u64 fit_start_sector,
return 0;
}
- dsectors = get_capacity(state->bdev->bd_disk);
+ dsectors = get_capacity(bdev->bd_disk);
if (sectors)
dsectors = (dsectors>sectors)?sectors:dsectors;