From 668b7a966080abaaab751d8d5171f89ca8a0516b Mon Sep 17 00:00:00 2001 From: qianlong Date: Mon, 9 Oct 2023 16:08:54 +0800 Subject: [PATCH] utag: Fix utag build error on 8650 For kernel 6.1.0 1 bio_alloc modify 2 PDE_DATA do not export ../../motorola/kernel/modules/drivers/misc/utag/utags.c:179:34: error: too few arguments to function call, expected 4, have 2 bio = bio_alloc(GFP_KERNEL, num); ~~~~~~~~~ ^ kernel_platform/msm-kernel/include/linux/bio.h:420:27: note: 'bio_alloc' declared here static inline struct bio *bio_alloc(struct block_device *bdev, ^ ../../motorola/kernel/modules/drivers/misc/utag/utags.c:1404:27: error: call to undeclared function 'PDE_DATA'; struct proc_node *proc = PDE_DATA(inode); Change-Id: I4e8879eb4a495029d4759905e0c3dc44eca5b025 Signed-off-by: qianlong Reviewed-on: https://gerrit.mot.com/2761422 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Xiaojun Ji Reviewed-by: Zhenxin Xi Submit-Approved: Jira Key --- drivers/misc/utag/utags.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/misc/utag/utags.c b/drivers/misc/utag/utags.c index 76ee136d085b..12d93fe6446b 100644 --- a/drivers/misc/utag/utags.c +++ b/drivers/misc/utag/utags.c @@ -152,6 +152,10 @@ struct ctrl { #include #include +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0) +#define PDE_DATA(x) pde_data(x) +#endif + static struct page *addr_to_page(void *addr) { if (is_vmalloc_addr(addr)) @@ -176,13 +180,19 @@ static int utags_submit_bio(struct block_device *bdev, void *buf, int pages, int while (left_pages > 0) { num = (left_pages >= NR_BIO_MAX_PAGES) ? NR_BIO_MAX_PAGES : left_pages; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0) + bio = bio_alloc(bdev, num, 0, GFP_KERNEL); +#else bio = bio_alloc(GFP_KERNEL, num); +#endif if (!bio) return -ENOMEM; bio->bi_iter.bi_sector = (pages - left_pages) * (PAGE_SIZE >> 9); bio->bi_opf = opf; +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0) bio_set_dev(bio, bdev); +#endif for (i = 0; i < num; i++) { if (!bio_add_page(bio, addr_to_page(buf + (pages - left_pages + i) * PAGE_SIZE), PAGE_SIZE, 0)) {